interface ReadExample {
readonly book_id: number,
book_name: string
}
class Book implements ReadExample{
book_id= 3;
book_name = 'A Thousand Stars';
constructor(book_id:number, book_name:string){
this.book_id = book_id;
this.book_name = book_name;
}
}
let book: Book = new Book(2, 'Sis');
console.log(book);
book.book_name = 'Sister';
book.book_id = 3;
console.log(book);
Why is this not throwing me any error. You see the property book_id is readonly. So why does it not throw an error here when I try to assign, book.book_id = 3? Does it not violate readonly?