TypeScript Version: 2.6.2
Code
declare const o: {
records?: string[]
}
const newRecords = o.records &&
o.records.map((record, i) => record + (o.records.length === i) ? '' : ',')
Expected behavior:
o.records is safe to using length property.
Actual behavior:
warning:
Object is possibly 'undefined'.
(property) records: string[] | undefined
Playground Link:
playground
Note: enable strict mode is required for reproducing.
Related Issues:
TypeScript Version: 2.6.2
Code
Expected behavior:
o.recordsis safe to usinglengthproperty.Actual behavior:
warning:
Playground Link:
playground
Note: enable strict mode is required for reproducing.
Related Issues: