Typescript does not import JSON and throws Type error
Created by: MattyBalaam
Is this a bug report?
Yes
Did you try recovering your dependencies?
Yes
Which terms did you search for in User Guide?
JSON, import JSON
Environment
System: OS: macOS High Sierra 10.13.6 CPU: x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz Binaries: Node: 10.11.0 - /usr/local/bin/node Yarn: 1.10.1 - /usr/local/bin/yarn npm: 6.4.1 - /usr/local/bin/npm Browsers: Chrome: 70.0.3538.77 Firefox: 63.0 Safari: 12.0 npmPackages: react: Not Found react-dom: Not Found react-scripts: Not Found npmGlobalPackages: create-react-app: Not Found
Steps to Reproduce
- add a json file to project
- add
import json from './test.json';
to another file - start compilation
Expected Behavior
Json file is imported into app and become JS object - which works in a refular .js CRA project.
Actual Behavior
Type error: Cannot compile namespaces when the '--isolatedModules' flag is provided. TS1208
Reproducible Demo
https://github.com/MattyBalaam/json-typescript-CRA-bug-report
- install dependencies
- run start