I see where you are coming from but you are not quite understanding what the OP was saying
class A {
public value: number
}
class B {
public value: number
}
const x: A = new B() // no error
This is structural typing (shape defines type), if typescript had nominal typing (name defines type) this would give an error. You could brand these classes to forcefully cause this to error.
Branding makes structural typing work like nominal typing for the branded type only.
It is more like "doing what this article describes" is the default behaviour of most languages (most languages use nominal typing).
Branding makes structural typing work like nominal typing for the branded type only.
It is more like "doing what this article describes" is the default behaviour of most languages (most languages use nominal typing).