From 419b838f54aa539c3be867d3a7e9a7ecae3c7c74 Mon Sep 17 00:00:00 2001 From: Madeorsk Date: Fri, 4 Oct 2024 17:06:59 +0200 Subject: [PATCH] Add a new model class type. --- package.json | 2 +- src/Model/Model.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 2724304..ce7280b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@sharkitek/core", - "version": "3.0.0", + "version": "3.0.1", "description": "TypeScript library for well-designed model architectures.", "keywords": [ "deserialization", diff --git a/src/Model/Model.ts b/src/Model/Model.ts index f59a9f8..0fd40f0 100644 --- a/src/Model/Model.ts +++ b/src/Model/Model.ts @@ -34,6 +34,11 @@ export type SerializedModel = { */ export type Model = ModelDefinition & PropertiesModel; +/** + * Type of a model class. + */ +export type ModelClass = ConstructorOf>>; + /** * Identifier type. */ @@ -91,7 +96,7 @@ export interface ModelDefinition export function model( shape: Shape, identifier?: Identifier, -): ConstructorOf>> +): ModelClass { // Get shape entries. const shapeEntries = Object.entries(shape) as [keyof Shape, UnknownDefinition][]; @@ -227,5 +232,5 @@ export function model>>; + } as unknown as ModelClass; }