Fix a bunch of type errors and add a type-check to the github workflows (#837)
* Add yarn type-check * Rename to yarn typecheck * Fix a collection of type errors * Add typecheck to automated tests * add `dist` to exluded folders tsconfig --------- Co-authored-by: Ansh Nanda <anshnanda10@gmail.com>
This commit is contained in:
parent
46c9de7c18
commit
e8843ded5b
23 changed files with 168 additions and 82 deletions
|
@ -11,7 +11,7 @@ export function doPolyfill() {
|
|||
interface FetchHandlerResponse {
|
||||
status: number
|
||||
headers: Record<string, string>
|
||||
body: ArrayBuffer | undefined
|
||||
body: any
|
||||
}
|
||||
|
||||
async function fetchHandler(
|
||||
|
|
|
@ -74,9 +74,12 @@ export class FeedViewPostsSlice {
|
|||
}
|
||||
|
||||
flattenReplyParent() {
|
||||
if (this.items[0].reply?.parent) {
|
||||
this.isFlattenedReply = true
|
||||
this.items.splice(0, 0, {post: this.items[0].reply?.parent})
|
||||
if (this.items[0].reply) {
|
||||
const reply = this.items[0].reply
|
||||
if (AppBskyFeedDefs.isPostView(reply.parent)) {
|
||||
this.isFlattenedReply = true
|
||||
this.items.splice(0, 0, {post: reply.parent})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -130,16 +133,17 @@ export class FeedTuner {
|
|||
|
||||
// turn non-threads with reply parents into threads
|
||||
for (const slice of slices) {
|
||||
if (
|
||||
!slice.isThread &&
|
||||
!slice.items[0].reason &&
|
||||
slice.items[0].reply?.parent &&
|
||||
!this.seenUris.has(slice.items[0].reply?.parent.uri) &&
|
||||
!soonToBeSeenUris.has(slice.items[0].reply?.parent.uri)
|
||||
) {
|
||||
const uri = slice.items[0].reply?.parent.uri
|
||||
slice.flattenReplyParent()
|
||||
soonToBeSeenUris.add(uri)
|
||||
if (!slice.isThread && !slice.items[0].reason && slice.items[0].reply) {
|
||||
const reply = slice.items[0].reply
|
||||
if (
|
||||
AppBskyFeedDefs.isPostView(reply.parent) &&
|
||||
!this.seenUris.has(reply.parent.uri) &&
|
||||
!soonToBeSeenUris.has(reply.parent.uri)
|
||||
) {
|
||||
const uri = reply.parent.uri
|
||||
slice.flattenReplyParent()
|
||||
soonToBeSeenUris.add(uri)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -231,7 +235,12 @@ export class FeedTuner {
|
|||
}
|
||||
|
||||
function getSelfReplyUri(item: FeedViewPost): string | undefined {
|
||||
return item.reply?.parent.author.did === item.post.author.did
|
||||
? item.reply?.parent.uri
|
||||
: undefined
|
||||
if (item.reply) {
|
||||
if (AppBskyFeedDefs.isPostView(item.reply.parent)) {
|
||||
return item.reply.parent.author.did === item.post.author.did
|
||||
? item.reply.parent.uri
|
||||
: undefined
|
||||
}
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import * as React from 'react'
|
|||
* Helper hook to run persistent timers on views
|
||||
*/
|
||||
export function useTimer(time: number, handler: () => void) {
|
||||
const timer = React.useRef(undefined)
|
||||
const timer = React.useRef<undefined | NodeJS.Timeout>(undefined)
|
||||
|
||||
// function to restart the timer
|
||||
const reset = React.useCallback(() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue