TypeScript Version: 3.7.5
Search Terms: Implements self
Code
Case 1
interface Test {
foo(): void;
}
class Test { }
new Test().foo(); // Expected Error
Case 2
class Test2 implements Test2 {} // Expected Error
Case 3
// Case 3
interface Test3 {
foo(): string
}
class Test3 implements Test3 { // Expected Error
bar() { return '' }
}
new Test3().foo(); // Expected Error
Actual behavior:
No errors...
Playground Link:
Playground
Related Issues:
https://github.com/Microsoft/TypeScript/issues/9699#issuecomment-232477522
These are all the intended behavior, as per the comment you linked.
This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes.
TS is great, but runtime error for type-safe code - is a wrong =(
Most helpful comment
TS is great, but runtime error for type-safe code - is a wrong =(