feat(react): add StrictMode definition (#24629)

This commit is contained in:
Joha2n
2018-04-02 11:59:11 +01:00
committed by John Reilly
parent def3d5d177
commit 5a3e0b2f34
2 changed files with 10 additions and 1 deletions
+3 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for React 16.1
// Type definitions for React 16.3
// Project: http://facebook.github.io/react/
// Definitions by: Asana <https://asana.com>
// AssureSign <http://www.assuresign.com>
@@ -16,6 +16,7 @@
// Josh Rutherford <https://github.com/theruther4d>
// Guilherme Hübner <https://github.com/guilhermehubner>
// Josh Goldberg <https://github.com/joshuakgoldberg>
// Johann Rakotoharisoa <https://github.com/jrakotoharisoa>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -268,6 +269,7 @@ declare namespace React {
const Children: ReactChildren;
const Fragment: ComponentType;
const StrictMode: ComponentType;
const version: string;
//
+7
View File
@@ -89,6 +89,13 @@ const StatelessComponentWithoutProps: React.SFC = (props) => {
</React.Fragment>
</div>;
// Strict Mode
<div>
<React.StrictMode>
<div />
</React.StrictMode>
</div>;
// Below tests that setState() works properly for both regular and callback modes
class SetStateTest extends React.Component<{}, { foo: boolean, bar: boolean }> {
handleSomething = () => {