Construct 3 suggestions & ideas

Suggest and vote on ideas for Construct 3! Please note this is only one aspect of planning. We do not guarantee any features here will be implemented, even if they are top-voted ideas. The aim is just to collect feedback. Remember to search for existing submissions before adding an idea, describe your ideas as comprehensively as possible, and vote for plausible ideas that are well thought out. Please see our full guidelines on suggesting features.

21 Vote

TypeScript support

Add official TypeScript support.

I love Construct and came back to it not so long ago since the addition of scripting support. Actually, now that R226 introduced modules, it's on par with the big serious engines on the market.

Construct scripting support is exceptional since it uses JavaScript, an established programming language (a huge advantage over gamemaker's gml).

But then, there is TypeScript.

TypeScript is becoming more and more popular and Construct can really float on this boat among people that are more experienced in programming (you could have a landing page targeted to "web developers").

See: https://insights.stackoverflow.com/survey/2020#technology-most-loved-dreaded-and-wanted-languages-loved

I'm personally among the developers that were wrong about TypeScript (and ditched it for a long time) and now see how useful (and attractive) the language really is for developers and teams. There is a huge trend of typescript adoption among game and web frameworks too.

Also, it wouldn't be too complicated to support TypeScript as Construct's API surface is not that huge and the internals can still be written in plain JavaScript. The real deal (and effort) would be to have a built-in ts compiler.

  • Zzk
  • Nov 26 2020
  • Declined
  • Attach files
  • Admin
    Ashley Gullen commented
    6 Jan 12:35pm

    This has become confusing: the original suggestion says "TypeScript support" and mentions a built-in TS compiler, which to me sounds like writing TypeScript inside Construct instead of JavaScript. But now you say you're just asking for TypeScript definition files. So it seems to me it's no longer clear which of these ideas all these votes have been collected for. I think the best thing to do is close this suggestion and post a new one making it clear what you are really asking for - if necessary, post two suggestions, one for writing TypeScript code in Construct, and another for providing TypeScript definition files for the scripting API.

  • Eugene Degtyar commented
    27 Dec, 2020 05:44am

    I would like to see Typescript definitions files. Is there any?

  • Admin
    Ashley Gullen commented
    3 Dec, 2020 11:59am

    This sounds like a different idea to the one that was posted. The suggestion just says "TypeScript support" which sounds like "Support writing TypeScript in Construct". But your comment seems to say the suggestion is just "Provide TypeScript definition files". Can you edit the original suggestion to clarify what you really mean? It's difficult to evaluate an idea if it's not clear what you're really suggesting.

  • Zzk commented
    3 Dec, 2020 10:08am

    @Ashley you are right re-creating an typescript editor is not what I mean't. I also agree that is better to focus on features that help developers use existing tools.

    By "officially supporting Typescript", I mean that there should be an official guide, type definitions ways to make it easier to use, even if it's via an external editor.

    Here is an example of how this can be approached: DenoJS (which is a javascript runtime, much like NodeJS) have a cli command that exports all it's type definitions (ex: `deno types > typedef.d.ts`). This will output an up-to-date definition file that can be used by any editor.

    Construct could output type definitions according to the objectTypes/*.json behaviors and instance variables so that the following could be statically checked:

    // To have a type definition that will statically know that this is a number
    runtime.objects["MyObject"].getInstanceByUid(uid)?.instVars["health"]
  • Admin
    Ashley Gullen commented
    1 Dec, 2020 05:06pm

    I think integrating the TypeScript compiler would be a medium amount of work, but adding the full editing features - such as autocomplete based on TypeScript's type information - would be a significant amount of work. This would also mean reinventing everything existing TypeScript code editors can do, such as VS Code. Since we're a small team with limited resources, I think it would be better to focus on features that help you use existing tools like VS Code with a folder-based project, such as the keyboard shortcut to reload scripts from the folder (which shipped in r227).

  • Zzk commented
    27 Nov, 2020 05:43pm

    Nevertheless, https://construct3.ideas.aha.io/ideas/C3-I-1632 is more important 😅

  • +14