Typescripts types are more similar to OCaml's variant types[0]; sadly my knowledge of OCaml's type system is less than a tenth of what I would like so I cannot give precise parallels, but in typescript you can have type A = 0 | null | Array<string>, type B = Array<number> | 0 | Array<string> and construct the type A & B = 0 | Array<string>
In general I think that it is not possible to "just" add an type intersection operator to an Hindley–Milner type system without making it either incomplete[1] or unsound[2]
In typescript this is often used with records as {a:number} & {b:string} = {a:number, b:string}
In general I think that it is not possible to "just" add an type intersection operator to an Hindley–Milner type system without making it either incomplete[1] or unsound[2]
In typescript this is often used with records as {a:number} & {b:string} = {a:number, b:string}
[0] https://v2.ocaml.org/releases/5.0/htmlman/types.html#sss:typ...
[1][2] which typescript is
EDIT: fix typo