Closed
Description
TypeScript Version: 2.2.0-dev.20161127
Code
declare var keyPrototype: any
declare function getKeyData(): Promise<{ key: any }>
async function getKey () {
const { key } = {
key: {
...keyPrototype
},
...await getKeyData()
}
return key
}
Expected behavior:
Code to typecheck. The resulting key
const should be a shallow copy of keyPrototype
, with certain keys overridden by the result of getKeyData
.
Actual behavior:
Error on the key
declaration inside const { key }
: "Initializer provides no value for this binding element and the binding element has no default value", despite the RHS being guaranteed to always have a key
key.