-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit modifies the build system so that TypeScript files can be transpiled into ES5 just like JavaScript files. Note that this commit does not change the build system to run TypeScript files through TypeScript. This means that no files will be type-checked at this stage, because we expect type-checking to be handled elsewhere (live, via your editor integration with `tsserver`, and before a PR is merged, via `yarn lint`). Rather, we merely instruct Babel to recognize and strip TypeScript-specific syntax from any files that have it, as if those files had been written using JavaScript syntax alone. This approach has an upside: it prevents the build process from being negatively impacted with respect to performance (as TypeScript takes a significant amount of time to run). This approach also has a downside, however. Because Babel's [TypeScript transform][1], which does the real work here, does not actually run files through TypeScript, but merely mimics TypeScript's parser, there are a few syntactical forms that Babel does not recognize, and we may have to either not use these forms or use another transform to get Babel to understand them. Also, any settings we place in `tsconfig.json` will be completely ignored by Babel (although there are some analogs for the most important settings). These and other caveats are detailed in the [documentation for the transform][2]. [1]: https://babeljs.io/docs/en/babel-plugin-transform-typescript [2]: https://babeljs.io/docs/en/babel-plugin-transform-typescript#typescript-compiler-options
- Loading branch information
Showing
7 changed files
with
186 additions
and
136 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.