Typescript: Implements self is not show problems

Created on 20 Feb 2020  路  3Comments  路  Source: microsoft/TypeScript


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

Working as Intended

Most helpful comment

TS is great, but runtime error for type-safe code - is a wrong =(

All 3 comments

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 =(

Was this page helpful?
0 / 5 - 0 ratings