2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/compiler/interfaceContextualType.ts ===
|
|
|
|
export interface IOptions {
|
|
|
|
>IOptions : IOptions
|
|
|
|
|
|
|
|
italic?: boolean;
|
|
|
|
>italic : boolean
|
|
|
|
|
|
|
|
bold?: boolean;
|
|
|
|
>bold : boolean
|
|
|
|
}
|
|
|
|
export interface IMap {
|
|
|
|
>IMap : IMap
|
|
|
|
|
|
|
|
[s: string]: IOptions;
|
|
|
|
>s : string
|
|
|
|
>IOptions : IOptions
|
|
|
|
}
|
|
|
|
|
|
|
|
class Bug {
|
|
|
|
>Bug : Bug
|
|
|
|
|
|
|
|
public values: IMap;
|
|
|
|
>values : IMap
|
|
|
|
>IMap : IMap
|
|
|
|
|
|
|
|
ok() {
|
|
|
|
>ok : () => void
|
|
|
|
|
|
|
|
this.values = {};
|
2014-10-13 15:56:58 +02:00
|
|
|
>this.values = {} : { [x: string]: undefined; }
|
2014-08-15 23:33:16 +02:00
|
|
|
>this.values : IMap
|
|
|
|
>this : Bug
|
|
|
|
>values : IMap
|
2014-10-13 15:56:58 +02:00
|
|
|
>{} : { [x: string]: undefined; }
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
this.values['comments'] = { italic: true };
|
|
|
|
>this.values['comments'] = { italic: true } : { italic: boolean; }
|
|
|
|
>this.values['comments'] : IOptions
|
|
|
|
>this.values : IMap
|
|
|
|
>this : Bug
|
|
|
|
>values : IMap
|
|
|
|
>{ italic: true } : { italic: boolean; }
|
|
|
|
>italic : boolean
|
|
|
|
}
|
|
|
|
shouldBeOK() {
|
|
|
|
>shouldBeOK : () => void
|
|
|
|
|
|
|
|
this.values = {
|
2014-10-13 15:56:58 +02:00
|
|
|
>this.values = { comments: { italic: true } } : { [x: string]: { italic: boolean; }; comments: { italic: boolean; }; }
|
2014-08-15 23:33:16 +02:00
|
|
|
>this.values : IMap
|
|
|
|
>this : Bug
|
|
|
|
>values : IMap
|
2014-10-13 15:56:58 +02:00
|
|
|
>{ comments: { italic: true } } : { [x: string]: { italic: boolean; }; comments: { italic: boolean; }; }
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
comments: { italic: true }
|
|
|
|
>comments : { italic: boolean; }
|
|
|
|
>{ italic: true } : { italic: boolean; }
|
|
|
|
>italic : boolean
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|