diff options
Diffstat (limited to 'src/new_fields/Schema.ts')
-rw-r--r-- | src/new_fields/Schema.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/new_fields/Schema.ts b/src/new_fields/Schema.ts index c7d2f0801..27b9635af 100644 --- a/src/new_fields/Schema.ts +++ b/src/new_fields/Schema.ts @@ -1,4 +1,4 @@ -import { Interface, ToInterface, Cast } from "./Types"; +import { Interface, ToInterface, Cast, FieldCtor, ToConstructor } from "./Types"; import { Doc } from "./Doc"; export type makeInterface<T extends Interface> = Partial<ToInterface<T>> & Doc; @@ -42,6 +42,7 @@ export function makeStrictInterface<T extends Interface>(schema: T): (doc: Doc) }; } -export function createSchema<T extends Interface>(schema: T): T { - return schema; +export function createSchema<T extends Interface>(schema: T): T & { prototype: ToConstructor<Doc> } { + schema.prototype = Doc; + return schema as any; } |