mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-03-26 22:39:39 +08:00
add react-better-password (#29278)
* add react-better-password * resolve CI errors * enable strictFunctionTypes * changed onChange type from any to function * mark onChange as optional
This commit is contained in:
17
types/react-better-password/index.d.ts
vendored
Normal file
17
types/react-better-password/index.d.ts
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// Type definitions for react-better-password 1.0
|
||||
// Project: https://github.com/karaggeorge/react-better-password
|
||||
// Definitions by: Mary Huynh <https://github.com/mhuynh1>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import * as React from 'react';
|
||||
export interface PasswordProps {
|
||||
className?: string;
|
||||
mask?: '•' | string;
|
||||
onChange?: (value: string) => void;
|
||||
placeholder?: string;
|
||||
show?: boolean;
|
||||
timeout?: number;
|
||||
value?: string;
|
||||
}
|
||||
export default class Password extends React.Component<PasswordProps> { }
|
||||
29
types/react-better-password/react-better-password-tests.tsx
Normal file
29
types/react-better-password/react-better-password-tests.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
import * as React from 'react';
|
||||
import Password from 'react-better-password';
|
||||
|
||||
interface PasswordState {
|
||||
password: string;
|
||||
}
|
||||
|
||||
class ReactBetterPasswordTest extends React.Component<{}, PasswordState> {
|
||||
state = {
|
||||
password: "",
|
||||
};
|
||||
|
||||
handlePw = (password: string) => {
|
||||
this.setState({ password });
|
||||
}
|
||||
|
||||
render() {
|
||||
const { password } = this.state;
|
||||
return (
|
||||
<Password
|
||||
className="password"
|
||||
value={password}
|
||||
onChange={this.handlePw}
|
||||
placeholder="set a password"
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
export default ReactBetterPasswordTest;
|
||||
25
types/react-better-password/tsconfig.json
Normal file
25
types/react-better-password/tsconfig.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"jsx": "react",
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-better-password-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
types/react-better-password/tslint.json
Normal file
1
types/react-better-password/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user