With salsa provides typings support to javascript files, is there a way on the cli to use salsa to get a list of warning as in the language service?
If we can, we can use it to much quicker validate typings for typings authors by re-using test code available in the source package.
This could have a significant impact on typescript adoption considering this use case:
.d.ts file.Using this feature, package author can still write code in js and easily verify if their typings need to be updated.
:rose:
cc @blakeembrey
A related work to this thread is a paper for Checking Correctness of
TypeScript Interfaces for JavaScript Libraries.
We now have the checkjs option for now which allows for validating types in JavaScript as specified by JsDoc comments and basic inference. No plans to add any type of dynamic/runtime verification at this point, so closing this issue.
@billti Maybe I missed it. Where are the docs / usage for this feature? Thanks!
There's a page at https://github.com/Microsoft/TypeScript/wiki/Type-Checking-JavaScript-Files which might be the best reference.
However, that doesn't help typings authors to validate their typings. :(
No plans to add any type of dynamic/runtime verification at this point, so closing this issue.
It is not about dynamic/runtime verification. Just need the same language service support to be available during compilation.
Yes! As an example of why this is necessary, see this PR that never landed: https://github.com/tapjs/node-tap/pull/256#issuecomment-228276649
Also see a longer response why it never landed: https://github.com/tapjs/node-tap/issues/237#issuecomment-299992415
The reason is that the author has no way to test the typings that would be shipped with node-tap.
A note about the tapjs issue; if the author of the package is not maintaining the .d.ts file DefinitelyTyped is a better place. the ideal case is that the .js file and .d.ts ship in tandem, and that changes in one are reflected in the other, but that again requires some cooperation from the package maintainers, and not everyone is willing to make such commitments.
It would be great if we have a random js file and we can validate it conforms to a .d.ts file; it would also be helpful to have a tool that given a validated pair of .js and .d.ts, and an update to the .js file, would tell you what, if any, declarations need to be updated. These were the topics of a research paper i linked to erlier.
We do not believe the general solution is feasible just using static analysis, and some execution will be needed. For that we believe this is outside the scope of the TS project, but can be a target of community tooling. we have similar tools in dts-gen that use execution to generate a .d.ts file.
Most helpful comment
This could have a significant impact on typescript adoption considering this use case:
Help package author to maintain their own
.d.tsfile.Using this feature, package author can still write code in js and easily verify if their typings need to be updated.
:rose:
cc @blakeembrey