-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature request: generate to JavaScript with JSDoc types #39
Comments
Hey @croconut ! Thanks for creating the issues. I guess this is the first one you want to target. What exactly do you want to do here? a) generate js code that uses typebox (my assumption based on issue body) Or perhaps something completely different..? Anyway, I would be down to have either of this added. Do you have any initial ideas for implementing it? I will state my thoughts as well once I know what the goal will be. |
Thanks for writing this library! :) So I'm looking for a js file that uses jsdoc annotated types. It looks something like the below to define a TS type with JSDocs. /** @typedef {import('@sinclair/typebox').Static<typeof T>} TType */ |
I would need a different name for the schema's type when using this from commonjs afaict, so right now I'm using TType in my codebase. |
Alright. I hope I did now understand what the goal is. To generate a .js file with the typebox code which contains jsdoc comments of the types when the value given for the "output" argument of the cli has a javascripty file ending. Correct? If you want feedback on your approach let me know on a high level how you want to go at this. Otherwise, feel free to get going and submit a PR : ) Just a thought I had on this now (might be bad or wrong): A decent strategy could even be to "postprocess" the generated typescript code. If I am seeing it correctly, all stuff like |
LGTM, although you'd also need to remove type imports |
Hey @croconut , just wondering, are there any updates on this? I did assume you will give this a shot and send a PR for this. Is this assumption correct? |
Oh lol sure |
Library version:
1.7.1
JSON schema version: draft-04
I am willing to contribute to fix the issue 馃挌
The current behavior
Generates to typescript.
The expected behavior
Identify the syntax to use based on the output file extension when writing. -> .cjs & .mjs & .js would be javascript compliant code, while ts would be typescript.
The text was updated successfully, but these errors were encountered: