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: remove top-level typescript import statements #1259

Merged

Conversation

ulivz
Copy link
Contributor

@ulivz ulivz commented Mar 2, 2021

Background

In some deployment systems, the builder and source code are placed in different paths, and we also expect the typescript's version to be completely controlled by the user, if the builder does not depend on typescript, then we will get error containing cannot found "typescript" caused by the top-level typescript import statement at ts-loader, In other words, we SHOULD respect the resolved compiler.

Prior to TypeScript 3.8, you can import a type using import. With TypeScript 3.8, you can import a type using the import statement, or using import type, and import type is always guaranteed to be removed from your JavaScript, this project has stopped testing TypeScript 3.6 and 3.7 at 953358e, so usage of import type is allowed here.

This pull request replaced all remove top-level typescript import statements with import type, and leverage constants from resolved compiler.

@ulivz ulivz force-pushed the feat/make-typescript-as-dev-dependencies branch from b987712 to 4a9d33c Compare March 2, 2021 09:17
@ulivz ulivz changed the title feat: typescript as dev dependencies feat: remove top-level typescript import declaration Mar 2, 2021
@ulivz ulivz force-pushed the feat/make-typescript-as-dev-dependencies branch from 4a9d33c to 23b75fe Compare March 2, 2021 09:23
@ulivz ulivz changed the title feat: remove top-level typescript import declaration feat: remove top-level typescript import declarations Mar 2, 2021
@ulivz ulivz force-pushed the feat/make-typescript-as-dev-dependencies branch from 23b75fe to 62ece47 Compare March 2, 2021 09:24
@ulivz ulivz changed the title feat: remove top-level typescript import declarations feat: remove top-level typescript import statements Mar 2, 2021
@ulivz ulivz force-pushed the feat/make-typescript-as-dev-dependencies branch from 62ece47 to 36bad2e Compare March 2, 2021 09:32
@ulivz
Copy link
Contributor Author

ulivz commented Mar 3, 2021

@johnnyreilly Could you help review this pull request? Thanks

@johnnyreilly
Copy link
Member

Sorry about the delay - have been busy. I like this change. Thanks for raising it.

I've just hit the update branch button. Please could you increment the version in the package.json and add an entry to the CHANGELOG.md?

@johnnyreilly
Copy link
Member

Let's 🚢

@johnnyreilly johnnyreilly merged commit a1b19a1 into TypeStrong:master Mar 28, 2021
@johnnyreilly
Copy link
Member

gasnier added a commit to gasnier/ts-loader that referenced this pull request Mar 28, 2021
feat: remove top-level typescript import statements (TypeStrong#1259)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants