Skip to content
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

feat: support import ts definition #1366

Closed
wants to merge 1 commit into from
Closed

feat: support import ts definition #1366

wants to merge 1 commit into from

Conversation

neviaumi
Copy link

Typescript support extension with .d.ts

But in current config of import , it should complain error when try import custom type.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.802% when pulling eb355e9 on davidNHK:feat/support-import-ts-definition into cf5573b on benmosher:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.802% when pulling eb355e9 on davidNHK:feat/support-import-ts-definition into cf5573b on benmosher:master.

@@ -2,7 +2,7 @@
* Adds `.jsx`, `.ts` and `.tsx` as an extension, and enables JSX/TSX parsing.
*/
var jsExtensions = ['.js', '.jsx'];
var tsExtensions = ['.ts', '.tsx'];
var tsExtensions = ['.d.ts','.ts', '.tsx'];
Copy link
Member

Choose a reason for hiding this comment

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

i'm concerned this might be a breaking change.

Copy link

Choose a reason for hiding this comment

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

This should be:

var tsExtensions = ['.ts', '.d.ts', '.tsx'];

Copy link
Member

Choose a reason for hiding this comment

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

I think it should be ['.ts', '.tsx', '.d.ts'], no? A full React module should override a definition file, I would think?

In practice I would expect it to matter <<0.1% of the time, though. Seems like a weird case to have definitions and full TS modules at the same filename location. Whereas a .d.ts should override a .js file, right?

So maybe the correct thing would be

var allExtensions = ['.ts', '.tsx', '.d.ts', '.js', '.jsx'];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants