Skip to content

Commit

Permalink
Cast with model
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomvh committed Aug 5, 2024
1 parent 5af8bd6 commit 8f865ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions projects/angular-odata/src/lib/models/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
ODataModelEventType,
ODataModelEventEmitter,
ModelFieldOptions,
ModelInterface,
} from './options';
import { EdmType, ParserOptions } from '../types';
import { ODataEntityAnnotations } from '../annotations';
Expand Down Expand Up @@ -778,6 +779,12 @@ export class ODataModel<T> {
//#endregion

// Cast
cast<S>(
type: string, ModelType?: typeof ODataModel
): ODataModel<T> & ModelInterface<T>;
cast<S, M extends ODataModel<S>>(
type: string, ModelType?: typeof ODataModel
): M;
cast<S>(type: string, ModelType?: typeof ODataModel) {
//: ODataModel<S> {
const resource = this.resource();
Expand Down
2 changes: 1 addition & 1 deletion projects/angular-odata/src/lib/schema/enum-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class ODataEnumType<E> extends ODataParserSchemaElement<
return this.parser.unpack(value);
}

pack(value: string | number) {
pack(value: string | number | number[]) {
return this.parser.pack(value);
}
}

0 comments on commit 8f865ba

Please sign in to comment.