dojo / typings

Dojo 1 - TypeScript Typings (including Dijit and DojoX)
Other
28 stars 37 forks source link

Incorrect declare typings #168

Closed rorticus closed 4 years ago

rorticus commented 4 years ago

The declare typings are not applying DeclareCreatedObject to the props object in the declare method. This means that you can't use this.inherited from inside a function passed into declare.

See the following example,

https://codesandbox.io/s/cool-galileo-sv5n3?file=/src/index.ts

It seems like it would be enough to add DeclareCreatedObject to the ThisType for each relevant entry in the Declare interface.

i.e.,

<A, B>(superClass: DeclareConstructor<A> | [DeclareConstructor<A>], props: B & ThisType<DeclareCreatedObject & A & B>): DeclareConstructor<A & B>;