@types/react 16.9.9 → 16.9.13

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
@@ -5,12 +5,12 @@
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
- Additional Details
11
- * Last updated: Wed, 16 Oct 2019 18:09:53 GMT
12
- * Dependencies: @types/csstype, @types/prop-types
13
- * Global values: React
10
+ ### Additional Details
11
+ * Last updated: Sat, 23 Nov 2019 20:10:45 GMT
12
+ * Dependencies: [@types/csstype](https://npmjs.com/package/@types/csstype), [@types/prop-types](https://npmjs.com/package/@types/prop-types)
13
+ * Global values: `React`
14
14
 
15
15
  # Credits
16
- These definitions were written by Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>, John Reilly <https://github.com/johnnyreilly>, Benoit Benezech <https://github.com/bbenezech>, Patricio Zavolinsky <https://github.com/pzavolinsky>, Digiguru <https://github.com/digiguru>, Eric Anderson <https://github.com/ericanderson>, Dovydas Navickas <https://github.com/DovydasNavickas>, Josh Rutherford <https://github.com/theruther4d>, Guilherme Hübner <https://github.com/guilhermehubner>, Ferdy Budhidharma <https://github.com/ferdaber>, Johann Rakotoharisoa <https://github.com/jrakotoharisoa>, Olivier Pascal <https://github.com/pascaloliv>, Martin Hochel <https://github.com/hotell>, Frank Li <https://github.com/franklixuefei>, Jessica Franco <https://github.com/Jessidhia>, Saransh Kataria <https://github.com/saranshkataria>, Kanitkorn Sujautra <https://github.com/lukyth>, Sebastian Silbermann <https://github.com/eps1lon>, and Kyle Scully <https://github.com/zieka>.
16
+ These definitions were written by Asana (https://asana.com), AssureSign (http://www.assuresign.com), Microsoft (https://microsoft.com), John Reilly (https://github.com/johnnyreilly), Benoit Benezech (https://github.com/bbenezech), Patricio Zavolinsky (https://github.com/pzavolinsky), Digiguru (https://github.com/digiguru), Eric Anderson (https://github.com/ericanderson), Dovydas Navickas (https://github.com/DovydasNavickas), Josh Rutherford (https://github.com/theruther4d), Guilherme Hübner (https://github.com/guilhermehubner), Ferdy Budhidharma (https://github.com/ferdaber), Johann Rakotoharisoa (https://github.com/jrakotoharisoa), Olivier Pascal (https://github.com/pascaloliv), Martin Hochel (https://github.com/hotell), Frank Li (https://github.com/franklixuefei), Jessica Franco (https://github.com/Jessidhia), Saransh Kataria (https://github.com/saranshkataria), Kanitkorn Sujautra (https://github.com/lukyth), Sebastian Silbermann (https://github.com/eps1lon), and Kyle Scully (https://github.com/zieka).
@@ -0,0 +1,166 @@
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('.');
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;
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']>;
76
+ /**
77
+ * The tail property is invalid when not using the `forwards` or `backwards` reveal orders.
78
+ */
79
+ tail?: never;
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
+
97
+ export interface SuspenseConfig extends TimeoutConfig {
98
+ busyDelayMs?: number;
99
+ busyMinDurationMs?: number;
100
+ }
101
+
102
+ // undocumented, considered for removal
103
+ export function unstable_withSuspenseConfig(
104
+ scope: () => void | undefined,
105
+ config: SuspenseConfig | null | undefined,
106
+ ): void;
107
+
108
+ export interface TimeoutConfig {
109
+ /**
110
+ * This timeout (in milliseconds) tells React how long to wait before showing the next state.
111
+ *
112
+ * React will always try to use a shorter lag when network and device allows it.
113
+ *
114
+ * **NOTE: We recommend that you share Suspense Config between different modules.**
115
+ */
116
+ timeoutMs: number;
117
+ }
118
+
119
+ // must be synchronous
120
+ export type TransitionFunction = () => void | undefined;
121
+ // strange definition to allow vscode to show documentation on the invocation
122
+ export interface TransitionStartFunction {
123
+ /**
124
+ * State updates caused inside the callback are allowed to be deferred.
125
+ *
126
+ * **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
127
+ *
128
+ * @param callback A _synchronous_ function which causes state updates that can be deferred.
129
+ */
130
+ (callback: TransitionFunction): void;
131
+ }
132
+
133
+ /**
134
+ * Returns a deferred version of the value that may “lag behind” it for at most `timeoutMs`.
135
+ *
136
+ * This is commonly used to keep the interface responsive when you have something that renders immediately
137
+ * based on user input and something that needs to wait for a data fetch.
138
+ *
139
+ * A good example of this is a text input.
140
+ *
141
+ * @param value The value that is going to be deferred
142
+ * @param config An optional object with `timeoutMs`
143
+ *
144
+ * @see https://reactjs.org/docs/concurrent-mode-reference.html#usedeferredvalue
145
+ */
146
+ export function useDeferredValue<T>(value: T, config?: TimeoutConfig | null): T;
147
+
148
+ /**
149
+ * Allows components to avoid undesirable loading states by waiting for content to load
150
+ * before transitioning to the next screen. It also allows components to defer slower,
151
+ * data fetching updates until subsequent renders so that more crucial updates can be
152
+ * rendered immediately.
153
+ *
154
+ * The `useTransition` hook returns two values in an array.
155
+ *
156
+ * The first is a function that takes a callback. We can use it to tell React which state we want to defer.
157
+ * The seconda boolean. It’s React’s way of informing us whether we’re waiting for the transition to finish.
158
+ *
159
+ * **If some state update causes a component to suspend, that state update should be wrapped in a transition.**
160
+ *
161
+ * @param config An optional object with `timeoutMs`
162
+ *
163
+ * @see https://reactjs.org/docs/concurrent-mode-reference.html#usetransition
164
+ */
165
+ export function useTransition(config?: SuspenseConfig | null): [TransitionStartFunction, boolean];
166
+ }
react/global.d.ts CHANGED
@@ -2,6 +2,9 @@
2
2
  React projects that don't include the DOM library need these interfaces to compile.
3
3
  React Native applications use React, but there is no DOM available. The JavaScript runtime
4
4
  is ES6/ES2015 only. These definitions allow such projects to compile with only `--lib ES6`.
5
+
6
+ Warning: all of these interfaces are empty. If you want type definitions for various properties
7
+ (such as HTMLInputElement.prototype.value), you need to add `--lib DOM` (via command line or tsconfig.json).
5
8
  */
6
9
 
7
10
  interface Event { }
react/index.d.ts CHANGED
@@ -24,6 +24,10 @@
24
24
  // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
25
25
  // TypeScript Version: 2.8
26
26
 
27
+ // NOTE: Users of the `experimental` builds of React should add a reference
28
+ // to 'react/experimental' in their project. See experimental.d.ts's top comment
29
+ // for reference and documentation on how exactly to do it.
30
+
27
31
  /// <reference path="global.d.ts" />
28
32
 
29
33
  import * as CSS from 'csstype';
@@ -338,6 +342,8 @@ declare namespace React {
338
342
  displayName?: string;
339
343
  }
340
344
  function createContext<T>(
345
+ // If you thought this should be optional, see
346
+ // https://github.com/DefinitelyTyped/DefinitelyTyped/pull/24509#issuecomment-382213106
341
347
  defaultValue: T,
342
348
  calculateChangedBits?: (prev: T, next: T) => number
343
349
  ): Context<T>;
@@ -353,6 +359,12 @@ declare namespace React {
353
359
 
354
360
  /** A fallback react tree to show when a Suspense child (like React.lazy) suspends */
355
361
  fallback: NonNullable<ReactNode>|null;
362
+ /**
363
+ * Tells React whether to “skip” revealing this boundary during the initial load.
364
+ * This API will likely be removed in a future release.
365
+ */
366
+ // NOTE: this is unflagged and is respected even in stable builds
367
+ unstable_avoidThisFallback?: boolean;
356
368
  }
357
369
  /**
358
370
  * This feature is not yet available for server-side rendering.
@@ -1657,6 +1669,7 @@ declare namespace React {
1657
1669
  style?: CSSProperties;
1658
1670
  tabIndex?: number;
1659
1671
  title?: string;
1672
+ translate?: 'yes' | 'no';
1660
1673
 
1661
1674
  // Unknown
1662
1675
  radioGroup?: string; // <command>, <menuitem>
@@ -2183,6 +2196,7 @@ declare namespace React {
2183
2196
  headers?: string;
2184
2197
  rowSpan?: number;
2185
2198
  scope?: string;
2199
+ abbr?: string;
2186
2200
  valign?: "top" | "middle" | "bottom" | "baseline";
2187
2201
  }
2188
2202
 
@@ -2192,6 +2206,7 @@ declare namespace React {
2192
2206
  headers?: string;
2193
2207
  rowSpan?: number;
2194
2208
  scope?: string;
2209
+ abbr?: string;
2195
2210
  }
2196
2211
 
2197
2212
  interface TimeHTMLAttributes<T> extends HTMLAttributes<T> {
react/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/react",
3
- "version": "16.9.9",
3
+ "version": "16.9.13",
4
4
  "description": "TypeScript definitions for React",
5
5
  "license": "MIT",
6
6
  "contributors": [
@@ -108,7 +108,7 @@
108
108
  }
109
109
  ],
110
110
  "main": "",
111
- "types": "index",
111
+ "types": "index.d.ts",
112
112
  "repository": {
113
113
  "type": "git",
114
114
  "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
@@ -119,6 +119,6 @@
119
119
  "@types/prop-types": "*",
120
120
  "csstype": "^2.2.0"
121
121
  },
122
- "typesPublisherContentHash": "7de3d69e84f5af61b3bc760bd4f2a18634fcbf57e7bf7cc4e0306aadb498307e",
122
+ "typesPublisherContentHash": "8b210364cfb98b8b56a7788c5f8fa667ff53f93eb5c90934e24bf36e68ebc397",
123
123
  "typeScriptVersion": "2.8"
124
124
  }