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

Make type declarations more accurate #1952

Merged
merged 6 commits into from
Aug 5, 2024
Merged

Make type declarations more accurate #1952

merged 6 commits into from
Aug 5, 2024

Conversation

nex3
Copy link
Contributor

@nex3 nex3 commented Jul 27, 2024

This also helps make it feasible to extend these types for
sass/dart-sass#88.

nex3 added 4 commits July 26, 2024 15:40
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/container.js Show resolved Hide resolved
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
Copy link
Member

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?

Copy link
Contributor Author

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.

lib/container.d.ts Show resolved Hide resolved
lib/container.d.ts Show resolved Hide resolved
@nex3 nex3 requested a review from ai July 29, 2024 21:22
@nex3
Copy link
Contributor Author

nex3 commented Aug 2, 2024

Merged main and added a declaration for Input.toJSON().

lib/at-rule.d.ts Show resolved Hide resolved
@nex3 nex3 requested a review from ai August 5, 2024 21:01
@ai ai merged commit 146d31c into postcss:main Aug 5, 2024
8 checks passed
@ai
Copy link
Member

ai commented Aug 5, 2024

Released in 8.4.41

@nex3 nex3 deleted the rule-props branch August 5, 2024 23:33
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