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 — Enable strictNullChecks mode for aio codebase · Issue #20646 · angular/angular

Enable strictNullChecks mode for aio codebase #20646

New issue
Copy link
New issue
Copy link
Closed
Closed
Enable strictNullChecks mode for aio codebase#20646
Copy link
Assignees
petebacondarwin
Labels
featureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issues

Description

@IgorMinar
IgorMinar
opened on Nov 27, 2017
Issue body actions

aio doesn't use the strictNullChecks tsc mode, primarily because the mode didn't exist when we started the project.

Having this mode on would help us catch more bugs using the typechecker and would also help us better understand the TS upgrade pain for users with this mode on (currently we have this mode on in g3 and angular framework code base, but we don't have any of our non-g3 apps using that mode).

Reacted by Sylvain Dumont

Activity

  1. IgorMinar
    added
    comp: aio
    featureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issues
    on Nov 27, 2017
  2. gkalpak commented on Nov 28, 2017

    @gkalpak
    gkalpak
    on Nov 28, 2017
    Member
    More actions

    Should we enable all --strict checks? Please? 😛
    From the TS handbook:

    --strict
    Enable all strict type checking options.
    Enabling --strict enables --noImplicitAny, --noImplicitThis, --alwaysStrict, --strictNullChecks and --strictFunctionTypes.

    Reacted by Daniel Wulff
  3. trotyl commented on Nov 28, 2017

    @trotyl
    trotyl
    on Nov 28, 2017
    Contributor
    More actions

    @gkalpak the --strict master option in tsconfig will break Angular in TypeScript 2.7 due to the new --strictPropertyInitialization option. It was mentioned in microsoft/TypeScript#15360 and microsoft/TypeScript#20117.

  4. gkalpak commented on Nov 28, 2017

    @gkalpak
    gkalpak
    on Nov 28, 2017
    Member
    More actions

    Thx for the heads-up 👍

    We can always explcitly opt-out of specific options. That's better than opt into imo.
    Also, I am not sure why this is incompatible with Angular (why can't you initialize input properties anyway)?

    Also, we just landed support for TS 2.5. Let's worry about 2.7 when we get there 😃

  5. trotyl commented on Nov 28, 2017

    @trotyl
    trotyl
    on Nov 28, 2017
    Contributor
    More actions

    I am not sure why this is incompatible with Angular

    In Angular we always initialize input properties AFTER constructor and before ngOnInit, so that's an error in TypeScript as it cannot detect the initialization (and if the properties are not nullable).

    We can always explcitly opt-out of specific options.

    That's a good idea, but Angular CLI seems unable to auto-update tsconfig, so may not apply there (sorry for off-topic, still fine for angular.io). 😄

  6. gkalpak commented on Nov 28, 2017

    @gkalpak
    gkalpak
    on Nov 28, 2017
    Member
    More actions

    I mean there is nothing stopping you from initializing input properties in the component:

    @Component({
      template: 'Hello, {{ name }}!',
    })
    class GreetingComponent {
      @Input() name = 'world';
    }
  7. trotyl commented on Nov 28, 2017

    @trotyl
    trotyl
    on Nov 28, 2017
    Contributor
    More actions

    That's true, but I guess most input properties may not have a default value? 😄

  8. gkalpak commented on Nov 28, 2017

    @gkalpak
    gkalpak
    on Nov 28, 2017
    Member
    More actions

    You can always explicit | null = null 😃
    Just to be clear, we are talking about just the angular.io app. But even if we end up turning --strictPropertyInitialization off, it is better to be "strict by default" 😃

  9. danwulff commented on Nov 28, 2017

    @danwulff
    danwulff
    on Nov 28, 2017
    More actions

    I feel like enabling the --strict flag, would provide for the safest / best use of typescript protection going forward. This would definitely be an undertaking for all of Angular but maybe shooting for this in release 6.0 could be a possibility? I hope @IgorMinar and the Angular team would at least take this into consideration.

    From the typescript 2.3 release notes: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-3.html#new---strict-master-option

    New checks added to TypeScript are often off by default to avoid breaking existing projects. While avoiding breakage is a good thing, this strategy has the drawback of making it increasingly complex to choose the highest level of type safety, and doing so requires explicit opt-in action on every TypeScript release. With the --strict option it becomes possible to choose maximum type safety with the understanding that additional errors might be reported by newer versions of the compiler as improved type checking features are added.

  10. petebacondarwin
    self-assigned this
    on Jan 5, 2018
  11. alexeagle
    added a commit that references this issue on Jan 12, 2018

    style(aio): enforce strict TypeScript checks (#21342)

    This issue will close once commit 71dd92b is merged into the 'main' branch.
    71dd92b
  12. alexeagle
    closed this as completedin c5c6d84on Jan 12, 2018
  13. angular-automatic-lock-bot commented on Sep 13, 2019

    @angular-automatic-lock-bot
    angular-automatic-lock-botBot
    on Sep 13, 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 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @petebacondarwin
    petebacondarwin

Labels

featureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issues

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.