Skip to content
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

Cannot import JSON when isolatedModules is true #28202

Closed
brunolemos opened this issue Oct 29, 2018 · 0 comments
Closed

Cannot import JSON when isolatedModules is true #28202

brunolemos opened this issue Oct 29, 2018 · 0 comments
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@brunolemos
Copy link

brunolemos commented Oct 29, 2018

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

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants