TypeScript Version: 2.2.0-dev.20161127
Code
declarevarkeyPrototype: anydeclarefunctiongetKeyData(): Promise<{key: any}>asyncfunctiongetKey(){const{ key }={key: {
...keyPrototype},
...awaitgetKeyData()}returnkey}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.
TypeScript Version: 2.2.0-dev.20161127
Code
Expected behavior:
Code to typecheck. The resulting
keyconst should be a shallow copy ofkeyPrototype, with certain keys overridden by the result ofgetKeyData.Actual behavior:
Error on the
keydeclaration insideconst { 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 akeykey.