NathanWalker / angular-seed-advanced

Advanced Angular seed project with support for ngrx/store, ngrx/effects, ngx-translate, angulartics2, lodash, NativeScript (*native* mobile), Electron (Mac, Windows and Linux desktop) and more.
MIT License
2.26k stars 445 forks source link

Typescript 2.4 error on fresh install with example code #450

Closed renestalder closed 7 years ago

renestalder commented 7 years ago

I'm submitting a ...

[x] bug report
[ ] feature request
[ ] support request

Current behavior When using TypeScript >= 2.4, the build/compiling doesn't work and fails because of typing errors:

dist/tmp/app/modules/i18n/effects/multilingual.effect.ts(18,43): error TS2684: The 'this' context of type 'Actions' is not assignable to method's 'this' of type 'Observable<any>'.
dist/tmp/app/modules/i18n/multilingual.module.ts(30,29): error TS2559: Type '{ provide: typeof TranslateLoader; deps: typeof Http[]; useFactory: (http: Http) => TranslateHttp...' has no properties in common with type 'TranslateModuleConfig'.
dist/tmp/app/modules/sample/effects/sample.effect.ts(20,41): error TS2684: The 'this' context of type 'Actions' is not assignable to method's 'this' of type 'Observable<any>'.
  Types of property 'lift' are incompatible.
    Type '(operator: Operator<any, Action>) => Observable<Action>' is not assignable to type '<R>(operator: Operator<any, R>) => Observable<R>'.
      Types of parameters 'operator' and 'operator' are incompatible.
        Type 'Operator<any, R>' is not assignable to type 'Operator<any, Action>'.
          Type 'R' is not assignable to type 'Action'.
dist/tmp/app/modules/sample/effects/sample.effect.ts(31,40): error TS2684: The 'this' context of type 'Actions' is not assignable to method's 'this' of type 'Observable<any>'.
project/node_modules/@ngrx/effects/src/actions.d.ts(4,22): error TS2415: Class 'Actions' incorrectly extends base class 'Observable<Action>'.
  Types of property 'lift' are incompatible.
    Type '(operator: Operator<any, Action>) => Observable<Action>' is not assignable to type '<R>(operator: Operator<Action, R>) => Observable<R>'.
      Types of parameters 'operator' and 'operator' are incompatible.
        Type 'Operator<Action, R>' is not assignable to type 'Operator<any, Action>'.
          Type 'R' is not assignable to type 'Action'.
project/node_modules/rxjs/Subject.d.ts(16,22): error TS2415: Class 'Subject<T>' incorrectly extends base class 'Observable<T>'.
  Types of property 'lift' are incompatible.
    Type '<R>(operator: Operator<T, R>) => Observable<T>' is not assignable to type '<R>(operator: Operator<T, R>) => Observable<R>'.
      Type 'Observable<T>' is not assignable to type 'Observable<R>'.
        Type 'T' is not assignable to type 'R'.

Expected behavior The build should run without error with the code provided by this repository and with TypeScript >= 2.4.

Minimal reproduction of the problem with instructions I can reproducing this when checking out the angular-seed-advanced repository and try to build with the latest TypeScript version. When I revert back to TypeScript 2.3.4, everything works fine. The problem might not come up with Yarn, since the version is locked in the lockfile. But it comes up with npm for sure.

What is the motivation / use case for changing the behavior? We want to be able using newer TypeScript versions.

Please tell us about your environment: macOS

psmontte commented 7 years ago

