Skip to content

Allow angular 2 applications to compile in strictNullChecks mode #11844

@abierbaum

Description

@abierbaum

I'm submitting a ... (check one with "x")

[X] bug report => search github for a similar issue or PR before submitting

Current behavior

When trying to compile an ng2 application with typescript 2.0 strictNullChecks turned on the compiler runs into errors.

Expected behavior

Expect that ng2 would support use with strictNullChecks.

Reproduction of the problem

Reproduced by taking the quick start application and setting the strictNullChecks option true in tsconfig.json. (see: https://github.com/abierbaum/quickstart)

When doing this and running npm run tsc the following error is shown:

> angular-quickstart@1.0.0 tsc /home/allenb/Source/quickstart
> tsc

node_modules/@angular/core/src/util/decorators.d.ts(11,5): error TS2411: Property 'extends' of type 'Type<any> | undefined' is not assignable to string index type 'Function | any[] | Type<any>'.
node_modules/@angular/platform-browser/src/dom/dom_renderer.d.ts(25,22): error TS2420: Class 'DomRenderer' incorrectly implements interface 'Renderer'.
  Types of property 'animate' are incompatible.
    Type '(element: any, startingStyles: AnimationStyles | undefined, keyframes: (AnimationKeyframe | undef...' is not assignable to type '(element: any, startingStyles: AnimationStyles, keyframes: AnimationKeyframe[], duration: number,...'.
      Type 'AnimationPlayer | undefined' is not assignable to type 'AnimationPlayer'.
        Type 'undefined' is not assignable to type 'AnimationPlayer'.

Other similar errors occur with larger projects.

What is the motivation / use case for changing the behavior?

strictNullChecks is a recommended best practices for new typescript code and it would be great if we could use this with ng2 applications.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions