Skip to content

fix(60563):@import * as namespace cannot be used with @implements #60566

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/compiler/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10467,6 +10467,7 @@ export function isValidBigIntString(s: string, roundTripOnly: boolean): boolean
/** @internal */
export function isValidTypeOnlyAliasUseSite(useSite: Node): boolean {
return !!(useSite.flags & NodeFlags.Ambient)
|| isInJSDoc(useSite)
|| isPartOfTypeQuery(useSite)
|| isIdentifierInNonEmittingHeritageClause(useSite)
|| isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(useSite)
Expand Down
21 changes: 21 additions & 0 deletions tests/baselines/reference/importTag23.errors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/b.js(6,14): error TS2420: Class 'C' incorrectly implements interface 'I'.
Property 'foo' is missing in type 'C' but required in type 'I'.


==== /a.ts (0 errors) ====
export interface I {
foo(): void;
}

==== /b.js (1 errors) ====
/**
* @import * as NS from './a'
*/

/** @implements {NS.I} */
export class C {}
~
!!! error TS2420: Class 'C' incorrectly implements interface 'I'.
!!! error TS2420: Property 'foo' is missing in type 'C' but required in type 'I'.
!!! related TS2728 /a.ts:2:5: 'foo' is declared here.

19 changes: 19 additions & 0 deletions tests/baselines/reference/importTag23.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//// [tests/cases/conformance/jsdoc/importTag23.ts] ////

=== /a.ts ===
export interface I {
>I : Symbol(I, Decl(a.ts, 0, 0))

foo(): void;
>foo : Symbol(I.foo, Decl(a.ts, 0, 20))
}

=== /b.js ===
/**
* @import * as NS from './a'
*/

/** @implements {NS.I} */
export class C {}
>C : Symbol(C, Decl(b.js, 0, 0))

19 changes: 19 additions & 0 deletions tests/baselines/reference/importTag23.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//// [tests/cases/conformance/jsdoc/importTag23.ts] ////

=== /a.ts ===
export interface I {
foo(): void;
>foo : () => void
> : ^^^^^^
}

=== /b.js ===
/**
* @import * as NS from './a'
*/

/** @implements {NS.I} */
export class C {}
>C : C
> : ^

16 changes: 16 additions & 0 deletions tests/cases/conformance/jsdoc/importTag23.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// @checkJs: true
// @allowJs: true
// @noEmit: true

// @filename: /a.ts
export interface I {
foo(): void;
}

// @filename: /b.js
/**
* @import * as NS from './a'
*/

/** @implements {NS.I} */
export class C {}
Loading