Skip to content

Commit

Permalink
chore: fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Dec 10, 2024
1 parent e8b6a7c commit c743266
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 19 deletions.
2 changes: 1 addition & 1 deletion examples/react-server/src/entry-browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async function main() {
ReactDOMClient.createRoot(document).render(reactRootEl);
} else {
// TODO: can we avoid await? (separate script stream?)
const formState = (await initialStreamData).actionResult;
const formState = (await initialStreamData).actionResult as any;
React.startTransition(() => {
ReactDOMClient.hydrateRoot(document, reactRootEl, {
formState,
Expand Down
3 changes: 1 addition & 2 deletions examples/react-server/src/entry-ssr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ async function renderHtml(request: Request, result: ReactServerHandlerResult) {
const rscPromise = ReactClient.createFromReadableStream<StreamData>(
rscStream1,
{
ssrManifest: {
serverConsumerManifest: {
moduleMap: createModuleMap(),
moduleLoading: null,
},
},
);
Expand Down
6 changes: 3 additions & 3 deletions examples/react-server/src/features/router/client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export function Link({
activeProps,
pendingProps,
...props
}: JSX.IntrinsicElements["a"] & {
activeProps?: JSX.IntrinsicElements["a"];
pendingProps?: JSX.IntrinsicElements["a"];
}: React.JSX.IntrinsicElements["a"] & {
activeProps?: React.JSX.IntrinsicElements["a"];
pendingProps?: React.JSX.IntrinsicElements["a"];
}) {
const { isPending, pathname } = useRouter();

Expand Down
3 changes: 2 additions & 1 deletion examples/react-server/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export type ModuleMap = {
export interface SsrManifest {
moduleMap: ModuleMap;
// TODO
moduleLoading: null;
serverModuleMap?: unknown;
moduleLoading?: unknown;
}

export type WebpackRequire = (id: string) => Promise<unknown>;
Expand Down
4 changes: 2 additions & 2 deletions examples/react-server/src/types/react-modules.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ declare module "react-server-dom-webpack/server.edge" {
actionResult: unknown,
body: FormData,
serverManifest?: unknown,
): Promise<unknown>;
): Promise<import("react-dom/client").ReactFormState | null>;
}

// https://github.com/facebook/react/blob/89021fb4ec9aa82194b0788566e736a4cedfc0e4/packages/react-server-dom-webpack/src/ReactFlightDOMClientEdge.js
Expand All @@ -48,7 +48,7 @@ declare module "react-server-dom-webpack/client.edge" {
export function createFromReadableStream<T>(
stream: ReadableStream<Uint8Array>,
options: {
ssrManifest: import(".").SsrManifest;
serverConsumerManifest: import(".").SsrManifest;
},
): Promise<T>;
}
Expand Down
10 changes: 0 additions & 10 deletions examples/react-server/src/types/react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,3 @@ declare module "react-dom/server" {
formState: unknown;
}
}

declare module "react-dom/client" {
interface HydrationOptions {
formState: unknown;
}

interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_CREATE_ROOT_CONTAINERS {
Document: Document;
}
}

0 comments on commit c743266

Please sign in to comment.