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

68 lines
1.4 KiB
Plaintext

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();
}
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();
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
module.exports = D;
"
`;