javascript - How to extend js class from outside library in TypeScript / Using mojs in TypeScript -


i know how declare library ( example usage mojs):

declare var mojs:any; 

but have problem extending it:

class myobject extends mojs.customshape {     getshape () {       return '..path'     }   }; 

i error:

type 'any' not constructor object type

i tried this:

declare var mojs:object{   customshape:any }; 

but no luck - wrong code.

so how can extend js library class in typescript?

ok, managed setting type objectconstructor

my code mojs:

declare var mojs: {     customshape:objectconstructor, //here usage     addshape:any,     burst:any,     timeline:any,     shape:any,     shapeswirl:any }; 

so objectconstructor can extend class without errors like:

 class myobject extends mojs.customshape {    getshape () {     return '..path'    }  }; 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -