-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFR] Bootstrap TypeScript migration #2426
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
tsconfig.json
Outdated
"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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Es3 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it tsc
which is used to build now according to the package.json files ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes indeed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great 1st step!
tsconfig.json
Outdated
"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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact there is no compilation done by type script, just typechecking babel still does the job with ts-preset
tsconfig.json
Outdated
// "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. */, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be commented for now
"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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be preserve, otherwise some babel plugins may not work anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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!