From 695d1e2dc49ce8a2d37f2676fcea0799de4b8e56 Mon Sep 17 00:00:00 2001 From: VictoriaGreen93 <37295924+VictoriaGreen93@users.noreply.github.com> Date: Tue, 13 Aug 2019 13:44:31 -0700 Subject: [PATCH] Add typings for swagger-ui-react (#37569) * Typings for swagger-ui-react * Typings for swagger-ui-react * Typings for swagger-ui-react * Typings for swagger-ui-react --- types/swagger-ui-react/index.d.ts | 27 +++++++++++++++++++ .../swagger-ui-react-tests.tsx | 13 +++++++++ types/swagger-ui-react/tsconfig.json | 25 +++++++++++++++++ types/swagger-ui-react/tslint.json | 1 + 4 files changed, 66 insertions(+) create mode 100644 types/swagger-ui-react/index.d.ts create mode 100644 types/swagger-ui-react/swagger-ui-react-tests.tsx create mode 100644 types/swagger-ui-react/tsconfig.json create mode 100644 types/swagger-ui-react/tslint.json diff --git a/types/swagger-ui-react/index.d.ts b/types/swagger-ui-react/index.d.ts new file mode 100644 index 0000000000..3d40898e18 --- /dev/null +++ b/types/swagger-ui-react/index.d.ts @@ -0,0 +1,27 @@ +// Type definitions for swagger-ui-react 3.23 +// Project: https://github.com/swagger-api/swagger-ui#readme +// Definitions by: viki.green +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import * as React from 'react'; + +interface Request { + [k: string]: any; +} +interface Response { + [k: string]: any; +} +type System = any; + +export interface SwaggerUIProps { + spec?: object; + url?: string; + onComplete?: (system: System) => void; + requestInterceptor?: (req: Request) => Request | Promise; + responseInterceptor?: (res: Response) => Response | Promise; + docExpansion: 'list' | 'full' | 'none'; +} + +declare class SwaggerUI extends React.PureComponent {} +export default SwaggerUI; diff --git a/types/swagger-ui-react/swagger-ui-react-tests.tsx b/types/swagger-ui-react/swagger-ui-react-tests.tsx new file mode 100644 index 0000000000..f38c93189f --- /dev/null +++ b/types/swagger-ui-react/swagger-ui-react-tests.tsx @@ -0,0 +1,13 @@ +import * as React from 'react'; +import SwaggerUI from 'swagger-ui-react'; + +
+ { + console.log(request); + return request; + }} + /> +
; diff --git a/types/swagger-ui-react/tsconfig.json b/types/swagger-ui-react/tsconfig.json new file mode 100644 index 0000000000..abe4430286 --- /dev/null +++ b/types/swagger-ui-react/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "jsx": "react", + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "swagger-ui-react-tests.tsx" + ] +} diff --git a/types/swagger-ui-react/tslint.json b/types/swagger-ui-react/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/swagger-ui-react/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }