I had to check out the tests to figure out what the intersection operator does. My intuition says that an intersection of two types should yield a type that is of equal or greater strength than both operands. The & operator smells more like a sum to me. I guess it doesn't matter, but a {x:number}&{y:number} example in the docs would have saved me some aggravation.
It's probably too late, but I would expect an intersection operator to provide (string | number) \cap (string | SomeClass) = string and {x: number | string, y: string} \cap {x: string, y: number} = {x: string}. I could use this intersection operator as a workaround (type Null = ?string \cap ?number), but it could be useless in practice. I mention the alternative in case it justifies deprecating the & symbol in favor of a + symbol. Then an intersection (\cap or something else) could take the & symbol someday.
I had to check out the tests to figure out what the intersection operator does. My intuition says that an intersection of two types should yield a type that is of equal or greater strength than both operands. The
&operator smells more like a sum to me. I guess it doesn't matter, but a{x:number}&{y:number}example in the docs would have saved me some aggravation.It's probably too late, but I would expect an intersection operator to provide
(string | number) \cap (string | SomeClass) = stringand{x: number | string, y: string} \cap {x: string, y: number} = {x: string}. I could use this intersection operator as a workaround (type Null = ?string \cap ?number), but it could be useless in practice. I mention the alternative in case it justifies deprecating the&symbol in favor of a+symbol. Then an intersection (\capor something else) could take the&symbol someday.