elysia 0.7.13 → 0.7.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,7 @@ import type { Static, TSchema } from '@sinclair/typebox';
4
4
  import type { Context } from './context';
5
5
  import type { WS } from './ws/types';
6
6
  import type { ElysiaConfig, DecoratorBase, DefinitionBase, RouteBase, Handler, InputSchema, LocalHook, MergeSchema, RouteSchema, UnwrapRoute, InternalRoute, HTTPMethod, VoidHandler, PreHandler, BodyHandler, OptionalHandler, AfterHandler, ErrorHandler, LifeCycleStore, MaybePromise, Prettify, ListenCallback, AddPrefix, AddSuffix, AddPrefixCapitalize, AddSuffixCapitalize, TraceReporter, TraceHandler, MaybeArray, GracefulHandler } from './types';
7
+ import { t } from './custom-types';
7
8
  /**
8
9
  * ### Elysia Server
9
10
  * Main instance to create web server using Elysia
@@ -890,8 +891,12 @@ export default class Elysia<BasePath extends string = '', Decorators extends Dec
890
891
  }>;
891
892
  error: Definitions['error'];
892
893
  }, ParentSchema, Routes, Scoped>;
893
- model<const NewType extends Record<string, unknown>>(mapper: (decorators: Definitions['type']) => NewType): Elysia<BasePath, Decorators, {
894
- type: NewType;
894
+ model<const NewType extends Record<string, TSchema>>(mapper: (decorators: {
895
+ [type in keyof Definitions['type']]: ReturnType<typeof t.Unsafe<Definitions['type'][type]>>;
896
+ }) => NewType): Elysia<BasePath, Decorators, {
897
+ type: {
898
+ [x in keyof NewType]: Static<NewType[x]>;
899
+ };
895
900
  error: Definitions['error'];
896
901
  }, ParentSchema, Routes, Scoped>;
897
902
  mapDerive<const NewStore extends Record<string, unknown>>(mapper: (decorators: Decorators['request']) => MaybePromise<NewStore>): Elysia<BasePath, {