-
-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Description
According to this comment, in order to compile TypeScript with Babel, you need the isolatedModules flag. However, this flag is incompatible with the declaration flag, which is used to avoid manually duplicated TypeScript type definitions for a library. We have been compiling redux-react-hook just fine without isolatedModules, but every time we run yarn test it is added back in and needs to be reverted. Is there a way for emitted declaration files to play nicely with create-react-app?
Is this a bug report?
Yes
Did you try recovering your dependencies?
Yes
➜ yarn --version
1.12.3
Which terms did you search for in User Guide?
typescript, tsconfig, declaration, isolatedModules
Environment
➜ create-react-app --info
Environment Info:
System:
OS: macOS 10.14.1
CPU: x64 Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz
Binaries:
Node: 10.15.0 - ~/.nvm/versions/node/v10.15.0/bin/node
Yarn: 1.12.3 - ~/.yarn/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v10.15.0/bin/npm
Browsers:
Chrome: 72.0.3626.119
Safari: 12.0.1
npmPackages:
react: ^16.8.3 => 16.8.3
react-dom: ^16.8.3 => 16.8.3
react-scripts: ^2.1.3 => 2.1.3
npmGlobalPackages:
create-react-app: Not Found
Steps to Reproduce
yarn create react-app cra-tsconfig-bug --typescriptcd cra-tsconfig-bugtouch .watchmanconfig- In
tsconfig.json, changeisolatedModulestodeclaration - Run
yarn test - Note that
isolatedModules: trueis added back totsconfig.json - Run the typescript compiler (open a tsx file in VSCode for example)
- See the error: "Option 'declaration' cannot be specified with option 'isolatedModules'"
Expected Behavior
yarn test should not be modifying my tsconfig.json to put it in an invalid state
Actual Behavior
yarn test adds isolatedModules: true, which is not compatible with declaration: true for emitting declaration files.
Reproducible Demo
See steps above, this is very easy to reproduce.