mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
[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:
committed by
Sheetal Nandi
parent
09a6331c19
commit
2ebc83a318
+16
@@ -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} />;
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user