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