Skip to content

Commit 5405963

Browse files
authored
Merge pull request #66 from smaspe/patch-1
Support 204 as a successful query, and exclude 204 body from error types
2 parents b986ed8 + aa73d51 commit 5405963

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/types.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ type _OpReturnType<T> = 200 extends keyof T
4949
? T[200]
5050
: 201 extends keyof T
5151
? T[201]
52+
: 204 extends keyof T
53+
? T[204]
5254
: 'default' extends keyof T
5355
? T['default']
5456
: unknown
@@ -65,11 +67,11 @@ export type OpDefaultReturnType<OP> = _OpDefaultReturnType<OpResponseTypes<OP>>
6567
const never: unique symbol = Symbol()
6668

6769
type _OpErrorType<T> = {
68-
[S in Exclude<keyof T, 200 | 201>]: {
70+
[S in Exclude<keyof T, 200 | 201 | 204>]: {
6971
status: S extends 'default' ? typeof never : S
7072
data: T[S]
7173
}
72-
}[Exclude<keyof T, 200 | 201>]
74+
}[Exclude<keyof T, 200 | 201 | 204>]
7375

7476
type Coalesce<T, D> = [T] extends [never] ? D : T
7577

0 commit comments

Comments
 (0)