First at all, thank you for putting this code together. I have a class with properties and gets/sets but also with extra function for specific behavior. The problem is that I get a error "...is missing the following properties from type 'DecoderObject': addOption, setOptions". Do you have any idea how to fix this?
Example
`export class Study {
private _name: string;
private _description: string;
private _goal: Goal[];
private _organizationName: string;
public readonly studyID: string;
public readonly organizationId: string;
public readonly owner: string;
public readonly ownerEmailAddress: string;
public static toApiDto(pItem: Study): ApiStudyDTO {
(...)
}
public static fromApiDTO(pItem: ApiStudyDTO): Study {
(….)
}
public get name(): string { return this._name; }
public set name(pValue: string) { this._name = pValue; }
public get description(): string { return this._description; }
public set description(pValue: string) { this._description = pValue; }
public get organizationName(): string { return this._organizationName; }
public set organizationName(pValue: string) { this._organizationName = pValue; }
public set goal(pValue: Goal[]) { this._goal = pValue; }
public get goal(): Goal[] { return this._goal; }
public addOption(pStudyOption: StudyOption) {
this.options.splice(0, 0, pStudyOption);
}
public setOptions(pStudyOptions: Array) {
this.options = pStudyOptions;
}
}`
and my JsonDecoder.Object definition is
JsonDecoder.object<Study>({ name: JsonDecoder.string, description: JsonDecoder.string, goal: JsonDecoder.array<Goal>(GoalDecoders.Goal, 'Goal[]'), organizationName: JsonDecoder.string, studyID: JsonDecoder.string, organizationId: JsonDecoder.string, owner: JsonDecoder.string, ownerEmailAddress: JsonDecoder.string, ownerName: JsonDecoder.string, studyDate: Decoders.isDate(), options: JsonDecoder.array<StudyOption>(StudyOptionDecoders.StudyOption, 'StudyOption[]') }, 'Study');
best
Hmendezm
Hi Everyone
First at all, thank you for putting this code together. I have a class with properties and gets/sets but also with extra function for specific behavior. The problem is that I get a error "...is missing the following properties from type 'DecoderObject': addOption, setOptions". Do you have any idea how to fix this?
Example `export class Study { private _name: string; private _description: string; private _goal: Goal[];
private _organizationName: string;
public readonly studyID: string; public readonly organizationId: string; public readonly owner: string; public readonly ownerEmailAddress: string; public static toApiDto(pItem: Study): ApiStudyDTO { (...) }
public static fromApiDTO(pItem: ApiStudyDTO): Study { (….) } public get name(): string { return this._name; } public set name(pValue: string) { this._name = pValue; }
public get description(): string { return this._description; } public set description(pValue: string) { this._description = pValue; }
public get organizationName(): string { return this._organizationName; } public set organizationName(pValue: string) { this._organizationName = pValue; }
public set goal(pValue: Goal[]) { this._goal = pValue; } public get goal(): Goal[] { return this._goal; }
public addOption(pStudyOption: StudyOption) { this.options.splice(0, 0, pStudyOption); }
public setOptions(pStudyOptions: Array) {
this.options = pStudyOptions;
}
}`
and my JsonDecoder.Object definition is
JsonDecoder.object<Study>({ name: JsonDecoder.string, description: JsonDecoder.string, goal: JsonDecoder.array<Goal>(GoalDecoders.Goal, 'Goal[]'), organizationName: JsonDecoder.string, studyID: JsonDecoder.string, organizationId: JsonDecoder.string, owner: JsonDecoder.string, ownerEmailAddress: JsonDecoder.string, ownerName: JsonDecoder.string, studyDate: Decoders.isDate(), options: JsonDecoder.array<StudyOption>(StudyOptionDecoders.StudyOption, 'StudyOption[]') }, 'Study');
best Hmendezm