[react] add typings for react-close-on-escape (#29789)

* [react] add typings for react-close-on-escape

* TASK: make component default export
This commit is contained in:
Robert Baruck
2018-10-16 12:56:31 -07:00
committed by Sheetal Nandi
parent 09a6331c19
commit 2ebc83a318
4 changed files with 54 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
// Type definitions for react-close-on-escape 3.0
// Project: https://github.com/conorhastings/react-close-on-escape#readme
// Definitions by: Robert Baruck <https://github.com/JamesAlias>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as React from "react";
export interface CloseOnEscapeProps {
/**
* Callback triggered by pressing ESC
*/
onEscape(): void;
}
export default class CloseOnEscape extends React.Component<CloseOnEscapeProps> {}
@@ -0,0 +1,12 @@
import * as React from 'react';
import CloseOnEscape from 'react-close-on-escape';
const onEscapeCallback = () => {};
// $ExpectError
const missingRequired = <CloseOnEscape />;
// $ExpectError
const invalidExample = <CloseOnEscape onEscape={true} />;
const validExample = <CloseOnEscape onEscape={onEscapeCallback} />;
+25
View File
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"lib": [
"es6"
],
"jsx": "react"
},
"files": [
"index.d.ts",
"react-close-on-escape-tests.tsx"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }