TypeScript/tests/baselines/reference/assignmentToObjectAndFunction.js
Sheetal Nandi 6ab3adfd43 Modified the emitComment logic to handle emitting leading or trailing spaces depending on flags
Leading comments have trailing separator while trailing comments have leading space
This removes the extra trailing space in the trailing comments
2014-08-15 14:32:08 -07:00

63 lines
1.3 KiB
JavaScript

//// [assignmentToObjectAndFunction.ts]
var errObj: Object = { toString: 0 }; // Error, incompatible toString
var goodObj: Object = {
toString(x?) {
return "";
}
}; // Ok, because toString is a subtype of Object's toString
var errFun: Function = {}; // Error for no call signature
function foo() { }
module foo {
export var boom = 0;
}
var goodFundule: Function = foo; // ok
function bar() { }
module bar {
export function apply(thisArg: string, argArray?: string) { }
}
var goodFundule2: Function = bar; // ok
function bad() { }
module bad {
export var apply = 0;
}
var badFundule: Function = bad; // error
//// [assignmentToObjectAndFunction.js]
var errObj = { toString: 0 }; // Error, incompatible toString
var goodObj = {
toString: function (x) {
return "";
}
}; // Ok, because toString is a subtype of Object's toString
var errFun = {}; // Error for no call signature
function foo() {
}
var foo;
(function (foo) {
foo.boom = 0;
})(foo || (foo = {}));
var goodFundule = foo; // ok
function bar() {
}
var bar;
(function (bar) {
function apply(thisArg, argArray) {
}
bar.apply = apply;
})(bar || (bar = {}));
var goodFundule2 = bar; // ok
function bad() {
}
var bad;
(function (bad) {
bad.apply = 0;
})(bad || (bad = {}));
var badFundule = bad; // error