Skip to content

Commit

Permalink
fix(types): add _ prefix to TypedResponse properties (#2917)
Browse files Browse the repository at this point in the history
  • Loading branch information
yusukebe authored Jun 6, 2024
1 parent cb55866 commit 731d7ae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions src/types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,29 +284,29 @@ describe('TypedResponse', () => {
test('unknown', () => {
type Actual = TypedResponse
type Expected = {
data: unknown
status: StatusCode
format: ResponseFormat
_data: unknown
_status: StatusCode
_format: ResponseFormat
}
type verify = Expect<Equal<Expected, Actual>>
})

test('text auto infer', () => {
type Actual = TypedResponse<string>
type Expected = {
data: string
status: StatusCode
format: 'text'
_data: string
_status: StatusCode
_format: 'text'
}
type verify = Expect<Equal<Expected, Actual>>
})

test('json auto infer', () => {
type Actual = TypedResponse<{ ok: true }>
type Expected = {
data: { ok: true }
status: StatusCode
format: 'json'
_data: { ok: true }
_status: StatusCode
_format: 'json'
}
type verify = Expect<Equal<Expected, Actual>>
})
Expand Down
6 changes: 3 additions & 3 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1753,9 +1753,9 @@ export type TypedResponse<
? 'json'
: ResponseFormat
> = {
data: T
status: U
format: F
_data: T
_status: U
_format: F
}

type MergeTypedResponse<T> = T extends Promise<infer T2>
Expand Down

0 comments on commit 731d7ae

Please sign in to comment.