Skip to content

rc.0 update / tsconfig - missing type definitions #5110

Closed
@jtsom

Description

@jtsom

OS?

Any

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:

   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
@angular/cli: 1.0.0-rc.0
node: 7.6.0
os: linux x64
@angular/common: 2.4.8
@angular/compiler: 2.4.8
@angular/core: 2.4.8
@angular/forms: 2.4.8
@angular/http: 2.4.8
@angular/platform-browser: 2.4.8
@angular/platform-browser-dynamic: 2.4.8
@angular/router: 3.4.8
@angular/cli: 1.0.0-rc.0
@angular/compiler-cli: 2.4.8

After updating a project to the rc.0 version of the CLI by following the steps in the wiki article, some types were now not found, at least using VSCode. Specifically trying to set a value on localstorage was showing an error that localstorage was not defined.

However, after looking at the changes to the tsconfig.json file, especially the one that was specified to be created at the root level, there is a difference in the 'lib' key. From the pre rc.0 tsconfig.json file:

    "lib": [
      "es2016",
      "dom"
    ],

In the new tsconfig.json file:

    "lib": [
      "es2016"
    ],

The missing dom key causes the Typescript system to not find the localstorage (and other) types.

I do see the dom key in the tsconfig.app.json file, and a mention that in V4 pull request (#4924) the tsconfig files will be inherited. but this is still an Angular v2 project, so these aren't.

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