im new to typescript i want to know how i get this error as far as i know i included all of the properties
Type '{ type: "text"; sender: string; recipient: string; timestamp: number; content: string; status: Status.SENT; }' is missing the following properties from type 'Text': wholeText, splitText, data, length, and 62 more.ts(2740)
and this is my code
enum Status {
SENT = "Sent",
DELIVERED = "Delivered",
READ = "Read",
}
interface Require {
sender: string;
recipient: string;
timestamp: number;
status: Status;
}
interface Text extends Require {
type: "text";
content: string;
}
const textMessage: Text = {
type: "text",
sender: "Bob",
recipient: "Alice",
timestamp: Date.now(),
content: "Hello this is bob!",
status : Status.SENT
};
You're running afoul of the existing
Texttype https://developer.mozilla.org/en-US/docs/Web/API/TextIf you rename your class to something unique
you obtain a new type.