prettier/tests/poly_class_export/__snapshots__/jsfmt.spec.js.snap

79 lines
1.2 KiB
Plaintext

exports[`test A.js 1`] = `
"// @flow
class A<T> {
x: T
}
module.exports = A;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
class A<T> {
x: T;
}
module.exports = A;
"
`;
exports[`test B.js 1`] = `
"// @flow
let A = require(\'./A\');
class B extends A<string> {
constructor() {
super();
}
}
module.exports = new B();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
let A = require(\"./A\");
class B extends A<string> {
constructor() {
super();
}
}
module.exports = new B();
"
`;
exports[`test C.js 1`] = `
"// @flow
// This test exports a function whose return type is the class\'s \`this\` type.
// It should be inferred (no annotation required).
class Foo {
foo(): this {
return this;
}
}
export function f(x: Foo) {
return x.foo();
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
// This test exports a function whose return type is the class\'s \`this\` type.
// It should be inferred (no annotation required).
class Foo {
foo(): this {
return this;
}
}
export function f(x: Foo) {
return x.foo();
}
"
`;