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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion: Add typescript types to package #191
Comments
I think this sounds good. We will probably want to ask DefinitelyTyped to deprecate the |
Some thoughts on this following a recent change in library name: #271 (comment) |
Thx to @kachkaev for pointing out that since we resolved #271 by changing our package name to Personally I would favour to generate the type definitions from our source, even if they are not yet ideal. Since we currently do not have any build pipeline, I think we should commit the generated types to version control. I think a single generated file should be good enough since it should only make the public interface available. I have been experimenting with testing type definitions in the past, but I'm not very experienced. Any support is welcome. |
@karfau I agree with you that providing the typings from source is the best solution. It minimizes the probability of discrepancies between the declarations and the implementation. It might take some time to setup though depending on the current state of the codebase, leaving folks with no typings for some time. If you generally support the migration of typings into the library, how about doing this in two steps?
Happy to help with 1 at least. |
An alternative idea could be to first add the types and then add a typecheck step to verify the consistency. This could help us avoid the complexities and limitations of adding a build pipeline, making it easier to install directly from GitHub, for example. By "typecheck step" it should be possible to use the TypeScript compiler to check consistency between types in the DTS and types in our JavaScript code with help from JSDoc comments, like I started contributing to Prettier. |
I disagree that we need to change how the lib s build to generate types (step 2): They can also be generated from JS files. The types that are currently in DefinitlyTyped have a really bad issue DefinitelyTyped/DefinitelyTyped#49953 I would actually prefer to at least try to generate the types from our existing sources, But of course such a step can also break build pipelines, so I agree that step 1 makes sense to fix the regression for now and basically "own the typing issues" by moving them into this repo. PR for step one is very welcome. |
👀 #283 |
I see that @kachkaev beat me to it, but I was presisely going to do that :) thanks! @karfau The sooner that 0.7.1 version can be published, the better (master as is looks perfect) so downstream TS projects can do the security update without losing the types (for example https://github.com/node-saml/node-saml/). Thanks again for everything! |
@forty in the meantime, you can add |
Seems like this issue can be closed since the original stated request ("Add typescript types to package") has been completed and released in v0.7.1? |
I think you can close this issue and track follow up work in separate issues |
It looks to me like this: the original task in the title "Add typescript types to package" is done ... but from discussions it looks like we have a couple of loose ends:
I would personally favor closing this and continuing with new issues as needed. Or is there anything else that should be discussed here? |
There are some issues with the typescript types provided by
@types/xmldom
, that are hard to resolve, since they rely on the DOM types provided by typescript:DefinitelyTyped/DefinitelyTyped#49953
I think the easiest way to resolve that issue and maintain the types is to add doc comments to the code in
lib
and generate the types from it.The main advantage is also that the types don't claim to support APIs that it actually doesn't support, which currently would lead to a runtime error.
The text was updated successfully, but these errors were encountered: