@types/react-dom
Advanced tools
Comparing version 18.2.7 to 18.2.13
@@ -29,20 +29,66 @@ /** | ||
import React = require('react'); | ||
import ReactDOM = require('.'); | ||
import React = require("react"); | ||
import ReactDOM = require("."); | ||
export {}; | ||
declare module '.' { | ||
type PreloadAs = 'font' | 'script' | 'style'; | ||
declare const REACT_FORM_STATE_SIGIL: unique symbol; | ||
declare module "." { | ||
function prefetchDNS(href: string): void; | ||
interface PreconnectOptions { | ||
// Don't create a helper type. | ||
// It would have to be in module scope to be inlined in TS tooltips. | ||
// But then it becomes part of the public API. | ||
// TODO: Upstream to microsoft/TypeScript-DOM-lib-generator -> w3c/webref | ||
// since the spec has a notion of a dedicated type: https://html.spec.whatwg.org/multipage/urls-and-fetching.html#cors-settings-attribute | ||
crossOrigin?: "anonymous" | "use-credentials" | "" | undefined; | ||
} | ||
function preconnect(href: string, options?: PreconnectOptions): void; | ||
type PreloadAs = | ||
| "audio" | ||
| "document" | ||
| "embed" | ||
| "fetch" | ||
| "font" | ||
| "image" | ||
| "object" | ||
| "track" | ||
| "script" | ||
| "style" | ||
| "video" | ||
| "worker"; | ||
interface PreloadOptions { | ||
as: PreloadAs; | ||
crossOrigin?: string | undefined; | ||
crossOrigin?: "anonymous" | "use-credentials" | "" | undefined; | ||
fetchPriority?: "high" | "low" | "auto" | undefined; | ||
// TODO: These should only be allowed with `as: 'image'` but it's not trivial to write tests against the full TS support matrix. | ||
imageSizes?: string | undefined; | ||
imageSrcSet?: string | undefined; | ||
integrity?: string | undefined; | ||
nonce?: string | undefined; | ||
referrerPolicy?: ReferrerPolicy | undefined; | ||
} | ||
function preload(href: string, options?: PreloadOptions): void; | ||
type PreinitAs = 'script' | 'style'; | ||
// https://html.spec.whatwg.org/multipage/links.html#link-type-modulepreload | ||
type PreloadModuleAs = RequestDestination; | ||
interface PreloadModuleOptions { | ||
/** | ||
* @default "script" | ||
*/ | ||
as: PreloadModuleAs; | ||
crossOrigin?: "anonymous" | "use-credentials" | "" | undefined; | ||
integrity?: string | undefined; | ||
nonce?: string | undefined; | ||
} | ||
function preloadModule(href: string, options?: PreloadModuleOptions): void; | ||
type PreinitAs = "script" | "style"; | ||
interface PreinitOptions { | ||
as: PreinitAs; | ||
crossOrigin?: string | undefined; | ||
crossOrigin?: "anonymous" | "use-credentials" | "" | undefined; | ||
fetchPriority?: "high" | "low" | "auto" | undefined; | ||
precedence?: string | undefined; | ||
@@ -53,2 +99,54 @@ integrity?: string | undefined; | ||
function preinit(href: string, options?: PreinitOptions): void; | ||
// Will be expanded to include all of https://github.com/tc39/proposal-import-attributes | ||
type PreinitModuleAs = "script"; | ||
interface PreinitModuleOptions { | ||
/** | ||
* @default "script" | ||
*/ | ||
as?: PreinitModuleAs; | ||
crossOrigin?: "anonymous" | "use-credentials" | "" | undefined; | ||
integrity?: string | undefined; | ||
nonce?: string | undefined; | ||
} | ||
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: State) => Promise<State>, | ||
initialState: State, | ||
permalink?: string, | ||
): [state: State, dispatch: () => void]; | ||
function 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 { | ||
formState?: ReactFormState | null; | ||
} | ||
} |
@@ -7,3 +7,3 @@ /** | ||
import React = require('react'); | ||
import React = require("react"); | ||
export interface HydrationOptions { | ||
@@ -10,0 +10,0 @@ /** |
@@ -30,25 +30,8 @@ /** | ||
import React = require('react'); | ||
import ReactDOM = require('./canary'); | ||
import React = require("react"); | ||
import ReactDOM = require("./canary"); | ||
export {}; | ||
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; | ||
declare module "." { | ||
} |
@@ -20,6 +20,13 @@ // Type definitions for React (react-dom) 18.2 | ||
import { | ||
ReactInstance, Component, ComponentState, | ||
ReactElement, FunctionComponentElement, CElement, | ||
DOMAttributes, DOMElement, ReactNode, ReactPortal | ||
} from 'react'; | ||
CElement, | ||
Component, | ||
ComponentState, | ||
DOMAttributes, | ||
DOMElement, | ||
FunctionComponentElement, | ||
ReactElement, | ||
ReactInstance, | ||
ReactNode, | ||
ReactPortal, | ||
} from "react"; | ||
@@ -29,3 +36,7 @@ export function findDOMNode(instance: ReactInstance | null | undefined): Element | null | Text; | ||
export function createPortal(children: ReactNode, container: Element | DocumentFragment, key?: null | string): ReactPortal; | ||
export function createPortal( | ||
children: ReactNode, | ||
container: Element | DocumentFragment, | ||
key?: null | string, | ||
): ReactPortal; | ||
@@ -46,3 +57,4 @@ export const version: string; | ||
container: Element, | ||
callback?: (element: T) => any): T; | ||
callback?: (element: T) => any, | ||
): T; | ||
export function unstable_renderSubtreeIntoContainer<P, T extends Component<P, ComponentState>>( | ||
@@ -52,3 +64,4 @@ parentComponent: Component<any>, | ||
container: Element, | ||
callback?: (component: T) => any): T; | ||
callback?: (component: T) => any, | ||
): T; | ||
export function unstable_renderSubtreeIntoContainer<P>( | ||
@@ -58,3 +71,4 @@ parentComponent: Component<any>, | ||
container: Element, | ||
callback?: (component?: Component<P, ComponentState> | Element) => any): Component<P, ComponentState> | Element | void; | ||
callback?: (component?: Component<P, ComponentState> | Element) => any, | ||
): Component<P, ComponentState> | Element | void; | ||
@@ -69,4 +83,4 @@ export type Container = Element | Document | DocumentFragment; | ||
element: DOMElement<DOMAttributes<T>, T>, | ||
container: Container| null, | ||
callback?: () => void | ||
container: Container | null, | ||
callback?: () => void, | ||
): T; | ||
@@ -76,4 +90,4 @@ | ||
element: Array<DOMElement<DOMAttributes<any>, any>>, | ||
container: Container| null, | ||
callback?: () => void | ||
container: Container | null, | ||
callback?: () => void, | ||
): Element; | ||
@@ -83,4 +97,4 @@ | ||
element: FunctionComponentElement<any> | Array<FunctionComponentElement<any>>, | ||
container: Container| null, | ||
callback?: () => void | ||
container: Container | null, | ||
callback?: () => void, | ||
): void; | ||
@@ -90,4 +104,4 @@ | ||
element: CElement<P, T>, | ||
container: Container| null, | ||
callback?: () => void | ||
container: Container | null, | ||
callback?: () => void, | ||
): T; | ||
@@ -97,4 +111,4 @@ | ||
element: Array<CElement<any, Component<any, ComponentState>>>, | ||
container: Container| null, | ||
callback?: () => void | ||
container: Container | null, | ||
callback?: () => void, | ||
): Component<any, ComponentState>; | ||
@@ -104,4 +118,4 @@ | ||
element: ReactElement<P>, | ||
container: Container| null, | ||
callback?: () => void | ||
container: Container | null, | ||
callback?: () => void, | ||
): Component<P, ComponentState> | Element | void; | ||
@@ -111,5 +125,5 @@ | ||
element: ReactElement[], | ||
container: Container| null, | ||
callback?: () => void | ||
container: Container | null, | ||
callback?: () => void, | ||
): Component<any, ComponentState> | Element | void; | ||
} |
{ | ||
"name": "@types/react-dom", | ||
"version": "18.2.7", | ||
"version": "18.2.13", | ||
"description": "TypeScript definitions for React (react-dom)", | ||
@@ -52,4 +52,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dom", | ||
}, | ||
"typesPublisherContentHash": "726a49383efba462b3ec2c83e7628b88070ea64986c3f1b2de67241452512b5a", | ||
"typeScriptVersion": "4.3", | ||
"typesPublisherContentHash": "9493aa01c7194270c928c9c5389b1724b9206c2ae267d9eb5e82551f54d9ba25", | ||
"typeScriptVersion": "4.5", | ||
"exports": { | ||
@@ -56,0 +56,0 @@ ".": { |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Wed, 12 Jul 2023 19:02:46 GMT | ||
* Last updated: Tue, 10 Oct 2023 18:07:33 GMT | ||
* Dependencies: [@types/react](https://npmjs.com/package/@types/react) | ||
@@ -14,0 +14,0 @@ * Global values: `ReactDOM`, `ReactDOMServer` |
@@ -24,4 +24,4 @@ // forward declarations | ||
import { ReactElement, ReactNode } from 'react'; | ||
import { ErrorInfo } from './client'; | ||
import { ReactElement, ReactNode } from "react"; | ||
import { ErrorInfo } from "./client"; | ||
@@ -28,0 +28,0 @@ export interface RenderToPipeableStreamOptions { |
import { | ||
AbstractView, Component, ComponentClass, | ||
ReactElement, ReactInstance, ClassType, | ||
DOMElement, FunctionComponentElement, CElement, | ||
ReactHTMLElement, DOMAttributes, FC | ||
} from 'react'; | ||
AbstractView, | ||
CElement, | ||
ClassType, | ||
Component, | ||
ComponentClass, | ||
DOMAttributes, | ||
DOMElement, | ||
FC, | ||
FunctionComponentElement, | ||
ReactElement, | ||
ReactHTMLElement, | ||
ReactInstance, | ||
} from "react"; | ||
@@ -27,3 +35,17 @@ import * as ReactTestUtils from "."; | ||
export type ModifierKey = "Alt" | "AltGraph" | "CapsLock" | "Control" | "Fn" | "FnLock" | "Hyper" | "Meta" | "NumLock" | "ScrollLock" | "Shift" | "Super" | "Symbol" | "SymbolLock"; | ||
export type ModifierKey = | ||
| "Alt" | ||
| "AltGraph" | ||
| "CapsLock" | ||
| "Control" | ||
| "Fn" | ||
| "FnLock" | ||
| "Hyper" | ||
| "Meta" | ||
| "NumLock" | ||
| "ScrollLock" | ||
| "Shift" | ||
| "Super" | ||
| "Symbol" | ||
| "SymbolLock"; | ||
@@ -67,3 +89,3 @@ export interface SyntheticEventData extends OptionalEventProperties { | ||
export interface MockedComponentClass { | ||
new (props: any): any; | ||
new(props: any): any; | ||
} | ||
@@ -87,3 +109,3 @@ | ||
*/ | ||
export namespace Simulate { | ||
export namespace Simulate { | ||
const abort: EventSimulator; | ||
@@ -180,5 +202,7 @@ const animationEnd: EventSimulator; | ||
export function renderIntoDocument<T extends Element>( | ||
element: DOMElement<any, T>): T; | ||
element: DOMElement<any, T>, | ||
): T; | ||
export function renderIntoDocument( | ||
element: FunctionComponentElement<any>): void; | ||
element: FunctionComponentElement<any>, | ||
): void; | ||
// If we replace `P` with `any` in this overload, then some tests fail because | ||
@@ -189,5 +213,7 @@ // calls to `renderIntoDocument` choose the last overload on the | ||
export function renderIntoDocument<P, T extends Component<P>>( | ||
element: CElement<P, T>): T; | ||
element: CElement<P, T>, | ||
): T; | ||
export function renderIntoDocument<P>( | ||
element: ReactElement<P>): Component<P> | Element | void; | ||
element: ReactElement<P>, | ||
): Component<P> | Element | void; | ||
@@ -200,3 +226,5 @@ /** | ||
export function mockComponent( | ||
mocked: MockedComponentClass, mockTagName?: string): typeof ReactTestUtils; | ||
mocked: MockedComponentClass, | ||
mockTagName?: string, | ||
): typeof ReactTestUtils; | ||
@@ -212,3 +240,5 @@ /** | ||
export function isElementOfType<T extends HTMLElement>( | ||
element: ReactElement, type: string): element is ReactHTMLElement<T>; | ||
element: ReactElement, | ||
type: string, | ||
): element is ReactHTMLElement<T>; | ||
/** | ||
@@ -218,3 +248,5 @@ * Returns `true` if `element` is a React element whose type is of a React `componentClass`. | ||
export function isElementOfType<P extends DOMAttributes<{}>, T extends Element>( | ||
element: ReactElement, type: string): element is DOMElement<P, T>; | ||
element: ReactElement, | ||
type: string, | ||
): element is DOMElement<P, T>; | ||
/** | ||
@@ -224,3 +256,5 @@ * Returns `true` if `element` is a React element whose type is of a React `componentClass`. | ||
export function isElementOfType<P>( | ||
element: ReactElement, type: FC<P>): element is FunctionComponentElement<P>; | ||
element: ReactElement, | ||
type: FC<P>, | ||
): element is FunctionComponentElement<P>; | ||
/** | ||
@@ -230,3 +264,5 @@ * Returns `true` if `element` is a React element whose type is of a React `componentClass`. | ||
export function isElementOfType<P, T extends Component<P>, C extends ComponentClass<P>>( | ||
element: ReactElement, type: ClassType<P, T, C>): element is CElement<P, T>; | ||
element: ReactElement, | ||
type: ClassType<P, T, C>, | ||
): element is CElement<P, T>; | ||
@@ -245,3 +281,5 @@ /** | ||
export function isCompositeComponentWithType<T extends Component<any>, C extends ComponentClass<any>>( | ||
instance: ReactInstance, type: ClassType<any, T, C>): boolean; | ||
instance: ReactInstance, | ||
type: ClassType<any, T, C>, | ||
): boolean; | ||
@@ -255,3 +293,4 @@ /** | ||
root: Component<any>, | ||
fn: (i: ReactInstance) => boolean): ReactInstance[]; | ||
fn: (i: ReactInstance) => boolean, | ||
): ReactInstance[]; | ||
@@ -264,3 +303,4 @@ /** | ||
root: Component<any>, | ||
className: string): Element[]; | ||
className: string, | ||
): Element[]; | ||
/** | ||
@@ -273,3 +313,4 @@ * Like `scryRenderedDOMComponentsWithClass()` but expects there to be one result, | ||
root: Component<any>, | ||
className: string): Element; | ||
className: string, | ||
): Element; | ||
@@ -282,3 +323,4 @@ /** | ||
root: Component<any>, | ||
tagName: string): Element[]; | ||
tagName: string, | ||
): Element[]; | ||
/** | ||
@@ -291,3 +333,4 @@ * Like `scryRenderedDOMComponentsWithTag()` but expects there to be one result, | ||
root: Component<any>, | ||
tagName: string): Element; | ||
tagName: string, | ||
): Element; | ||
@@ -299,3 +342,4 @@ /** | ||
root: Component<any>, | ||
type: ClassType<any, T, C>): T[]; | ||
type: ClassType<any, T, C>, | ||
): T[]; | ||
@@ -309,3 +353,4 @@ /** | ||
root: Component<any>, | ||
type: ClassType<any, T, C>): T; | ||
type: ClassType<any, T, C>, | ||
): T; | ||
@@ -312,0 +357,0 @@ /** |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33375
769