Skip to content

Commit 5e41135

Browse files
authored
build: simplify typescript update script (#307)
1 parent c7d5a6d commit 5e41135

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

scripts/update-endpoints/typescript.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,17 @@ function sortEndpoints(endpoints) {
6767
}
6868

6969
function endpointToTypes(endpoint) {
70+
const key = endpointToKey(endpoint);
7071
const response = endpoint.resultsKey
71-
? `Endpoints["GET ${endpoint.url}"]["response"] & { data: Endpoints["GET ${endpoint.url}"]["response"]["data"]["${endpoint.resultsKey}"] }`
72-
: `Endpoints["GET ${endpoint.url}"]["response"]`;
72+
? `Endpoints[${key}]["response"] & { data: Endpoints[${key}]["response"]["data"]["${endpoint.resultsKey}"] }`
73+
: `Endpoints[${key}]["response"]`;
7374

7475
return `
7576
/**
7677
* @see ${endpoint.documentationUrl}
7778
*/
78-
"GET ${endpoint.url}": {
79-
parameters: Endpoints["GET ${endpoint.url}"]["parameters"];
79+
${key}: {
80+
parameters: Endpoints[${key}]["parameters"];
8081
response: ${response};
8182
};
8283
`;

0 commit comments

Comments
 (0)