-
-
Notifications
You must be signed in to change notification settings - Fork 53
Labels
bugSomething isn't workingSomething isn't working
Description
What version of Elysia is running?
1.4.10
What platform is your computer?
Darwin 24.3.0 arm64 arm
What steps can reproduce the bug?
import { Elysia, t } from 'elysia'
import { treaty } from './src/treaty2'
const app = new Elysia().get('/optional', ({ query: { name } }) => name, {
query: t.Object({
name: t.Optional(t.String())
})
})
export type App = typeof app
const api = treaty<App>('localhost:8080')
type QueryParams = NonNullable<Parameters<typeof api.optional.get>[0]>['query']
// type QueryParams = Record<string, unknown> | undefinedWhat is the expected behavior?
The type of QueryParams should give some hinting as to the name. Either:
type QueryParams = { name?: string | undefined; } | undefinedor to preserve existing behavior, with additional type hints:
type QueryParams = ({ name?: string | undefined; } & Record<string, unknown>) | undefinedWhat do you see instead?
type QueryParams = Record<string, unknown> | undefinedAdditional information
The same probably follow for headers as well that has the same inference logic as query.
Have you try removing the node_modules and bun.lockb and try again yet?
yes
boompikachu
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working