On fresh install today 4th July, I am getting this error on Windows 10: [0] C:/test/asa/nativescript/node_modules/@ngrx/effects/src/actions.d.ts(4,22): error TS2415: Class 'Actions' incorrectly extends base class 'Observable'. [0] Types of property 'lift' are incompatible. [0] Type '(operator: Operator<any, Action>) => Observable' is not assignable to type '(operator: Operator<Action, R>) => Observable'. [0] Types of parameters 'operator' and 'operator' are incompatible. [0] Type 'Operator<Action, R>' is not assignable to type 'Operator<any, Action>'. [0] Type 'R' is not assignable to type 'Action'. [0] C:/test/asa/nativescript/node_modules/rxjs/Subject.d.ts(16,22): error TS2415: Class 'Subject' incorrectly extends base class 'Observable'. [0] Types of property 'lift' are incompatible. [0] Type '(operator: Operator<T, R>) => Observable' is not assignable to type '(operator: Operator<T, R>) => Observable'. [0] Type 'Observable' is not assignable to type 'Observable'. [0] Type 'T' is not assignable to type 'R'. [0] C:/test/asa/nativescript/node_modules/tns-core-modules/ui/core/properties/properties.d.ts(48,14): error TS2559: Type 'Property<T, U>' has no properties in common with type 'TypedPropertyDescriptor'. [0] C:/test/asa/nativescript/node_modules/tns-core-modules/ui/core/properties/properties.d.ts(59,14): error TS2559: Type 'CoercibleProperty<T, U>' has no properties in common with type 'TypedPropertyDescriptor'. [0] app\modules\i18n\effects\multilingual.effect.ts(18,43): error TS2684: The 'this' context of type 'Actions' is not assignable to method's 'this' of type 'Observable'. [0] app\modules\i18n\multilingual.module.ts(30,29): error TS2559: Type '{ provide: typeof TranslateLoader; deps: typeof Http[]; useFactory: (http: Http) => TranslateHttp...' has no properties in common with type 'TranslateModuleConfig'. [0] app\modules\sample\effects\sample.effect.ts(20,41): error TS2684: The 'this' context of type 'Actions' is not assignable to method's 'this' of type 'Observable'. [0] Types of property 'lift' are incompatible. [0] Type '(operator: Operator<any, Action>) => Observable' is not assignable to type '(operator: Operator<any, R>) => Observable'. [0] Types of parameters 'operator' and 'operator' are incompatible. [0] Type 'Operator<any, R>' is not assignable to type 'Operator<any, Action>'. [0] Type 'R' is not assignable to type 'Action'. [0] app\modules\sample\effects\sample.effect.ts(31,40): error TS2684: The 'this' context of type 'Actions' is not assignable to method's 'this' of type 'Observable'. [0] C:/test/asa/nativescript/node_modules/@ngrx/effects/src/actions.d.ts(4,22): error TS2415: Class 'Actions' incorrectly extends base class 'Observable'. [0] Types of property 'lift' are incompatible. [0] Type '(operator: Operator<any, Action>) => Observable' is not assignable to type '(operator: Operator<Action, R>) => Observable'. [0] Types of parameters 'operator' and 'operator' are incompatible. [0] Type 'Operator<Action, R>' is not assignable to type 'Operator<any, Action>'. [0] Type 'R' is not assignable to type 'Action'. [0] C:/test/asa/nativescript/node_modules/rxjs/Subject.d.ts(16,22): error TS2415: Class 'Subject' incorrectly extends base class 'Observable'. [0] Types of property 'lift' are incompatible. [0] Type '(operator: Operator<T, R>) => Observable' is not assignable to type '(operator: Operator<T, R>) => Observable'. [0] Type 'Observable' is not assignable to type 'Observable'. [0] Type 'T' is not assignable to type 'R'. [0] C:/test/asa/nativescript/node_modules/tns-core-modules/ui/core/properties/properties.d.ts(48,14): error TS2559: Type 'Property<T, U>' has no properties in common with type 'TypedPropertyDescriptor'. [0] C:/test/asa/nativescript/node_modules/tns-core-modules/ui/core/properties/properties.d.ts(59,14): error TS2559: Type 'CoercibleProperty<T, U>' has no properties in common with type 'TypedPropertyDescriptor'. [0] app\modules\i18n\effects\multilingual.effect.ts(18,43): error TS2684: The 'this' context of type 'Actions' is not assignable to method's 'this' of type 'Observable'. [0] app\modules\i18n\multilingual.module.ts(30,29): error TS2559: Type '{ provide: typeof TranslateLoader; deps: typeof Http[]; useFactory: (http: Http) => TranslateHttp...' has no properties in common with type 'TranslateModuleConfig'. [0] app\modules\sample\effects\sample.effect.ts(20,41): error TS2684: The 'this' context of type 'Actions' is not assignable to method's 'this' of type 'Observable'. [0] Types of property 'lift' are incompatible. [0] Type '(operator: Operator<any, Action>) => Observable' is not assignable to type '(operator: Operator<any, R>) => Observable'. [0] Types of parameters 'operator' and 'operator' are incompatible. [0] Type 'Operator<any, R>' is not assignable to type 'Operator<any, Action>'. [0] Type 'R' is not assignable to type 'Action'. [0] app\modules\sample\effects\sample.effect.ts(31,40): error TS2684: The 'this' context of type 'Actions' is not assignable to method's 'this' of type 'Observable'.

psmontte commented 7 years ago

My Environment:

  • Windows 10

  • node 6.11.0

  • npm 5.0.4

Installed Latest commit 2b4d827. Error Details (npm start & npm run start.android) C:/test/asa/nativescript/node_modules/@ngrx/effects/src/actions.d.ts(4,22): error TS2415: Class 'Actions' incorrectly extends base class 'Observable'. Types of property 'lift' are incompatible. Type '(operator: Operator<any, Action>) => Observable' is not assignable to type '(operator: Operator<Action, R>) => Observable'. Types of parameters 'operator' and 'operator' are incompatible. Type 'Operator<Action, R>' is not assignable to type 'Operator<any, Action>'. Type 'R' is not assignable to type 'Action'. C:/test/asa/nativescript/node_modules/rxjs/Subject.d.ts(16,22): error TS2415: Class 'Subject' incorrectly extends base class 'Observable'. Types of property 'lift' are incompatible. Type '(operator: Operator<T, R>) => Observable' is not assignable to type '(operator: Operator<T, R>) => Observable'. Type 'Observable' is not assignable to type 'Observable'. Type 'T' is not assignable to type 'R'. C:/test/asa/nativescript/node_modules/tns-core-modules/ui/core/properties/properties.d.ts(48,14): error TS2559: Type 'Property<T, U>' has no properties in common with type 'TypedPropertyDescriptor'. C:/test/asa/nativescript/node_modules/tns-core-modules/ui/core/properties/properties.d.ts(59,14): error TS2559: Type 'CoercibleProperty<T, U>' has no properties in common with type 'TypedPropertyDescriptor'. app\modules\i18n\effects\multilingual.effect.ts(18,43): error TS2684: The 'this' context of type 'Actions' is not assignable to method's 'this' of type 'Observable'. app\modules\i18n\multilingual.module.ts(30,29): error TS2559: Type '{ provide: typeof TranslateLoader; deps: typeof Http[]; useFactory: (http: Http) => TranslateHttp...' has no properties in common with type 'TranslateModuleConfig'. app\modules\sample\effects\sample.effect.ts(20,41): error TS2684: The 'this' context of type 'Actions' is not assignable to method's 'this' of type 'Observable'. Types of property 'lift' are incompatible. Type '(operator: Operator<any, Action>) => Observable' is not assignable to type '(operator: Operator<any, R>) => Observable'. Types of parameters 'operator' and 'operator' are incompatible. Type 'Operator<any, R>' is not assignable to type 'Operator<any, Action>'. Type 'R' is not assignable to type 'Action'. app\modules\sample\effects\sample.effect.ts(31,40): error TS2684: The 'this' context of type 'Actions' is not assignable to method's 'this' of type 'Observable'. C:/test/asa/nativescript/node_modules/@ngrx/effects/src/actions.d.ts(4,22): error TS2415: Class 'Actions' incorrectly extends base class 'Observable'. Types of property 'lift' are incompatible. Type '(operator: Operator<any, Action>) => Observable' is not assignable to type '(operator: Operator<Action, R>) => Observable'. Types of parameters 'operator' and 'operator' are incompatible. Type 'Operator<Action, R>' is not assignable to type 'Operator<any, Action>'. Type 'R' is not assignable to type 'Action'. C:/test/asa/nativescript/node_modules/rxjs/Subject.d.ts(16,22): error TS2415: Class 'Subject' incorrectly extends base class 'Observable'. Types of property 'lift' are incompatible. Type '(operator: Operator<T, R>) => Observable' is not assignable to type '(operator: Operator<T, R>) => Observable'. Type 'Observable' is not assignable to type 'Observable'. Type 'T' is not assignable to type 'R'. C:/test/asa/nativescript/node_modules/tns-core-modules/ui/core/properties/properties.d.ts(48,14): error TS2559: Type 'Property<T, U>' has no properties in common with type 'TypedPropertyDescriptor'. C:/test/asa/nativescript/node_modules/tns-core-modules/ui/core/properties/properties.d.ts(59,14): error TS2559: Type 'CoercibleProperty<T, U>' has no properties in common with type 'TypedPropertyDescriptor'. app\modules\i18n\effects\multilingual.effect.ts(18,43): error TS2684: The 'this' context of type 'Actions' is not assignable to method's 'this' of type 'Observable'. app\modules\i18n\multilingual.module.ts(30,29): error TS2559: Type '{ provide: typeof TranslateLoader; deps: typeof Http[]; useFactory: (http: Http) => TranslateHttp...' has no properties in common with type 'TranslateModuleConfig'. app\modules\sample\effects\sample.effect.ts(20,41): error TS2684: The 'this' context of type 'Actions' is not assignable to method's 'this' of type 'Observable'. Types of property 'lift' are incompatible. Type '(operator: Operator<any, Action>) => Observable' is not assignable to type '(operator: Operator<any, R>) => Observable'. Types of parameters 'operator' and 'operator' are incompatible. Type 'Operator<any, R>' is not assignable to type 'Operator<any, Action>'. Type 'R' is not assignable to type 'Action'. app\modules\sample\effects\sample.effect.ts(31,40): error TS2684: The 'this' context of type 'Actions' is not assignable to method's 'this' of type 'Observable'.

fourctv commented 7 years ago

same here, rolled back to 2.34 and everything is back in place.

2.4.1 seems to more restrict and thus causes syntax errors on some components, including some node_modules.

It did catch some errors on my code, which I fixed, but fixing someone else's imported code would cause a lot of issues, so for now, rolling back to 2.3.4 till those modules get updated/fixed.