-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Cannot import JSON when isolatedModules is true #28202
Copy link
Copy link
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Description
TypeScript Version: 3.2.0-dev.20181027
Search Terms: json isolatedModules, resolveJsonModule isolatedModules
Code
import test from './test.json'tsconfig.json:
{
"compilerOptions": {
"target": "es5",
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve"
},
"include": [
"src"
]
}Expected behavior:
Imports JSON without any error.
Actual behavior:
TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided.
Playground Link: Could not find a playground that supports editing tsconfig.json, adding a json file and that would show tsc output
Related Issues: #15230, #18232, https://stackoverflow.com/q/52103265/2228575
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue