Skip to content

Conversation

@weswigham
Copy link
Member

Fixes #23334

@weswigham weswigham requested review from mhegazy and sandersn April 17, 2018 21:46
if (isTypeAssignableToKind(exprType, TypeFlags.NumberLike)) {
indexerType = getIndexTypeOfType(parentType, IndexKind.Number);
}
else if (isTypeAssignableToKind(exprType, TypeFlags.StringLike)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string is valid for number indexing as well.. so symbols aside..
indexrType = (isTypeAssignableToKind(exprType, TypeFlags.NumberLike) && getIndexTypeOfType(parentType, IndexKind.Number) || getIndexTypeOfType(parentType, IndexKind.String)

@weswigham weswigham force-pushed the computed-implicit-any branch from e78530c to d965c33 Compare April 17, 2018 22:55
if (isTypeAssignableToKind(exprType, TypeFlags.NumberLike)) {
indexerType = getIndexTypeOfType(parentType, IndexKind.Number) || getIndexTypeOfType(parentType, IndexKind.String);
}
else if (isTypeAssignableToKind(exprType, TypeFlags.StringLike)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const named = Symbol("");
let { [named]: prop } = strIndexed;
void prop;``

today that is string ... we probably wanna keep it this way until we have a symbol indexer.

@weswigham
Copy link
Member Author

@mhegazy updated. Destructuring now has the same buggy behavior as indexing 😿

@mhegazy
Copy link
Contributor

mhegazy commented Apr 26, 2018

We need to update it to handle symbols like we do in regular indexing.

@weswigham
Copy link
Member Author

@mhegazy Does this look like the correct errors to issue for symbol destructuring (and should they be noImplicitAny)?

@weswigham weswigham merged commit 6d3b6e2 into microsoft:master Apr 27, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants