[RFR] Bootstrap TypeScript migration - #2426
Conversation
| "compilerOptions": { | ||
| /* Basic Options */ | ||
| "target": | ||
| "ES3" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */, |
There was a problem hiding this comment.
In fact there is no compilation done by type script, just typechecking babel still does the job with ts-preset
There was a problem hiding this comment.
Isn't it tsc which is used to build now according to the package.json files ?
| "compilerOptions": { | ||
| /* Basic Options */ | ||
| "target": | ||
| "ES3" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */, |
There was a problem hiding this comment.
In fact there is no compilation done by type script, just typechecking babel still does the job with ts-preset
| // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ | ||
|
|
||
| /* Strict Type-Checking Options */ | ||
| "strict": true /* Enable all strict type-checking options. */, |
| "allowJs": true /* Allow javascript files to be compiled. */, | ||
| // "checkJs": true, /* Report errors in .js files. */ | ||
| "jsx": | ||
| "react" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */, |
There was a problem hiding this comment.
Should be preserve, otherwise some babel plugins may not work anymore
There was a problem hiding this comment.
forget about that, because of --noEmit :)
| // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ | ||
| // "composite": true, /* Enable project compilation */ | ||
| // "removeComments": true, /* Do not emit comments to output. */ | ||
| // "noEmit": true, /* Do not emit outputs. */ |
There was a problem hiding this comment.
Should be noEmit, ... Babel does the emit job
|
@brikou we use babel to test react-admin with the simple example, but we'll use Typescript to compile the ES6/TS code to ES5 for packaging, so we need both the |
|
Great plan! I'd love to contribute to this migration |
|
@eknowles you could help by explaining me why the unit tests fail... Apparently, transpiling js components with TypeScript messes up some of the component |
|
Green, and Ready for Review |
We've decided to gradually migrate react-admin to TypeScript. Explaining why isn't the purpose of this description, but we expect more stability and a better developper experience.
Our strategy is:
export *)Document the new standard(it will only be a standard for packages we've migrated)Then, we'll rename files from .js to .ts/.tsx and add types little by little (outside of the scope of this PR)
Comments are welcome!