I am stuck with an inheritance issue writing my first angular 5 application. I am getting the error: Property 'message' does not exist on type 'CouponEvent'. from the angular-cli
export class Event {
public _eventId: number;
public _type: string;
public _name: string;
public _sendDate: Date;
public _message: string;
constructor(){}
public get message(): string {
return this._message;
}
public get type(): string {
return this._type;
}
public get name(): string {
return this._name;
}
public get sendDate(): Date {
return this._sendDate;
}
public get eventId():number {
return this._eventId;
}
}
import './Event';
export class CouponEvent extends Event {
_expirationDate: Date;
get expirationDate(): Date {
return this._expirationDate;
}
}
In my util class I am try to format the message and event.message is not found.
import { Injectable } from '@angular/core';
import {Event} from '../models/Event';
import {CouponEvent} from '../models/CouponEvent';
@Injectable()
export class UtilService {
formatMessage(event: CouponEvent): string {
let msg = event.message.replace(/\${code}/gi,event.code);
const date = event.expirationDate.toString
msg = event.message.replace(/\${expiration}/gi,date);
return msg;
}
}
Any help would be greatly appreciated. This being my first time working with type script I am sort of lost why this not working.
Thank you for you're suggestions!!