@types/react 16.9.7 → 16.9.11

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,9 +8,9 @@ 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: Tue, 15 Oct 2019 18:43:08 GMT
11
+ * Last updated: Fri, 25 Oct 2019 08:56:09 GMT
12
12
  * Dependencies: @types/csstype, @types/prop-types
13
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>, and Sebastian Silbermann <https://github.com/eps1lon>.
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
@@ -20,9 +20,14 @@
20
20
  // Saransh Kataria <https://github.com/saranshkataria>
21
21
  // Kanitkorn Sujautra <https://github.com/lukyth>
22
22
  // Sebastian Silbermann <https://github.com/eps1lon>
23
+ // Kyle Scully <https://github.com/zieka>
23
24
  // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
24
25
  // TypeScript Version: 2.8
25
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
+
26
31
  /// <reference path="global.d.ts" />
27
32
 
28
33
  import * as CSS from 'csstype';
@@ -337,6 +342,8 @@ declare namespace React {
337
342
  displayName?: string;
338
343
  }
339
344
  function createContext<T>(
345
+ // If you thought this should be optional, see
346
+ // https://github.com/DefinitelyTyped/DefinitelyTyped/pull/24509#issuecomment-382213106
340
347
  defaultValue: T,
341
348
  calculateChangedBits?: (prev: T, next: T) => number
342
349
  ): Context<T>;
@@ -352,6 +359,12 @@ declare namespace React {
352
359
 
353
360
  /** A fallback react tree to show when a Suspense child (like React.lazy) suspends */
354
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;
355
368
  }
356
369
  /**
357
370
  * This feature is not yet available for server-side rendering.
@@ -416,6 +429,7 @@ declare namespace React {
416
429
  /**
417
430
  * If using the new style context, re-declare this in your class to be the
418
431
  * `React.ContextType` of your `static contextType`.
432
+ * Should be used with type annotation or static contextType.
419
433
  *
420
434
  * ```ts
421
435
  * static contextType = MyContext
@@ -425,8 +439,7 @@ declare namespace React {
425
439
  * declare context: React.ContextType<typeof MyContext>
426
440
  * ```
427
441
  *
428
- * @deprecated if used without a type annotation, or without static contextType
429
- * @see https://reactjs.org/docs/legacy-context.html
442
+ * @see https://reactjs.org/docs/context.html
430
443
  */
431
444
  // TODO (TypeScript 3.0): unknown
432
445
  context: any;
@@ -1658,8 +1671,6 @@ declare namespace React {
1658
1671
  title?: string;
1659
1672
 
1660
1673
  // Unknown
1661
- inputMode?: string;
1662
- is?: string;
1663
1674
  radioGroup?: string; // <command>, <menuitem>
1664
1675
 
1665
1676
  // WAI-ARIA
@@ -1688,6 +1699,18 @@ declare namespace React {
1688
1699
  results?: number;
1689
1700
  security?: string;
1690
1701
  unselectable?: 'on' | 'off';
1702
+
1703
+ // Living Standard
1704
+ /**
1705
+ * Hints at the type of data that might be entered by the user while editing the element or its contents
1706
+ * @see https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute
1707
+ */
1708
+ inputMode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';
1709
+ /**
1710
+ * Specify that a standard HTML element should behave like a defined custom built-in element
1711
+ * @see https://html.spec.whatwg.org/multipage/custom-elements.html#attr-is
1712
+ */
1713
+ is?: string;
1691
1714
  }
1692
1715
 
1693
1716
  interface AllHTMLAttributes<T> extends HTMLAttributes<T> {
react/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/react",
3
- "version": "16.9.7",
3
+ "version": "16.9.11",
4
4
  "description": "TypeScript definitions for React",
5
5
  "license": "MIT",
6
6
  "contributors": [
@@ -100,6 +100,11 @@
100
100
  "name": "Sebastian Silbermann",
101
101
  "url": "https://github.com/eps1lon",
102
102
  "githubUsername": "eps1lon"
103
+ },
104
+ {
105
+ "name": "Kyle Scully",
106
+ "url": "https://github.com/zieka",
107
+ "githubUsername": "zieka"
103
108
  }
104
109
  ],
105
110
  "main": "",
@@ -114,6 +119,6 @@
114
119
  "@types/prop-types": "*",
115
120
  "csstype": "^2.2.0"
116
121
  },
117
- "typesPublisherContentHash": "b1ff71010d2ecb83b6032e7198d45276c40c4d2be6d392fe5e6a48f3f8b5eea7",
122
+ "typesPublisherContentHash": "59a76ac3cf8d9766c117506cb0118cf5b72d6dfded31ffa59a86c43a2ff80faa",
118
123
  "typeScriptVersion": "2.8"
119
124
  }