11## Motivation
22
3- We write our demos in TS but want to offer the same demos to JS users.
3+ We write our demos in TS, but want to offer the same demos to JS users.
44Maintaining two versions of the demos is hard and therefore we simply transpile
5- the TS demos with babel to JS.
5+ the TS demos with Babel into JS.
66
7- However we have some TS only utility functions that are essentially identity function
8- with no side-effects whos only purpose is to defeat type widening. These add noise
9- to the JS files and bundle size for everyone.
7+ However, we have some TS- only utility functions that are essentially identity function
8+ with no side-effects, with the sole purpose being to defeat type widening.
9+ Without it, noise is added to the JS files and bundle size for everyone.
1010
11- This plugin unwraps them
11+ This plugin unwraps them.
1212
1313## Recognized patterns
1414
@@ -20,6 +20,8 @@ const styles = () => createStyles({});
2020export default withStyles (styles )(Component );
2121```
2222
23+ would be changed to:
24+
2325``` js
2426import { withStyles } from ' @material-ui/core/styles' ;
2527
@@ -35,9 +37,9 @@ It works also with the `@material-ui/styles` package.
3537- default import from ` createStyles `
3638- aliased imports
3739
38- ## Why not as a typescript transformer?
40+ ## Why not a TypeScript transformer?
3941
40- Face these issues in chronological order
41- 1 . no config API i.e. transformers are only supported for programmatic transpilation/compilation
42- 2 . since we need to pipe prettier we might as well use a programmatic approach so back to transformer
43- 3 . typescript does not preserve blanklines (Microsoft/TypeScript #843 ) back to babel plugins
42+ We face these issues ( in chronological order):
43+ 1 . no config API ( i.e. transformers are only supported for programmatic transpilation/compilation)
44+ 2 . since we need to pipe Prettier, we might as well use a programmatic approach so back to transformer
45+ 3 . TypeScript does not send blanklines (Microsoft/TypeScript #843 ) back to Babel plugins
0 commit comments