Using TypeScript in Construct

You're viewing a single comment in a conversation. View all the comments
  • 2 Comments

  • Order by
  • Is it possible to make Construct to allow me to write imports like:

    import Globals from "./globals"

    instead of:

    import Globals from "./globals.js";

    without .js at the end.

    When I'm working on TypeScript projects all imports usually omit file extension. This is a bit anoying to manualy change it all the time. I'll see if I can configure my IDE to add .js at the end. But I've been working more than 5 years with TypeScript and never ever I've added any extensions in the imports. Also IDE auto insert imports, and they don't have extensions

      • [-] [+]
      • 2
      • Ashley's avatar
      • Ashley
      • Construct Team Founder
      • 2 points
      • (0 children)

      TypeScript needs to generate JavaScript that refers to a filename like "./globals.js", because that's how it works in the browser. You can configure TypeScript however you like, so long as it outputs that. I think I saw that TypeScript 5.7 is going to be adding some new options around this.