prettier/tests/flow/dump-types/__snapshots__/jsfmt.spec.js.snap

86 lines
2.3 KiB
Plaintext

// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`import.js 1`] = `
====================================options=====================================
parsers: ["flow"]
printWidth: 80
| printWidth
=====================================input======================================
// @flow
var num = 42;
function bar() { }
bar();
module.exports = num;
=====================================output=====================================
// @flow
var num = 42;
function bar() {}
bar();
module.exports = num;
================================================================================
`;
exports[`test.js 1`] = `
====================================options=====================================
parsers: ["flow"]
printWidth: 80
| printWidth
=====================================input======================================
// @flow
var num = require('./import');
function foo(x) { }
foo(0);
var a:string = num;
function unannotated(x) {
return x;
}
// test deduping of inferred types
const nullToUndefined = val => val === null ? undefined : val;
function f0(x: ?Object) { return nullToUndefined(x); }
function f1(x: ?Object) { return nullToUndefined(x); }
function f2(x: ?string) { return nullToUndefined(x); }
function f3(x: ?string) { return nullToUndefined(x); }
declare var idx: $Facebookism$Idx;
declare var obj: {a?: {b: ?{c: null | {d: number}}}};
const idxResult = idx(obj, obj => obj.a.b.c.d);
=====================================output=====================================
// @flow
var num = require("./import");
function foo(x) {}
foo(0);
var a: string = num;
function unannotated(x) {
return x;
}
// test deduping of inferred types
const nullToUndefined = val => (val === null ? undefined : val);
function f0(x: ?Object) {
return nullToUndefined(x);
}
function f1(x: ?Object) {
return nullToUndefined(x);
}
function f2(x: ?string) {
return nullToUndefined(x);
}
function f3(x: ?string) {
return nullToUndefined(x);
}
declare var idx: $Facebookism$Idx;
declare var obj: { a?: { b: ?{ c: null | { d: number } } } };
const idxResult = idx(obj, obj => obj.a.b.c.d);
================================================================================
`;