ui-router/core

Typescript error: 'onChange' in type 'BaseLocationServices' is not assignable to the same property in base type 'LocationServices'

sebastianhaeni opened this issue · 8 comments

Since version 5.0.21 I'm getting the following TypeScript error when compiling:

node_modules/@uirouter/core/lib/vanilla/baseLocationService.d.ts:43:5 - error TS2416: Property 'onChange' in type 'BaseLocationServices' is not assignable to the same property in base type 'LocationServices'.
  Type '(cb: EventListener) => () => Function[]' is not assignable to type '(callback: Function) => Function'.
    Types of parameters 'cb' and 'callback' are incompatible.
      Type 'Function' is not assignable to type 'EventListener'.
        Type 'Function' provides no match for the signature '(evt: Event): void'.

43:     onChange(cb: EventListener): () => Function[];
        ~~~~~~~~

Is there something wrong with my configuration or my imports? It worked with 5.0.20.

Seems like the change was made in 095f531 .

I am using angular-hybrid 6.0.2and getting the same error:

ERROR in node_modules/@uirouter/core/lib/vanilla/baseLocationService.d.ts(43,5): error TS2416: Property 'onChange' in type 'BaseLocationServices' is not assignable to the same property in base type 'LocationServices'.
  Type '(cb: EventListener) => () => Function[]' is not assignable to type '(callback: Function) => Function'.
    Types of parameters 'cb' and 'callback' are incompatible.
      Type 'Function' is not assignable to type 'EventListener'.
        Type 'Function' provides no match for the signature '(evt: Event): void'.

This module uses the same core version 5.0.21.

Same here with "@uirouter/angular-hybrid": "^6.0.2"

Ugh.. I assumed this would be fixed in 5.0.22

yikes, that change set was marked as "(docs)", but was NOT just docs. It changed code

How do I reproduce this typescript error?

edit: downstream project using "strict": true in tsconfig.json, thanks tommck for the details on gitter