@types/react 17.0.43 → 17.0.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
File without changes
@@ -5,10 +5,10 @@
5
5
  This package contains type definitions for React (http://facebook.github.io/react/).
6
6
 
7
7
  # Details
8
- Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react.
8
+ Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react/v17.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Thu, 24 Mar 2022 22:01:43 GMT
11
+ * Last updated: Thu, 16 Jun 2022 09:31:35 GMT
12
12
  * Dependencies: [@types/csstype](https://npmjs.com/package/@types/csstype), [@types/prop-types](https://npmjs.com/package/@types/prop-types), [@types/scheduler](https://npmjs.com/package/@types/scheduler)
13
13
  * Global values: `React`
14
14
 
@@ -153,3 +153,5 @@ interface Text { }
153
153
  interface TouchList { }
154
154
  interface WebGLRenderingContext { }
155
155
  interface WebGL2RenderingContext { }
156
+
157
+ interface TrustedHTML { }
@@ -29,14 +29,6 @@
29
29
  // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
30
30
  // TypeScript Version: 2.8
31
31
 
32
- // NOTE: Users of the upcoming React 18 release should add a reference
33
- // to 'react/next' in their project. See next.d.ts's top comment
34
- // for reference and documentation on how exactly to do it.
35
-
36
- // NOTE: Users of the `experimental` builds of React should add a reference
37
- // to 'react/experimental' in their project. See experimental.d.ts's top comment
38
- // for reference and documentation on how exactly to do it.
39
-
40
32
  /// <reference path="global.d.ts" />
41
33
 
42
34
  import * as CSS from 'csstype';
@@ -1347,7 +1339,9 @@ declare namespace React {
1347
1339
  interface DOMAttributes<T> {
1348
1340
  children?: ReactNode | undefined;
1349
1341
  dangerouslySetInnerHTML?: {
1350
- __html: string;
1342
+ // Should be InnerHTML['innerHTML'].
1343
+ // But unfortunately we're mixing renderer-specific type declarations.
1344
+ __html: string | TrustedHTML;
1351
1345
  } | undefined;
1352
1346
 
1353
1347
  // Clipboard Events
@@ -2090,6 +2084,8 @@ declare namespace React {
2090
2084
  }
2091
2085
 
2092
2086
  interface DialogHTMLAttributes<T> extends HTMLAttributes<T> {
2087
+ onCancel?: ReactEventHandler<T> | undefined;
2088
+ onClose?: ReactEventHandler<T> | undefined;
2093
2089
  open?: boolean | undefined;
2094
2090
  }
2095
2091
 
File without changes
File without changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/react",
3
- "version": "17.0.43",
3
+ "version": "17.0.46",
4
4
  "description": "TypeScript definitions for React",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react",
6
6
  "license": "MIT",
@@ -146,6 +146,6 @@
146
146
  "@types/scheduler": "*",
147
147
  "csstype": "^3.0.2"
148
148
  },
149
- "typesPublisherContentHash": "eb0438d4dbd7569f29ddd1f4d8ee8a7e294faa1c5259c584487708a81306cc32",
150
- "typeScriptVersion": "3.9"
149
+ "typesPublisherContentHash": "dce66dea1dba969712cb4378e94d514431dce04b5657fab62a24220fbfb9cc14",
150
+ "typeScriptVersion": "4.0"
151
151
  }
react/experimental.d.ts DELETED
@@ -1,96 +0,0 @@
1
- /**
2
- * These are types for things that are present in the `experimental` builds of React but not yet
3
- * on a stable build.
4
- *
5
- * Once they are promoted to stable they can just be moved to the main index file.
6
- *
7
- * To load the types declared here in an actual project, there are three ways. The easiest one,
8
- * if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section,
9
- * is to add `"react/experimental"` to the `"types"` array.
10
- *
11
- * Alternatively, a specific import syntax can to be used from a typescript file.
12
- * This module does not exist in reality, which is why the {} is important:
13
- *
14
- * ```ts
15
- * import {} from 'react/experimental'
16
- * ```
17
- *
18
- * It is also possible to include it through a triple-slash reference:
19
- *
20
- * ```ts
21
- * /// <reference types="react/experimental" />
22
- * ```
23
- *
24
- * Either the import or the reference only needs to appear once, anywhere in the project.
25
- */
26
-
27
- // See https://github.com/facebook/react/blob/master/packages/react/src/React.js to see how the exports are declared,
28
- // and https://github.com/facebook/react/blob/master/packages/shared/ReactFeatureFlags.js to verify which APIs are
29
- // flagged experimental or not. Experimental APIs will be tagged with `__EXPERIMENTAL__`.
30
- //
31
- // For the inputs of types exported as simply a fiber tag, the `beginWork` function of ReactFiberBeginWork.js
32
- // is a good place to start looking for details; it generally calls prop validation functions or delegates
33
- // all tasks done as part of the render phase (the concurrent part of the React update cycle).
34
- //
35
- // Suspense-related handling can be found in ReactFiberThrow.js.
36
-
37
- import React = require('./next');
38
-
39
- export {};
40
-
41
- declare module '.' {
42
- export type SuspenseListRevealOrder = 'forwards' | 'backwards' | 'together';
43
- export type SuspenseListTailMode = 'collapsed' | 'hidden';
44
-
45
- export interface SuspenseListCommonProps {
46
- /**
47
- * Note that SuspenseList require more than one child;
48
- * it is a runtime warning to provide only a single child.
49
- *
50
- * It does, however, allow those children to be wrapped inside a single
51
- * level of `<React.Fragment>`.
52
- */
53
- children: ReactElement | Iterable<ReactElement>;
54
- }
55
-
56
- interface DirectionalSuspenseListProps extends SuspenseListCommonProps {
57
- /**
58
- * Defines the order in which the `SuspenseList` children should be revealed.
59
- */
60
- revealOrder: 'forwards' | 'backwards';
61
- /**
62
- * Dictates how unloaded items in a SuspenseList is shown.
63
- *
64
- * - By default, `SuspenseList` will show all fallbacks in the list.
65
- * - `collapsed` shows only the next fallback in the list.
66
- * - `hidden` doesn’t show any unloaded items.
67
- */
68
- tail?: SuspenseListTailMode | undefined;
69
- }
70
-
71
- interface NonDirectionalSuspenseListProps extends SuspenseListCommonProps {
72
- /**
73
- * Defines the order in which the `SuspenseList` children should be revealed.
74
- */
75
- revealOrder?: Exclude<SuspenseListRevealOrder, DirectionalSuspenseListProps['revealOrder']> | undefined;
76
- /**
77
- * The tail property is invalid when not using the `forwards` or `backwards` reveal orders.
78
- */
79
- tail?: never | undefined;
80
- }
81
-
82
- export type SuspenseListProps = DirectionalSuspenseListProps | NonDirectionalSuspenseListProps;
83
-
84
- /**
85
- * `SuspenseList` helps coordinate many components that can suspend by orchestrating the order
86
- * in which these components are revealed to the user.
87
- *
88
- * When multiple components need to fetch data, this data may arrive in an unpredictable order.
89
- * However, if you wrap these items in a `SuspenseList`, React will not show an item in the list
90
- * until previous items have been displayed (this behavior is adjustable).
91
- *
92
- * @see https://reactjs.org/docs/concurrent-mode-reference.html#suspenselist
93
- * @see https://reactjs.org/docs/concurrent-mode-patterns.html#suspenselist
94
- */
95
- export const SuspenseList: ExoticComponent<SuspenseListProps>;
96
- }
react/next.d.ts DELETED
@@ -1,148 +0,0 @@
1
- /**
2
- * These are types for things that are present in the upcoming React 18 release.
3
- *
4
- * Once React 18 is released they can just be moved to the main index file.
5
- *
6
- * To load the types declared here in an actual project, there are three ways. The easiest one,
7
- * if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section,
8
- * is to add `"react/next"` to the `"types"` array.
9
- *
10
- * Alternatively, a specific import syntax can to be used from a typescript file.
11
- * This module does not exist in reality, which is why the {} is important:
12
- *
13
- * ```ts
14
- * import {} from 'react/next'
15
- * ```
16
- *
17
- * It is also possible to include it through a triple-slash reference:
18
- *
19
- * ```ts
20
- * /// <reference types="react/next" />
21
- * ```
22
- *
23
- * Either the import or the reference only needs to appear once, anywhere in the project.
24
- */
25
-
26
- // See https://github.com/facebook/react/blob/master/packages/react/src/React.js to see how the exports are declared,
27
-
28
- import React = require('.');
29
-
30
- export {};
31
-
32
- declare const UNDEFINED_VOID_ONLY: unique symbol;
33
- type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
34
-
35
- declare module '.' {
36
- export interface SuspenseProps {
37
- /**
38
- * The presence of this prop indicates that the content is computationally expensive to render.
39
- * In other words, the tree is CPU bound and not I/O bound (e.g. due to fetching data).
40
- * @see {@link https://github.com/facebook/react/pull/19936}
41
- */
42
- unstable_expectedLoadTime?: number | undefined;
43
- }
44
-
45
- // must be synchronous
46
- export type TransitionFunction = () => VoidOrUndefinedOnly;
47
- // strange definition to allow vscode to show documentation on the invocation
48
- export interface TransitionStartFunction {
49
- /**
50
- * State updates caused inside the callback are allowed to be deferred.
51
- *
52
- * **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
53
- *
54
- * @param callback A _synchronous_ function which causes state updates that can be deferred.
55
- */
56
- (callback: TransitionFunction): void;
57
- }
58
-
59
- /**
60
- * Returns a deferred version of the value that may “lag behind” it for at most `timeoutMs`.
61
- *
62
- * This is commonly used to keep the interface responsive when you have something that renders immediately
63
- * based on user input and something that needs to wait for a data fetch.
64
- *
65
- * A good example of this is a text input.
66
- *
67
- * @param value The value that is going to be deferred
68
- *
69
- * @see https://reactjs.org/docs/concurrent-mode-reference.html#usedeferredvalue
70
- */
71
- export function useDeferredValue<T>(value: T): T;
72
-
73
- /**
74
- * Allows components to avoid undesirable loading states by waiting for content to load
75
- * before transitioning to the next screen. It also allows components to defer slower,
76
- * data fetching updates until subsequent renders so that more crucial updates can be
77
- * rendered immediately.
78
- *
79
- * The `useTransition` hook returns two values in an array.
80
- *
81
- * The first is a boolean, React’s way of informing us whether we’re waiting for the transition to finish.
82
- * The second is a function that takes a callback. We can use it to tell React which state we want to defer.
83
- *
84
- * **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
85
- *
86
- * @param config An optional object with `timeoutMs`
87
- *
88
- * @see https://reactjs.org/docs/concurrent-mode-reference.html#usetransition
89
- */
90
- export function useTransition(): [boolean, TransitionStartFunction];
91
-
92
- /**
93
- * Similar to `useTransition` but allows uses where hooks are not available.
94
- *
95
- * @param callback A _synchronous_ function which causes state updates that can be deferred.
96
- */
97
- export function startTransition(scope: TransitionFunction): void;
98
-
99
- export function useId(): string;
100
-
101
- /**
102
- * this should be an internal type
103
- */
104
- interface MutableSource<T> {
105
- _source: T;
106
- }
107
-
108
- export type MutableSourceSubscribe<T> = (source: T, callback: () => void) => () => void;
109
-
110
- /**
111
- * @param source A source could be anything as long as they can be subscribed to and have a "version".
112
- * @param getVersion A function returns a value which will change whenever part of the source changes.
113
- */
114
- export function unstable_createMutableSource<T>(source: T, getVersion: () => any): MutableSource<T>;
115
-
116
- /**
117
- * useMutableSource() enables React components to safely and efficiently read from a mutable external source in Concurrent Mode.
118
- * The API will detect mutations that occur during a render to avoid tearing
119
- * and it will automatically schedule updates when the source is mutated.
120
- * @param MutableSource
121
- * @param getSnapshot
122
- * @param subscribe
123
- *
124
- * @see https://github.com/reactjs/rfcs/blob/master/text/0147-use-mutable-source.md
125
- */
126
- export function unstable_useMutableSource<T, TResult extends unknown>(MutableSource: MutableSource<T>, getSnapshot: (source: T) => TResult, subscribe: MutableSourceSubscribe<T>): TResult;
127
-
128
- /**
129
- * @param effect Imperative function that can return a cleanup function
130
- * @param deps If present, effect will only activate if the values in the list change.
131
- *
132
- * @see https://github.com/facebook/react/pull/21913
133
- */
134
- export function useInsertionEffect(effect: EffectCallback, deps?: DependencyList): void;
135
-
136
- /**
137
- * @param subscribe
138
- * @param getSnapshot
139
- *
140
- * @see https://github.com/reactwg/react-18/discussions/86
141
- */
142
- // keep in sync with `useSyncExternalStore` from `use-sync-external-store`
143
- export function useSyncExternalStore<Snapshot>(
144
- subscribe: (onStoreChange: () => void) => () => void,
145
- getSnapshot: () => Snapshot,
146
- getServerSnapshot?: () => Snapshot,
147
- ): Snapshot;
148
- }