olegbl / d2rmm

Mod Manager for Diablo II: Resurrected
https://www.nexusmods.com/diablo2resurrected/mods/169
MIT License
54 stars 9 forks source link

[TypeScript] how to load D2RMM as a library? #21

Closed Caedendi closed 1 month ago

Caedendi commented 1 month ago

Is there a way to load D2RMM as a library for a TypeScript-style mod and remove all the errors my IDE gives?

Same question for config/mod.json. Would be great if there was some way for the IDE to recognize mod.json as config, if settings exist and if types match.

olegbl commented 1 month ago

If you author the TS code inside D2RMM/mods, TSC should pick up all the types automatically from types.d.ts.

I'm not aware of anything that does type checking for JSON files.

Caedendi commented 1 month ago

~How do I do that? I'm a complete TS noob~

Nvm I get it now: open the D2RMM folder itself in the IDE.

So I understand there's currently no way to do this when developing from another folder, is that something that can be added in the future or is that too complex?

olegbl commented 1 month ago

You should be able to copy/paste the types.d.ts file from the D2RMM folder to any other folder of your choosing and get type checking and auto completion.