2017-02-22 00:59:19 +03:00
|
|
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
exports[`A.js 1`] = `
|
|
|
|
====================================options=====================================
|
|
|
|
parsers: ["flow"]
|
|
|
|
printWidth: 80
|
|
|
|
| printWidth
|
|
|
|
=====================================input======================================
|
2017-04-12 23:41:51 +03:00
|
|
|
// @flow
|
2016-12-23 22:31:38 +03:00
|
|
|
|
|
|
|
class A<T> {
|
|
|
|
x: T
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = A;
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
=====================================output=====================================
|
2016-12-27 21:29:31 +03:00
|
|
|
// @flow
|
2017-01-10 05:49:06 +03:00
|
|
|
|
2016-12-27 21:29:31 +03:00
|
|
|
class A<T> {
|
|
|
|
x: T;
|
|
|
|
}
|
2017-01-10 05:49:06 +03:00
|
|
|
|
2017-01-11 18:16:38 +03:00
|
|
|
module.exports = A;
|
2017-04-12 23:41:51 +03:00
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
================================================================================
|
2016-12-23 22:31:38 +03:00
|
|
|
`;
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
exports[`B.js 1`] = `
|
|
|
|
====================================options=====================================
|
|
|
|
parsers: ["flow"]
|
|
|
|
printWidth: 80
|
|
|
|
| printWidth
|
|
|
|
=====================================input======================================
|
2017-04-12 23:41:51 +03:00
|
|
|
// @flow
|
2016-12-23 22:31:38 +03:00
|
|
|
|
2017-02-22 00:59:19 +03:00
|
|
|
let A = require('./A');
|
2016-12-23 22:31:38 +03:00
|
|
|
|
|
|
|
class B extends A<string> {
|
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = new B();
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
=====================================output=====================================
|
2016-12-27 21:29:31 +03:00
|
|
|
// @flow
|
2017-01-10 05:49:06 +03:00
|
|
|
|
2017-04-12 23:41:51 +03:00
|
|
|
let A = require("./A");
|
2017-01-10 05:49:06 +03:00
|
|
|
|
2016-12-27 21:29:31 +03:00
|
|
|
class B extends A<string> {
|
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
}
|
2017-01-10 05:49:06 +03:00
|
|
|
|
2017-01-11 18:16:38 +03:00
|
|
|
module.exports = new B();
|
2017-04-12 23:41:51 +03:00
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
================================================================================
|
2016-12-23 22:31:38 +03:00
|
|
|
`;
|
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
exports[`C.js 1`] = `
|
|
|
|
====================================options=====================================
|
|
|
|
parsers: ["flow"]
|
|
|
|
printWidth: 80
|
|
|
|
| printWidth
|
|
|
|
=====================================input======================================
|
2017-04-12 23:41:51 +03:00
|
|
|
// @flow
|
2016-12-23 22:31:38 +03:00
|
|
|
|
2017-02-22 00:59:19 +03:00
|
|
|
// This test exports a function whose return type is the class's \`this\` type.
|
2016-12-23 22:31:38 +03:00
|
|
|
// It should be inferred (no annotation required).
|
|
|
|
|
|
|
|
class Foo {
|
|
|
|
foo(): this {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export function f(x: Foo) {
|
|
|
|
return x.foo();
|
|
|
|
}
|
2018-11-25 11:21:14 +03:00
|
|
|
|
|
|
|
=====================================output=====================================
|
2016-12-23 22:31:38 +03:00
|
|
|
// @flow
|
2017-01-10 05:49:06 +03:00
|
|
|
|
2017-02-22 00:59:19 +03:00
|
|
|
// This test exports a function whose return type is the class's \`this\` type.
|
2016-12-23 22:31:38 +03:00
|
|
|
// It should be inferred (no annotation required).
|
2017-01-10 05:49:06 +03:00
|
|
|
|
2016-12-23 22:31:38 +03:00
|
|
|
class Foo {
|
|
|
|
foo(): this {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|
2017-01-10 05:49:06 +03:00
|
|
|
|
2016-12-23 22:31:38 +03:00
|
|
|
export function f(x: Foo) {
|
|
|
|
return x.foo();
|
2017-01-11 18:16:38 +03:00
|
|
|
}
|
2017-04-12 23:41:51 +03:00
|
|
|
|
2018-11-25 11:21:14 +03:00
|
|
|
================================================================================
|
2016-12-23 22:31:38 +03:00
|
|
|
`;
|