Skip to content

Commit

Permalink
Allow generic to be left out in PropsWithChildren type
Browse files Browse the repository at this point in the history
Many components take only `children` as a prop, and nothing else. Defaulting the generic helper type `PropsWithChildren` to `{}` allows the consumer to use it as simply `props: PropsWithChildren` instead of the awkward-looking `props: PropsWithChildren<{}>`.
  • Loading branch information
jakst authored Jul 2, 2021
1 parent 47ad259 commit 38d5157
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/solid/src/render/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import { sharedConfig, nextHydrateContext, setHydrateContext } from "./hydration";
import type { JSX } from "../jsx";

export type PropsWithChildren<P> = P & { children?: JSX.Element };
export type PropsWithChildren<P = {}> = P & { children?: JSX.Element };
export type Component<P = {}> = (props: PropsWithChildren<P>) => JSX.Element;
/**
* Takes the props of the passed component and returns its type
Expand Down

0 comments on commit 38d5157

Please sign in to comment.