You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For now, in order to use an Elysia model for typing functions return value we need to process as follows (as far as I know):
// /models/thing.tsconstThingDTO=t.Array(t.Object({id: t.String({format: "uuid"}),name: t.String(),},{additionalProperties: false},),);exportconstthingModels=newElysia().model({thing: ThingDTO,});exporttypeThing=typeofThingDTO.static;// Could be in a separate file such as /utils/compute.tsexportfunctionreturnThing(): Thing{return[{id: "",name: "",},];}// /plugins/thing.tsexportconstthingPlugin=newElysia().use(thingModels).get("/thing",()=>returnThing(),{response: ThingDTO});
I suggest accessing Elysia model properties through the plugin directly:
typeofthingModels.thing.static
or something like this.
I might have missed something but this, for now, seems impossible.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
For now, in order to use an Elysia model for typing functions return value we need to process as follows (as far as I know):
I suggest accessing Elysia model properties through the plugin directly:
or something like this.
I might have missed something but this, for now, seems impossible.
Beta Was this translation helpful? Give feedback.
All reactions