-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed
Description
Bug Report
π Search Terms
type narrow argument
π Version & Regression Information
- This is the behavior in every version I tried
β― Playground Link
π» Code
declare function wrapFunc(f: (ctx: Ctx) => void): void
declare function requireStr(s: string): void
interface Ctx {
throw(status: number): never;
}
async function f2(ctx: Ctx) {
let s: string | false = undefined as any
if (!s) ctx.throw(100)
requireStr(s)
}
wrapFunc(async function (ctx: Ctx) {
let s: string | false = undefined as any
if (!s) ctx.throw(100)
requireStr(s)
})
wrapFunc(async function (ctx) {
let s: string | false = undefined as any
if (!s) ctx.throw(100)
requireStr(s) // <-- Compile Error! here `s` is string | false
})
noinkling
Metadata
Metadata
Assignees
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed