typescript - How to declare two unassignable types? -
i have ffi binding , there couple of places void *
used. i'd differentiate on typescript side. is:
interface struct1ptr extends buffer {}; interface struct2ptr extends buffer {}; var x: struct1ptr; var y: struct2ptr;
i'd make types unassignable, error signaled when try assign x = y
or y = x
or use wrong type arguments functions.
typescript uses structural typing everything, have make them structurally different, e.g :
interface struct1ptr extends buffer { _isstruct1: void }; interface struct2ptr extends buffer { _isstruct2: void }; var x: struct1ptr; var y: struct2ptr;
Comments
Post a Comment