TypeScript/tests/baselines/reference/objectTypesWithOptionalProperties2.js
Paul Gschwendtner b26f77a703
Do not incorrectly add line separators for non-synthetic nodes when emitting node list (#44070)
As of 3c32f6e154, a line separator is
added between nodes if the nodes are not synthetic and on separate
lines. This it push s wrong and previously only happened if the non-synthetic
nodes were on different lines but had the same parent.

Fixes #44068.
2021-06-04 09:46:23 -05:00

48 lines
750 B
TypeScript

//// [objectTypesWithOptionalProperties2.ts]
// Illegal attempts to define optional methods
var a: {
x()?: number; // error
}
interface I {
x()?: number; // error
}
class C {
x()?: number; // error
}
interface I2<T> {
x()?: T; // error
}
class C2<T> {
x()?: T; // error
}
var b = {
x()?: 1 // error
}
//// [objectTypesWithOptionalProperties2.js]
// Illegal attempts to define optional methods
var a;
var C = /** @class */ (function () {
function C() {
}
C.prototype.x = function () { };
return C;
}());
var C2 = /** @class */ (function () {
function C2() {
}
C2.prototype.x = function () { };
return C2;
}());
var b = {
x: function () { },
1: // error
};