-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Make type declarations more accurate #1952
Conversation
This ensures that `ChildProps` requires at least one of concrete property which indicates what type of node should be created. Also updates `Container.normalize()` to create a `Rule()` when passed `{selectors: ...}`.
Roots are always handled by `Container.normalize()`, which flattens them out into their constituent children.
lib/at-rule.d.ts
Outdated
clone(overrides?: Partial<AtRule.AtRuleProps>): AtRule | ||
cloneAfter(overrides?: Partial<AtRule.AtRuleProps>): AtRule | ||
cloneBefore(overrides?: Partial<AtRule.AtRuleProps>): AtRule | ||
clone(overrides?: Partial<AtRule.AtRuleProps>): this |
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.
Why it is this
if we clone, create a new object?
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
doesn't mean the current object, it just means the type of the current class. This means that a subtype will automatically treat this as returning its own type, rather than returning the superclass AtRule
. See this documentation.
Merged main and added a declaration for |
Released in 8.4.41 |
This also helps make it feasible to extend these types for
sass/dart-sass#88.