Use Typescript ?

1 favourites
  • 12 posts
  • Can Typescript be used with this engine or is it Javascript only? I searched the forums but am still not sure.

  • Please disregard. I did find the answer in the forum. Looks like javascript only. Thank you.

  • Check out any tutorial on how to configure TypeScript + Webpack. Create one empty script file in Construct 3, save the project as a folder, and make Webpack build a bundle along the path of this script, and that's it. Yes, you will have to click "Update scripts from folder" every time you change your scripts, but this is not such a problem. I've been doing this for months. Now the project is 5K lines in TypeScript. I feel pretty good.

    The webpack also allows you to use NPM packages without any problems.

  • Hey Ancient Newbie,

    I just created a feature request for TypeScript: construct3.ideas.aha.io/ideas/C3-I-1628

    nerdError That's what I have been doing too; Nevertheless, an official support for it would be nice.

  • nerdError I have yet another suggestion (sorry for spamming).

    A keyboard shortcut to reload from folder:

    construct3.ideas.aha.io/ideas/C3-I-1632

    It would be nice to have an option to automatically reload it too.

    imgur.com/a/KJUXsjT

  • Use webpack-dev-server to get auto reload / modules replacment when saving files

  • Use webpack-dev-server to get auto reload / modules replacment when saving files

    Dev-server will re-build your scripts in folder, but Construct 3 anyway wont load those files automatically.

  • Check out any tutorial on how to configure TypeScript + Webpack. Create one empty script file in Construct 3, save the project as a folder, and make Webpack build a bundle along the path of this script, and that's it. Yes, you will have to click "Update scripts from folder" every time you change your scripts, but this is not such a problem. I've been doing this for months. Now the project is 5K lines in TypeScript. I feel pretty good.

    The webpack also allows you to use NPM packages without any problems.

    Super old topic, but did you write TS definition files for Construct's builtin types?

    Somewhat related, has anyone written extensions for VS Code, Sublime, or any other external IDE that supports autocomplete for Construct?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • nerdError I have yet another suggestion (sorry for spamming).

    A keyboard shortcut to reload from folder:

    https://construct3.ideas.aha.io/ideas/C3-I-1632

    It would be nice to have an option to automatically reload it too.

    https://imgur.com/a/KJUXsjT

    Hello. is there an extension for VS Code, tell me

  • vmwxiong I couldn't find an stable up-to-date definition online. So I'm writing it myself.

    I'm following the scripting reference docs to write only what I needed.

    Here is what I have so far: gist.github.com/Zizaco/ad7b380d228f89ce5ba13693a2cc9505

    arturradukevic453 I don't think so. But as said on the topic, all you have to do is compile TS into the scripts folder and them use the hotkey that was added by construct team: construct3.ideas.aha.io/ideas/C3-I-1632

  • Zizaco Unfortunate to hear, but really cool to see your WIP version. Are you planning on keeping it around in an open repo somewhere? Would love to continue to see it as it gets updated.

  • I'm tring to use typescript, but I have one problem.

    Lets say I have an init function that has to be called from construct event sheets.

    Do I have to declare then in globalThis?

    When webpack compiles the script, if I try to call the init function I receive init is not defined error.

    Thanks

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