Like if there is an interface
interface IHello {
x: 'hello';
}
function fun(obj: IHello) {
...
}
then doing this
var obj = {
x: 'hello'
};
fun(obj);
gives an error
Type string
is not assignable to type hello
;
What is the correct way of doing it?