Given the following class:
class MyOb {
foo: string;
setFields(props) {
Object.assign(this, props);
}
}
Is it possible to constrain the props parameter of setFields to the properties of MyObj? So that:
new MyOb().setFields({ foo: 'bar' }) // compiles
new MyOb().setFields({ x: 'bar' }) // fails, property x is not a part of MyOb