From 8f865ba00b85c70deb9b072678587bae1fb6dd06 Mon Sep 17 00:00:00 2001 From: Diego van Haaster Date: Mon, 5 Aug 2024 11:42:22 -0300 Subject: [PATCH] Cast with model --- projects/angular-odata/src/lib/models/model.ts | 7 +++++++ projects/angular-odata/src/lib/schema/enum-type.ts | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/angular-odata/src/lib/models/model.ts b/projects/angular-odata/src/lib/models/model.ts index 09c0832c..69ea57f7 100644 --- a/projects/angular-odata/src/lib/models/model.ts +++ b/projects/angular-odata/src/lib/models/model.ts @@ -26,6 +26,7 @@ import { ODataModelEventType, ODataModelEventEmitter, ModelFieldOptions, + ModelInterface, } from './options'; import { EdmType, ParserOptions } from '../types'; import { ODataEntityAnnotations } from '../annotations'; @@ -778,6 +779,12 @@ export class ODataModel { //#endregion // Cast + cast( + type: string, ModelType?: typeof ODataModel + ): ODataModel & ModelInterface; + cast>( + type: string, ModelType?: typeof ODataModel + ): M; cast(type: string, ModelType?: typeof ODataModel) { //: ODataModel { const resource = this.resource(); diff --git a/projects/angular-odata/src/lib/schema/enum-type.ts b/projects/angular-odata/src/lib/schema/enum-type.ts index 84a68cbf..0af3f8d0 100644 --- a/projects/angular-odata/src/lib/schema/enum-type.ts +++ b/projects/angular-odata/src/lib/schema/enum-type.ts @@ -81,7 +81,7 @@ export class ODataEnumType extends ODataParserSchemaElement< return this.parser.unpack(value); } - pack(value: string | number) { + pack(value: string | number | number[]) { return this.parser.pack(value); } }