Skip to content

TS losing optional properties when used with index signature and generics #9900

Description

TypeScript Version: 2.0.0-beta

Code

Base code:

// A *self-contained* demonstration of the problem follows...interfaceTest{a?: number;b?: string;}interfaceTestWithStrictProp{a?: number;b?: string;c: string;}interfaceTestIndex{[key: string]: Test;}interfaceTestIndexWithStrict{[key: string]: TestWithStrictProp;}declarefunctiontestFunc<TextendsTestIndex>(t: T): void;declarefunctiontestFuncStrict<TextendsTestIndexWithStrict>(t: T): void;

Consumer code

testFunc({test: {// Compiler doesn't see properties here}});testFuncStrict({test: {// Compiler see a?, b? and c}});

Expected behavior:
Completion in testFunc({ test: { ... } });

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions