-
Notifications
You must be signed in to change notification settings - Fork 79
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
Typescript type errors #167
Comments
Is this related to latest TS release? AFAIK many use this project with TS and few PRs landed already and they were happy. About design decisions if we’re talking TSDoc better hints and types I’d be more than happy to improve but if it means code needs to change to reflect 1:1 DOM API that might be out of this project scope and we should find a better way to tell TS to not bother there. Hope this makes sense. |
Thanks for the reply, yeah this is the latest ts version. The current types are great as far as working with the library in TS goes, the The design decision I wasn't sure about was just why the Thank you for confirming that the goal for the library is not to implement a 1:1 DOM API. I will go ahead with making a PR. |
@jeremy-rifkin are you going to update the PR? |
Is there any update on this? I'm trying to test linkedom as a replacement for JSDOM in an existing typescript project but I'm getting lots of type errors on build. Hitting a wall. |
I don't use TS and can't care less about it, simply because it produces JS so it's TS that should work, not JS that already does ... that being said, because I don't use TS, any PR is welcome here to fix whatever TS problem you have 👋 |
@regexj there's not much to thumb down in there ... this project is 100% tested, code covered, and downloaded 100K+ times per month, fueling Cloudflare Workers and much more ... do you realize the issue is not the code here, but your configuration? All TS hints have been mostly PRs because this modules is a JS one and it uses JSDoc with TS hints to help people like you ... moaning about TS issues without filing a PR is not much thumb up to me, sorry. |
The thumbs down is to your attitude. I don't have time to get your library working in my TS environment. It's a shame, I wanted to give it a go as it sounded promising, but there are other JSDOM replacements to try. Good luck and hopefully you can get a contributor to help with your TS issues in the future. |
too bad .. as Open Source should be more pro-activeness and less demanding.
what is a shame is people demanding in Open Source, needing that software to move forward, and complaining without contributing around projects that don't fix automatically stuff for you. I have other things to think about, but I am welcoming PRs related not to bugs, but to your environment that causes issues ... no PRs? sorry, I have other priorities piled up already. |
Hey all, I'm sorry I've let my PR go stale. I'd like to get it merged so at least most errors while using it with TS can be resolved! I'll look at it again this weekend. |
The tricky thing I ran into in #168 was the whole masquerading as Out of curiosity @WebReflection, would you be open to converting some of the library's code to typescript? Over on https://github.com/compiler-explorer/compiler-explorer we've had a long-haul effort to convert the codebase to typescript (almost there!) and in the process we've found a lot of bugs we never knew we had. I know it's a lot to ask so no worries at all if you'd like to avoid such a change :) |
no, for the same reason Deno core is JS and not TS, sorry. |
bug from here or in your logic? this one I am curious about, as 100% code coverage might not test all possible cases anyway, so I am willing to improve that, if bugs are here, and not just in TS. lately many complained about bugs that don't exist in my source code, only in the TS env 🤷 |
Separate from this project. We've found it's just extremely helpful to have a solid type foundation throughout the code, which is what typescript gives us. It has helped us identify issues where different parts of the code call functions with unexpected types (e.g. calling a function taking a string with a number or null or undefined) and issues where different parts of the code think they're working with slightly different types. Granted, CE is a much larger project that does not have 100% test coverage. |
Here CE is 100% test covered … the DOM does a lot of coercion though … numbers or booleans are casted as string and accepted. This project won’t change the dynamic nature of the platform it represents, that’s on TS to be relaxed about it or ignore it. Were all these bugs a TS only issue though? I assume yes, but if not, please file those bugs here. |
Hi there,
I'm running into loads of type errors from linkedom when using the library in a typescript project.
These type errors appear to all be either missing properties or incorrect implementations of base class methods (due to parameter types or return types not matching).
The errors are too long to send but I will send a few:
Workaround:
tsc --skipLibCheck
It'd be great to get the types correct here so
--skipLibCheck
isn't needed. I would make a PR for this however it seems design decisions would need to be made to fix the types. I'm not sure if the types can be reconciled while still extending / implementingglobalThis.DOMParser
,globalThis.HTMLElement
,/globalThis\.HTML.*Element/
, etc.The text was updated successfully, but these errors were encountered: