Skip to content

Irrelevant Cannot compile modules using option 'outFile' error when using emitDeclarationOnly #27117

Closed

Description

Noticed via https://stackoverflow.com/q/52326378 .

TypeScript Version: master (e471856)

Search Terms: cannot compile modules outFile emitDeclarationOnly

Code

// tsconfig.json
{
  "compilerOptions": {
    "declaration": true,
    "emitDeclarationOnly": true,
    "outFile": "out.d.ts"
  }
}
// a.ts
export default 42;

Expected behavior: Successful declaration file generation.

Actual behavior: a.ts:1:1 - error TS6131: Cannot compile modules using option 'outFile' unless the '--module' flag is 'amd' or 'system'.

Playground Link: N/A

Related Issues: None found

Activity

  1. added
    Working as IntendedThe behavior described is the intended behavior; this is not a bug
    BugA bug in TypeScript
    and removed
    Working as IntendedThe behavior described is the intended behavior; this is not a bug
    on Sep 21, 2018
  2. added 2 commits that reference this issue on Sep 27, 2018
    27ddfbb
    32e75e7
  3. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions