-
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
Improve TS typing #168
Improve TS typing #168
Conversation
resolved |
I think that is the right fix |
oh gosh ... all definition files are automatically generated per each CI build step or locally before pushing to npm. Apologies I should've mentioned this as this PR is quite some effort if it was fixed manually per each generated file, but next release will re-create again all files and all changes will be lost. The files you need to eventually change are in the esm folder, not in the types one, as that's all automation. |
Oh shoot thanks! This PR was fast - just a bunch of regex replaces - so nothing of value lost. I’ll make the correct changes when I’m back at my computer. |
I noticed |
readonly CAPTURING_PHASE: number; | ||
readonly NONE: number; | ||
}; | ||
declare const GlobalCustomEvent: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might not be correct, maybe this should actually implement globalThis.CustomEvent
At the moment there are a lot of types that are not right. Examples from the readme don't work. |
I'm afraid this PR needs some linting adjustment or the CI won't be happy ... and I care about 100% code coverage and happy CI here. Please have a look and yes, exceptions accepted for linters! |
I think this PR is good to go |
@WebReflection Hi, I want to contribute. Could you please explain what's the right way to include types? Are they generated from jsdoc comments? |
@@ -25,9 +25,6 @@ const handler = { | |||
} | |||
}; | |||
|
|||
/** | |||
* @implements globalThis.DOMStringMap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason to remove this?
@@ -22,9 +22,6 @@ const update = ({[OWNER_ELEMENT]: ownerElement, value}) => { | |||
); | |||
}; | |||
|
|||
/** | |||
* @implements globalThis.DOMTokenList |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason to remove this?
I just wonder once all "pretending to implement" classes are gone, if TS really helps out or it 'causes just confusion. There are things not really standard that might come up while using this project and I guess what are your thoughts there ... also, those two classes ... I think the implementation conforms with the standard? 🤔 are all implements needed to go? |
Thanks for taking a look! It may very well be these two classes do actually implement everything from their globalThis counterparts - I can re-introduce these I think the one "pretending to implement" part remaining is whatever is returned by |
this PR has conflicts ... please resolve those and I'd be happy to move forward, thanks! |
no answer in years ... closing. |
This is an attempt to fix #167
I do not believe it's correct to suggest the DOMParser implements
globalThis.DOMParser
, theHTMLElement
implementsglobalThis.HTMLElement
, etc.I think these changes should be ok given the goal of the library is to be close but not too close to the actual dom API.
Perhaps one of the original authors can lend insight into the original motivation for these
implements
annotations.Todo: