-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptVS Code PriorityCritical issues that VS Code needs fixed in the current TypeScript milestoneCritical issues that VS Code needs fixed in the current TypeScript milestone
Milestone
Description
TypeScript Version: 3.7.2
Code
class Foo {
constructor(protected readonly something: string) {
}
}
class Bar extends Foo {
constructor() {
super("something");
}
get something(): string {
return "other";
}
}
new Bar();Expected behavior:
I would like to see a compile error.
Actual behavior:
There is no compile error. But the code will run with this error:
VM27:4 Uncaught TypeError: Cannot set property something of #<Bar> which has only a getter
at new Foo (eval at <anonymous> (main-3.js:1239), <anonymous>:4:24)
at new Bar (eval at <anonymous> (main-3.js:1239), <anonymous>:9:9)
at eval (eval at <anonymous> (main-3.js:1239), <anonymous>:15:1)
at main-3.js:1239
Playground Link: <!-- A link to a TypeScript Playground "Share" link which demonstrates this behavior Playground Link
Related Issues:
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptVS Code PriorityCritical issues that VS Code needs fixed in the current TypeScript milestoneCritical issues that VS Code needs fixed in the current TypeScript milestone