From f17caa9fa6d08a7d7b010c32568cab436a247516 Mon Sep 17 00:00:00 2001 From: Konstantin Date: Fri, 5 Oct 2018 20:30:09 +0200 Subject: [PATCH] Add typings for react-google-login-component (#29467) --- types/react-google-login-component/index.d.ts | 24 +++++++++++++++++ .../react-google-login-component-tests.tsx | 24 +++++++++++++++++ .../tsconfig.json | 26 +++++++++++++++++++ .../react-google-login-component/tslint.json | 1 + 4 files changed, 75 insertions(+) create mode 100644 types/react-google-login-component/index.d.ts create mode 100644 types/react-google-login-component/react-google-login-component-tests.tsx create mode 100644 types/react-google-login-component/tsconfig.json create mode 100644 types/react-google-login-component/tslint.json diff --git a/types/react-google-login-component/index.d.ts b/types/react-google-login-component/index.d.ts new file mode 100644 index 0000000000..272b198657 --- /dev/null +++ b/types/react-google-login-component/index.d.ts @@ -0,0 +1,24 @@ +// Type definitions for react-google-login-component 0.9 +// Project: https://github.com/kennetpostigo/react-google-login-component +// Definitions by: Konstantin Lebedev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import * as React from "react"; + +export interface GoogleLoginInfo { + getAuthResponse: () => { + access_token: string; + }; +} + +export interface GoogleLoginProps extends React.ButtonHTMLAttributes { + socialId: string; + scope?: string; + fetchBasicProfile?: boolean; + buttonText?: string; + prompt?: string; + responseHandler: (response: GoogleLoginInfo) => void; +} + +export class GoogleLogin extends React.Component {} diff --git a/types/react-google-login-component/react-google-login-component-tests.tsx b/types/react-google-login-component/react-google-login-component-tests.tsx new file mode 100644 index 0000000000..e4566071fa --- /dev/null +++ b/types/react-google-login-component/react-google-login-component-tests.tsx @@ -0,0 +1,24 @@ +import { GoogleLogin, GoogleLoginInfo } from "react-google-login-component"; +import * as React from "react"; + +const handler = (response: GoogleLoginInfo) => { + console.log(response.getAuthResponse().access_token); +}; + +const ReactGoogleLoginComponent: JSX.Element = ( + +); + +const ReactGoogleLoginComponentAllOptions: JSX.Element = ( + +); diff --git a/types/react-google-login-component/tsconfig.json b/types/react-google-login-component/tsconfig.json new file mode 100644 index 0000000000..506e9f7e7f --- /dev/null +++ b/types/react-google-login-component/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "target": "es6", + "jsx": "react", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-google-login-component-tests.tsx" + ] +} diff --git a/types/react-google-login-component/tslint.json b/types/react-google-login-component/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-google-login-component/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }