mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Added typedef for @reach/alert (#35509)
This commit is contained in:
parent
56395c2fc1
commit
60d1e6c75b
13
types/reach__alert/index.d.ts
vendored
Normal file
13
types/reach__alert/index.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
// Type definitions for @reach/alert 0.1
|
||||
// Project: https://github.com/reach/reach-ui
|
||||
// Definitions by: Harry Hedger <https://github.com/hedgerh>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
export type AlertProps = {
|
||||
type?: "assertive" | "polite";
|
||||
} & React.HTMLProps<HTMLDivElement>;
|
||||
|
||||
export const Alert: React.FC<AlertProps>;
|
||||
25
types/reach__alert/reach__alert-tests.tsx
Normal file
25
types/reach__alert/reach__alert-tests.tsx
Normal file
@ -0,0 +1,25 @@
|
||||
import { Alert } from '@reach/alert';
|
||||
|
||||
import * as React from "react";
|
||||
import { render } from "react-dom";
|
||||
|
||||
render(<Alert />, document.getElementById('app'));
|
||||
|
||||
// should handle both types
|
||||
render(<Alert type="assertive" />, document.getElementById('app'));
|
||||
render(<Alert type="polite" />, document.getElementById('app'));
|
||||
|
||||
// Should take div props and spread them down to div tag
|
||||
render(<Alert onDoubleClick={() => {}} />, document.getElementById('app'));
|
||||
render(
|
||||
<Alert type="assertive">This is a standard alert.</Alert>,
|
||||
document.getElementById('app')
|
||||
);
|
||||
|
||||
// Should explode on a bad type
|
||||
// $ExpectError
|
||||
render(<Alert type="foo" />, document.getElementById('app'));
|
||||
|
||||
// Should throw on a bad prop
|
||||
// $ExpectError
|
||||
render(<Alert badProp />, document.getElementById('app'));
|
||||
28
types/reach__alert/tsconfig.json
Normal file
28
types/reach__alert/tsconfig.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"@reach/alert": ["reach__alert"]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"reach__alert-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
types/reach__alert/tslint.json
Normal file
1
types/reach__alert/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user