Conversation
There was a problem hiding this comment.
Pull request overview
This PR adjusts the TypeScript surface of h/s so their second argument can be typed as a union of Child and Properties (matching actual runtime behavior), which helps consumers that pass values like node.attributes from remark-directive without extra casts/defaults.
Changes:
- Update JSDoc overload in
createHto acceptChild | Propertiesas the second parameter. - Add a
tsdtype test that verifies aChild | Properties-typed value is accepted as the second argument toh.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test-d/index.ts | Adds a type-level regression test for passing a Child | Properties union as the second argument. |
| lib/create-h.js | Updates the overload signature to reflect that the second parameter can be either Child or Properties. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
|
Yeah, but the next Are you sure your tests don’t pass, without the change? Sorry for the wait! |
|
@wooorm Yes, I'm sure, here the key point is |
Initial checklist
Description of changes
The second parameter accepts
ChildorPropertiesat the same time actually, and when usingnode.attributesviaremark-directive, there is no need to add|| {}athttps://github.com/remarkjs/remark-directive/blob/23b8f416da165b6ddaa4c5e7e82addaf6dcb96a9/readme.md?plain=1#L161