@types/react 18.2.5 → 18.2.6

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 CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for React (https://react.dev/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Thu, 04 May 2023 13:32:50 GMT
11
+ * Last updated: Sat, 06 May 2023 11:32:49 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
 
react/index.d.ts CHANGED
@@ -1398,6 +1398,9 @@ declare namespace React {
1398
1398
  interface SVGProps<T> extends SVGAttributes<T>, ClassAttributes<T> {
1399
1399
  }
1400
1400
 
1401
+ interface SVGLineElementAttributes<T> extends SVGProps<T> {}
1402
+ interface SVGTextElementAttributes<T> extends SVGProps<T> {}
1403
+
1401
1404
  interface DOMAttributes<T> {
1402
1405
  children?: ReactNode | undefined;
1403
1406
  dangerouslySetInnerHTML?: {
@@ -3115,6 +3118,19 @@ declare namespace React {
3115
3118
  */
3116
3119
  componentStack: string;
3117
3120
  }
3121
+
3122
+ namespace JSX {
3123
+ interface Element extends GlobalJSXElement {}
3124
+ interface ElementClass extends GlobalJSXElementClass {}
3125
+ interface ElementAttributesProperty extends GlobalJSXElementAttributesProperty {}
3126
+ interface ElementChildrenAttribute extends GlobalJSXElementChildrenAttribute {}
3127
+
3128
+ type LibraryManagedAttributes<C, P> = GlobalJSXLibraryManagedAttributes<C, P>;
3129
+
3130
+ interface IntrinsicAttributes extends GlobalJSXIntrinsicAttributes {}
3131
+ interface IntrinsicClassAttributes<T> extends GlobalJSXIntrinsicClassAttributes<T> {}
3132
+ interface IntrinsicElements extends GlobalJSXIntrinsicElements {}
3133
+ }
3118
3134
  }
3119
3135
 
3120
3136
  // naked 'any' type in a conditional type will short circuit and union both the then/else branches
@@ -3162,6 +3178,9 @@ type ReactManagedAttributes<C, P> = C extends { propTypes: infer T; defaultProps
3162
3178
  : P;
3163
3179
 
3164
3180
  declare global {
3181
+ /**
3182
+ * @deprecated Use `React.JSX` instead of the global `JSX` namespace.
3183
+ */
3165
3184
  namespace JSX {
3166
3185
  interface Element extends React.ReactElement<any, any> { }
3167
3186
  interface ElementClass extends React.Component<any> {
@@ -3342,7 +3361,7 @@ declare global {
3342
3361
  foreignObject: React.SVGProps<SVGForeignObjectElement>;
3343
3362
  g: React.SVGProps<SVGGElement>;
3344
3363
  image: React.SVGProps<SVGImageElement>;
3345
- line: React.SVGProps<SVGLineElement>;
3364
+ line: React.SVGLineElementAttributes<SVGLineElement>;
3346
3365
  linearGradient: React.SVGProps<SVGLinearGradientElement>;
3347
3366
  marker: React.SVGProps<SVGMarkerElement>;
3348
3367
  mask: React.SVGProps<SVGMaskElement>;
@@ -3357,7 +3376,7 @@ declare global {
3357
3376
  stop: React.SVGProps<SVGStopElement>;
3358
3377
  switch: React.SVGProps<SVGSwitchElement>;
3359
3378
  symbol: React.SVGProps<SVGSymbolElement>;
3360
- text: React.SVGProps<SVGTextElement>;
3379
+ text: React.SVGTextElementAttributes<SVGTextElement>;
3361
3380
  textPath: React.SVGProps<SVGTextPathElement>;
3362
3381
  tspan: React.SVGProps<SVGTSpanElement>;
3363
3382
  use: React.SVGProps<SVGUseElement>;
@@ -3365,3 +3384,18 @@ declare global {
3365
3384
  }
3366
3385
  }
3367
3386
  }
3387
+
3388
+ // React.JSX needs to point to global.JSX to keep global module augmentations intact.
3389
+ // But we can't access global.JSX so we need to create these aliases instead.
3390
+ // Once the global JSX namespace will be removed we replace React.JSX with the contents of global.JSX
3391
+ interface GlobalJSXElement extends JSX.Element {}
3392
+ interface GlobalJSXElementClass extends JSX.ElementClass {}
3393
+ interface GlobalJSXElementAttributesProperty extends JSX.ElementAttributesProperty {}
3394
+ interface GlobalJSXElementChildrenAttribute extends JSX.ElementChildrenAttribute {}
3395
+
3396
+ type GlobalJSXLibraryManagedAttributes<C, P> = JSX.LibraryManagedAttributes<C, P>;
3397
+
3398
+ interface GlobalJSXIntrinsicAttributes extends JSX.IntrinsicAttributes {}
3399
+ interface GlobalJSXIntrinsicClassAttributes<T> extends JSX.IntrinsicClassAttributes<T> {}
3400
+
3401
+ interface GlobalJSXIntrinsicElements extends JSX.IntrinsicElements {}
@@ -1,2 +1,12 @@
1
- // Expose `JSX` namespace in `global` namespace
2
- import './';
1
+ import * as React from './';
2
+
3
+ export namespace JSX {
4
+ interface Element extends React.JSX.Element {}
5
+ interface ElementClass extends React.JSX.ElementClass {}
6
+ interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {}
7
+ interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {}
8
+ type LibraryManagedAttributes<C, P> = React.JSX.LibraryManagedAttributes<C, P>;
9
+ interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {}
10
+ interface IntrinsicClassAttributes<T> extends React.JSX.IntrinsicClassAttributes<T> {}
11
+ interface IntrinsicElements extends React.JSX.IntrinsicElements {}
12
+ }
react/jsx-runtime.d.ts CHANGED
@@ -1,2 +1,12 @@
1
- // Expose `JSX` namespace in `global` namespace
2
- import './';
1
+ import * as React from './';
2
+
3
+ export namespace JSX {
4
+ interface Element extends React.JSX.Element {}
5
+ interface ElementClass extends React.JSX.ElementClass {}
6
+ interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {}
7
+ interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {}
8
+ type LibraryManagedAttributes<C, P> = React.JSX.LibraryManagedAttributes<C, P>;
9
+ interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {}
10
+ interface IntrinsicClassAttributes<T> extends React.JSX.IntrinsicClassAttributes<T> {}
11
+ interface IntrinsicElements extends React.JSX.IntrinsicElements {}
12
+ }
react/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/react",
3
- "version": "18.2.5",
3
+ "version": "18.2.6",
4
4
  "description": "TypeScript definitions for React",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react",
6
6
  "license": "MIT",
@@ -158,7 +158,7 @@
158
158
  "@types/scheduler": "*",
159
159
  "csstype": "^3.0.2"
160
160
  },
161
- "typesPublisherContentHash": "ce0153f6bb1a5154576d9159e1711034f75efa459f9b1e0c773d78e6e18a9fda",
161
+ "typesPublisherContentHash": "c2bc059f2a425eccfea97f64d97f713fa3727098c1d3ee4e21b0c9d9b5775f19",
162
162
  "typeScriptVersion": "4.3",
163
163
  "exports": {
164
164
  ".": {
react/ts5.0/index.d.ts CHANGED
@@ -1366,6 +1366,9 @@ declare namespace React {
1366
1366
  interface SVGProps<T> extends SVGAttributes<T>, ClassAttributes<T> {
1367
1367
  }
1368
1368
 
1369
+ interface SVGLineElementAttributes<T> extends SVGProps<T> {}
1370
+ interface SVGTextElementAttributes<T> extends SVGProps<T> {}
1371
+
1369
1372
  interface DOMAttributes<T> {
1370
1373
  children?: ReactNode | undefined;
1371
1374
  dangerouslySetInnerHTML?: {
@@ -3083,6 +3086,19 @@ declare namespace React {
3083
3086
  */
3084
3087
  componentStack: string;
3085
3088
  }
3089
+
3090
+ namespace JSX {
3091
+ interface Element extends GlobalJSXElement {}
3092
+ interface ElementClass extends GlobalJSXElementClass {}
3093
+ interface ElementAttributesProperty extends GlobalJSXElementAttributesProperty {}
3094
+ interface ElementChildrenAttribute extends GlobalJSXElementChildrenAttribute {}
3095
+
3096
+ type LibraryManagedAttributes<C, P> = GlobalJSXLibraryManagedAttributes<C, P>;
3097
+
3098
+ interface IntrinsicAttributes extends GlobalJSXIntrinsicAttributes {}
3099
+ interface IntrinsicClassAttributes<T> extends GlobalJSXIntrinsicClassAttributes<T> {}
3100
+ interface IntrinsicElements extends GlobalJSXIntrinsicElements {}
3101
+ }
3086
3102
  }
3087
3103
 
3088
3104
  // naked 'any' type in a conditional type will short circuit and union both the then/else branches
@@ -3130,6 +3146,9 @@ type ReactManagedAttributes<C, P> = C extends { propTypes: infer T; defaultProps
3130
3146
  : P;
3131
3147
 
3132
3148
  declare global {
3149
+ /**
3150
+ * @deprecated Use `React.JSX` instead of the global `JSX` namespace.
3151
+ */
3133
3152
  namespace JSX {
3134
3153
  interface Element extends React.ReactElement<any, any> { }
3135
3154
  interface ElementClass extends React.Component<any> {
@@ -3310,7 +3329,7 @@ declare global {
3310
3329
  foreignObject: React.SVGProps<SVGForeignObjectElement>;
3311
3330
  g: React.SVGProps<SVGGElement>;
3312
3331
  image: React.SVGProps<SVGImageElement>;
3313
- line: React.SVGProps<SVGLineElement>;
3332
+ line: React.SVGLineElementAttributes<SVGLineElement>;
3314
3333
  linearGradient: React.SVGProps<SVGLinearGradientElement>;
3315
3334
  marker: React.SVGProps<SVGMarkerElement>;
3316
3335
  mask: React.SVGProps<SVGMaskElement>;
@@ -3325,7 +3344,7 @@ declare global {
3325
3344
  stop: React.SVGProps<SVGStopElement>;
3326
3345
  switch: React.SVGProps<SVGSwitchElement>;
3327
3346
  symbol: React.SVGProps<SVGSymbolElement>;
3328
- text: React.SVGProps<SVGTextElement>;
3347
+ text: React.SVGTextElementAttributes<SVGTextElement>;
3329
3348
  textPath: React.SVGProps<SVGTextPathElement>;
3330
3349
  tspan: React.SVGProps<SVGTSpanElement>;
3331
3350
  use: React.SVGProps<SVGUseElement>;
@@ -3333,3 +3352,18 @@ declare global {
3333
3352
  }
3334
3353
  }
3335
3354
  }
3355
+
3356
+ // React.JSX needs to point to global.JSX to keep global module augmentations intact.
3357
+ // But we can't access global.JSX so we need to create these aliases instead.
3358
+ // Once the global JSX namespace will be removed we replace React.JSX with the contents of global.JSX
3359
+ interface GlobalJSXElement extends JSX.Element {}
3360
+ interface GlobalJSXElementClass extends JSX.ElementClass {}
3361
+ interface GlobalJSXElementAttributesProperty extends JSX.ElementAttributesProperty {}
3362
+ interface GlobalJSXElementChildrenAttribute extends JSX.ElementChildrenAttribute {}
3363
+
3364
+ type GlobalJSXLibraryManagedAttributes<C, P> = JSX.LibraryManagedAttributes<C, P>;
3365
+
3366
+ interface GlobalJSXIntrinsicAttributes extends JSX.IntrinsicAttributes {}
3367
+ interface GlobalJSXIntrinsicClassAttributes<T> extends JSX.IntrinsicClassAttributes<T> {}
3368
+
3369
+ interface GlobalJSXIntrinsicElements extends JSX.IntrinsicElements {}
@@ -1,2 +1,12 @@
1
- // Expose `JSX` namespace in `global` namespace
2
- import './';
1
+ import * as React from './';
2
+
3
+ export namespace JSX {
4
+ interface Element extends React.JSX.Element {}
5
+ interface ElementClass extends React.JSX.ElementClass {}
6
+ interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {}
7
+ interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {}
8
+ type LibraryManagedAttributes<C, P> = React.JSX.LibraryManagedAttributes<C, P>;
9
+ interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {}
10
+ interface IntrinsicClassAttributes<T> extends React.JSX.IntrinsicClassAttributes<T> {}
11
+ interface IntrinsicElements extends React.JSX.IntrinsicElements {}
12
+ }
@@ -1,2 +1,12 @@
1
- // Expose `JSX` namespace in `global` namespace
2
- import './';
1
+ import * as React from './';
2
+
3
+ export namespace JSX {
4
+ interface Element extends React.JSX.Element {}
5
+ interface ElementClass extends React.JSX.ElementClass {}
6
+ interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {}
7
+ interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {}
8
+ type LibraryManagedAttributes<C, P> = React.JSX.LibraryManagedAttributes<C, P>;
9
+ interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {}
10
+ interface IntrinsicClassAttributes<T> extends React.JSX.IntrinsicClassAttributes<T> {}
11
+ interface IntrinsicElements extends React.JSX.IntrinsicElements {}
12
+ }