Is the type checking between an interface and a class with Typescript working correctly?

I created the following:

 
interface IABC {

    var1: boolean;
}

class ABC implements IABC {

    var1;

    constructor() {
    }

    clear= (): void => {
        this.var1 = 999;
    };

}


But there is no type checking and it allows 999 to be assigned to this.var1

Is this the correct behaviour?

1 comment
Comment actions Permalink

The compiler does accept it...


0

Please sign in to leave a comment.