Skip to content

fix: add WithChildren to MediaFeature type - #312

Merged
bartveneman merged 2 commits into
mainfrom
claude/pensive-noether-wrtoq0
Oct 18, 2026
Merged

bartveneman merged 2 commits into
mainfrom
claude/pensive-noether-wrtoq0

Conversation

@bartveneman

Copy link
Copy Markdown
Member

Fixes #249

MediaFeature was typed as a leaf, but at runtime it can have children beyond .value, e.g. the min-width:0\0 hack yields a Number and a sibling Identifier. That made node.has_children and for (const child of node) type errors.

Changes

  • MediaFeature now includes WithChildren<Identifier | Number | Dimension | Ratio>
  • value is narrowed from CSSNode | null to Identifier | Number | Dimension | Ratio | null (Ratio added to the issue's proposed union because (aspect-ratio: 16/9) produces it)
  • Added a regression test for the 0\0 hack

Generated by Claude Code

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Package Size Increase

📦 Package 📏 Base Size 📏 Source Size 📈 Size Change
@projectwallace/css-parser 46.2 kB 46.3 kB +38 B

@pkg-pr-new

pkg-pr-new Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@projectwallace/css-parser@7697d71

commit: 7697d71

@bartveneman
bartveneman merged commit ae18cb6 into main Oct 18, 2026
16 checks passed
@bartveneman
bartveneman deleted the claude/pensive-noether-wrtoq0 branch October 18, 2026 09:35
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.

Incorrect types for MediaFeature

2 participants