I want to union two objects according to my idea, but it seems that typescript has only one way to union object
type A = {
m: string;
n: number;
}
type B = {
n: string;
}
type C = B | A;
the result typeof C is like
{
m: string;
n: number | string;
}
but what i want is A can only represent in divide
//i want it is inValid
{
m: "hello",
n: "hi"
}
//other case is valid
{
m: "hello",
n: 1
}
{
n: "hello"
}