Suppose I have the following code:
interface A {
    a: number;
}
interface B extends A {
    b: number;
}
const b: B = {a: 1, b: 5};
const a: A = b as A;
Now the variable a has type A, but it still contains b inside of it. Sometimes it is undesirable - I'd like to be sure that, if I have a variable of type A, it has the exact fields of type A. I was wondering, whether TypeScript has some kind of a "hard cast" which would remove any unneeded fields when converting between types.
 
     
     
    