Open kevinbarabash opened 2 years ago
Using if statements to change the type of a variable within the then block, e.g.
if
then
x: number | undefined let y = if (x != undefined) { x + 5; } else { 0; }
We can shadow x within the then block by setting its type to number in the ctx.env for that block.
x
number
ctx.env
This should also work on deep refinements, e.g. if (x.y.z != undefined).
if (x.y.z != undefined)
Using
if
statements to change the type of a variable within thethen
block, e.g.We can shadow
x
within thethen
block by setting its type tonumber
in thectx.env
for that block.This should also work on deep refinements, e.g.
if (x.y.z != undefined)
.