Skip to content

Commit

Permalink
simplify model decorator signature
Browse files Browse the repository at this point in the history
  • Loading branch information
xaviergonz committed Nov 12, 2023
1 parent 126eab2 commit dbd2298
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/lib/src/modelShared/modelDecorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ import {
* @param name Unique name for the model type. Note that this name must be unique for your whole
* application, so it is usually a good idea to use some prefix unique to your application domain.
*/
export const model: (
name: string
) => <MC extends ModelClass<AnyModel | AnyDataModel>>(clazz: MC, ...args: any[]) => MC =
(name) =>
(clazz, ...args) => {
export const model =
(name: string) =>
<MC extends ModelClass<AnyModel | AnyDataModel>>(clazz: MC, ...args: any[]): MC => {
const ctx = typeof args[1] === "object" ? (args[1] as ClassDecoratorContext) : undefined

return internalModel(name, clazz, ctx?.addInitializer) as any
Expand Down

0 comments on commit dbd2298

Please sign in to comment.