Ionic-framework: TS strict null checks compliant

Created on 4 Mar 2017  路  6Comments  路  Source: ionic-team/ionic-framework

Once ionic uses Angular 4, we should make Ionic compliant with the --strictNullChecks option of the typescript transpiler.

  • Reduce technical debt
  • Better static analysis for ionic
  • Fix hidden bugs

Ref:
https://github.com/angular/angular/blob/master/CHANGELOG.md#400-rc1-2017-02-24
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-0.html

Duplicate of https://github.com/driftyco/ionic/issues/9456

All 6 comments

I tried to enable strict mode in my project ("strict": true in "compilerOptions" section of tsconfig.json) and had this error from one of your files.

node_modules/ionic-angular/util/base-input.d.ts(23,22): error TS2420: Class 'BaseInput<T>' incorrectly implements interface 'CommonInput<T>'.
  Types of property 'ionFocus' are incompatible.
    Type 'EventEmitter<BaseInput<T>>' is not assignable to type 'EventEmitter<CommonInput<T>>'.
      Types of property 'observers' are incompatible.
        Type 'Observer<BaseInput<T>>[]' is not assignable to type 'Observer<CommonInput<T>>[]'.
          Type 'Observer<BaseInput<T>>' is not assignable to type 'Observer<CommonInput<T>>'.
            Type 'CommonInput<T>' is not assignable to type 'BaseInput<T>'.

This prevents me from using strict mode in my project. Is there any workaround or ETA for this?

Thanks

The error in ionic serve is this:

image

I think we are loosing a great part of the benefit of using Typescript if we are not able to use it in strict mode. Please consider fixing this one error.

Ionic 4 will address this problems

Why Closed? Did you resolved? just removed "strict"?

Ah... I skipped to read @manucorporat 's message, I should just wait it, shouldn't I?

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Was this page helpful?
0 / 5 - 0 ratings