Skip to content

Bug from #23592 - Type 'keyof U & K' does not satisfy the constraint 'string | number | symbol' #23648

Closed
@kpdonn

Description

@kpdonn

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

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions