Skip to content
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

fix type definitions #284

Conversation

romainmenke
Copy link
Contributor

No description provided.

@@ -166,7 +166,7 @@ declare namespace parser {
replaceWith(...nodes: Node[]): Node;
next(): Node;
prev(): Node;
clone(opts?: {[override: string]:any}): Node;
clone(opts?: {[override: string]:any}): this;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After cloning the return the value is always an instance of this.

With Node as the return type you always need to do more type checks after cloning because the specific type was erased.

Comment on lines +214 to +215
append(selector: Child): this;
prepend(selector: Child): this;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was a typo.

append/prepend have similar implementations as insertAfter/insertBefore and those have type Child

Comment on lines +236 to +237
removeAll(): this;
empty(): this;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same reason as the change in clone().
Returning this preserves the specific type of the current instance.

@romainmenke
Copy link
Contributor Author

@alexander-akait Could you take a look at this when you have time?
Thank you in advance!

Copy link
Collaborator

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to make release? Sorry for delay

@romainmenke
Copy link
Contributor Author

A release would be awesome!

Don't worry about taking your time with this :)
I know you have plenty to do 🙇

@alexander-akait alexander-akait merged commit 01ba4f3 into postcss:master Dec 6, 2023
3 checks passed
@romainmenke romainmenke deleted the fix-type-definitions--diligent-collie-29b549818a branch December 6, 2023 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants