From ab64ce72e84376fe458e62027e67357623786a75 Mon Sep 17 00:00:00 2001 From: mhuynh1 <41922824+mhuynh1@users.noreply.github.com> Date: Tue, 9 Oct 2018 12:07:10 -0700 Subject: [PATCH] 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 --- types/react-better-password/index.d.ts | 17 +++++++++++ .../react-better-password-tests.tsx | 29 +++++++++++++++++++ types/react-better-password/tsconfig.json | 25 ++++++++++++++++ types/react-better-password/tslint.json | 1 + 4 files changed, 72 insertions(+) create mode 100644 types/react-better-password/index.d.ts create mode 100644 types/react-better-password/react-better-password-tests.tsx create mode 100644 types/react-better-password/tsconfig.json create mode 100644 types/react-better-password/tslint.json diff --git a/types/react-better-password/index.d.ts b/types/react-better-password/index.d.ts new file mode 100644 index 0000000000..b07a4e840e --- /dev/null +++ b/types/react-better-password/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for react-better-password 1.0 +// Project: https://github.com/karaggeorge/react-better-password +// Definitions by: Mary Huynh +// 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 { } diff --git a/types/react-better-password/react-better-password-tests.tsx b/types/react-better-password/react-better-password-tests.tsx new file mode 100644 index 0000000000..1aea80d250 --- /dev/null +++ b/types/react-better-password/react-better-password-tests.tsx @@ -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 ( + + ); + } +} +export default ReactBetterPasswordTest; diff --git a/types/react-better-password/tsconfig.json b/types/react-better-password/tsconfig.json new file mode 100644 index 0000000000..2381541694 --- /dev/null +++ b/types/react-better-password/tsconfig.json @@ -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" + ] +} \ No newline at end of file diff --git a/types/react-better-password/tslint.json b/types/react-better-password/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-better-password/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }