Closed
Description
TypeScript Version: 2.9.0-dev.20180424
Search Terms:
keyof, intersection, conditional types
Code
type Example<T, U> = { [K in keyof T]: K extends keyof U ? UnexpectedError<K> : NoErrorHere<K> }
type UnexpectedError<T extends PropertyKey> = T
type NoErrorHere<T extends PropertyKey> = T
Expected behavior:
No errors.
Actual behavior:
Error on K
in UnexpectedError<K>
with message
Type 'keyof U & K' does not satisfy the constraint 'string | number | symbol'.
Type 'keyof U & K' is not assignable to type 'symbol'.
Playground Link:
Link (no error in playground)
Related Issues:
#23592