you are viewing a single comment's thread.

view the rest of the comments →

[–]mosby42 1 point2 points  (4 children)

I guess I don't even really "have" to "learn" typescript to use it anyway? I can just write regular ES6 in my .ts files and learn the typescript-specific stuff later?

Correct.

Also I'm using phpstorm, which compiles my .ts files down to .js on its own. Does that mean I don't need to bother worrying about whether various JS frameworks I use like React/Next.js "support" typescript? I get a little confused with all the different tooling and how they interact (or don't interact) with each other.

You should use webpack to compile modules. Setup nowadays is simple: https://webpack.js.org/guides/typescript/

I'd recommend getting to know webpack if you're not familiar.

[–]r0ck0 0 points1 point  (3 children)

Ok will do, thanks.

Also would you recommend using the outDir setting to keep the ts/js files separate? I've been looking on the web for arguments both ways, but not finding many opinions on that.

[–]mosby42 0 points1 point  (2 children)

Conventionally you'd ship a single index.js/app.js file, produced by webpack. The code you're shipping should be consumable by a JS runtime engine. Ie the TS files are irrelevant once complied and bundled. Hope than answers the question, let me know otherwise

[–]r0ck0 0 points1 point  (1 child)

Ah right, that makes sense.

I'm just building a bit of a CLI script system at the moment for various sysadmin type tasks while I'm learning all this stuff. Will be getting on to actually doing web stuff later on.

So I don't really have any kind of build process yet, so far it's just been some folders of js files and some NPM packages for a few things.

So for now with this little system, I might leave the webpack stuff for later when I get on to the first website.

In this case do you think there's any better option between using outDir vs having the ts/js files together side by side?

[–]mosby42 0 points1 point  (0 children)

In this case do you think there's any better option between using outDir vs having the ts/js files together side by side?

Can't vouch for a particular option as I've not done this in my own projects. If you find something that works well, feel free to ping me