Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Mapped types with type parameter are not assignable to { [key: string]: any} #12900

Copy link
Copy link
@wonderful-panda

Description

@wonderful-panda
Issue body actions

TypeScript Version: 2.1.4 and nightly(2.2.0-dev.20161213)

Code

interface Base {
   foo: { [key: string]: any };
   bar: any;
   baz: any;
}

interface E1<T> extends Base {
  foo: T;
}

interface Something { name: string, value: string };
interface E2 extends Base {
  foo: Partial<Something>;  // or other mapped type
}

interface E3<T> extends Base {
  foo: Partial<T>; // or other mapped type
}

Expected behavior:
Successfully compiled.

Actual behavior:
E1 and E2 are OK, but E3 causes compile error.

error TS2430: Interface 'E3<T>' incorrectly extends interface 'Base'.
Types of property 'foo' are incompatible.
Type 'Partial<T>' is not assignable to type '{ [key: string]: any; }'.
Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.