-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
type A = number | string
function isNumber(_): _ is number { return typeof _ === 'number' }
const as: A[] = [1, 2, '3']
// (1) - OK: bs is number[]
let bs = as.filter(isNumber)
// (2) - Not OK - cs is still A[], but should be number[]
let cs = as.filter(_ => isNumber(_))
// (3) - Not OK - ds is still A[], but should be string[]
let ds = as.filter(_ => !isNumber(_))
yahiko00, niieani, rob3c, rictic, mpawelski and 33 more
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created