@types/react 17.0.44 → 18.0.0
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 v17.0 → react}/LICENSE +0 -0
- react v17.0/README.md → react/README.md +1 -1
- react/experimental.d.ts +121 -0
- {react v17.0 → react}/global.d.ts +0 -0
- react v17.0/index.d.ts → react/index.d.ts +95 -75
- {react v17.0 → react}/jsx-dev-runtime.d.ts +0 -0
- {react v17.0 → react}/jsx-runtime.d.ts +0 -0
- react/next.d.ts +30 -0
- react v17.0/package.json → react/package.json +2 -2
{react v17.0 → react}/LICENSE
RENAMED
File without changes
|
@@ -5,7 +5,7 @@
|
|
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.
|
9
9
|
|
10
10
|
### Additional Details
|
11
11
|
* Last updated: Thu, 07 Apr 2022 17:31:22 GMT
|
react/experimental.d.ts
ADDED
@@ -0,0 +1,121 @@
|
|
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 interface SuspenseProps {
|
43
|
+
/**
|
44
|
+
* The presence of this prop indicates that the content is computationally expensive to render.
|
45
|
+
* In other words, the tree is CPU bound and not I/O bound (e.g. due to fetching data).
|
46
|
+
* @see {@link https://github.com/facebook/react/pull/19936}
|
47
|
+
*/
|
48
|
+
unstable_expectedLoadTime?: number | undefined;
|
49
|
+
}
|
50
|
+
|
51
|
+
export type SuspenseListRevealOrder = 'forwards' | 'backwards' | 'together';
|
52
|
+
export type SuspenseListTailMode = 'collapsed' | 'hidden';
|
53
|
+
|
54
|
+
export interface SuspenseListCommonProps {
|
55
|
+
/**
|
56
|
+
* Note that SuspenseList require more than one child;
|
57
|
+
* it is a runtime warning to provide only a single child.
|
58
|
+
*
|
59
|
+
* It does, however, allow those children to be wrapped inside a single
|
60
|
+
* level of `<React.Fragment>`.
|
61
|
+
*/
|
62
|
+
children: ReactElement | Iterable<ReactElement>;
|
63
|
+
}
|
64
|
+
|
65
|
+
interface DirectionalSuspenseListProps extends SuspenseListCommonProps {
|
66
|
+
/**
|
67
|
+
* Defines the order in which the `SuspenseList` children should be revealed.
|
68
|
+
*/
|
69
|
+
revealOrder: 'forwards' | 'backwards';
|
70
|
+
/**
|
71
|
+
* Dictates how unloaded items in a SuspenseList is shown.
|
72
|
+
*
|
73
|
+
* - By default, `SuspenseList` will show all fallbacks in the list.
|
74
|
+
* - `collapsed` shows only the next fallback in the list.
|
75
|
+
* - `hidden` doesn’t show any unloaded items.
|
76
|
+
*/
|
77
|
+
tail?: SuspenseListTailMode | undefined;
|
78
|
+
}
|
79
|
+
|
80
|
+
interface NonDirectionalSuspenseListProps extends SuspenseListCommonProps {
|
81
|
+
/**
|
82
|
+
* Defines the order in which the `SuspenseList` children should be revealed.
|
83
|
+
*/
|
84
|
+
revealOrder?: Exclude<SuspenseListRevealOrder, DirectionalSuspenseListProps['revealOrder']> | undefined;
|
85
|
+
/**
|
86
|
+
* The tail property is invalid when not using the `forwards` or `backwards` reveal orders.
|
87
|
+
*/
|
88
|
+
tail?: never | undefined;
|
89
|
+
}
|
90
|
+
|
91
|
+
export type SuspenseListProps = DirectionalSuspenseListProps | NonDirectionalSuspenseListProps;
|
92
|
+
|
93
|
+
/**
|
94
|
+
* `SuspenseList` helps coordinate many components that can suspend by orchestrating the order
|
95
|
+
* in which these components are revealed to the user.
|
96
|
+
*
|
97
|
+
* When multiple components need to fetch data, this data may arrive in an unpredictable order.
|
98
|
+
* However, if you wrap these items in a `SuspenseList`, React will not show an item in the list
|
99
|
+
* until previous items have been displayed (this behavior is adjustable).
|
100
|
+
*
|
101
|
+
* @see https://reactjs.org/docs/concurrent-mode-reference.html#suspenselist
|
102
|
+
* @see https://reactjs.org/docs/concurrent-mode-patterns.html#suspenselist
|
103
|
+
*/
|
104
|
+
export const SuspenseList: ExoticComponent<SuspenseListProps>;
|
105
|
+
|
106
|
+
/**
|
107
|
+
* this should be an internal type
|
108
|
+
*/
|
109
|
+
interface MutableSource<T> {
|
110
|
+
_source: T;
|
111
|
+
}
|
112
|
+
|
113
|
+
export type MutableSourceSubscribe<T> = (source: T, callback: () => void) => () => void;
|
114
|
+
|
115
|
+
// TODO: This may not be intentionally part of the experimental release considering useMutableSource is no longer available
|
116
|
+
/**
|
117
|
+
* @param source A source could be anything as long as they can be subscribed to and have a "version".
|
118
|
+
* @param getVersion A function returns a value which will change whenever part of the source changes.
|
119
|
+
*/
|
120
|
+
export function unstable_createMutableSource<T>(source: T, getVersion: () => any): MutableSource<T>;
|
121
|
+
}
|
File without changes
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// Type definitions for React
|
1
|
+
// Type definitions for React 18.0
|
2
2
|
// Project: http://facebook.github.io/react/
|
3
3
|
// Definitions by: Asana <https://asana.com>
|
4
4
|
// AssureSign <http://www.assuresign.com>
|
@@ -29,6 +29,10 @@
|
|
29
29
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
30
30
|
// TypeScript Version: 2.8
|
31
31
|
|
32
|
+
// NOTE: Users of the `experimental` builds of React should add a reference
|
33
|
+
// to 'react/experimental' in their project. See experimental.d.ts's top comment
|
34
|
+
// for reference and documentation on how exactly to do it.
|
35
|
+
|
32
36
|
/// <reference path="global.d.ts" />
|
33
37
|
|
34
38
|
import * as CSS from 'csstype';
|
@@ -52,6 +56,7 @@ type Booleanish = boolean | 'true' | 'false';
|
|
52
56
|
declare const UNDEFINED_VOID_ONLY: unique symbol;
|
53
57
|
// Destructors are only allowed to return void.
|
54
58
|
type Destructor = () => void | { [UNDEFINED_VOID_ONLY]: never };
|
59
|
+
type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
|
55
60
|
|
56
61
|
// tslint:disable-next-line:export-just-namespace
|
57
62
|
export = React;
|
@@ -67,10 +72,6 @@ declare namespace React {
|
|
67
72
|
[K in keyof JSX.IntrinsicElements]: P extends JSX.IntrinsicElements[K] ? K : never
|
68
73
|
}[keyof JSX.IntrinsicElements] |
|
69
74
|
ComponentType<P>;
|
70
|
-
/**
|
71
|
-
* @deprecated Please use `ElementType`
|
72
|
-
*/
|
73
|
-
type ReactType<P = any> = ElementType<P>;
|
74
75
|
type ComponentType<P = {}> = ComponentClass<P> | FunctionComponent<P>;
|
75
76
|
|
76
77
|
type JSXElementConstructor<P> =
|
@@ -147,11 +148,6 @@ declare namespace React {
|
|
147
148
|
P = Pick<ComponentProps<T>, Exclude<keyof ComponentProps<T>, 'key' | 'ref'>>
|
148
149
|
> extends ReactElement<P, Exclude<T, number>> { }
|
149
150
|
|
150
|
-
/**
|
151
|
-
* @deprecated Please use `FunctionComponentElement`
|
152
|
-
*/
|
153
|
-
type SFCElement<P> = FunctionComponentElement<P>;
|
154
|
-
|
155
151
|
interface FunctionComponentElement<P> extends ReactElement<P, FunctionComponent<P>> {
|
156
152
|
ref?: ('ref' extends keyof P ? P extends { ref?: infer R | undefined } ? R : never : never) | undefined;
|
157
153
|
}
|
@@ -229,7 +225,7 @@ declare namespace React {
|
|
229
225
|
* @deprecated Use either `ReactNode[]` if you need an array or `Iterable<ReactNode>` if its passed to a host component.
|
230
226
|
*/
|
231
227
|
interface ReactNodeArray extends ReadonlyArray<ReactNode> {}
|
232
|
-
type ReactFragment =
|
228
|
+
type ReactFragment = Iterable<ReactNode>;
|
233
229
|
type ReactNode = ReactChild | ReactFragment | ReactPortal | boolean | null | undefined;
|
234
230
|
|
235
231
|
//
|
@@ -388,16 +384,10 @@ declare namespace React {
|
|
388
384
|
interface SuspenseProps {
|
389
385
|
children?: ReactNode | undefined;
|
390
386
|
|
391
|
-
// TODO(react18): `fallback?: ReactNode;`
|
392
387
|
/** A fallback react tree to show when a Suspense child (like React.lazy) suspends */
|
393
|
-
fallback
|
388
|
+
fallback?: ReactNode;
|
394
389
|
}
|
395
390
|
|
396
|
-
// TODO(react18): Updated JSDoc to reflect that Suspense works on the server.
|
397
|
-
/**
|
398
|
-
* This feature is not yet available for server-side rendering.
|
399
|
-
* Suspense support will be added in a later release.
|
400
|
-
*/
|
401
391
|
const Suspense: ExoticComponent<SuspenseProps>;
|
402
392
|
const version: string;
|
403
393
|
|
@@ -468,8 +458,7 @@ declare namespace React {
|
|
468
458
|
*
|
469
459
|
* @see https://reactjs.org/docs/context.html
|
470
460
|
*/
|
471
|
-
|
472
|
-
context: any;
|
461
|
+
context: unknown;
|
473
462
|
|
474
463
|
constructor(props: Readonly<P> | P);
|
475
464
|
/**
|
@@ -489,12 +478,7 @@ declare namespace React {
|
|
489
478
|
forceUpdate(callback?: () => void): void;
|
490
479
|
render(): ReactNode;
|
491
480
|
|
492
|
-
|
493
|
-
// property is not available on `P` by default, even though you can
|
494
|
-
// always pass children as variadic arguments to `createElement`.
|
495
|
-
// In the future, if we can define its call signature conditionally
|
496
|
-
// on the existence of `children` in `P`, then we should remove this.
|
497
|
-
readonly props: Readonly<P> & Readonly<{ children?: ReactNode | undefined }>;
|
481
|
+
readonly props: Readonly<P>;
|
498
482
|
state: Readonly<S>;
|
499
483
|
/**
|
500
484
|
* @deprecated
|
@@ -521,26 +505,10 @@ declare namespace React {
|
|
521
505
|
// Class Interfaces
|
522
506
|
// ----------------------------------------------------------------------
|
523
507
|
|
524
|
-
/**
|
525
|
-
* @deprecated as of recent React versions, function components can no
|
526
|
-
* longer be considered 'stateless'. Please use `FunctionComponent` instead.
|
527
|
-
*
|
528
|
-
* @see [React Hooks](https://reactjs.org/docs/hooks-intro.html)
|
529
|
-
*/
|
530
|
-
type SFC<P = {}> = FunctionComponent<P>;
|
531
|
-
|
532
|
-
/**
|
533
|
-
* @deprecated as of recent React versions, function components can no
|
534
|
-
* longer be considered 'stateless'. Please use `FunctionComponent` instead.
|
535
|
-
*
|
536
|
-
* @see [React Hooks](https://reactjs.org/docs/hooks-intro.html)
|
537
|
-
*/
|
538
|
-
type StatelessComponent<P = {}> = FunctionComponent<P>;
|
539
|
-
|
540
508
|
type FC<P = {}> = FunctionComponent<P>;
|
541
509
|
|
542
510
|
interface FunctionComponent<P = {}> {
|
543
|
-
(props:
|
511
|
+
(props: P, context?: any): ReactElement<any, any> | null;
|
544
512
|
propTypes?: WeakValidationMap<P> | undefined;
|
545
513
|
contextTypes?: ValidationMap<any> | undefined;
|
546
514
|
defaultProps?: Partial<P> | undefined;
|
@@ -560,7 +528,7 @@ declare namespace React {
|
|
560
528
|
type ForwardedRef<T> = ((instance: T | null) => void) | MutableRefObject<T | null> | null;
|
561
529
|
|
562
530
|
interface ForwardRefRenderFunction<T, P = {}> {
|
563
|
-
(props:
|
531
|
+
(props: P, ref: ForwardedRef<T>): ReactElement | null;
|
564
532
|
displayName?: string | undefined;
|
565
533
|
// explicit rejected with `never` required due to
|
566
534
|
// https://github.com/microsoft/TypeScript/issues/36826
|
@@ -574,12 +542,6 @@ declare namespace React {
|
|
574
542
|
propTypes?: never | undefined;
|
575
543
|
}
|
576
544
|
|
577
|
-
/**
|
578
|
-
* @deprecated Use ForwardRefRenderFunction. forwardRef doesn't accept a
|
579
|
-
* "real" component.
|
580
|
-
*/
|
581
|
-
interface RefForwardingComponent <T, P = {}> extends ForwardRefRenderFunction<T, P> {}
|
582
|
-
|
583
545
|
interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> {
|
584
546
|
new (props: P, context?: any): Component<P, S>;
|
585
547
|
propTypes?: WeakValidationMap<P> | undefined;
|
@@ -854,7 +816,7 @@ declare namespace React {
|
|
854
816
|
|
855
817
|
function memo<P extends object>(
|
856
818
|
Component: FunctionComponent<P>,
|
857
|
-
propsAreEqual?: (prevProps: Readonly<
|
819
|
+
propsAreEqual?: (prevProps: Readonly<P>, nextProps: Readonly<P>) => boolean
|
858
820
|
): NamedExoticComponent<P>;
|
859
821
|
function memo<T extends ComponentType<any>>(
|
860
822
|
Component: T,
|
@@ -893,8 +855,7 @@ declare namespace React {
|
|
893
855
|
// The identity check is done with the SameValue algorithm (Object.is), which is stricter than ===
|
894
856
|
type ReducerStateWithoutAction<R extends ReducerWithoutAction<any>> =
|
895
857
|
R extends ReducerWithoutAction<infer S> ? S : never;
|
896
|
-
|
897
|
-
type DependencyList = ReadonlyArray<any>;
|
858
|
+
type DependencyList = ReadonlyArray<unknown>;
|
898
859
|
|
899
860
|
// NOTE: callbacks are _only_ allowed to return either void, or a destructor.
|
900
861
|
type EffectCallback = () => (void | Destructor);
|
@@ -1101,8 +1062,10 @@ declare namespace React {
|
|
1101
1062
|
* @version 16.8.0
|
1102
1063
|
* @see https://reactjs.org/docs/hooks-reference.html#usecallback
|
1103
1064
|
*/
|
1104
|
-
//
|
1105
|
-
|
1065
|
+
// A specific function type would not trigger implicit any.
|
1066
|
+
// See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/52873#issuecomment-845806435 for a comparison between `Function` and more specific types.
|
1067
|
+
// tslint:disable-next-line ban-types
|
1068
|
+
function useCallback<T extends Function>(callback: T, deps: DependencyList): T;
|
1106
1069
|
/**
|
1107
1070
|
* `useMemo` will only recompute the memoized value when one of the `deps` has changed.
|
1108
1071
|
*
|
@@ -1124,6 +1087,83 @@ declare namespace React {
|
|
1124
1087
|
// it's just the function name without the "use" prefix.
|
1125
1088
|
function useDebugValue<T>(value: T, format?: (value: T) => any): void;
|
1126
1089
|
|
1090
|
+
// must be synchronous
|
1091
|
+
export type TransitionFunction = () => VoidOrUndefinedOnly;
|
1092
|
+
// strange definition to allow vscode to show documentation on the invocation
|
1093
|
+
export interface TransitionStartFunction {
|
1094
|
+
/**
|
1095
|
+
* State updates caused inside the callback are allowed to be deferred.
|
1096
|
+
*
|
1097
|
+
* **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
|
1098
|
+
*
|
1099
|
+
* @param callback A _synchronous_ function which causes state updates that can be deferred.
|
1100
|
+
*/
|
1101
|
+
(callback: TransitionFunction): void;
|
1102
|
+
}
|
1103
|
+
|
1104
|
+
/**
|
1105
|
+
* Returns a deferred version of the value that may “lag behind” it for at most `timeoutMs`.
|
1106
|
+
*
|
1107
|
+
* This is commonly used to keep the interface responsive when you have something that renders immediately
|
1108
|
+
* based on user input and something that needs to wait for a data fetch.
|
1109
|
+
*
|
1110
|
+
* A good example of this is a text input.
|
1111
|
+
*
|
1112
|
+
* @param value The value that is going to be deferred
|
1113
|
+
*
|
1114
|
+
* @see https://reactjs.org/docs/concurrent-mode-reference.html#usedeferredvalue
|
1115
|
+
*/
|
1116
|
+
export function useDeferredValue<T>(value: T): T;
|
1117
|
+
|
1118
|
+
/**
|
1119
|
+
* Allows components to avoid undesirable loading states by waiting for content to load
|
1120
|
+
* before transitioning to the next screen. It also allows components to defer slower,
|
1121
|
+
* data fetching updates until subsequent renders so that more crucial updates can be
|
1122
|
+
* rendered immediately.
|
1123
|
+
*
|
1124
|
+
* The `useTransition` hook returns two values in an array.
|
1125
|
+
*
|
1126
|
+
* The first is a boolean, React’s way of informing us whether we’re waiting for the transition to finish.
|
1127
|
+
* The second is a function that takes a callback. We can use it to tell React which state we want to defer.
|
1128
|
+
*
|
1129
|
+
* **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
|
1130
|
+
*
|
1131
|
+
* @param config An optional object with `timeoutMs`
|
1132
|
+
*
|
1133
|
+
* @see https://reactjs.org/docs/concurrent-mode-reference.html#usetransition
|
1134
|
+
*/
|
1135
|
+
export function useTransition(): [boolean, TransitionStartFunction];
|
1136
|
+
|
1137
|
+
/**
|
1138
|
+
* Similar to `useTransition` but allows uses where hooks are not available.
|
1139
|
+
*
|
1140
|
+
* @param callback A _synchronous_ function which causes state updates that can be deferred.
|
1141
|
+
*/
|
1142
|
+
export function startTransition(scope: TransitionFunction): void;
|
1143
|
+
|
1144
|
+
export function useId(): string;
|
1145
|
+
|
1146
|
+
/**
|
1147
|
+
* @param effect Imperative function that can return a cleanup function
|
1148
|
+
* @param deps If present, effect will only activate if the values in the list change.
|
1149
|
+
*
|
1150
|
+
* @see https://github.com/facebook/react/pull/21913
|
1151
|
+
*/
|
1152
|
+
export function useInsertionEffect(effect: EffectCallback, deps?: DependencyList): void;
|
1153
|
+
|
1154
|
+
/**
|
1155
|
+
* @param subscribe
|
1156
|
+
* @param getSnapshot
|
1157
|
+
*
|
1158
|
+
* @see https://github.com/reactwg/react-18/discussions/86
|
1159
|
+
*/
|
1160
|
+
// keep in sync with `useSyncExternalStore` from `use-sync-external-store`
|
1161
|
+
export function useSyncExternalStore<Snapshot>(
|
1162
|
+
subscribe: (onStoreChange: () => void) => () => void,
|
1163
|
+
getSnapshot: () => Snapshot,
|
1164
|
+
getServerSnapshot?: () => Snapshot,
|
1165
|
+
): Snapshot;
|
1166
|
+
|
1127
1167
|
//
|
1128
1168
|
// Event System
|
1129
1169
|
// ----------------------------------------------------------------------
|
@@ -1308,26 +1348,6 @@ declare namespace React {
|
|
1308
1348
|
// Props / DOM Attributes
|
1309
1349
|
// ----------------------------------------------------------------------
|
1310
1350
|
|
1311
|
-
/**
|
1312
|
-
* @deprecated. This was used to allow clients to pass `ref` and `key`
|
1313
|
-
* to `createElement`, which is no longer necessary due to intersection
|
1314
|
-
* types. If you need to declare a props object before passing it to
|
1315
|
-
* `createElement` or a factory, use `ClassAttributes<T>`:
|
1316
|
-
*
|
1317
|
-
* ```ts
|
1318
|
-
* var b: Button | null;
|
1319
|
-
* var props: ButtonProps & ClassAttributes<Button> = {
|
1320
|
-
* ref: b => button = b, // ok!
|
1321
|
-
* label: "I'm a Button"
|
1322
|
-
* };
|
1323
|
-
* ```
|
1324
|
-
*/
|
1325
|
-
interface Props<T> {
|
1326
|
-
children?: ReactNode | undefined;
|
1327
|
-
key?: Key | undefined;
|
1328
|
-
ref?: LegacyRef<T> | undefined;
|
1329
|
-
}
|
1330
|
-
|
1331
1351
|
interface HTMLProps<T> extends AllHTMLAttributes<T>, ClassAttributes<T> {
|
1332
1352
|
}
|
1333
1353
|
|
File without changes
|
File without changes
|
react/next.d.ts
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
/**
|
2
|
+
* These are types for things that are present in the React `next` release channel.
|
3
|
+
*
|
4
|
+
* To load the types declared here in an actual project, there are three ways. The easiest one,
|
5
|
+
* if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section,
|
6
|
+
* is to add `"react/next"` to the `"types"` array.
|
7
|
+
*
|
8
|
+
* Alternatively, a specific import syntax can to be used from a typescript file.
|
9
|
+
* This module does not exist in reality, which is why the {} is important:
|
10
|
+
*
|
11
|
+
* ```ts
|
12
|
+
* import {} from 'react/next'
|
13
|
+
* ```
|
14
|
+
*
|
15
|
+
* It is also possible to include it through a triple-slash reference:
|
16
|
+
*
|
17
|
+
* ```ts
|
18
|
+
* /// <reference types="react/next" />
|
19
|
+
* ```
|
20
|
+
*
|
21
|
+
* Either the import or the reference only needs to appear once, anywhere in the project.
|
22
|
+
*/
|
23
|
+
|
24
|
+
// See https://github.com/facebook/react/blob/main/packages/react/src/React.js to see how the exports are declared,
|
25
|
+
|
26
|
+
import React = require('.');
|
27
|
+
|
28
|
+
export {};
|
29
|
+
|
30
|
+
declare module '.' {}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/react",
|
3
|
-
"version": "
|
3
|
+
"version": "18.0.0",
|
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": "
|
149
|
+
"typesPublisherContentHash": "6779161312d4a456b9a73a478b25f72f9b02fc5b0117762da5cfd6e0883bb745",
|
150
150
|
"typeScriptVersion": "3.9"
|
151
151
|
}
|