Skip to content

Commit d757e70

Browse files
authored
🤖 Merge PR DefinitelyTyped#71752 feat(swagger-react-ui): Support ESM and update package version by @davulrich
1 parent cd61c55 commit d757e70

File tree

6 files changed

+62
-47
lines changed

6 files changed

+62
-47
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import * as React from "react";
2+
import { SwaggerUIProps } from "./swagger-ui-react.js";
3+
4+
declare const SwaggerUI: React.FunctionComponent<SwaggerUIProps>;
5+
export default SwaggerUI;
Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,5 @@
11
import * as React from "react";
2-
3-
interface Request {
4-
[k: string]: any;
5-
}
6-
interface Response {
7-
[k: string]: any;
8-
}
9-
type System = any;
10-
11-
type PluginGenerator = (system: System) => object;
12-
13-
type Plugin = object | PluginGenerator;
14-
15-
type Preset = () => unknown;
16-
17-
export interface SwaggerUIProps {
18-
spec?: object | string;
19-
url?: string;
20-
layout?: string;
21-
onComplete?: (system: System) => void;
22-
requestInterceptor?: (req: Request) => Request | Promise<Request>;
23-
responseInterceptor?: (res: Response) => Response | Promise<Response>;
24-
docExpansion?: "list" | "full" | "none";
25-
defaultModelExpandDepth?: number;
26-
defaultModelsExpandDepth?: number;
27-
defaultModelRendering?: "example" | "model";
28-
queryConfigEnabled?: boolean;
29-
plugins?: Plugin[];
30-
supportedSubmitMethods?: Array<"get" | "put" | "post" | "delete" | "options" | "head" | "patch" | "trace">;
31-
deepLinking?: boolean;
32-
showMutatedRequest?: boolean;
33-
showExtensions?: boolean;
34-
showCommonExtensions?: boolean;
35-
presets?: Preset[];
36-
filter?: string | boolean;
37-
requestSnippetsEnabled?: boolean;
38-
requestSnippets?: object;
39-
displayOperationId?: boolean;
40-
tryItOutEnabled?: boolean;
41-
displayRequestDuration?: boolean;
42-
persistAuthorization?: boolean;
43-
withCredentials?: boolean;
44-
oauth2RedirectUrl?: string;
45-
}
2+
import { SwaggerUIProps } from "./swagger-ui-react";
463

474
declare const SwaggerUI: React.FunctionComponent<SwaggerUIProps>;
48-
export default SwaggerUI;
5+
export = SwaggerUI;

‎types/swagger-ui-react/package.json‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
{
22
"private": true,
33
"name": "@types/swagger-ui-react",
4-
"version": "4.19.9999",
4+
"version": "5.18.9999",
55
"projects": [
66
"https://github.com/swagger-api/swagger-ui#readme"
77
],
8+
"exports": {
9+
".": {
10+
"import": "./index.d.mts",
11+
"require": "./index.d.ts"
12+
}
13+
},
814
"dependencies": {
915
"@types/react": "*"
1016
},

‎types/swagger-ui-react/swagger-ui-react-tests.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as React from "react";
1+
import React from "react";
22
import SwaggerUI from "swagger-ui-react";
33

44
<div>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
interface Request {
2+
[k: string]: any;
3+
}
4+
interface Response {
5+
[k: string]: any;
6+
}
7+
type System = any;
8+
9+
type PluginGenerator = (system: System) => object;
10+
11+
type Plugin = object | PluginGenerator;
12+
13+
type Preset = () => unknown;
14+
15+
export interface SwaggerUIProps {
16+
spec?: object | string;
17+
url?: string;
18+
layout?: string;
19+
onComplete?: (system: System) => void;
20+
requestInterceptor?: (req: Request) => Request | Promise<Request>;
21+
responseInterceptor?: (res: Response) => Response | Promise<Response>;
22+
docExpansion?: "list" | "full" | "none";
23+
defaultModelExpandDepth?: number;
24+
defaultModelsExpandDepth?: number;
25+
defaultModelRendering?: "example" | "model";
26+
queryConfigEnabled?: boolean;
27+
plugins?: Plugin[];
28+
supportedSubmitMethods?: Array<"get" | "put" | "post" | "delete" | "options" | "head" | "patch" | "trace">;
29+
deepLinking?: boolean;
30+
showMutatedRequest?: boolean;
31+
showExtensions?: boolean;
32+
showCommonExtensions?: boolean;
33+
presets?: Preset[];
34+
filter?: string | boolean;
35+
requestSnippetsEnabled?: boolean;
36+
requestSnippets?: object;
37+
displayOperationId?: boolean;
38+
tryItOutEnabled?: boolean;
39+
displayRequestDuration?: boolean;
40+
persistAuthorization?: boolean;
41+
withCredentials?: boolean;
42+
oauth2RedirectUrl?: string;
43+
}
44+
45+
export default SwaggerUIProps;

‎types/swagger-ui-react/tsconfig.json‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
},
1717
"files": [
1818
"index.d.ts",
19+
"index.d.mts",
20+
"swagger-ui-react.d.ts",
1921
"swagger-ui-react-tests.tsx"
2022
]
2123
}

0 commit comments

Comments
 (0)