tscc
tscc copied to clipboard
Using TSCC As an Externs Generator
I'd like to use tscc tp generate some externs files from d.ts files, similar to what's found on the closure externs repo, using definitely typed as input. Do you think that's viable? If so, do you have some pointers on how to achieve that? Thanks!
Most of existing d.ts files are module, not script s. tsickle generate correct externs for script d.ts files, but currently there are several bugs in tsickle regarding generation of externs from module d.ts files, such as https://github.com/angular/tsickle/issues/1202 https://github.com/angular/tsickle/issues/1135 https://github.com/angular/tsickle/issues/1203.
Also, there are always typescript types that cannot be translated to closure types.
Viability would depend on your goal -- if you are trying to generate correct externs, tsickle is still incomplete in several aspects. If the generated externs just need to work with closure compiler, I'd say it is viable (except for export *
in module d.ts.), because minor issues with generated externs don't affect compilation much, and you can workaround minor type incompatibility issues by carefully typing things.
I have submitted several PRs to the upstream tsickle repository to fix above issues, but after some time they all stalled with no further response from tsickle devs.