Compiler error in TreePage's state.treeOrError.directories on IGitTree
Created by: JoshuaKGoldberg
After setting up a new repository locally following an install and build, directories
is of type IGitTree | null[]
in backend/graphqlschema.ts
.
The null[]
seems... wrong?
export interface IGitTree {
__typename: 'GitTree'
path: string
isRoot: boolean
name: string
isDirectory: boolean
commit: IGitCommit
repository: IRepository
url: string
canonicalURL: string
externalURLs: IExternalLink[]
submodule: ISubmodule | null
directories: IGitTree | null[]
files: IFile[]
entries: TreeEntry[]
symbols: ISymbolConnection
isSingleChild: boolean
}
TreePage.tsx
is the only place where TypeScript complains:
this.state.treeOrError.directories.length ... this.state.treeOrError.directories.map((e, i) => { ... name={e.name} })
If the type is changed to IGitTree[]
, no more complaints.