xddq / ts2typebox

Creating TypeBox code from Typescript types
MIT License
43 stars 3 forks source link

.d.ts file parsing failed #22

Closed ExpandOcean closed 1 year ago

ExpandOcean commented 1 year ago

Hi, first of all, thanks for your work. It appears that the present version of ts2typebox cannot parse.d.ts (lib.es5.d.ts for example). Will this be supported in the future?

ts2typebox --input lib.es5.d.ts Unhandled: FirstStatement declare var NaN: number; Unhandled: FirstStatement declare var Infinity: number; Unhandled: ConstructSignature new(value?: any): Object; ...

xddq commented 1 year ago

@ExpandOcean Hey!

Interesting. There was no support planned, but getting it to work with declare, such as declare var NaN: number; should be somewhat straight forward.

What is your concrete use case and which problem do you want to have solved?

I think all you need to do is enter the relevant content of your d.ts file into ts-ast-viewer and then add a new case inside typescript-to-typebox, somewhere here.

Feel free to tackle this issue (if you want). Please just let me know that you work on it so there won't be any duplicated work. And please don't forget to add test cases for the new feature. For me personally, I currently have other higher priorities and will not work on this for the next 2-3 weeks.

I will still react to discussions/issues/prs whatever somewhat timely and could merge and release as well.

Hope this helps!

xddq commented 1 year ago

@ExpandOcean Closing since there was no response/demand. Codegen moved to https://github.com/sinclairzx81/typebox-codegen in case you want to bring this up again.