Add typings for react-twitter-auth

This commit is contained in:
Paul Fasola
2018-02-18 03:11:12 +01:00
parent 628c63919c
commit dcb61d156c
4 changed files with 74 additions and 0 deletions

25
types/react-twitter-auth/index.d.ts vendored Normal file
View File

@@ -0,0 +1,25 @@
// Type definitions for react-twitter-auth 0.10
// Project: https://github.com/GenFirst/react-twitter-auth
// Definitions by: Paul Fasola <https://github.com/paulfasola>
// 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<TwitterLoginProp>;
export default TwitterLogin;

View File

@@ -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 (
<TwitterLogin loginUrl="http://server.url/api/v1/auth/twitter"
onSuccess={ handleSucess }
onFailure={ handleFailure }
requestTokenUrl="http://server.url/api/v1/auth/twitter/reverse"
dialogWidth={ 1200 }
dialogHeight={ 800 }
style={ "font-size: 14px;" }
disabled={ false }
text={ "test" }
tag={ "test" }
className={ "test" }
credentials={ "same-origin" }
showIcon={true}/>
);
};

View File

@@ -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"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }