Skip to content

Commit 36afeb4

Browse files
committed
fix error
1 parent a0203a7 commit 36afeb4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: src/parser/typescript/index.ts

+10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { ESLintExtendedProgram } from "..";
2+
import { traverseNodes } from "../..";
23
import type { NormalizedParserOptions } from "../parser-options";
34
import { parseScript, parseScriptInSvelte } from "../script";
45
import type { AnalyzeTypeScriptContext } from "./analyze";
@@ -33,6 +34,15 @@ export function parseTypeScript(
3334
const tsCtx = analyzeTypeScript(code, attrs, parserOptions);
3435

3536
const result = parseScript(tsCtx.script, attrs, parserOptions);
37+
traverseNodes(result.ast, {
38+
visitorKeys: result.visitorKeys,
39+
enterNode(node, parent) {
40+
(node as any).parent = parent;
41+
},
42+
leaveNode() {
43+
//
44+
},
45+
});
3646

3747
tsCtx.restoreContext.restore(result as unknown as TSESParseForESLintResult);
3848

0 commit comments

Comments
 (0)