GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Ng2 does not compile with Typescript --strictNullChecks · Issue #8720 · angular/angular

Ng2 does not compile with Typescript --strictNullChecks #8720

New issue
Copy link
New issue
Copy link
Closed
Closed
Ng2 does not compile with Typescript --strictNullChecks#8720
Copy link

Description

@opensrcken
opensrcken
opened on May 19, 2016
Issue body actions

IMPORTANT: This repository's issues are reserved for feature requests and bug reports. Do not submit support requests here, see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question.

Steps to reproduce and a minimal demo of the problem

# set up ng2 quick start -- https://angular.io/docs/ts/latest/quickstart.html
> npm install typescript@next -g
# set `strictNullChecks: true` in `tsconfig.json`.
> npm start
> tsc && concurrently "npm run tsc:w" "npm run lite"

node_modules/@angular/core/src/metadata.d.ts(356,32): error TS2459: Type '{ descendants?: boolean | undefined; read?: any; } | undefined' has no property 'descendants' and no string index signature.
node_modules/@angular/core/src/metadata.d.ts(356,45): error TS2459: Type '{ descendants?: boolean | undefined; read?: any; } | undefined' has no property 'read' and no string index signature.
node_modules/@angular/core/src/metadata.d.ts(360,36): error TS2459: Type '{ descendants?: boolean | undefined; read?: any; } | undefined' has no property 'descendants' and no string index signature.
node_modules/@angular/core/src/metadata.d.ts(360,49): error TS2459: Type '{ descendants?: boolean | undefined; read?: any; } | undefined' has no property 'read' and no string index signature.
node_modules/@angular/core/src/metadata.d.ts(369,32): error TS2459: Type '{ descendants?: boolean | undefined; read?: any; } | undefined' has no property 'descendants' and no string index signature.
node_modules/@angular/core/src/metadata.d.ts(369,45): error TS2459: Type '{ descendants?: boolean | undefined; read?: any; } | undefined' has no property 'read' and no string index signature.
node_modules/@angular/core/src/metadata.d.ts(373,36): error TS2459: Type '{ descendants?: boolean | undefined; read?: any; } | undefined' has no property 'descendants' and no string index signature.
node_modules/@angular/core/src/metadata.d.ts(373,49): error TS2459: Type '{ descendants?: boolean | undefined; read?: any; } | undefined' has no property 'read' and no string index signature.
node_modules/@angular/core/src/metadata.d.ts(382,32): error TS2459: Type '{ read?: any; } | undefined' has no property 'read' and no string index signature.
node_modules/@angular/core/src/metadata.d.ts(385,36): error TS2459: Type '{ read?: any; } | undefined' has no property 'read' and no string index signature.
node_modules/@angular/core/src/metadata.d.ts(393,32): error TS2459: Type '{ read?: any; } | undefined' has no property 'read' and no string index signature.
node_modules/@angular/core/src/metadata.d.ts(396,36): error TS2459: Type '{ read?: any; } | undefined' has no property 'read' and no string index signature.
node_modules/@angular/core/src/metadata.d.ts(404,32): error TS2459: Type '{ read?: any; } | undefined' has no property 'read' and no string index signature.
node_modules/@angular/core/src/metadata.d.ts(407,36): error TS2459: Type '{ read?: any; } | undefined' has no property 'read' and no string index signature.
node_modules/@angular/core/src/metadata/di.d.ts(147,44): error TS2459: Type '{ descendants?: boolean | undefined; first?: boolean | undefined; read?: any; } | undefined' has no property 'descendants' and no string index signature.
node_modules/@angular/core/src/metadata/di.d.ts(147,57): error TS2459: Type '{ descendants?: boolean | undefined; first?: boolean | undefined; read?: any; } | undefined' has no property 'first' and no string index signature.
node_modules/@angular/core/src/metadata/di.d.ts(147,64): error TS2459: Type '{ descendants?: boolean | undefined; first?: boolean | undefined; read?: any; } | undefined' has no property 'read' and no string index signature.
node_modules/@angular/core/src/metadata/di.d.ts(193,44): error TS2459: Type '{ descendants?: boolean | undefined; read?: any; } | undefined' has no property 'descendants' and no string index signature.
node_modules/@angular/core/src/metadata/di.d.ts(193,57): error TS2459: Type '{ descendants?: boolean | undefined; read?: any; } | undefined' has no property 'read' and no string index signature.
node_modules/@angular/core/src/metadata/di.d.ts(220,44): error TS2459: Type '{ read?: any; } | undefined' has no property 'read' and no string index signature.
node_modules/@angular/core/src/metadata/di.d.ts(261,44): error TS2459: Type '{ descendants?: boolean | undefined; first?: boolean | undefined; read?: any; } | undefined' has no property 'descendants' and no string index signature.
node_modules/@angular/core/src/metadata/di.d.ts(261,57): error TS2459: Type '{ descendants?: boolean | undefined; first?: boolean | undefined; read?: any; } | undefined' has no property 'first' and no string index signature.
node_modules/@angular/core/src/metadata/di.d.ts(261,64): error TS2459: Type '{ descendants?: boolean | undefined; first?: boolean | undefined; read?: any; } | undefined' has no property 'read' and no string index signature.
node_modules/@angular/core/src/metadata/di.d.ts(351,44): error TS2459: Type '{ read?: any; } | undefined' has no property 'read' and no string index signature.
node_modules/@angular/core/src/metadata/di.d.ts(427,44): error TS2459: Type '{ read?: any; } | undefined' has no property 'read' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(721,18): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'selector' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(721,28): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'inputs' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(721,36): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'outputs' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(721,45): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'properties' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(721,57): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'events' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(721,65): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'host' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(721,71): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'bindings' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(721,81): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'providers' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(721,92): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'exportAs' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(721,102): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'queries' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(844,18): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'selector' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(844,28): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'inputs' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(844,36): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'outputs' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(844,45): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'properties' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(844,57): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'events' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(844,65): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'host' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(844,71): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'exportAs' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(844,81): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'moduleId' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(844,91): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'bindings' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(844,101): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'providers' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(844,112): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'viewBindings' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(844,126): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'viewProviders' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(844,141): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'changeDetection' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(844,158): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'queries' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(844,167): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'templateUrl' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(844,180): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'template' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(844,190): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'styleUrls' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(844,201): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'styles' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(844,209): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'directives' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(844,221): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'pipes' and no string index signature.
node_modules/@angular/core/src/metadata/directives.d.ts(844,228): error TS2459: Type '{ selector?: string | undefined; inputs?: string[] | undefined; outputs?: string[] | undefined; p...' has no property 'encapsulation' and no string index signature.
node_modules/@angular/core/src/metadata/view.d.ts(114,18): error TS2459: Type '{ templateUrl?: string | undefined; template?: string | undefined; directives?: (Type | any[])[] ...' has no property 'templateUrl' and no string index signature.
node_modules/@angular/core/src/metadata/view.d.ts(114,31): error TS2459: Type '{ templateUrl?: string | undefined; template?: string | undefined; directives?: (Type | any[])[] ...' has no property 'template' and no string index signature.
node_modules/@angular/core/src/metadata/view.d.ts(114,41): error TS2459: Type '{ templateUrl?: string | undefined; template?: string | undefined; directives?: (Type | any[])[] ...' has no property 'directives' and no string index signature.
node_modules/@angular/core/src/metadata/view.d.ts(114,53): error TS2459: Type '{ templateUrl?: string | undefined; template?: string | undefined; directives?: (Type | any[])[] ...' has no property 'pipes' and no string index signature.
node_modules/@angular/core/src/metadata/view.d.ts(114,60): error TS2459: Type '{ templateUrl?: string | undefined; template?: string | undefined; directives?: (Type | any[])[] ...' has no property 'encapsulation' and no string index signature.
node_modules/@angular/core/src/metadata/view.d.ts(114,75): error TS2459: Type '{ templateUrl?: string | undefined; template?: string | undefined; directives?: (Type | any[])[] ...' has no property 'styles' and no string index signature.
node_modules/@angular/core/src/metadata/view.d.ts(114,83): error TS2459: Type '{ templateUrl?: string | undefined; template?: string | undefined; directives?: (Type | any[])[] ...' has no property 'styleUrls' and no string index signature.
node_modules/@angular/core/src/util/decorators.d.ts(9,5): error TS2411: Property 'extends' of type 'Type | undefined' is not assignable to string index type 'Type | Function | any[]'.

