johnfn / ts2gd

💥 Compile TypeScript to GDScript for Godot
200 stars 14 forks source link

ts2gd.json json schema #63

Open ksjogo opened 2 years ago

ksjogo commented 2 years ago

The config file is/might be growing. Having a JSON could help to reduce user errors. We could define it in TS and use it and then generate the schema with https://github.com/YousefED/typescript-json-schema

johnfn commented 2 years ago

Yeah, I like this idea. But might that be overkill? E.g. we could just codegen ts2gd.json instead as ts2gd.ts and do something like this:

import Ts2GdConfig from "@ts2gd/config"

export const config: Ts2GdConfig = {
    destination: "path",
   source: "other path",
}

And then we could just define a simple Ts2GdConfig type in TS, and then the errors would be obvious in the user's IDE, without even checking ts2gd output.

I'm not sure why TS doesn't do something like this, come to think of it.