feat: remove top-level typescript import statements#1259
Merged
johnnyreilly merged 4 commits intoTypeStrong:masterfrom Mar 28, 2021
Merged
feat: remove top-level typescript import statements#1259johnnyreilly merged 4 commits intoTypeStrong:masterfrom
johnnyreilly merged 4 commits intoTypeStrong:masterfrom
Conversation
b987712 to
4a9d33c
Compare
4a9d33c to
23b75fe
Compare
23b75fe to
62ece47
Compare
62ece47 to
36bad2e
Compare
Contributor
Author
|
@johnnyreilly Could you help review this pull request? Thanks |
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 |
Member
|
Let's 🚢 |
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 containingcannot found "typescript"caused by the top-level typescript import statement atts-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 ofimport typeis allowed here.This pull request replaced all remove top-level typescript
importstatements withimport type, and leverage constants from resolved compiler.