Skip to content

Port TS PR 60566 (@import * as namespace cannot be used with @implements) #1260

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 1 commit into from
Jun 24, 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
2 changes: 1 addition & 1 deletion internal/ast/utilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -3033,7 +3033,7 @@ func IsJSDocSingleCommentNode(node *Node) bool {
}

func IsValidTypeOnlyAliasUseSite(useSite *Node) bool {
return useSite.Flags&NodeFlagsAmbient != 0 ||
return useSite.Flags&(NodeFlagsAmbient|NodeFlagsJSDoc) != 0 ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind of funny that you didn't do this in the other PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other PR?

IsPartOfTypeQuery(useSite) ||
isIdentifierInNonEmittingHeritageClause(useSite) ||
isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(useSite) ||
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/b.js(5,18): error TS1361: 'NS' cannot be used as a value because it was imported using 'import type'.
/b.js(6,14): error TS2420: Class 'C' incorrectly implements interface 'I'.
Property 'foo' is missing in type 'C' but required in type 'I'.

Expand All @@ -8,15 +7,12 @@
foo(): void;
}

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

/** @implements {NS.I} */
~~
!!! error TS1361: 'NS' cannot be used as a value because it was imported using 'import type'.
!!! related TS1376 /b.js:2:17: 'NS' was imported here.
export class C {}
~
!!! error TS2420: Class 'C' incorrectly implements interface 'I'.
Expand Down

This file was deleted.