You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running openapi-typescript with --path-params-as-types enabled will result in a TypeScript definition that throws the following error:
'`/objects/${string}/some-route`' index type '{ get: { parameters: { path: { object_id: string; }; }; responses: { ... }; }' is not assignable to '`/objects/${string}`' index type '{ get: { parameters: { path: { object_id: string; }; }; responses: { ... }; }'
I assume this results from the fact that the ${string} portion can hypothetically match any possible string (including any number of / characters) - not sure if there's a straightforward solution to this, but figured it raise it here in case anybody has solved this or has ideas on how to solve it.
Name
Version
openapi-typescript
6.7.3
Node.js
20.10.0
OS + version
macOS 14
TypeScript version
4.9.5
Reproduction
Generate types from the following example API spec using the --path-params-as-types flag:
Description
Given the following example API routes:
/objects/${object_id}
/objects/${object_id}/some-route
Running
openapi-typescript
with--path-params-as-types
enabled will result in a TypeScript definition that throws the following error:I assume this results from the fact that the
${string}
portion can hypothetically match any possible string (including any number of/
characters) - not sure if there's a straightforward solution to this, but figured it raise it here in case anybody has solved this or has ideas on how to solve it.openapi-typescript
6.7.3
20.10.0
macOS 14
4.9.5
Reproduction
Generate types from the following example API spec using the
--path-params-as-types
flag:Expected result
(in case it’s not obvious)
Checklist
npx @redocly/cli@latest lint
)The text was updated successfully, but these errors were encountered: