-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
FixedA PR has been merged for this issueA PR has been merged for this issue
Milestone

Description
TypeScript Version: 2.7.1 and 2.8.0-dev.20180215
Search Terms: "keyof any"
Code
function foo<T>(bar: T, baz: keyof T) {
console.log(bar[baz]);
}
const sym = Symbol();
const quirk = { [sym]: "thing" };
foo<any>(quirk, sym);
Expected behavior:
keyof any
should be equivalent to PropertyKey
(that is string | number | symbol
)
The example code should compile without error.
Actual behavior:
keyof any
is equivalent to string
The example code does not compile and produces error:
error TS2345: Argument of type 'unique symbol' is not assignable to parameter of type 'string'.
Metadata
Metadata
Assignees
Labels
FixedA PR has been merged for this issueA PR has been merged for this issue