Add TypeScript types and maybe publish to NPM. #3

Open
opened 2025-08-05 20:41:41 +08:00 by ajh123 · 2 comments
ajh123 commented 2025-08-05 20:41:41 +08:00 (Migrated from github.com)

Some Lua / CC projects makes use TypeScript rather then regular Lua but it gets traspiled to regular Lua using TypeScriptToLua. They do this for a better IDE experience and to use advance fetures like classes (which Lua does not nativly support without hacks).

It is possibile to import regular Lua files in such an envrionment however the IDE will complain about missing type definitions.

Whilst it is possible for the project to make their own type defitions for Basalt - it would be better if Basalt came with their own.

Furthermore, you can publish Basalt to NPM (which publishing Lua scripts is allowed) to make it easier for TSTL based projects to use.

You don't have to replace your existing Lua files with TypeScript - we just need type declaration files - actually you just need one basalt.d.ts file inside your release folder.

Some Lua / CC projects makes use TypeScript rather then regular Lua but it gets traspiled to regular Lua using TypeScriptToLua. They do this for a better IDE experience and to use advance fetures like classes (which Lua does not nativly support without hacks). It is [possibile to import](https://typescripttolua.github.io/docs/external-code#importing-lua-packages-from-npm) regular Lua files in such an envrionment however the IDE will complain about missing type definitions. Whilst it is possible for the project to [make their own type defitions](https://typescripttolua.github.io/docs/advanced/writing-declarations/) for Basalt - it would be better if Basalt came with their own. Furthermore, you can publish Basalt to NPM (which publishing Lua scripts is allowed) to make it easier for TSTL based projects to use. You don't have to replace your existing Lua files with TypeScript - we just need type declaration files - actually you just need one `basalt.d.ts` file inside your `release` folder.
SirEdvin commented 2025-09-28 15:49:40 +08:00 (Migrated from github.com)

I would double this, having typescript mappings would be very cool

I would double this, having typescript mappings would be very cool
SirEdvin commented 2025-11-02 04:03:47 +08:00 (Migrated from github.com)

For anyone intersected, here is my version of mappings. It is not complete by any means, because it covers only things that I used, but it is usable to some extent.

For anyone intersected, here is [my](https://gitlab.com/SirEdvin/dark-toolkit-2/-/blob/master/libs/basalt-ts/index.d.ts?ref_type=heads) version of mappings. It is not complete by any means, because it covers only things that I used, but it is usable to some extent.
Sign in to join this conversation.
No description provided.