@types/react-dom
Advanced tools
Comparing version
@@ -34,2 +34,4 @@ /** | ||
declare const REACT_FORM_STATE_SIGIL: unique symbol; | ||
declare module "." { | ||
@@ -110,2 +112,41 @@ function prefetchDNS(href: string): void; | ||
function preinitModule(href: string, options?: PreinitModuleOptions): void; | ||
interface FormStatusNotPending { | ||
pending: false; | ||
data: null; | ||
method: null; | ||
action: null; | ||
} | ||
interface FormStatusPending { | ||
pending: true; | ||
data: FormData; | ||
method: string; | ||
action: string | ((formData: FormData) => void | Promise<void>); | ||
} | ||
type FormStatus = FormStatusPending | FormStatusNotPending; | ||
function useFormStatus(): FormStatus; | ||
function useFormState<State>( | ||
action: (state: Awaited<State>) => State | Promise<State>, | ||
initialState: Awaited<State>, | ||
permalink?: string, | ||
): [state: Awaited<State>, dispatch: () => void]; | ||
function useFormState<State, Payload>( | ||
action: (state: Awaited<State>, payload: Payload) => State | Promise<State>, | ||
initialState: Awaited<State>, | ||
permalink?: string, | ||
): [state: Awaited<State>, dispatch: (payload: Payload) => void]; | ||
} | ||
declare module "./client" { | ||
interface ReactFormState { | ||
[REACT_FORM_STATE_SIGIL]: never; | ||
} | ||
interface HydrationOptions { | ||
formState?: ReactFormState | null; | ||
} | ||
} |
@@ -35,43 +35,3 @@ /** | ||
declare const REACT_FORM_STATE_SIGIL: unique symbol; | ||
declare module "." { | ||
interface FormStatusNotPending { | ||
pending: false; | ||
data: null; | ||
method: null; | ||
action: null; | ||
} | ||
interface FormStatusPending { | ||
pending: true; | ||
data: FormData; | ||
method: string; | ||
action: string | ((formData: FormData) => void | Promise<void>); | ||
} | ||
type FormStatus = FormStatusPending | FormStatusNotPending; | ||
function experimental_useFormStatus(): FormStatus; | ||
function experimental_useFormState<State>( | ||
action: (state: State) => Promise<State>, | ||
initialState: State, | ||
permalink?: string, | ||
): [state: State, dispatch: () => void]; | ||
function experimental_useFormState<State, Payload>( | ||
action: (state: State, payload: Payload) => Promise<State>, | ||
initialState: State, | ||
permalink?: string, | ||
): [state: State, dispatch: (payload: Payload) => void]; | ||
} | ||
declare module "./client" { | ||
interface ReactFormState { | ||
[REACT_FORM_STATE_SIGIL]: never; | ||
} | ||
interface HydrationOptions { | ||
experimental_formState?: ReactFormState | null; | ||
} | ||
} |
@@ -1,13 +0,1 @@ | ||
// Type definitions for React (react-dom) 18.2 | ||
// Project: https://reactjs.org | ||
// Definitions by: Asana <https://asana.com> | ||
// AssureSign <http://www.assuresign.com> | ||
// Microsoft <https://microsoft.com> | ||
// MartynasZilinskas <https://github.com/MartynasZilinskas> | ||
// Josh Rutherford <https://github.com/theruther4d> | ||
// Jessica Franco <https://github.com/Jessidhia> | ||
// Sebastian Silbermann <https://github.com/eps1lon> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// TypeScript Version: 2.8 | ||
// NOTE: Users of the `experimental` builds of React should add a reference | ||
@@ -68,2 +56,3 @@ // to 'react-dom/experimental' in their project. See experimental.d.ts's top comment | ||
callback?: (component?: Component<P, ComponentState> | Element) => any, | ||
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type | ||
): Component<P, ComponentState> | Element | void; | ||
@@ -111,2 +100,3 @@ | ||
callback?: () => void, | ||
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type | ||
): Component<P, ComponentState> | Element | void; | ||
@@ -118,3 +108,4 @@ | ||
callback?: () => void, | ||
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type | ||
): Component<any, ComponentState> | Element | void; | ||
} |
{ | ||
"name": "@types/react-dom", | ||
"version": "18.2.11", | ||
"description": "TypeScript definitions for React (react-dom)", | ||
"version": "18.2.18", | ||
"description": "TypeScript definitions for react-dom", | ||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dom", | ||
@@ -22,19 +22,19 @@ "license": "MIT", | ||
"name": "MartynasZilinskas", | ||
"url": "https://github.com/MartynasZilinskas", | ||
"githubUsername": "MartynasZilinskas" | ||
"githubUsername": "MartynasZilinskas", | ||
"url": "https://github.com/MartynasZilinskas" | ||
}, | ||
{ | ||
"name": "Josh Rutherford", | ||
"url": "https://github.com/theruther4d", | ||
"githubUsername": "theruther4d" | ||
"githubUsername": "theruther4d", | ||
"url": "https://github.com/theruther4d" | ||
}, | ||
{ | ||
"name": "Jessica Franco", | ||
"url": "https://github.com/Jessidhia", | ||
"githubUsername": "Jessidhia" | ||
"githubUsername": "Jessidhia", | ||
"url": "https://github.com/Jessidhia" | ||
}, | ||
{ | ||
"name": "Sebastian Silbermann", | ||
"url": "https://github.com/eps1lon", | ||
"githubUsername": "eps1lon" | ||
"githubUsername": "eps1lon", | ||
"url": "https://github.com/eps1lon" | ||
} | ||
@@ -44,13 +44,2 @@ ], | ||
"types": "index.d.ts", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", | ||
"directory": "types/react-dom" | ||
}, | ||
"scripts": {}, | ||
"dependencies": { | ||
"@types/react": "*" | ||
}, | ||
"typesPublisherContentHash": "db6cb2d465dc7cdd50f519c9905019bde94d32e9e38a2bbc509160297db14ba4", | ||
"typeScriptVersion": "4.5", | ||
"exports": { | ||
@@ -88,3 +77,14 @@ ".": { | ||
"./package.json": "./package.json" | ||
} | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", | ||
"directory": "types/react-dom" | ||
}, | ||
"scripts": {}, | ||
"dependencies": { | ||
"@types/react": "*" | ||
}, | ||
"typesPublisherContentHash": "24d1ea368814e26159c63355ce8fb31303c23d7ff1fedf2165b6564f8d24b013", | ||
"typeScriptVersion": "4.6" | ||
} |
@@ -5,3 +5,3 @@ # Installation | ||
# Summary | ||
This package contains type definitions for React (react-dom) (https://reactjs.org). | ||
This package contains type definitions for react-dom (https://reactjs.org). | ||
@@ -12,7 +12,6 @@ # Details | ||
### Additional Details | ||
* Last updated: Fri, 06 Oct 2023 23:05:45 GMT | ||
* Last updated: Fri, 15 Dec 2023 23:35:35 GMT | ||
* Dependencies: [@types/react](https://npmjs.com/package/@types/react) | ||
* Global values: `ReactDOM`, `ReactDOMServer` | ||
# Credits | ||
These definitions were written by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com), [MartynasZilinskas](https://github.com/MartynasZilinskas), [Josh Rutherford](https://github.com/theruther4d), [Jessica Franco](https://github.com/Jessidhia), and [Sebastian Silbermann](https://github.com/eps1lon). |
// forward declarations | ||
declare global { | ||
namespace NodeJS { | ||
// tslint:disable-next-line:no-empty-interface | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
interface ReadableStream {} | ||
// tslint:disable-next-line:no-empty-interface | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
interface WritableStream {} | ||
@@ -14,3 +14,3 @@ } | ||
*/ | ||
// tslint:disable-next-line:no-empty-interface | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
interface AbortSignal {} | ||
@@ -21,3 +21,3 @@ | ||
*/ | ||
// tslint:disable-next-line:no-empty-interface | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
interface ReadableStream {} | ||
@@ -48,2 +48,6 @@ } | ||
export interface ServerOptions { | ||
identifierPrefix?: string; | ||
} | ||
/** | ||
@@ -69,3 +73,3 @@ * Only available in the environments with [Node.js Streams](https://nodejs.dev/learn/nodejs-streams). | ||
*/ | ||
export function renderToString(element: ReactElement): string; | ||
export function renderToString(element: ReactElement, options?: ServerOptions): string; | ||
@@ -79,3 +83,3 @@ /** | ||
*/ | ||
export function renderToNodeStream(element: ReactElement): NodeJS.ReadableStream; | ||
export function renderToNodeStream(element: ReactElement, options?: ServerOptions): NodeJS.ReadableStream; | ||
@@ -88,3 +92,3 @@ /** | ||
*/ | ||
export function renderToStaticMarkup(element: ReactElement): string; | ||
export function renderToStaticMarkup(element: ReactElement, options?: ServerOptions): string; | ||
@@ -96,3 +100,3 @@ /** | ||
*/ | ||
export function renderToStaticNodeStream(element: ReactElement): NodeJS.ReadableStream; | ||
export function renderToStaticNodeStream(element: ReactElement, options?: ServerOptions): NodeJS.ReadableStream; | ||
@@ -99,0 +103,0 @@ export interface RenderToReadableStreamOptions { |
@@ -361,3 +361,3 @@ import { | ||
declare const UNDEFINED_VOID_ONLY: unique symbol; | ||
// tslint:disable-next-line: void-return | ||
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type | ||
type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never }; | ||
@@ -364,0 +364,0 @@ // While act does always return Thenable, if a void function is passed, we pretend the return value is also void to not trigger dangling Promise lint rules. |
33267
-0.48%764
-0.65%16
-5.88%