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
Even after awaiting, there's also differences regarding default vs namespace imports due to TS's ES Module interop... we can get the line to be true like so
suguanYang
changed the title
Incorrect typeof ES6 import expression
About the typeof ES6 import expression
Feb 22, 2025
import() has different semantics/types at type and value level. At value level the import() call returns a Promise<>.
I'm trying to make this more clear to me:
The typeof import() expression call is just another form of typeof namespace in types annotation, if a module itself has namespace, it will make the value of import and the type of import at different level.
π Search Terms
typeof import("x")
should be the same as the return type ofimport
expression callπ Version & Regression Information
All version
β― Playground Link
https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAKjgQwM5wEoFNkGN4BmUEIcA5FDvmQNwBQuEAdqvJXvALxyiSwAUFKjDIBKenRgBPMFjgBJVAFEAjgFdkAGwA8AFQA0cAKoA+ON11wsADxhYmAE3RG4AfmNXb9p3EvuYUGpyAFxwBFqoIWERWBKSMnKKqhqa2KhqmjAAjOYKyupa2tKyEARw7PiGxVilPODQMIIVIqImNHAA9B3RmpHxsnnJWmkZMABMuUkFOtW12BxVCbW8DU3CYm2d3QFBdHRAA
π» Code
π Actual behavior
π Expected behavior
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: