Skip to content

feat: support import ts definition #1366

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

Closed
wants to merge 1 commit into from
Closed
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 config/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'];

var allExtensions = jsExtensions.concat(tsExtensions);

module.exports = {
Expand Down