Closed
Description
TypeScript Version: 2.2.0-dev.20161122
With --strictNullChecks
.
Code
function spread(arg?: {}): {} {
return {...arg}
}
spread()
Expected behavior:
spread()
returns empty object {}
.
Actual behavior:
Spread types may only be created from object types.
The spec specifically allows null
and undefined
spread arguments by having an early check before the ToObject
abstract operation (3.1.2).