Skip to content

"use strict" emitted in JSON file with --isolatedModules and --resolveJsonModule #36372

@ghost

Description

TypeScript Version: 3.7.5, 3.8.0-dev.20200123

Search Terms:
isolatedModules, resolveJsonModule, use strict,

Code

// testschema.json 
{}

// main.ts
import schema from "./testschema.json"
console.log(schema)

tsconfig.json:

{
  "compilerOptions": {
    "target": "es2019",
    "module": "commonjs",
    "strict": true,
    "esModuleInterop": true,
    "isolatedModules": true,
    "resolveJsonModule": true,
    "outDir": "dist"
  }
}

Compile project with tsc

Expected behavior:
Original testschema.json is emitted in dist.

Actual behavior:

"use strict";
{}

Workaround
If I leave out "isolatedModules" or set it to false, it works again.

Related Issues:
#24514

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions