You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But how do you do the same when importing within a JSDoc type?
For example in x.js:
/** @param {import("foo").Foo} foo A foo. */functionx(foo){// …}
In the above situation, if Foo is a type that comes from a .d.ts file and isn't actually a named export in the ESM module, trying to import the x.js module in a TypeScript module with type checking enabled will cause a TS error: TS2694 [ERROR]: Namespace '__' has no exported member 'Foo'..
The text was updated successfully, but these errors were encountered:
I don't believe there is a way for doing this at the moment, but similar to microsoft/TypeScript#33437 we should try to get a solution in the TS compiler for doing this.
Discussed in #12404
Originally posted by jaydenseric October 12, 2021
There is a way to declare types when importing:
But how do you do the same when importing within a JSDoc type?
For example in
x.js
:In the above situation, if
Foo
is a type that comes from a.d.ts
file and isn't actually a named export in the ESM module, trying to import thex.js
module in a TypeScript module with type checking enabled will cause a TS error:TS2694 [ERROR]: Namespace '__' has no exported member 'Foo'.
.The text was updated successfully, but these errors were encountered: