Skip to content

Commit 1a0abfa

Browse files
committed
JS: Enable type extraction inside conditional types again
1 parent 4f5c06f commit 1a0abfa

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

javascript/extractor/lib/typescript/src/ast_extractor.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -168,20 +168,9 @@ export function augmentAst(ast: AugmentedSourceFile, code: string, project: Proj
168168
}
169169
}
170170

171-
// Number of conditional type expressions the visitor is currently inside.
172-
// We disable type extraction inside such type expressions, to avoid complications
173-
// with `infer` types.
174-
let insideConditionalTypes = 0;
175-
176171
visitAstNode(ast);
177172
function visitAstNode(node: AugmentedNode) {
178-
if (node.kind === ts.SyntaxKind.ConditionalType) {
179-
++insideConditionalTypes;
180-
}
181173
ts.forEachChild(node, visitAstNode);
182-
if (node.kind === ts.SyntaxKind.ConditionalType) {
183-
--insideConditionalTypes;
184-
}
185174

186175
// fill in line/column info
187176
if ("pos" in node) {
@@ -202,7 +191,7 @@ export function augmentAst(ast: AugmentedSourceFile, code: string, project: Proj
202191
}
203192
}
204193

205-
if (typeChecker != null && insideConditionalTypes === 0) {
194+
if (typeChecker != null) {
206195
if (isTypedNode(node)) {
207196
let contextualType = isContextuallyTypedNode(node)
208197
? typeChecker.getContextualType(node)

0 commit comments

Comments
 (0)