From 38d515707a2fcd036400c48cafc1c686b7943b83 Mon Sep 17 00:00:00 2001 From: Jakob Norlin Date: Sat, 3 Jul 2021 01:35:47 +0200 Subject: [PATCH] Allow generic to be left out in PropsWithChildren type 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<{}>`. --- packages/solid/src/render/component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/solid/src/render/component.ts b/packages/solid/src/render/component.ts index d939b8af2..59f18cb9d 100644 --- a/packages/solid/src/render/component.ts +++ b/packages/solid/src/render/component.ts @@ -9,7 +9,7 @@ import { import { sharedConfig, nextHydrateContext, setHydrateContext } from "./hydration"; import type { JSX } from "../jsx"; -export type PropsWithChildren

= P & { children?: JSX.Element }; +export type PropsWithChildren

= P & { children?: JSX.Element }; export type Component

= (props: PropsWithChildren

) => JSX.Element; /** * Takes the props of the passed component and returns its type