diff --git a/README.md b/README.md
index 4d8bd75..24c4cf8 100644
--- a/README.md
+++ b/README.md
@@ -19,7 +19,7 @@
-
+
## Introduction
diff --git a/package.json b/package.json
index 08685e8..a59d876 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@sharkitek/core",
- "version": "3.1.0",
+ "version": "3.2.0",
"description": "TypeScript library for well-designed model architectures.",
"keywords": [
"deserialization",
diff --git a/src/Model/Model.ts b/src/Model/Model.ts
index d38bdef..dc7d63c 100644
--- a/src/Model/Model.ts
+++ b/src/Model/Model.ts
@@ -54,6 +54,11 @@ export type ModelClass = Shape[K]["_sharkitek"];
+/**
+ * Identifier name type.
+ */
+export type IdentifierNameType = Shape extends ModelShape ? keyof Shape : unknown;
+
/**
* Interface of a Sharkitek model definition.
*/
@@ -64,6 +69,11 @@ export interface ModelDefinition;
+
/**
* Serialize the model.
*/
@@ -103,7 +113,7 @@ export interface ModelDefinition>, Shape extends ModelShape, Identifier extends keyof Shape = any>(
+export function model>, Shape extends ModelShape, Identifier extends IdentifierNameType = any>(
shape: Shape,
identifier?: Identifier,
): ModelClass
@@ -160,6 +170,11 @@ export function model)?.[identifier];
}
+ getIdentifierName(): IdentifierNameType
+ {
+ return identifier;
+ }
+
serialize(): SerializedModel
{
// Creating an empty (=> partial) serialized object.