From dcb61d156cbbee90fb0da4afbe31f99a13a24878 Mon Sep 17 00:00:00 2001 From: Paul Fasola Date: Sun, 18 Feb 2018 03:11:12 +0100 Subject: [PATCH] Add typings for react-twitter-auth --- types/react-twitter-auth/index.d.ts | 25 +++++++++++++++++++ .../react-twitter-auth-tests.tsx | 23 +++++++++++++++++ types/react-twitter-auth/tsconfig.json | 25 +++++++++++++++++++ types/react-twitter-auth/tslint.json | 1 + 4 files changed, 74 insertions(+) create mode 100644 types/react-twitter-auth/index.d.ts create mode 100644 types/react-twitter-auth/react-twitter-auth-tests.tsx create mode 100644 types/react-twitter-auth/tsconfig.json create mode 100644 types/react-twitter-auth/tslint.json diff --git a/types/react-twitter-auth/index.d.ts b/types/react-twitter-auth/index.d.ts new file mode 100644 index 0000000000..7348b10a21 --- /dev/null +++ b/types/react-twitter-auth/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for react-twitter-auth 0.10 +// Project: https://github.com/GenFirst/react-twitter-auth +// Definitions by: Paul Fasola +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +interface TwitterLoginProp { + tag?: string; + text?: string; + loginUrl: string; + requestTokenUrl: string; + onFailure: (msg: string) => void; + onSuccess: (response: string) => void; + disabled?: boolean; + style?: string; + className?: string; + dialogWidth?: number; + dialogHeight?: number; + showIcon?: boolean; + credentials?: string; +} + +declare var TwitterLogin: React.StatelessComponent; + +export default TwitterLogin; diff --git a/types/react-twitter-auth/react-twitter-auth-tests.tsx b/types/react-twitter-auth/react-twitter-auth-tests.tsx new file mode 100644 index 0000000000..a1d212a726 --- /dev/null +++ b/types/react-twitter-auth/react-twitter-auth-tests.tsx @@ -0,0 +1,23 @@ +import * as React from 'react'; +import TwitterLogin from 'react-twitter-auth'; + +const ReactTwitterAuth: React.StatelessComponent = () => { + function handleSucess(response: string) {} + function handleFailure(msg: string) {} + + return ( + + ); +}; diff --git a/types/react-twitter-auth/tsconfig.json b/types/react-twitter-auth/tsconfig.json new file mode 100644 index 0000000000..1c73a25222 --- /dev/null +++ b/types/react-twitter-auth/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "jsx": "react", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-twitter-auth-tests.tsx" + ] +} diff --git a/types/react-twitter-auth/tslint.json b/types/react-twitter-auth/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-twitter-auth/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }