Incorrect types for MediaFeature
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 85/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- tooling
Research direction
Start with the MediaFeature definition in dist/node-types-mntWKkN-.d.ts and compare its child-related types with the runtime behavior described for min-width:0\0. The work is done when MediaFeature exposes the specified WithChildren union and its value property is narrowed to Identifier, Number, Dimension, or null.
Written by the indexing model from the issue text.
Description
MediaFeature type is missing WithChildren
File: dist/node-types-mntWKkN-.d.ts
Problem
MediaFeature can have children beyond the .value node at runtime, but the type does not extend WithChildren. This makes node.has_children and for (const child of node) TypeScript errors even though they work correctly.
A concrete example is the CSS hack min-width:0\0. The parser emits a MediaFeature with two children: a Number node (0) exposed via .value, and a sibling Identifier node (\0) only reachable by iterating children.
Current definition
type MediaFeature = CSSNode & {
readonly type: typeof MEDIA_FEATURE;
readonly type_name: 'Feature';
readonly property: string;
readonly value: CSSNode | null;
clone(options?: CloneOptions): ToPlain<MediaFeature>;
};
Expected definition
type MediaFeature = CSSNode & WithChildren<Identifier | Number | Dimension> & {
readonly type: typeof MEDIA_FEATURE;
readonly type_name: 'Feature';
readonly property: string;
readonly value: Identifier | Number | Dimension | null;
clone(options?: CloneOptions): ToPlain<MediaFeature>;
};
Changes
- Add WithChildren<Identifier | Number | Dimension> — boolean features have no children; plain features have one child matching the value; the 0\0 hack produces two children.
- Narrow value: CSSNode | null → value: Identifier | Number | Dimension | null to match the actual child union.
- Dominant language
- CSS
- Stars
- 4
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from projectwallace/css-parser
-
annoyance
Difficulty 3/5 1-2 days Newbie friendliness 45/100
projectwallace/css-parser#195 ·
-
annoyance
Difficulty 4/5 3-5 days Newbie friendliness 38/100
projectwallace/css-parser#89 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
projectwallace/css-parser#76 ·
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
All issues in projectwallace/css-parser
Similar issues
-
sponsored
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
microsoft/navcontainerhelper#4217 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
use-agent-os/agent-os#3314 ·
-
agentic-workflows
Difficulty 1/5 Under an hour Newbie friendliness 85/100
githubnext/rig#534 ·
-
documentation low-priority templates
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
jesseray718/openroot#87 ·