8000 Cannot import JSON when isolatedModules is true · Issue #28202 · microsoft/TypeScript · GitHub
[go: up one dir, main page]

Skip to content
Cannot import JSON when isolatedModules is true #28202
Closed
@brunolemos

Description

@brunolemos

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0