@cabloy/types-react 19.2.7

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.
@@ -0,0 +1,45 @@
1
+ import * as React from "./";
2
+ export { Fragment } from "./";
3
+
4
+ export namespace JSX {
5
+ type ElementType = React.JSX.ElementType;
6
+ interface Element extends React.JSX.Element {}
7
+ interface ElementClass extends React.JSX.ElementClass {}
8
+ interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {}
9
+ interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {}
10
+ type LibraryManagedAttributes<C, P> = React.JSX.LibraryManagedAttributes<C, P>;
11
+ interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {}
12
+ interface IntrinsicClassAttributes<T> extends React.JSX.IntrinsicClassAttributes<T> {}
13
+ interface IntrinsicElements extends React.JSX.IntrinsicElements {}
14
+ }
15
+
16
+ export interface JSXSource {
17
+ /**
18
+ * The source file where the element originates from.
19
+ */
20
+ fileName?: string | undefined;
21
+
22
+ /**
23
+ * The line number where the element was created.
24
+ */
25
+ lineNumber?: number | undefined;
26
+
27
+ /**
28
+ * The column number where the element was created.
29
+ */
30
+ columnNumber?: number | undefined;
31
+ }
32
+
33
+ /**
34
+ * Create a React element.
35
+ *
36
+ * You should not use this function directly. Use JSX and a transpiler instead.
37
+ */
38
+ export function jsxDEV(
39
+ type: React.ElementType,
40
+ props: unknown,
41
+ key: React.Key | undefined,
42
+ isStatic: boolean,
43
+ source?: JSXSource,
44
+ self?: unknown,
45
+ ): React.ReactElement;
@@ -0,0 +1,36 @@
1
+ import * as React from "./";
2
+ export { Fragment } from "./";
3
+
4
+ export namespace JSX {
5
+ type ElementType = React.JSX.ElementType;
6
+ interface Element extends React.JSX.Element {}
7
+ interface ElementClass extends React.JSX.ElementClass {}
8
+ interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {}
9
+ interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {}
10
+ type LibraryManagedAttributes<C, P> = React.JSX.LibraryManagedAttributes<C, P>;
11
+ interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {}
12
+ interface IntrinsicClassAttributes<T> extends React.JSX.IntrinsicClassAttributes<T> {}
13
+ interface IntrinsicElements extends React.JSX.IntrinsicElements {}
14
+ }
15
+
16
+ /**
17
+ * Create a React element.
18
+ *
19
+ * You should not use this function directly. Use JSX and a transpiler instead.
20
+ */
21
+ export function jsx(
22
+ type: React.ElementType,
23
+ props: unknown,
24
+ key?: React.Key,
25
+ ): React.ReactElement;
26
+
27
+ /**
28
+ * Create a React element.
29
+ *
30
+ * You should not use this function directly. Use JSX and a transpiler instead.
31
+ */
32
+ export function jsxs(
33
+ type: React.ElementType,
34
+ props: unknown,
35
+ key?: React.Key,
36
+ ): React.ReactElement;
package/package.json ADDED
@@ -0,0 +1,210 @@
1
+ {
2
+ "name": "@cabloy/types-react",
3
+ "version": "19.2.7",
4
+ "description": "TypeScript definitions for react",
5
+ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react",
6
+ "license": "MIT",
7
+ "contributors": [
8
+ {
9
+ "name": "Asana",
10
+ "url": "https://asana.com"
11
+ },
12
+ {
13
+ "name": "AssureSign",
14
+ "url": "http://www.assuresign.com"
15
+ },
16
+ {
17
+ "name": "Microsoft",
18
+ "url": "https://microsoft.com"
19
+ },
20
+ {
21
+ "name": "John Reilly",
22
+ "githubUsername": "johnnyreilly",
23
+ "url": "https://github.com/johnnyreilly"
24
+ },
25
+ {
26
+ "name": "Benoit Benezech",
27
+ "githubUsername": "bbenezech",
28
+ "url": "https://github.com/bbenezech"
29
+ },
30
+ {
31
+ "name": "Patricio Zavolinsky",
32
+ "githubUsername": "pzavolinsky",
33
+ "url": "https://github.com/pzavolinsky"
34
+ },
35
+ {
36
+ "name": "Eric Anderson",
37
+ "githubUsername": "ericanderson",
38
+ "url": "https://github.com/ericanderson"
39
+ },
40
+ {
41
+ "name": "Dovydas Navickas",
42
+ "githubUsername": "DovydasNavickas",
43
+ "url": "https://github.com/DovydasNavickas"
44
+ },
45
+ {
46
+ "name": "Josh Rutherford",
47
+ "githubUsername": "theruther4d",
48
+ "url": "https://github.com/theruther4d"
49
+ },
50
+ {
51
+ "name": "Guilherme Hübner",
52
+ "githubUsername": "guilhermehubner",
53
+ "url": "https://github.com/guilhermehubner"
54
+ },
55
+ {
56
+ "name": "Ferdy Budhidharma",
57
+ "githubUsername": "ferdaber",
58
+ "url": "https://github.com/ferdaber"
59
+ },
60
+ {
61
+ "name": "Johann Rakotoharisoa",
62
+ "githubUsername": "jrakotoharisoa",
63
+ "url": "https://github.com/jrakotoharisoa"
64
+ },
65
+ {
66
+ "name": "Olivier Pascal",
67
+ "githubUsername": "pascaloliv",
68
+ "url": "https://github.com/pascaloliv"
69
+ },
70
+ {
71
+ "name": "Martin Hochel",
72
+ "githubUsername": "hotell",
73
+ "url": "https://github.com/hotell"
74
+ },
75
+ {
76
+ "name": "Frank Li",
77
+ "githubUsername": "franklixuefei",
78
+ "url": "https://github.com/franklixuefei"
79
+ },
80
+ {
81
+ "name": "Jessica Franco",
82
+ "githubUsername": "Jessidhia",
83
+ "url": "https://github.com/Jessidhia"
84
+ },
85
+ {
86
+ "name": "Saransh Kataria",
87
+ "githubUsername": "saranshkataria",
88
+ "url": "https://github.com/saranshkataria"
89
+ },
90
+ {
91
+ "name": "Kanitkorn Sujautra",
92
+ "githubUsername": "lukyth",
93
+ "url": "https://github.com/lukyth"
94
+ },
95
+ {
96
+ "name": "Sebastian Silbermann",
97
+ "githubUsername": "eps1lon",
98
+ "url": "https://github.com/eps1lon"
99
+ },
100
+ {
101
+ "name": "Kyle Scully",
102
+ "githubUsername": "zieka",
103
+ "url": "https://github.com/zieka"
104
+ },
105
+ {
106
+ "name": "Cong Zhang",
107
+ "githubUsername": "dancerphil",
108
+ "url": "https://github.com/dancerphil"
109
+ },
110
+ {
111
+ "name": "Dimitri Mitropoulos",
112
+ "githubUsername": "dimitropoulos",
113
+ "url": "https://github.com/dimitropoulos"
114
+ },
115
+ {
116
+ "name": "JongChan Choi",
117
+ "githubUsername": "disjukr",
118
+ "url": "https://github.com/disjukr"
119
+ },
120
+ {
121
+ "name": "Victor Magalhães",
122
+ "githubUsername": "vhfmag",
123
+ "url": "https://github.com/vhfmag"
124
+ },
125
+ {
126
+ "name": "Priyanshu Rav",
127
+ "githubUsername": "priyanshurav",
128
+ "url": "https://github.com/priyanshurav"
129
+ },
130
+ {
131
+ "name": "Dmitry Semigradsky",
132
+ "githubUsername": "Semigradsky",
133
+ "url": "https://github.com/Semigradsky"
134
+ },
135
+ {
136
+ "name": "Matt Pocock",
137
+ "githubUsername": "mattpocock",
138
+ "url": "https://github.com/mattpocock"
139
+ }
140
+ ],
141
+ "main": "",
142
+ "types": "index.d.ts",
143
+ "typesVersions": {
144
+ "<=5.0": {
145
+ "*": [
146
+ "ts5.0/*"
147
+ ]
148
+ }
149
+ },
150
+ "exports": {
151
+ ".": {
152
+ "types@<=5.0": {
153
+ "default": "./ts5.0/index.d.ts"
154
+ },
155
+ "types": {
156
+ "default": "./index.d.ts"
157
+ }
158
+ },
159
+ "./canary": {
160
+ "types@<=5.0": {
161
+ "default": "./ts5.0/canary.d.ts"
162
+ },
163
+ "types": {
164
+ "default": "./canary.d.ts"
165
+ }
166
+ },
167
+ "./compiler-runtime": {
168
+ "types": {
169
+ "default": "./compiler-runtime.d.ts"
170
+ }
171
+ },
172
+ "./experimental": {
173
+ "types@<=5.0": {
174
+ "default": "./ts5.0/experimental.d.ts"
175
+ },
176
+ "types": {
177
+ "default": "./experimental.d.ts"
178
+ }
179
+ },
180
+ "./jsx-runtime": {
181
+ "types@<=5.0": {
182
+ "default": "./ts5.0/jsx-runtime.d.ts"
183
+ },
184
+ "types": {
185
+ "default": "./jsx-runtime.d.ts"
186
+ }
187
+ },
188
+ "./jsx-dev-runtime": {
189
+ "types@<=5.0": {
190
+ "default": "./ts5.0/jsx-dev-runtime.d.ts"
191
+ },
192
+ "types": {
193
+ "default": "./jsx-dev-runtime.d.ts"
194
+ }
195
+ },
196
+ "./package.json": "./package.json"
197
+ },
198
+ "repository": {
199
+ "type": "git",
200
+ "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
201
+ "directory": "types/react"
202
+ },
203
+ "dependencies": {
204
+ "csstype": "^3.2.2"
205
+ },
206
+ "peerDependencies": {},
207
+ "typesPublisherContentHash": "fd69ea47f2fc8e9d139677eb6bcca67ee4b3ac279ce5ceb2e6e23ce8403c356d",
208
+ "typeScriptVersion": "5.2",
209
+ "scripts": {}
210
+ }
@@ -0,0 +1,120 @@
1
+ /**
2
+ * These are types for things that are present in the React `canary` 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/canary"` 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/canary'
13
+ * ```
14
+ *
15
+ * It is also possible to include it through a triple-slash reference:
16
+ *
17
+ * ```ts
18
+ * /// <reference types="react/canary" />
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 const UNDEFINED_VOID_ONLY: unique symbol;
31
+ type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
32
+
33
+ declare module "." {
34
+ export function unstable_useCacheRefresh(): () => void;
35
+
36
+ // @enableViewTransition
37
+ export interface ViewTransitionInstance {
38
+ /**
39
+ * The {@link ViewTransitionProps name} that was used in the corresponding {@link ViewTransition} component or `"auto"` if the `name` prop was omitted.
40
+ */
41
+ name: string;
42
+ }
43
+
44
+ export type ViewTransitionClassPerType = Record<"default" | (string & {}), "none" | "auto" | (string & {})>;
45
+ export type ViewTransitionClass = ViewTransitionClassPerType | ViewTransitionClassPerType[string];
46
+
47
+ export interface ViewTransitionProps {
48
+ children?: ReactNode | undefined;
49
+ /**
50
+ * Assigns the {@link https://developer.chrome.com/blog/view-transitions-update-io24#view-transition-class `view-transition-class`} class to the underlying DOM node.
51
+ */
52
+ default?: ViewTransitionClass | undefined;
53
+ /**
54
+ * Combined with {@link className} if this `<ViewTransition>` or its parent Component is mounted and there's no other with the same name being deleted.
55
+ * `"none"` is a special value that deactivates the view transition name under that condition.
56
+ */
57
+ enter?: ViewTransitionClass | undefined;
58
+ /**
59
+ * Combined with {@link className} if this `<ViewTransition>` or its parent Component is unmounted and there's no other with the same name being deleted.
60
+ * `"none"` is a special value that deactivates the view transition name under that condition.
61
+ */
62
+ exit?: ViewTransitionClass | undefined;
63
+ /**
64
+ * "auto" will automatically assign a view-transition-name to the inner DOM node.
65
+ * That way you can add a View Transition to a Component without controlling its DOM nodes styling otherwise.
66
+ *
67
+ * A difference between this and the browser's built-in view-transition-name: auto is that switching the DOM nodes within the `<ViewTransition>` component preserves the same name so this example cross-fades between the DOM nodes instead of causing an exit and enter.
68
+ * @default "auto"
69
+ */
70
+ name?: "auto" | (string & {}) | undefined;
71
+ /**
72
+ * The `<ViewTransition>` or its parent Component is mounted and there's no other `<ViewTransition>` with the same name being deleted.
73
+ */
74
+ onEnter?: (instance: ViewTransitionInstance, types: Array<string>) => void;
75
+ /**
76
+ * The `<ViewTransition>` or its parent Component is unmounted and there's no other `<ViewTransition>` with the same name being deleted.
77
+ */
78
+ onExit?: (instance: ViewTransitionInstance, types: Array<string>) => void;
79
+ /**
80
+ * This `<ViewTransition>` is being mounted and another `<ViewTransition>` instance with the same name is being unmounted elsewhere.
81
+ */
82
+ onShare?: (instance: ViewTransitionInstance, types: Array<string>) => void;
83
+ /**
84
+ * The content of `<ViewTransition>` has changed either due to DOM mutations or because an inner child `<ViewTransition>` has resized.
85
+ */
86
+ onUpdate?: (instance: ViewTransitionInstance, types: Array<string>) => void;
87
+ ref?: Ref<ViewTransitionInstance> | undefined;
88
+ /**
89
+ * Combined with {@link className} if this `<ViewTransition>` is being mounted and another instance with the same name is being unmounted elsewhere.
90
+ * `"none"` is a special value that deactivates the view transition name under that condition.
91
+ */
92
+ share?: ViewTransitionClass | undefined;
93
+ /**
94
+ * Combined with {@link className} if the content of this `<ViewTransition>` has changed either due to DOM mutations or because an inner child has resized.
95
+ * `"none"` is a special value that deactivates the view transition name under that condition.
96
+ */
97
+ update?: ViewTransitionClass | undefined;
98
+ }
99
+
100
+ /**
101
+ * Opt-in for using {@link https://developer.mozilla.org/en-US/docs/Web/API/View_Transition_API View Transitions} in React.
102
+ * View Transitions only trigger for async updates like {@link startTransition}, {@link useDeferredValue}, Actions or <{@link Suspense}> revealing from fallback to content.
103
+ * Synchronous updates provide an opt-out but also guarantee that they commit immediately which View Transitions can't.
104
+ *
105
+ * @see {@link https://react.dev/reference/react/ViewTransition `<ViewTransition>` reference documentation}
106
+ */
107
+ export const ViewTransition: ExoticComponent<ViewTransitionProps>;
108
+
109
+ /**
110
+ * @see {@link https://react.dev/reference/react/addTransitionType `addTransitionType` reference documentation}
111
+ */
112
+ export function addTransitionType(type: string): void;
113
+
114
+ // @enableFragmentRefs
115
+ export interface FragmentInstance {}
116
+
117
+ export interface FragmentProps {
118
+ ref?: Ref<FragmentInstance> | undefined;
119
+ }
120
+ }
@@ -0,0 +1,147 @@
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("./canary");
38
+
39
+ export {};
40
+
41
+ declare const UNDEFINED_VOID_ONLY: unique symbol;
42
+ type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
43
+
44
+ declare module "." {
45
+ export interface SuspenseProps {
46
+ // @enableCPUSuspense
47
+ /**
48
+ * The presence of this prop indicates that the content is computationally expensive to render.
49
+ * In other words, the tree is CPU bound and not I/O bound (e.g. due to fetching data).
50
+ * @see {@link https://github.com/facebook/react/pull/19936}
51
+ */
52
+ defer?: boolean | undefined;
53
+ }
54
+
55
+ export type SuspenseListRevealOrder = "forwards" | "backwards" | "together" | "independent";
56
+ export type SuspenseListTailMode = "collapsed" | "hidden" | "visible";
57
+
58
+ export interface SuspenseListCommonProps {
59
+ }
60
+
61
+ interface DirectionalSuspenseListProps extends SuspenseListCommonProps {
62
+ /**
63
+ * Note that SuspenseList require more than one child;
64
+ * it is a runtime warning to provide only a single child.
65
+ *
66
+ * It does, however, allow those children to be wrapped inside a single
67
+ * level of `<React.Fragment>`.
68
+ */
69
+ children: Iterable<ReactElement> | AsyncIterable<ReactElement>;
70
+ /**
71
+ * Defines the order in which the `SuspenseList` children should be revealed.
72
+ * @default "forwards"
73
+ */
74
+ revealOrder?: "forwards" | "backwards" | "unstable_legacy-backwards" | undefined;
75
+ /**
76
+ * Dictates how unloaded items in a SuspenseList is shown.
77
+ *
78
+ * - `collapsed` shows only the next fallback in the list.
79
+ * - `hidden` doesn't show any unloaded items.
80
+ * - `visible` shows all fallbacks in the list.
81
+ *
82
+ * @default "hidden"
83
+ */
84
+ tail?: SuspenseListTailMode | undefined;
85
+ }
86
+
87
+ interface NonDirectionalSuspenseListProps extends SuspenseListCommonProps {
88
+ children: ReactNode;
89
+ /**
90
+ * Defines the order in which the `SuspenseList` children should be revealed.
91
+ */
92
+ revealOrder: Exclude<SuspenseListRevealOrder, DirectionalSuspenseListProps["revealOrder"]>;
93
+ /**
94
+ * The tail property is invalid when not using the `forwards` or `backwards` reveal orders.
95
+ */
96
+ tail?: never;
97
+ }
98
+
99
+ export type SuspenseListProps = DirectionalSuspenseListProps | NonDirectionalSuspenseListProps;
100
+
101
+ /**
102
+ * `SuspenseList` helps coordinate many components that can suspend by orchestrating the order
103
+ * in which these components are revealed to the user.
104
+ *
105
+ * When multiple components need to fetch data, this data may arrive in an unpredictable order.
106
+ * However, if you wrap these items in a `SuspenseList`, React will not show an item in the list
107
+ * until previous items have been displayed (this behavior is adjustable).
108
+ *
109
+ * @see https://reactjs.org/docs/concurrent-mode-reference.html#suspenselist
110
+ * @see https://reactjs.org/docs/concurrent-mode-patterns.html#suspenselist
111
+ */
112
+ export const unstable_SuspenseList: ExoticComponent<SuspenseListProps>;
113
+
114
+ type Reference = object;
115
+ type TaintableUniqueValue = string | bigint | ArrayBufferView;
116
+ function experimental_taintUniqueValue(
117
+ message: string | undefined,
118
+ lifetime: Reference,
119
+ value: TaintableUniqueValue,
120
+ ): void;
121
+ function experimental_taintObjectReference(message: string | undefined, object: Reference): void;
122
+
123
+ // @enableGestureTransition
124
+ // Implemented by the specific renderer e.g. `react-dom`.
125
+ // Keep in mind that augmented interfaces merge their JSDoc so if you put
126
+ // JSDoc here and in the renderer, the IDE will display both.
127
+ export interface GestureProvider {}
128
+ export interface GestureOptions {
129
+ rangeStart?: number | undefined;
130
+ rangeEnd?: number | undefined;
131
+ }
132
+ /** */
133
+ export function unstable_startGestureTransition(
134
+ provider: GestureProvider,
135
+ scope: () => void,
136
+ options?: GestureOptions,
137
+ ): () => void;
138
+
139
+ // @enableSrcObject
140
+ interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_IMG_SRC_TYPES {
141
+ srcObject: Blob;
142
+ }
143
+
144
+ interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_MEDIA_SRC_TYPES {
145
+ srcObject: Blob | MediaSource | MediaStream;
146
+ }
147
+ }