Skip to content

Jquery error TS1209: Ambient const enums are not allowed when the '--isolatedModules' flag is provided. #20703

@pmunin

Description

@pmunin

TypeScript Version: 2.6.2

Code

//package.json:
{
  "name": "issue-ts-isolatedmodule",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "jquery": "^3.2.1"
  }
  ,"devDependencies": {
    "typescript": "^2.6.2",
    "@types/jquery":"^3.2.17"
  }
}

//tsconfig.json

{
  "compilerOptions": {
    "outDir": "build/dist",
    "module": "esnext",
    "target": "es5",
    "lib": ["es6", "dom"],
    "sourceMap": true,
    "allowJs": true,
    "jsx": "react",
    "moduleResolution": "node",
    "rootDir": "src",
    "forceConsistentCasingInFileNames": true,
    "suppressImplicitAnyIndexErrors": true,
    "isolatedModules": true,
    "preserveConstEnums": true,
    "preserveSymlinks": true,
    "allowSyntheticDefaultImports": true
  },
  "exclude": [
    "node_modules",
    "build",
    "scripts",
    "acceptance-tests",
    "webpack",
    "jest",
    "src/setupTests.ts"
  ]
}
//src/index.ts
export function HalloWorld(){
    return "Hallo world!"
}

Executing tsc -p ..

Expected behavior:
successfully compiled /build/dist/{tsfilename}.js for each ts module:

Actual behavior:

node_modules/@types/jquery/index.d.ts(7690,16): error TS1209: Ambient const enums are not allowed when the '--isolatedModules' flag is provided.
node_modules/@types/jquery/index.d.ts(7698,16): error TS1209: Ambient const enums are not allowed when the '--isolatedModules' flag is provided.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CommittedThe team has roadmapped this issueHelp WantedYou can do thisSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions