GlassBricks / typed-factorio

Complete and featureful Typescript defintions for the Factorio modding API
MIT License
33 stars 3 forks source link

Add `types` declaration to package.json #6

Closed aSemy closed 2 years ago

aSemy commented 2 years ago

I wanted to try and use another tool to utilise the typed-factorio .d.ts files, but this requires that package.json has a types (or typings) field defined.

For example, TypeScriptToLua's package.json has:

    "types": "dist/index.d.ts",

The types field requires a single file of all the types. I see there's typed-factorio/runtime/index.d.ts, but as this references files from libraries, this might not be suitable? This task might require a specific index.d.ts file that only references typed-factorio files?

Thanks!

GlassBricks commented 2 years ago

I think the types field is meant to provide types if you have a javascript npm package (with a main.js), so typescript knows about the types when you import "package". typed-factorio has no executable files, so types wouldn't be appropriate.

Out of curiosity, what tool are you trying to use? There might be another way to specify types.

aSemy commented 2 years ago

I wanted to try Dukat, along with Gradle https://github.com/Kotlin/dukat. I've managed to manually specify the typed-factorio .d.ts files before, but it's automatic if package.json has types defined :)

GlassBricks commented 2 years ago

A kotlin-typescript-lua pipeline? interesting...

I'm not sure dukat currently supports "global" declarations as typed-factorio does, however we can try it anyways. I've just released version 0.11.0-packagetypes-1 which adds the types field. Let me know how it goes. If it works well I'll add it to the main versions as well.

GlassBricks commented 2 years ago

Closing due to inactivity.

If the experiment above shows promise, I'll reopen this issue.