TypeScript Version: master
Search Terms: rename all locations find references discriminated union
Code
typeResult={kind: "success",code: number}|// 1{kind: "failure",message: string};// 2functionfn(): Result{if(Math.random()>0.5){return{kind: "failure",message: "oops"}// 3}else{return{kind: "success",code: 200}// 4}}constr=fn();if(r.kind==="failure"){// 5r.message;}elseif(r.kind==="success"){// 6r.code;}There are 6 occurrences of kind in this program (annotated above); renaming at locations 1 and 2 does not produce an error-free program, locations 3 and 4 do, location 5 does, but location 6 does not.
Playground Link:link
Related Issues: ?
TypeScript Version: master
Search Terms: rename all locations find references discriminated union
Code
There are 6 occurrences of
kindin this program (annotated above); renaming at locations 1 and 2 does not produce an error-free program, locations 3 and 4 do, location 5 does, but location 6 does not.Playground Link:link
Related Issues: ?