Skip to content

Commit

Permalink
Remove Props helper and shallow Readonly for props
Browse files Browse the repository at this point in the history
  • Loading branch information
edemaine committed Mar 7, 2022
1 parent 64d8af1 commit 7447ce5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions packages/solid/src/render/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ export function enableHydration() {
hydrationEnabled = true;
}

export type Props<P = {}> = Readonly<P>;
export type PropsWithChildren<P = {}, C = JSX.Element> =
Props<P> & { readonly children?: C };
export type Component<P = {}> = (props: Props<P>) => JSX.Element;
export type PropsWithChildren<P = {}, C = JSX.Element> = P & { children?: C };
export type Component<P = {}> = (props: P) => JSX.Element;
export type ComponentWithChildren<P = {}, C = JSX.Element> =
(props: PropsWithChildren<P, C>) => JSX.Element;
/**
Expand All @@ -34,9 +32,9 @@ export type ComponentProps<T extends keyof JSX.IntrinsicElements | Component<any
: T extends keyof JSX.IntrinsicElements
? JSX.IntrinsicElements[T]
: {};
/** Type of `props.ref`, for use in `Props`.
/** Type of `props.ref`, for use in `Component` or `props` typing.
*
* @example Props<{ref: Ref<Element>}>
* @example Component<{ref: Ref<Element>}>
*/
export type Ref<T> = T | ((val: T) => void);

Expand Down
2 changes: 1 addition & 1 deletion packages/solid/web/test/suspense.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe("Testing Suspense", () => {
resolvers: Function[] = [],
[triggered, trigger] = createSignal(false);
const LazyComponent = lazy<typeof ChildComponent>(() => new Promise(r => resolvers.push(r))),
ChildComponent = (props: Props<{ greeting: string }>) => {
ChildComponent = (props: { greeting: string }) => {
const [value] = createResource<string, string>(
() => triggered() && "child",
() => new Promise(r => setTimeout(() => r("Jo"), 300)),
Expand Down

0 comments on commit 7447ce5

Please sign in to comment.