Skip to content

Module value in TSConfig does not enforce ModuleResolution valueΒ #63671

Description

@yohny

πŸ”Ž Search Terms

moduleresolution enforce

πŸ•— Version & Regression Information

I tested also on typescript 5 and the behavior was the same

⏯ Playground Link

No response

πŸ’» Code

According to docs certain module values imply and enforce certain moduleResolution values as decribed at https://www.typescriptlang.org/docs/handbook/modules/reference.html#implied-and-enforced-options

However the following tsconfig works without any issue:

{
  "compilerOptions": {
    "module": "nodenext",
    "moduleResolution": "node16", // this should not be allowed
    "outDir": "dist",
    "rootDir": ".",
    "sourceMap": true,
    "strict": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "types": ["*"]
  }
}

even when according to docs --module nodenext should enforce --moduleResolution nodenext

πŸ™ Actual behavior

the tsc compilation works with option that should fail according to docs

πŸ™‚ Expected behavior

fix the behavior or the docs

Additional information about the issue

typescript version: 6.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions