Files
test-repo/tests/flow-repo/missing_annotation/__snapshots__/jsfmt.spec.js.snap
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

177 lines
4.1 KiB
Plaintext
Raw Normal View History

2017-02-21 13:59:19 -08:00
// Jest Snapshot v1, https://goo.gl/fbAQLP
2020-04-10 19:12:01 +08:00
exports[`array.js format 1`] = `
2018-11-25 16:21:14 +08:00
====================================options=====================================
parsers: ["flow"]
printWidth: 80
| printWidth
=====================================input======================================
// @flow
type Foo = {};
var f: Foo = {};
export var arr = [f];
2017-04-12 13:41:51 -07:00
2018-11-25 16:21:14 +08:00
=====================================output=====================================
2017-04-12 13:41:51 -07:00
// @flow
2018-11-25 16:21:14 +08:00
type Foo = {};
var f: Foo = {};
export var arr = [f];
================================================================================
`;
2020-04-10 19:12:01 +08:00
exports[`async_return.js format 1`] = `
2018-11-25 16:21:14 +08:00
====================================options=====================================
parsers: ["flow"]
printWidth: 80
| printWidth
=====================================input======================================
// @flow
export async function foo() {
return 123;
2017-01-11 10:16:38 -05:00
}
2017-04-12 13:41:51 -07:00
2018-11-25 16:21:14 +08:00
=====================================output=====================================
// @flow
export async function foo() {
return 123;
}
================================================================================
`;
2020-04-10 19:12:01 +08:00
exports[`infer.js format 1`] = `
2018-11-25 16:21:14 +08:00
====================================options=====================================
parsers: ["flow"]
printWidth: 80
| printWidth
=====================================input======================================
2017-04-12 13:41:51 -07:00
/* @flow */
var Foo = {
a: function(arg) { // missing arg annotation
return arg;
},
b: function(arg) { // missing arg annotation
return {
bar: arg
};
},
c: function(arg: string) { // no return annotation required
return {
bar: arg
};
},
d: function(arg: string): {
bar: string
} {
return {
bar: arg
};
},
// return type annotation may be omitted, but if so, input positions on
// observed return type (e.g. param types in a function type) must come
// from annotations
e: function(arg: string) {
return function(x) { // missing param annotation
return x;
}
},
// ...if the return type is annotated explicitly, this is unnecessary
f: function(arg: string): (x:number) => number {
return function(x) { // no error
return x;
}
}
};
var Bar = {
2017-02-21 13:59:19 -08:00
a: Foo.a('Foo'), // no annotation required
2017-02-21 13:59:19 -08:00
// object property types are inferred, so make sure that this doesn't cause
// us to also infer the parameter's type.
b: Foo.b('bar'), // no annotation required
2017-02-21 13:59:19 -08:00
c: Foo.c('bar'), // no annotation required
2017-02-21 13:59:19 -08:00
d: Foo.d('bar'), // no annotation required
};
module.exports = Foo, Bar;
2018-11-25 16:21:14 +08:00
=====================================output=====================================
/* @flow */
var Foo = {
a: function (arg) {
// missing arg annotation
return arg;
},
b: function (arg) {
// missing arg annotation
2017-01-30 09:08:55 -08:00
return {
bar: arg,
2017-01-30 09:08:55 -08:00
};
},
c: function (arg: string) {
// no return annotation required
2017-01-30 09:08:55 -08:00
return {
bar: arg,
2017-01-30 09:08:55 -08:00
};
},
d: function (arg: string): {
bar: string,
2017-01-30 09:08:55 -08:00
} {
return {
bar: arg,
2017-01-30 09:08:55 -08:00
};
},
// return type annotation may be omitted, but if so, input positions on
// observed return type (e.g. param types in a function type) must come
// from annotations
e: function (arg: string) {
return function (x) {
// missing param annotation
return x;
};
},
// ...if the return type is annotated explicitly, this is unnecessary
f: function (arg: string): (x: number) => number {
return function (x) {
// no error
return x;
};
},
};
var Bar = {
2017-04-12 13:41:51 -07:00
a: Foo.a("Foo"), // no annotation required
2017-02-21 13:59:19 -08:00
// object property types are inferred, so make sure that this doesn't cause
// us to also infer the parameter's type.
2017-04-12 13:41:51 -07:00
b: Foo.b("bar"), // no annotation required
2017-04-12 13:41:51 -07:00
c: Foo.c("bar"), // no annotation required
d: Foo.d("bar"), // no annotation required
};
2017-03-03 13:46:11 -08:00
(module.exports = Foo), Bar;
2017-04-12 13:41:51 -07:00
2018-11-25 16:21:14 +08:00
================================================================================
`;