-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
ESM X.test
which have zero export statement, should be sub type of ESM X
which have at least one export statement
#57735
Comments
foo.test.ts
without export default {}
leads to wrong type unionfoo.test.ts
without export default {}
leads to wrong type union
You have two modules shapes here:
The "nothing" variants supertype the |
But if Because the only way to let ESM module have If there is zero export statement, it means a zero key object Right? Change to
|
That would be a very bad type; given |
Quote recommendation from
|
The TypeScript maintainers have a... let's say... contentious relationship with the Either way, |
But, compared with |
The typescript-eslint maintainers are uncharacteristically super wrong about this. |
π typescript-eslint maintainer here. The Also looking at typescript-eslint/typescript-eslint#5018 (comment):
TypeScript did in fact ship the change to make Three related issues on our side:
For context: typescript-eslint is a separate maintenance team from TypeScript. Our opinions can sometimes fall out of sync with TypeScript best practices because we -like many independent open source projects- generally only take action in response to user prodding. We haven't been prodded about |
As far as I see, maybe should split The original issue is ActualESM ExpectedESM Because it is
> mod = await import('/tmp/empty-file.mjs')
> mod.x=1
1
> mod.x
undefined |
foo.test.ts
without export default {}
leads to wrong type unionX.test
which have zero export statement, should be sub type of ESM X
which have at least one export statement
There's no type in TypeScript that means "a type that is guaranteed to be completely empty" because TypeScript doesn't have sealed/exact types |
This issue has been marked as "Not a Defect" and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
π Search Terms
dynamic import
type union
no
export
export {}
export default {}
π Version & Regression Information
β― Playground Link
No response
π» Code
reproduce.ts
a.ts
π Actual behavior
a.test.ts
type is
a.test.ts
type is
a.test.ts
type is
π Expected behavior
When
a.test.ts
type is
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: