Bug Report
🔎 Search Terms
type guard、narrowing
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
⏯ Playground Link
Playground link with relevant code
💻 Code
const value: number | string = 100;
function fn(): number | undefined {
switch (typeof value) {
case 'number':
const v = typeof value;
return v;
default:
return
}
}
🙁 Actual behavior
the type of 'v' is not number
🙂 Expected behavior
the typeof of 'v' is number