feat: remove top-level typescript import statements #1259
Merged
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 type
is allowed here.This pull request replaced all remove top-level typescript
import
statements withimport type
, and leverage constants from resolved compiler.