SOLID Principles in JavaScript
What SOLID principle suggests that a derived class should be able to replace its base class without breaking the application?
class File {
read(): string { return 'file content'; }
write(content: string): void { /* write content */ }
}
class ReadOnlyFile extends File {
write(content: string): void {
throw new Error('Cannot write to read-only file');
}
}