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

81 lines
1.2 KiB
Plaintext

// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`A.js 1`] = `
// @flow
class A<T> {
x: T
}
module.exports = A;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// @flow
class A<T> {
x: T;
}
module.exports = A;
`;
exports[`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[`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();
}
`;