prettier/tests/flow/return_new/__snapshots__/jsfmt.spec.js.snap

57 lines
1.4 KiB
Plaintext
Raw Normal View History

exports[`test test.js 1`] = `
"function Foo() { return {}; }
var foo: number = new Foo(); // error (returns object literal above)
function Bar() { return 0; }
var bar: number = new Bar(); // error (returns new object)
function Qux() { }
var qux: number = new Qux(); // error (returns new object)
class A { }
function B() { return new A(); }
var a: A = new B(); // OK (returns new A)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function Foo() {
return {};
}
var foo: number = new Foo(); // error (returns object literal above)
function Bar() {
return 0;
}
var bar: number = new Bar(); // error (returns new object)
function Qux() {}
var qux: number = new Qux(); // error (returns new object)
class A {}
function B() {
return new A();
}
2017-01-11 18:16:38 +03:00
var a: A = new B(); // OK (returns new A)
"
`;
exports[`test test2.js 1`] = `
"declare class D {
constructor(): { x: number }; // OK
y: any;
}
var d = new D();
2016-12-30 19:56:42 +03:00
d.x = \"\"; // error, string ~/~ number (but property x is found)
(new D: D); // error, new D is an object, D not in proto chain
module.exports = D;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
declare class D {
constructor(): { x: number }, // OK
y: any
}
var d = new D();
d.x = \"\"; // error, string ~/~ number (but property x is found)
(new D(): D); // error, new D is an object, D not in proto chain
2017-01-11 18:16:38 +03:00
module.exports = D;
"
`;