Skip to content

Commit dd6afdd

Browse files
committed
🎉 feat: merge multiple macro resolve response
1 parent 7773183 commit dd6afdd

File tree

1 file changed

+20
-38
lines changed

1 file changed

+20
-38
lines changed

test/types/lifecycle/soundness.ts

Lines changed: 20 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2217,44 +2217,26 @@ import { Prettify } from '../../../src/types'
22172217

22182218
// intersect multiple resolve macro response
22192219
{
2220-
// intersect multiple resolve macro response
2221-
{
2222-
const app = new Elysia()
2223-
.macro({
2224-
multiple: {
2225-
resolve({ status }) {
2226-
if (Math.random() > 0.5) return status(401)
2227-
return status(403)
2228-
}
2229-
}
2230-
})
2231-
.get('/multiple', () => 'Ok', { multiple: true })
2232-
2233-
expectTypeOf<
2234-
(typeof app)['~Routes']['multiple']['get']['response']
2235-
>().toEqualTypeOf<{
2236-
200: string
2237-
401: 'Unauthorized'
2238-
403: 'Forbidden'
2239-
}>()
2240-
2241-
const app = new Elysia()
2242-
.macro('multiple', {
2243-
resolve({ status }) {
2244-
if (Math.random() > 0.5) return status(401)
2245-
return status(403)
2246-
}
2247-
})
2248-
.get('/multiple', () => 'Ok', { multiple: true })
2249-
2250-
expectTypeOf<
2251-
(typeof app)['~Routes']['multiple']['get']['response']
2252-
>().toEqualTypeOf<{
2253-
200: string
2254-
401: 'Unauthorized'
2255-
403: 'Forbidden'
2256-
}>()
2257-
}
2220+
const app = new Elysia()
2221+
.macro('multiple', {
2222+
resolve({ status }) {
2223+
if (Math.random() > 0.5) return status(401)
2224+
return status(403)
2225+
}
2226+
})
2227+
.get('/multiple', () => 'Ok', { multiple: true })
2228+
2229+
expectTypeOf<
2230+
(typeof app)['~Routes']['multiple']['get']['response']
2231+
>().toEqualTypeOf<{
2232+
200: string
2233+
401: 'Unauthorized'
2234+
403: 'Forbidden'
2235+
}>()
2236+
}
2237+
2238+
// intersect multiple resolve macro response
2239+
{
22582240
const app = new Elysia()
22592241
.macro('multiple', {
22602242
resolve({ status }) {

0 commit comments

Comments
 (0)