Closed
Description
TypeScript Version: nightly (2.6.0-dev.20170829)
Code
type Point = { x: number, y: number }
type Mapped = Record<'x'|'y', number>
type IndexSignature = { [x: string]: never }
// All of the following have type: `() => Object`
type Test1 = Point['valueOf']
type Test2 = Mapped['valueOf']
type Test3 = IndexSignature['valueOf']
Expected behavior:
Test1
, Test2
and Test3
should all be errors.
User provided types should be considered "exact". No properties should be inherited from Object
. The current behaviour is of little use, however it's quite confusing and really gets in the way of type level programming.