Destructuring array into an object is assignable to an array type #34780
Labels
Comments
See #9726 - TS would need a way to know that the array methods don't end up on |
@RyanCavanaugh is this really a design limitation due to lack of enumerable properties? I believe in a very similar case for objects (not arrays) the type is correctly inferred:
Could we have similar feature for arrays? |
yeah i found that too doing a |
@sebapawlak TS knows which members of a class are enumerable and which aren't, but we don't have any declaration form for annotated the value-declared type of |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TypeScript Version: 3.8.0-dev.20191026
Search Terms:
Code
Expected behavior: Typescript errors about type mismatch.
Actual behavior: Typescript does neither warn nor error about this and
foo
is no longer an array.Playground Link: https://www.typescriptlang.org/play/?ts=3.8.0-dev.20191026&ssl=1&ssc=18&pln=1&pc=8#code/DYUwLgBARghgThAvBA2gRgDQQExYMwC6AUEaJAGYD2lAXBDAHYCeKBSEA3hAHS+wIBfEgGNKDAM6VQ3YJQDmACgCCcODCbcAluJVqmCqpQCURiAHozEcjGDiQQA
Related Issues: #14768
The text was updated successfully, but these errors were encountered: