Skip to content

fix(types): should accept Child and Properties at the same time#24

Open
JounQin wants to merge 1 commit intomainfrom
fix/types
Open

fix(types): should accept Child and Properties at the same time#24
JounQin wants to merge 1 commit intomainfrom
fix/types

Conversation

@JounQin
Copy link
Member

@JounQin JounQin commented Mar 19, 2026

Initial checklist

  • I read the support docs
  • I read the contributing guide
  • I agree to follow the code of conduct
  • I searched issues and discussions and couldn’t find anything or linked relevant results below
  • I made sure the docs are up to date
  • I included tests (or that’s not needed)

Description of changes

The second parameter accepts Child or Properties at the same time actually, and when using node.attributes via remark-directive, there is no need to add || {} at

https://github.com/remarkjs/remark-directive/blob/23b8f416da165b6ddaa4c5e7e82addaf6dcb96a9/readme.md?plain=1#L161

Copilot AI review requested due to automatic review settings March 19, 2026 08:35
@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Mar 19, 2026
@JounQin JounQin requested review from remcohaszing and wooorm and removed request for Copilot March 19, 2026 08:36
@JounQin JounQin requested review from Copilot and removed request for wooorm March 19, 2026 14:39
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 createH to accept Child | Properties as the second parameter.
  • Add a tsd type test that verifies a Child | Properties-typed value is accepted as the second argument to h.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤞 phase/open Post is being triaged manually

Development

Successfully merging this pull request may close these issues.

3 participants