Skip to content

Commit 4bf1041

Browse files
committed
Add try/catch around a stack overflow error
1 parent a9c9c99 commit 4bf1041

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/FileIndexer.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,17 @@ export class FileIndexer {
196196
.getResolvedSignature(jsxElement)
197197
?.getParameters()?.[0]
198198
if (props) {
199-
const tpe = this.checker.getTypeOfSymbolAtLocation(props, node)
200-
const property = tpe.getProperty(node.name.text)
201-
for (const decl of property?.declarations || []) {
202-
return this.lsifSymbol(decl)
199+
try {
200+
const tpe = this.checker.getTypeOfSymbolAtLocation(props, node)
201+
const property = tpe.getProperty(node.name.text)
202+
for (const decl of property?.declarations || []) {
203+
return this.lsifSymbol(decl)
204+
}
205+
} catch {
206+
// TODO: https://github.com/sourcegraph/lsif-typescript/issues/34
207+
// continue regardless of error, the TypeScript compiler tends to
208+
// trigger stack overflows in getTypeOfSymbolAtLocation and we
209+
// don't know why yet.
203210
}
204211
}
205212
}

0 commit comments

Comments
 (0)