Current behavior
Compilation fails.

Expected/desired behavior
Compilation succeeds.

Other information
Strict null checking is a highly anticipated feature that will come to Typescript 1.9. I think lots of Typescript developers would appreciate support for it in ng2.

Activity

  1. opensrcken
    changed the title [-]Ng2 does not compile with Typescript Strict Null Checks[/-] [+]Ng2 does not compile with Typescript --strictNullChecks[/+] on May 19, 2016
  2. opensrcken commented on May 19, 2016

    @opensrcken
    opensrcken
    on May 19, 2016
    ContributorAuthor
    More actions

    Many of those errors might be caused by an issue with the compiler. I've opened an issue here to be sure: microsoft/TypeScript#8681 to get the TS team's take.

    If this issue is not addressed in the Typescript compiler, a current working solution seems to be replacing the destructuring in the interface with a standard variable name. The implementers of the interface are still allowed to destructure in their function signatures. e.g.

    export interface QueryMetadataFactory {
        (selector: Type | string, whatever?: {
            descendants?: boolean;
            read?: any;
        }): ParameterDecorator;
        new (selector: Type | string, whatever?: {
            descendants?: boolean;
            read?: any;
        }): QueryMetadata;
    }
    
  3. opensrcken commented on May 29, 2016

    @opensrcken
    opensrcken
    on May 29, 2016
    ContributorAuthor
    More actions

    After the fix to microsoft/TypeScript#8681, the only outstanding compiler error with strict null checks is

    node_modules/@angular/core/src/util/decorators.d.ts(9,5): error TS2411: Property 'extends' of type 'Type | undefined' is not assignable to string index type 'Type | Function | any[]'.
    

    This seems like a simple fix.

    Reacted by Martin Coll
  4. opensrcken
    added 4 commits that reference this issue on May 29, 2016

    Allow angular2 to compile with TS --strictNullChecks

    9d7e7b4

    fix(d.ts): enable angular2 compilation with TS flag --strictNullChecks

    5e95408

    fix(d.ts): enable angular2 compilation with TS flag --strictNullChecks

    90c65c6

    fix(d.ts): enable angular2 compilation with TS flag --strictNullChecks

    3057f9e
  5. mhevery
    added a commit that references this issue on Jun 1, 2016

    fix(d.ts): enable angular2 compilation with TS flag --strictNullChecks (

    7e352a2
  6. opensrcken commented on Jun 5, 2016

    @opensrcken
    opensrcken
    on Jun 5, 2016
    ContributorAuthor
    More actions

    Fixed.

  7. opensrcken
    closed this as completedon Jun 5, 2016
  8. hlobil commented on Jun 20, 2016

    @hlobil
    hlobil
    on Jun 20, 2016
    More actions

    I have rc2 and 1.9.0-dev.20160620-1.0.

    I am still getting error when enabling strict null check.

    9 extends?: Type;
    ~~~~~~~~~~~~~~~
    node_modules/@angular/core/src/util/decorators.d.ts(9,5): error TS2411: Property 'extends' of type 'Type | undefined' is not assignable to string index type 'Type | Function | any[]'.

  9. sam-s4s commented on Aug 4, 2016

    @sam-s4s
    sam-s4s
    on Aug 4, 2016
    More actions

    Any word on this?

    I just tried strictNullChecks on rc4 (and typescript 2.1.0-dev.20160803) and I get the same error as above...

    ERROR in [default] C:\test\node_modules@angular\core\src\util\decorators.d.ts:18:4
    Property 'extends' of type 'Type | undefined' is not assignable to string index type 'Function | any[] | Type'.

    Reacted by d-ph
  10. d-ph commented on Aug 14, 2016

    @d-ph
    d-ph
    on Aug 14, 2016
    More actions

    Adding a unit test for checking, whether the whole angular2 project builds with typescript 2.0+ with strictNullChecks enabled, would be helpful.

    Reacted by Martin Mose Facondini and Martin Coll
  11. seanesss commented on Aug 18, 2016

    @seanesss
    seanesss
    on Aug 18, 2016
    More actions

    I have this problem too.

    Reacted by Martin Coll, Nikolay Matrosov, Sergey Vohmyanin, Carl Irving, Yona Appletree, Allen, Niels Kristian Hansen Skovmand and kgtkr
    Reacted by Günter Zöchbauer
  12. abierbaum commented on Sep 22, 2016

    @abierbaum
    abierbaum
    on Sep 22, 2016
    More actions

    I opened a new bug for this now that Angular 2.0.0 and Typescript 2 are both released.

    #11844

  13. angular-automatic-lock-bot commented on Sep 9, 2019

    @angular-automatic-lock-bot
    angular-automatic-lock-botBot
    on Sep 9, 2019
    More actions

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  14. angular-automatic-lock-bot
    locked and limited conversation to collaborators on Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.