Skip to content

tsconfig.app.json types are ignored #5351

Closed
@coryrylan

Description

@coryrylan

Please provide us with the following information:

OS?

Windows 10 x64

Versions.

@angular/cli: 1.0.0-rc.1
node: 6.9.1
os: win32 x64

Repro steps.

Update package.json from @angular/cli": "1.0.0-rc.0 to @angular/cli": "1.0.0-rc.1.

The log given by the failure.

Cannot find name 'require'
Cannot find namespace 'ol'
Cannot find name 'describe'
Cannot find name 'beforeEach'
Cannot find name 'it'
Cannot find name 'expect'

Mention any other details that might be useful.

When using certain 3rd party libraries or require() you need to add the types to the tsconfig.app.json as described here https://github.com/angular/angular-cli/wiki/stories-third-party-lib. In the latest RC1 it looks like the types option is ignored resulting the above error. If I remove the types entry and replace it with the global typeRoots entry it seems to work but is not ideal to pull in all types. This also affects the tsconfig.spec.json.

Breaks in RC1, used to work in RC0

{
  "compilerOptions": {
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "es2016",
      "dom"
    ],
    "outDir": "../out-tsc/app",
    "target": "es5",
    "module": "es2015",
    "baseUrl": "",
    "types": [
      "node",
      "openlayers"
    ]
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}

Work around for RC1

{
  "compilerOptions": {
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "es2016",
      "dom"
    ],
    "outDir": "../out-tsc/app",
    "target": "es5",
    "module": "es2015",
    "baseUrl": "",
    "typeRoots": [
      "../node_modules/@types"
    ]
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs: repro stepsWe cannot reproduce the issue with the information given

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions