Skip to content Skip to sidebar Skip to footer

How To Extend Js Class From Outside Library In Typescript / Using Mojs In Typescript

i know how to declare library ( example usage mojs): declare var mojs:any; but i have problem with extending from it: class MyObject extends mojs.CustomShape { getShape () {

Solution 1:

Ok, i managed this by setting type as ObjectConstructor

My code for mojs:

declarevarmojs: {
    CustomShape:ObjectConstructor, //here usageaddShape:any,
    Burst:any,
    Timeline:any,
    Shape:any,
    ShapeSwirl:any
};

So with ObjectConstructor i can extend this class without errors like:

classMyObjectextendsmojs.CustomShape {
   getShape () {
    return'..path'
   }
 };

Post a Comment for "How To Extend Js Class From Outside Library In Typescript / Using Mojs In Typescript"