Skip to content

Commit

Permalink
prevent early binding of importClause in jsdoc imports
Browse files Browse the repository at this point in the history
  • Loading branch information
a-tarasyuk committed Jan 19, 2025
1 parent 49cdbda commit 7c18a9c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
8 changes: 5 additions & 3 deletions src/compiler/binder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1110,10 +1110,12 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
node.flowNode = undefined;
}
if (isJSDocImportTag(node)) {
return;
bindJSDocImportTag(node);
}
else {
bindEachChild(node);
bindJSDoc(node);
}
bindEachChild(node);
bindJSDoc(node);
inAssignmentPattern = saveInAssignmentPattern;
return;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/importTag24.errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ a.js(19,17): error TS2322: Type 'number' is not assignable to type 'string'.
export type Foo = string;

==== a.js (4 errors) ====
/** @import { Foo } from './types.d.ts') */
/** @import { Foo } from './types.d.ts' */

function f1() { return undefined; }
~~
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/importTag24.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type Foo = string;
>Foo : Symbol(Foo, Decl(types.d.ts, 0, 0))

=== a.js ===
/** @import { Foo } from './types.d.ts') */
/** @import { Foo } from './types.d.ts' */

function f1() { return undefined; }
>f1 : Symbol(f1, Decl(a.js, 0, 0))
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/importTag24.types
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export type Foo = string;
> : ^^^^^^

=== a.js ===
/** @import { Foo } from './types.d.ts') */
/** @import { Foo } from './types.d.ts' */

function f1() { return undefined; }
>f1 : () => any
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/conformance/jsdoc/importTag24.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
export type Foo = string;

// @filename: a.js
/** @import { Foo } from './types.d.ts') */
/** @import { Foo } from './types.d.ts' */

function f1() { return undefined; }

Expand Down

0 comments on commit 7c18a9c

Please sign in to comment.