Variable assignments with built-in assignment filters

Assignment filters are special dynamic types that hold only 1 of its non-static data members at any one time

let a = | 1,2,3 | // variable assignment "a" can only accept the values 1 or 2 or 3

a==1 // ReferenceError: a is not defined
a==2 // ReferenceError: a is not defined
a==3 // ReferenceError: a is not defined

a = 5 // ReferenceError: a is not defined
a = 1 // a==1

a==1 // true
a==2 // false
a==3 // false

let b = 1

switch(b){
    case a:
        console.log("This is a valid assignment for a:",a)
        break;
    default:
        console.log("ReferenceError: a is not defined for b ==",a)
        break
}

a == b // true

let c = | myIntegerNumberField(),myRationalNumberField(),myComplexNumberField() | // let c equal any rational number, discrete integer, or vector

(cf C++ union)

For now you could use Proxy to achieve similar result, Proxy allows to set the "trap" for the setter. let c = new Proxy(...);

What does this provide that things like TypeScript doesn't?