Skip to content

Allow isolatedModules: true with noEmitOnError: true #31012

Closed
@mheiber

Description

@mheiber

Search Terms

  • isolatedModules
  • noEmitOnError

Suggestion

Allow isolatedModules: true with noEmitOnError: true

Use Cases

What do you want to use this for?

My understanding of the purpose of isolatedModules: true is that it does extra validation to ensure that separate compilation is safe. We want to use it for that purpose.

Allowing emit in the presence of errors is contrary to that goal. We're doing the validation to stop dangerous code from getting through.

What shortcomings exist with current approaches?

We use TypeScript in our compilation pipeline.

The only workaround I can think of is some hack to compile to a different location and copy files over once checks pass. This doesn't seem great for watch mode, and could be error-prone or racy.

Examples

tsconfig.json:

{
    "compilerOptions": {
        "noEmitOnError": true,
        "isolatedModules": true,
    }
}

Actual behavior: tsconfig.json(5,9): error TS5053: Option 'noEmitOnError' cannot be specified with option 'isolatedModules'.

Expected behavior: no error message, just works

Checklist

My suggestion meets these guidelines:

  • [x ] This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions