englercj / tsd-jsdoc

Compiles JSDoc annotated JavaScript into a Typescript Definition file (.d.ts)
MIT License
316 stars 42 forks source link

#106 adds support for @external keyword #107

Open jamiehowarth0 opened 5 years ago

englercj commented 4 years ago

I think this will allow code that uses @external to successfully parse, but the typescript it outputs will be incorrect and potentially disruptive when used in other projects.

For example, this makes @external jQuery generate declare class jQuery {}. If someone includes a def file for jQuery, it will also have declare class jQuery {} which I think will cause an error.

This is why I mention in the readme that I'm not sure what the right behavior for this tag is, and therefore left it unimplemented. I think the only "correct" thing it could do would be to import the external and use the definitions defined elsewhere by the import. However, I don't even think that works for all environments people use this in.