openapi-typescript
openapi-typescript copied to clipboard
`SuccessResponseJSON` and `ErrorResponseJSON` always return `never`
Description
I think SuccessResponseJSON and ErrorResponseJSON weren't updated along with their non-JSON counterparts in v7 and they should've been something like this:
- export type JSONLike<T> = FilterKeys<T, `${string}/json`>;
+ export type JSONLike = `${string}/json`;
- export type SuccessResponseJSON<PathMethod> = JSONLike<SuccessResponse<ResponseObjectMap<PathMethod>>>;
+ export type SuccessResponseJSON<PathMethod> = SuccessResponse<ResponseObjectMap<PathMethod>, JSONLike>;
| Name | Version |
|---|---|
openapi-typescript |
7.1.0 |
| Node.js | v21.7.2 |
| OS + version | NixOS |
Reproduction
import type { SuccessResponseJSON } from "openapi-typescript-helpers";
type x = SuccessResponseJSON<paths["/a/valid/path"]["get"]>; // `never`
type y = SuccessResponse<ResponseObjectMap<paths["/a/valid/path"]["get"]>>; // works
Checklist
- [ ] My OpenAPI schema passes the Redocly validator (
npx @redocly/cli@latest lint) - [ ] I’m willing to open a PR (see CONTRIBUTING.md)