Skip to content

Make type declarations more accurate#1952

Merged
ai merged 6 commits intopostcss:mainfrom
nex3:rule-props
Aug 5, 2024
Merged

Make type declarations more accurate#1952
ai merged 6 commits intopostcss:mainfrom
nex3:rule-props

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/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.

@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().

@nex3 nex3 requested a review from ai August 5, 2024 21:01
@ai ai merged commit 146d31c into postcss:main Aug 5, 2024
@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