How do I import a .ts file so it can...

Not favoritedFavorited Favorited 0 favourites
  • 5 posts
From the Asset Store
Convert multiple Excel files into JSON files and import them into construct3.
  • ...be used in the event sheets? I've looked at the tutorials and even downloaded the sample. In the sample it looks easy (it uses .js) but is it a .ts thing?

    I set the .ts script to be the Import for events, then I do a 'import * as Blah from './myTSfile.js'. And none of the Blah.functions are available in the event sheets. I've check the syntax and the 'export function blahBlah() : string...it's all TS and it's right. But nothing is available. Wasting way too much time on this. Any ideas?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok so I guess this is a known problem. When you make a small change in a .ts file and save, it doesn't run the tsc most of the time? Man, this is heart-breaking. I'm knee deep in TS and making multiple changes constantly, but I can't force a TS re-compile. I mean...damn...

  • It works fine for me - here's a sample project showing it working as described. As ever if you share a project we can see what you actually did which makes it much easier to help.

  • Hi Ashley. I did some more testing and what I believe is that changing something in a .ts file and previewing/saving does trigger a tsc event. But...if you have a TS block in the event sheet and make a change there, it doesn't trigger a tsc event reliably. In order for a change in a TS block in an event sheet to recompile, I had to reload the project entirely.

    Also, try this:

    Import a function such as import { myFunc } from blah. Then use it in the event sheet in a TS block. Good it works. Now change the function name to myFunc1, and import myFunc1, and change it on the event sheet to myFunc1, and the event sheet will throw an error and say did you mean myFunc? Because the tsc didn't fire off for the script block in the event sheet I'm guessing.

    Maybe there's a tsc setting somewhere that automatically forces a compile when any TS file/script bloc in the event sheet is changed on each preview or save that I'm missing?

    For now, when I get an error caused by the tsc not firing when a TS block is changed in an event sheet (I really think that's what going on here), I'm just reloading the entire project so I can keep going.

  • But...if you have a TS block in the event sheet and make a change there, it doesn't trigger a tsc event reliably. In order for a change in a TS block in an event sheet to recompile, I had to reload the project entirely.

    Again, this seems to be working fine for me. If I change the console.log message in the provided project to "foo", preview, then change to "bar", preview, then change to "baz", and preview, every time it updates correctly. Currently Construct just compiles everything in the project on every preview, so nothing should ever be out of date. If you still think Construct has some bug with this then please file an issue following all the guidelines and in particular providing precise steps to follow that reliably demonstrate the problem.

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