Closed as not planned
Closed as not planned
Description
π Search Terms
type guard parameter any unknown
π Version & Regression Information
- This changed between versions 4.9.6 and 5.0.4
β― Playground Link
π» Code
interface Box<T> {
value: T
}
function isBox<T>(box: unknown): box is Box<T> {
return true
}
const numberBox: Box<unknown> = {value:1}
if (isBox<number>(numberBox)) {
numberBox.value
// ^?
}
if (isBox<any>(numberBox)) {
numberBox.value
// ^?
}
π Actual behavior
if (isBox<any>(numberBox)) {
numberBox.value
// ^? (property) Box<unknown>.value: unknown
}
π Expected behavior
if (isBox<any>(numberBox)) {
numberBox.value
// ^? (property) Box<any>.value: any
}