Skip to content

Type helper: PropsWithChildren #15706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Hugos68 opened this issue Apr 8, 2025 · 1 comment
Open

Type helper: PropsWithChildren #15706

Hugos68 opened this issue Apr 8, 2025 · 1 comment

Comments

@Hugos68
Copy link
Contributor

Hugos68 commented Apr 8, 2025

Describe the problem

I often catch myself creating the same helper in nearly every Svelte project:

interface PropsWithChildren<T extends []> {
  children?: Snippet<T>;
}

And using it like this:

interface Props extends PropsWithChildren {
    ....
}

const props: Props = $props();

Typing the same code over and over is a waste of time.

Describe the proposed solution

Svelte could export this helper as a first party type utility.

React, although not known to have done everything best, does have this utility and I use it whenever I have any React project

Importance

nice to have

@geodask
Copy link

geodask commented Apr 14, 2025

+1, adding PropsWithChildren as a first-party type utility would be nice indeed. I have a PR prepared and ready to submit whenever the team decides to move forward with this.

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

No branches or pull requests

2 participants