TypeScript/tests/baselines/reference/interfaceContextualType.js
2015-12-08 17:51:10 -08:00

40 lines
784 B
TypeScript

//// [interfaceContextualType.ts]
export interface IOptions {
italic?: boolean;
bold?: boolean;
}
export interface IMap {
[s: string]: IOptions;
}
class Bug {
public values: IMap;
ok() {
this.values = {};
this.values['comments'] = { italic: true };
}
shouldBeOK() {
this.values = {
comments: { italic: true }
};
}
}
//// [interfaceContextualType.js]
"use strict";
var Bug = (function () {
function Bug() {
}
Bug.prototype.ok = function () {
this.values = {};
this.values['comments'] = { italic: true };
};
Bug.prototype.shouldBeOK = function () {
this.values = {
comments: { italic: true }
};
};
return Bug;
}());