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 fb8e4c9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 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
3 changes: 1 addition & 2 deletions packages/solid/web/test/suspense.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* @jsxImportSource solid-js */
import "../../test/MessageChannel";
import { lazy, createSignal, createResource, useTransition, enableScheduling } from "../../src";
import type { Props } from "../../src";
import { render, Suspense, SuspenseList } from "../src";

global.queueMicrotask = setImmediate;
Expand All @@ -13,7 +12,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 fb8e4c9

Please sign in to comment.