@types/react 16.9.47 → 16.9.51
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.
- react/README.md +1 -1
- react/experimental.d.ts +22 -0
- react/index.d.ts +18 -4
- react/package.json +3 -3
react/README.md
CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for React (http://facebook.github.io/reac
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react.
|
9
9
|
|
10
10
|
### Additional Details
|
11
|
-
* Last updated:
|
11
|
+
* Last updated: Mon, 05 Oct 2020 18:02:24 GMT
|
12
12
|
* Dependencies: [@types/csstype](https://npmjs.com/package/@types/csstype), [@types/prop-types](https://npmjs.com/package/@types/prop-types)
|
13
13
|
* Global values: `React`
|
14
14
|
|
react/experimental.d.ts
CHANGED
@@ -163,4 +163,26 @@ declare module '.' {
|
|
163
163
|
* @see https://reactjs.org/docs/concurrent-mode-reference.html#usetransition
|
164
164
|
*/
|
165
165
|
export function unstable_useTransition(config?: SuspenseConfig | null): [TransitionStartFunction, boolean];
|
166
|
+
|
167
|
+
/**
|
168
|
+
* @private
|
169
|
+
*/
|
170
|
+
const opaqueIdentifierBranding: unique symbol;
|
171
|
+
/**
|
172
|
+
* WARNING: Don't use this as a `string`.
|
173
|
+
*
|
174
|
+
* This is an opaque type that is not supposed to type-check structurally.
|
175
|
+
* It is only valid if returned from React methods and passed to React e.g. `<button aria-labelledby={opaqueIdentifier} />`
|
176
|
+
*/
|
177
|
+
// We can't create a type that would be rejected for string concatenation or `.toString()` calls.
|
178
|
+
// So in order to not have to add `string | OpaqueIdentifier` to every react-dom host prop we intersect it with `string`.
|
179
|
+
type OpaqueIdentifier = string & {
|
180
|
+
readonly [opaqueIdentifierBranding]: unknown;
|
181
|
+
// While this would cause `const stringified: string = opaqueIdentifier.toString()` to not type-check it also adds completions while typing.
|
182
|
+
// It would also still allow string concatenation.
|
183
|
+
// Unsure which is better. Not type-checking or not suggesting.
|
184
|
+
// toString(): void;
|
185
|
+
};
|
186
|
+
|
187
|
+
export function unstable_useOpaqueIdentifier(): OpaqueIdentifier;
|
166
188
|
}
|
react/index.d.ts
CHANGED
@@ -475,12 +475,12 @@ declare namespace React {
|
|
475
475
|
// TODO (TypeScript 3.0): unknown
|
476
476
|
context: any;
|
477
477
|
|
478
|
-
constructor(props: Readonly<P>);
|
478
|
+
constructor(props: Readonly<P> | P);
|
479
479
|
/**
|
480
480
|
* @deprecated
|
481
481
|
* @see https://reactjs.org/docs/legacy-context.html
|
482
482
|
*/
|
483
|
-
constructor(props: P, context
|
483
|
+
constructor(props: P, context: any);
|
484
484
|
|
485
485
|
// We MUST keep setState() as a unified signature because it allows proper checking of the method return type.
|
486
486
|
// See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18365#issuecomment-351013257
|
@@ -551,6 +551,16 @@ declare namespace React {
|
|
551
551
|
displayName?: string;
|
552
552
|
}
|
553
553
|
|
554
|
+
type VFC<P = {}> = VoidFunctionComponent<P>;
|
555
|
+
|
556
|
+
interface VoidFunctionComponent<P = {}> {
|
557
|
+
(props: P, context?: any): ReactElement<any, any> | null;
|
558
|
+
propTypes?: WeakValidationMap<P>;
|
559
|
+
contextTypes?: ValidationMap<any>;
|
560
|
+
defaultProps?: Partial<P>;
|
561
|
+
displayName?: string;
|
562
|
+
}
|
563
|
+
|
554
564
|
interface ForwardRefRenderFunction<T, P = {}> {
|
555
565
|
(props: PropsWithChildren<P>, ref: ((instance: T | null) => void) | MutableRefObject<T | null> | null): ReactElement | null;
|
556
566
|
displayName?: string;
|
@@ -905,7 +915,7 @@ declare namespace React {
|
|
905
915
|
* @see https://reactjs.org/docs/hooks-reference.html#usestate
|
906
916
|
*/
|
907
917
|
function useState<S>(initialState: S | (() => S)): [S, Dispatch<SetStateAction<S>>];
|
908
|
-
// convenience overload when first argument is
|
918
|
+
// convenience overload when first argument is omitted
|
909
919
|
/**
|
910
920
|
* Returns a stateful value, and a function to update it.
|
911
921
|
*
|
@@ -956,7 +966,7 @@ declare namespace React {
|
|
956
966
|
* @see https://reactjs.org/docs/hooks-reference.html#usereducer
|
957
967
|
*/
|
958
968
|
// overload where "I" may be a subset of ReducerState<R>; used to provide autocompletion.
|
959
|
-
// If "I" matches ReducerState<R> exactly then the last overload will allow initializer to be
|
969
|
+
// If "I" matches ReducerState<R> exactly then the last overload will allow initializer to be omitted.
|
960
970
|
// the last overload effectively behaves as if the identity function (x => x) is the initializer.
|
961
971
|
function useReducer<R extends Reducer<any, any>, I>(
|
962
972
|
reducer: R,
|
@@ -2025,14 +2035,18 @@ declare namespace React {
|
|
2025
2035
|
allow?: string;
|
2026
2036
|
allowFullScreen?: boolean;
|
2027
2037
|
allowTransparency?: boolean;
|
2038
|
+
/** @deprecated */
|
2028
2039
|
frameBorder?: number | string;
|
2029
2040
|
height?: number | string;
|
2030
2041
|
loading?: "eager" | "lazy";
|
2042
|
+
/** @deprecated */
|
2031
2043
|
marginHeight?: number;
|
2044
|
+
/** @deprecated */
|
2032
2045
|
marginWidth?: number;
|
2033
2046
|
name?: string;
|
2034
2047
|
referrerPolicy?: string;
|
2035
2048
|
sandbox?: string;
|
2049
|
+
/** @deprecated */
|
2036
2050
|
scrolling?: string;
|
2037
2051
|
seamless?: boolean;
|
2038
2052
|
src?: string;
|
react/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/react",
|
3
|
-
"version": "16.9.
|
3
|
+
"version": "16.9.51",
|
4
4
|
"description": "TypeScript definitions for React",
|
5
5
|
"license": "MIT",
|
6
6
|
"contributors": [
|
@@ -144,6 +144,6 @@
|
|
144
144
|
"@types/prop-types": "*",
|
145
145
|
"csstype": "^3.0.2"
|
146
146
|
},
|
147
|
-
"typesPublisherContentHash": "
|
148
|
-
"typeScriptVersion": "3.
|
147
|
+
"typesPublisherContentHash": "e6d1e8790b01a3fa2da65495350765d8a8d615619c5b759fee32719b160b6d2e",
|
148
|
+
"typeScriptVersion": "3.2"
|
149
149
|
}
|