Typescript def files for addons

0 favourites
  • 2 posts
From the Asset Store
Excel2JSON
$1.20 USD
60% off
Convert multiple Excel files into JSON files and import them into construct3.
  • Ashley

    Looking for some guidance on getting the typescript def files to generate corerctly.

    I am calling this in Behavior.js

    this._info.SetScriptInterfaceNames({ instance: "IAnimatedCounterBehaviorInstance" });

    this._info.SetTypeScriptDefinitionFiles(["c3runtime/IAnimatedCounterBehaviorInstance.d.ts"]);

    In the c3runtime folder I have the d.ts file (IAnimatedCounterBehaviorInstance.d.ts)

    the signature is

    declare class IAnimatedCounterBehaviorInstance<InstType> extends IBehaviorInstance<InstType>

    ... when creating a new typescript project and updating the typescript def files

    I see my d.ts file getting added correctly butwhen i look at the instanceTypes.d.ts

    The type of the instance is not set to my interface but my plugin id

    declare namespace InstanceType { class __TextBehaviors<InstType> { AnimatedCounter: C3.Behaviors.piranha305_animatedcounter.Instance<InstType>; } class Text extends ITextInstance { behaviors: __TextBehaviors<this>; } }

    If I manually change the type it is working perfect.

    class __TextBehaviors<InstType> { AnimatedCounter: IAnimatedCounterBehaviorInstance<InstType>; }

    is there a way to have construct generate the right type? maybe I missed something in the setup?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It should work - it's what the built-in addons do. Can you share a sample addon demonstrating the problem? It would be best to file an issue if it's not working as expected.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)