repo
stringlengths
5
106
file_url
stringlengths
78
301
file_path
stringlengths
4
211
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:56:49
2026-01-05 02:23:25
truncated
bool
2 classes
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declaration_files_haste/ws/test/format.test.js
tests/format/flow-repo/declaration_files_haste/ws/test/format.test.js
runFormatTest(import.meta, ["flow"]);
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declaration_files_haste/foo/bar/nested_test.js
tests/format/flow-repo/declaration_files_haste/foo/bar/nested_test.js
/* @flow */ var docblock = require('qux/docblock'); var min = require('d3/min.js'); var corge = require('qux/corge'); var SomeOtherModule = require('SomeOtherModule'); // make sure we don't pick up non-header @providesModule // annotations - see node_modules/qux/docblock.js var unreachable = require('annotation'); (...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declaration_files_haste/foo/bar/format.test.js
tests/format/flow-repo/declaration_files_haste/foo/bar/format.test.js
runFormatTest(import.meta, ["flow"]);
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/match_failure/enum.js
tests/format/flow-repo/match_failure/enum.js
// @flow type Binary = 0 | 1; function stringifyBinary(binary: Binary): string { if (binary === 0) { return 'zero'; } else if (binary === 2) { // oops return 'one'; } throw "unreachable"; // TODO: this shouldn't be needed }
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/match_failure/disjoint_union.js
tests/format/flow-repo/match_failure/disjoint_union.js
/* @flow */ type Shape = {type: 'rectangle', width: number, height: number} | {type: 'circle', radius: number}; function area(shape: Shape): number { if (shape.type === 'square') { // TODO: this should be an error return shape.width * shape.height; } else if (shape.type === 'circle') { return Math.PI ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/match_failure/format.test.js
tests/format/flow-repo/match_failure/format.test.js
runFormatTest(import.meta, ["flow"]);
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/async/async2.js
tests/format/flow-repo/async/async2.js
// @flow // misc basic function test1() { async function foo() { return 42; } async function bar() { var a = await foo(); var b: number = a; // valid var c: string = a; // Error: number ~> string } } // // void returns: // // inference should produce return type Promise<void> // in the abse...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/async/async3.js
tests/format/flow-repo/async/async3.js
// @flow /** * test nested-promise unwrapping. * Note: currently we don't do this properly in the underlying * type of the Promise class, which causes spurious errors to * be raised here. Once that's fixed, the errors here will go * away. */ async function foo() { return 42; } async function bar() { return...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/async/async_return_void.js
tests/format/flow-repo/async/async_return_void.js
// @flow async function foo1(): Promise<string> { return; } async function foo2(): Promise<string> { return undefined; } async function foo3(): Promise<string> { function bar() { } return bar(); }
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/async/async_base_class.js
tests/format/flow-repo/async/async_base_class.js
// This is kind of weird, but it should parse. This works in babel without the // parens around (await promise). From the es6 and async/await specs I (nmote) // am not clear on whether it should. In any case it's a strange corner case // that is probably not important to support. class C {}; var P: Promise<Class<C>> =...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/async/await_parse.js
tests/format/flow-repo/async/await_parse.js
async function f() { await 1; } async function ft<T>(a: T) { await 1; } class C { async m() { await 1; } async mt<T>(a: T) { await 1; } static async m(a) { await 1; } static async mt<T>(a: T) { await 1; } } var e = async function () { await 1; }; var et = async function<T> (a: T) { await 1; }; var n = new as...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/async/async.js
tests/format/flow-repo/async/async.js
// @flow // "For async functions, a Promise<T> is returned, // and the type of return expressions must be T." // async function f0(): Promise<number> { return 1; } async function f1(): Promise<bool> { return 1; // error, number != bool } // await: (p: Promise<T> | T) => T // async function f2(p: Promise<numbe...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/async/async_parse.js
tests/format/flow-repo/async/async_parse.js
async function f() {} async function ft<T>(a: T) {} class C { async m() {} async mt<T>(a: T) {} static async m(a) {} static async mt<T>(a: T) {} } var e = async function () {}; var et = async function<T> (a: T) {}; var n = new async function() {}; var o = { async m() {} }; var ot = { async m<T>(a: T) {} }; ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/async/async_promise.js
tests/format/flow-repo/async/async_promise.js
async function f(): Promise<number> { return Promise.resolve(1); }
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/async/format.test.js
tests/format/flow-repo/async/format.test.js
runFormatTest(import.meta, ["flow"]);
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/overload/test3.js
tests/format/flow-repo/overload/test3.js
// passing a union-like thing into an overload is ok // if overload handles each branch of union-like thing // unions declare function f(x: string): void; declare function f(x: number): void; declare var x_f: string | number; f(x_f); // ok // maybe declare function g(x: null): void; declare function g(x: void): void;...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/overload/test.js
tests/format/flow-repo/overload/test.js
function foo() { var output = new FakeUint8Array(); output.set(new FakeUint8Array(), 0); // matches one of the overloads of set }
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/overload/overload.js
tests/format/flow-repo/overload/overload.js
/** * tests of overload selection * * @flow */ var x1: number = "".match(0)[0]; var x2: number = "".match(/pattern/)[0]; var x3: string = "".replace(/pattern/,"..."); var x4: number = "".split(/pattern/)[0]; declare class C { foo(x:number): number; foo(x:string): string; bar(x: { a: number }): number...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/overload/test2.js
tests/format/flow-repo/overload/test2.js
declare class Foo { bar(x: 'hmm'): number; bar(x: string): string; } var foo = new Foo; (foo.bar('hmm'): number); // OK (foo.bar('hmmm'): number); // error
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/overload/union.js
tests/format/flow-repo/overload/union.js
function foo<U> (x: $Either<Array<U>,U>): Array<U> { return []; } var x1:number = foo(0)[0]; var x2:string = foo([""])[0];
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/overload/format.test.js
tests/format/flow-repo/overload/format.test.js
runFormatTest(import.meta, ["flow"]);
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/overload/lib/lib.js
tests/format/flow-repo/overload/lib/lib.js
declare class FakeUint8Array { set(index: number, value: number): void; set(array: FakeUint8Array | Array<number>, offset?: number): void; }
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/overload/lib/format.test.js
tests/format/flow-repo/overload/lib/format.test.js
runFormatTest(import.meta, ["flow"]);
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/incremental_haste_blacklist/A.js
tests/format/flow-repo/incremental_haste_blacklist/A.js
/* @flow */
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/incremental_haste_blacklist/index.js
tests/format/flow-repo/incremental_haste_blacklist/index.js
/* @flow */ require('A');
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/incremental_haste_blacklist/format.test.js
tests/format/flow-repo/incremental_haste_blacklist/format.test.js
runFormatTest(import.meta, ["flow"]);
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/annot2/A.js
tests/format/flow-repo/annot2/A.js
/** * @providesModule A * @flow */ import type T from "T"; export default class { p: T; constructor() { this.p = 0; } }
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/annot2/T.js
tests/format/flow-repo/annot2/T.js
/** * @providesModule T */
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/annot2/B.js
tests/format/flow-repo/annot2/B.js
/** * @flow */ import A from "A" class B extends A { p: string; // OK, string ~> any }
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/annot2/format.test.js
tests/format/flow-repo/annot2/format.test.js
runFormatTest(import.meta, ["flow"]);
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/object_freeze/object_freeze.js
tests/format/flow-repo/object_freeze/object_freeze.js
/* @flow */ var foo = Object.freeze({bar: '12345'}); foo.bar = '23456'; // error Object.assign(foo, {bar: '12345'}); // error var baz = {baz: 12345}; var bliffl = Object.freeze({bar: '12345', ...baz}); bliffl.bar = '23456'; // error bliffl.baz = 3456; // error bliffl.corge; // error bliffl.constructor = baz; // erro...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/object_freeze/format.test.js
tests/format/flow-repo/object_freeze/format.test.js
runFormatTest(import.meta, ["flow"]);
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/optional_props/test3_exact_annot.js
tests/format/flow-repo/optional_props/test3_exact_annot.js
/* The logic that allows ({}: {p?:T}), described in test3.js, should _not_ also fire for exact annotations. */ const a: {| a: number |} = { a: 1 }; const b: { a: number, b?: number } = a; // error: property `b` not found b.b = 0; // because subsequent writes would widen the exact object (a.b: number); // error: pro...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/optional_props/test3.js
tests/format/flow-repo/optional_props/test3.js
// @flow /* object literals are sealed. this is simply a heuristic decision: most of the time, the rule gives the 'right' errors. an exception is when a literal is used as an initializer for an lvalue whose type specifies optional properties missing from the literal, as below. the problem become...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/optional_props/test3_failure.js
tests/format/flow-repo/optional_props/test3_failure.js
// generalization of failure in test3.js class A<O: {x: { a: number, b?: string}}> { o: O; foo() { this.o.x = { a: 123 }; this.o.x.b = 'hello'; // this is a spurious error (see test3.js for details) } }
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/optional_props/test.js
tests/format/flow-repo/optional_props/test.js
var x: { } = { foo: 0 }; var y: { foo?: string } = x; // OK in TypeScript, not OK in Flow var z: string = y.foo || ""; var o = { }; y = o; // OK; we know that narrowing could not have happened o.foo = 0; // future widening is constrained function bar(config: { foo?: number }) {} bar({}); bar({foo: ""});
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/optional_props/test2.js
tests/format/flow-repo/optional_props/test2.js
var a: { foo?: string } = {}; a.foo = undefined; // This is not an error a.foo = null; // But this is an error var b: { foo?: ?string } = {}; b.foo = undefined; // This is fine b.foo = null; // Also fine var c: { foo?: string } = { foo: undefined }; // This is not an error var d: { foo?: string } = { foo: null }; // ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/optional_props/format.test.js
tests/format/flow-repo/optional_props/format.test.js
runFormatTest(import.meta, ["flow"]);
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/generators/return.js
tests/format/flow-repo/generators/return.js
function test1(gen: Generator<void, string, void>) { // You can pass whatever you like to return, it doesn't need to be related to // the Generator's return type var ret = gen.return(0); (ret.value: void); // error: string | number ~> void } // However, a generator can "refuse" the return by catching an except...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/generators/variance.js
tests/format/flow-repo/generators/variance.js
declare var g1: Generator<string, string, ?string>; var g2: Generator<?string, ?string, string> = g1;
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/generators/generators.js
tests/format/flow-repo/generators/generators.js
function *stmt_yield(): Generator<number, void, void> { yield 0; // ok yield ""; // error: string ~> number } function *stmt_next(): Generator<void, void, number> { var a = yield; if (a) { (a : number); // ok } var b = yield; if (b) { (b : string); // error: number ~> string } } function *stm...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/generators/class_failure.js
tests/format/flow-repo/generators/class_failure.js
// generalization of failure in class.js class GeneratorExamples<X> { *infer_stmt() { var x: boolean = yield 0; // error: number ~> boolean return ""; } } var examples = new GeneratorExamples(); for (var x of examples.infer_stmt()) { (x : string) } // error: number ~> string var infer_stmt_next = exampl...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/generators/refi.js
tests/format/flow-repo/generators/refi.js
function *a(x: {a: void | string}): Generator<void, void, void> { if (!x.a) return; (x.a: string); // ok yield; (x.a: string); // error } function *b(x: void | string): Generator<void, void, void> { if (!x) return; (x: string); // ok yield; (x: string); // ok } declare function fn(): Generator<void, v...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/generators/throw.js
tests/format/flow-repo/generators/throw.js
function *catch_return() { try { yield 0; } catch (e) { return e; } } var catch_return_value = catch_return().throw("").value; if (catch_return_value !== undefined) { (catch_return_value : string); // error: number ~> string } function *yield_return() { try { yield 0; return; } catch (e) {...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/generators/class.js
tests/format/flow-repo/generators/class.js
class GeneratorExamples { *stmt_yield(): Generator<number, void, void> { yield 0; // ok yield ""; // error: string ~> number } *stmt_next(): Generator<void, void, number> { var a = yield; if (a) { (a : number); // ok } var b = yield; if (b) { (b : string); // error: numbe...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/generators/format.test.js
tests/format/flow-repo/generators/format.test.js
runFormatTest(import.meta, ["flow"]);
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/facebook_fbt_none/main.js
tests/format/flow-repo/facebook_fbt_none/main.js
// @flow var React = require('react'); (<fbt />: React.Element<*>); (<fbt />: number); // Error: ReactElement ~> number
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/facebook_fbt_none/format.test.js
tests/format/flow-repo/facebook_fbt_none/format.test.js
runFormatTest(import.meta, ["flow"]);
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/record/test.js
tests/format/flow-repo/record/test.js
type Key1 = 'foo' | 'bar'; // make an enum type with known key set var o1: {[key: Key1]: number} = { foo: 0, bar: "", // error: string ~/~ number }; o1.foo; // OK o1.qux; // error: qux not found o1.toString(); // ok type R = {foo: any, bar: any}; type Key2 = $Keys<R>; // another way to make an enum type, with unkn...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/record/format.test.js
tests/format/flow-repo/record/format.test.js
runFormatTest(import.meta, ["flow"]);
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/error_messages/errors.js
tests/format/flow-repo/error_messages/errors.js
if (typeof define === 'function' && define.amd) { }
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/error_messages/format.test.js
tests/format/flow-repo/error_messages/format.test.js
runFormatTest(import.meta, ["flow"]);
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/duplicate_methods/test.js
tests/format/flow-repo/duplicate_methods/test.js
class C1 { m() { } m() { } } new C1().m(); class C2 { get m() { return 42; } m() { } } new C2().m(); class C3 { set m(x) { } m() { } } new C3().m(); class C4 { get m() { return 42; } set m(x: number) { } } new C4().m = new C4().m - 42; class C5 { m() { } get m() { return 42; } set m(x: num...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/duplicate_methods/format.test.js
tests/format/flow-repo/duplicate_methods/format.test.js
runFormatTest(import.meta, ["flow"]);
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/array-filter/test.js
tests/format/flow-repo/array-filter/test.js
/* @flow */ function filterOutVoids<T> (arr: Array<?T>): Array<T> { return arr.filter(Boolean) } function filterOutSmall (arr: Array<?number>): Array<?number> { return arr.filter(num => num && num > 10) }
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/array-filter/test2.js
tests/format/flow-repo/array-filter/test2.js
/* @flow */ function filterItems(items: Array<string|number>): Array<string|number> { return items.map(item => { if (typeof item === 'string') { return item.length > 2 ? item : null; } else { return item*10; } }).filter(Boolean); } const filteredItems = filterItems(['foo', 'b', 1, 2]); co...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/array-filter/format.test.js
tests/format/flow-repo/array-filter/format.test.js
runFormatTest(import.meta, ["flow"]);
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/node_modules_without_json/test.js
tests/format/flow-repo/node_modules_without_json/test.js
// @flow let foo = require('foo');
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/node_modules_without_json/format.test.js
tests/format/flow-repo/node_modules_without_json/format.test.js
runFormatTest(import.meta, ["flow"]);
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/method_properties/test.js
tests/format/flow-repo/method_properties/test.js
class C { C() { } foo() { } static bar() { } qux() { this.constructor.x; } } C.x; (new C).foo.x; C.bar.x; import {Foo} from './exports_optional_prop'; const foo = new Foo(); (foo.bar(): string); // error, could be undefined function f(x) { (x.bar(): string); // error. caused by `f(foo)`; annotate x to track...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/method_properties/exports_optional_prop.js
tests/format/flow-repo/method_properties/exports_optional_prop.js
// @flow declare class Foo { bar?: () => string } export {Foo};
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/method_properties/format.test.js
tests/format/flow-repo/method_properties/format.test.js
runFormatTest(import.meta, ["flow"]);
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/encaps/encaps.js
tests/format/flow-repo/encaps/encaps.js
class A { } var a = new A(); var s1 = `l${a.x}r`; // error: no prop x in A function tag(strings,...values) { var x:number = strings[0]; // error: string ~> number return x; } var s2 = tag `l${42}r`; function tag2(strings,...values) { return { foo: "" }; // ok: tagged templates can return whatever } var s3 ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/encaps/format.test.js
tests/format/flow-repo/encaps/format.test.js
runFormatTest(import.meta, ["flow"]);
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/object_api/object_keys.js
tests/format/flow-repo/object_api/object_keys.js
/* @flow */ var sealed = {one: 'one', two: 'two'}; (Object.keys(sealed): Array<'one'|'two'>); (Object.keys(sealed): void); // error, Array<string> var unsealed = {}; Object.keys(unsealed).forEach(k => { (k : number) // error: string ~> number }); var dict: { [k: number]: string } = {}; Object.keys(dict).forEach(k ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/object_api/object_missing.js
tests/format/flow-repo/object_api/object_missing.js
// @flow let tests = [ function() { Object.doesNotExist(); }, ];
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/object_api/object_prototype.js
tests/format/flow-repo/object_api/object_prototype.js
/* @flow */ function takesABool(x: boolean) {} function takesAString(x: string) {} function takesANumber(x: number) {} function takesAnObject(x: Object) {} class Foo {} var a = { foo: 'bar' }; var b = { foo: 'bar', ...{}}; var c = { foo: 'bar', toString: function(): number { return 123; }}; var d : { [key: string]: ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/object_api/b.js
tests/format/flow-repo/object_api/b.js
/* @flow */ var a = require('./a'); var b = Object.assign({ bar() {}, ...{} }, a); b.a(); // works here module.exports = b;
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/object_api/object_create.js
tests/format/flow-repo/object_api/object_create.js
/* @flow */ class C { foo: string; } // OK, `instanceof C` would be true (Object.create(C.prototype): C); // OK, `instanceof C` would be true (Object.create(new C): C); // error, object literals don't structurally match instances ({ foo: "foo" }: C); // error, object types don't structurally match instances type O...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/object_api/c.js
tests/format/flow-repo/object_api/c.js
/* @flow */ var c = require('./b'); c.a(); c.foo();
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/object_api/object_getprototypeof.js
tests/format/flow-repo/object_api/object_getprototypeof.js
// @flow class Foo {} class Bar extends Foo {} let tests = [ function() { const x = new Bar(); (Object.getPrototypeOf(x): Foo); }, ];
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/object_api/a.js
tests/format/flow-repo/object_api/a.js
/* @flow */ module.exports = { a() {} };
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/object_api/object_assign.js
tests/format/flow-repo/object_api/object_assign.js
/* @flow */ var export_ = Object.assign({}, { foo: function(param) { return param; } }); var decl_export_: { foo: any; bar: any } = Object.assign({}, export_); let anyObj: Object = {}; Object.assign(anyObj, anyObj); // makes sure this terminates module.exports = export_;
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/object_api/format.test.js
tests/format/flow-repo/object_api/format.test.js
runFormatTest(import.meta, ["flow"]);
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/structural_subtyping/obj.js
tests/format/flow-repo/structural_subtyping/obj.js
/** * @flow */ interface IHasXString { x: string; } var propTest1: IHasXString = { x: 'hello' }; var propTest2: IHasXString = { x: 123 }; // Error string != number var propTest3: IHasXString = {}; // Property not found var propTest4: IHasXString = ({}: Object); function propTest5(y: {[key: string]: string}) { ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/structural_subtyping/class.js
tests/format/flow-repo/structural_subtyping/class.js
/** * @flow */ class ClassWithXString { x: string; } interface IHasXString { x: string; } interface IHasXNumber { x: number; } interface IHasYString { y: string; } var testInstance1: IHasXString = new ClassWithXString(); var testInstance2: IHasXNumber = new ClassWithXString(); // Error wrong type var tes...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/structural_subtyping/builtin.js
tests/format/flow-repo/structural_subtyping/builtin.js
/** * @flow */ interface IHasLength { length: number; } var lengthTest1: IHasLength = []; var lengthTest2: IHasLength = 'hello'; var lengthTest3: IHasLength = 123; // number doesn't have length var lengthTest4: IHasLength = true; // bool doesn't have length
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/structural_subtyping/optional.js
tests/format/flow-repo/structural_subtyping/optional.js
/* @flow */ interface HasOptional { a: string, b?: number, }; var test1: HasOptional = { a: "hello" } var test2: HasOptional = {}; // Error: missing property a var test3: HasOptional = { a: "hello", b: true }; // Error: boolean ~> number
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/structural_subtyping/format.test.js
tests/format/flow-repo/structural_subtyping/format.test.js
runFormatTest(import.meta, ["flow"]);
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/arrays/Arrays.js
tests/format/flow-repo/arrays/Arrays.js
/* @providesModule Arrays */ function foo(x:string) { } var a = []; a[0] = 1; a[1] = "..."; foo(a[1]); var y; a.forEach(x => y=x); // for literals, composite element type is union of individuals // note: test both tuple and non-tuple inferred literals var alittle: Array<?number> = [0, 1, 2, 3, null]; var abig: Arr...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/arrays/numeric_elem.js
tests/format/flow-repo/arrays/numeric_elem.js
var arr = []; var day = new Date; // Date instances are numeric (see Flow_js.numeric) and thus can index into // arrays. arr[day] = 0; (arr[day]: string); // error: number ~> string
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/arrays/format.test.js
tests/format/flow-repo/arrays/format.test.js
runFormatTest(import.meta, ["flow"]);
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/union_new/test30-helper.js
tests/format/flow-repo/union_new/test30-helper.js
// @noflow module.exports = { FOO: 'foo', BAR: 'bar', }
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/union_new/test21.js
tests/format/flow-repo/union_new/test21.js
// @noflow // annotations for disjoint unions type T = | { type: "FOO", x: number } | { type: "BAR", x: string } ({ type: (bar(): "BAR"), x: str() }: T); ({ type: bar(), x: str() }: T); ({ type: bar(), x: (str(): string) }: T); function bar() { return "BAR"; } function str() { return "hello"; }
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/union_new/test13.js
tests/format/flow-repo/union_new/test13.js
// @noflow /* ensure there are no unintended side effects when trying branches */ ({type: 'B', id: 'hi'}: { type: 'A'; id: ?string; } | { type: 'B'; id: string; });
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/union_new/issue-1664.js
tests/format/flow-repo/union_new/issue-1664.js
/* @flow */ type DataBase = { id: string, name: string, }; type UserData = DataBase & { kind: "user", }; type SystemData = DataBase & { kind: "system", } type Data = UserData | SystemData; const data: Data = { id: "", name: "", kind: "system", } if (data.kind === "system") { (data: SystemData); }
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/union_new/issue-1349.js
tests/format/flow-repo/union_new/issue-1349.js
/* @flow */ var bar: Array<{b: ?boolean, c: number} | {b: boolean}> = [ {b: true, c: 123}, {b: true} ];
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/union_new/test15.js
tests/format/flow-repo/union_new/test15.js
// @noflow // functions as objects function foo<X>(target: EventTarget) { target.addEventListener('click', (e) => {}); } declare class EventTarget { addEventListener(type: 'foo', listener: KeyboardEventHandler): void; addEventListener(type: string, listener: EventHandler): void; } declare class Event { } decl...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/union_new/test19.js
tests/format/flow-repo/union_new/test19.js
// @noflow // constructor overloads function m<X>() { return new D(); } declare class D { constructor(_: void): void; constructor(_: null): void; }
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/union_new/test7.js
tests/format/flow-repo/union_new/test7.js
// @noflow /** * Test that shows how the implementation of union types is broken */ //////////////////// // recursive types //////////////////// function rec(x: F1 | F2) { } rec({ x: 0 }); type F1 = G1; type F2 = G2; type G1 = { x: H1, y?: G1 }; type G2 = { x: H2, y?: G2 }; type H1 = string; type H2 = number; //...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/union_new/test3.js
tests/format/flow-repo/union_new/test3.js
// @noflow /** * Test that shows how the implementation of union types is broken */ /////////////////////////////// // example with function types /////////////////////////////// function fun(a: ((x: number) => void) | ((x: string) => void)) { } fun((((x) => {}): A1)); type A1 = (x: B1) => void; type B1 = strin...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/union_new/test22.js
tests/format/flow-repo/union_new/test22.js
// @noflow // refinement of disjoint unions type Empty = { } type Success = { type: 'SUCCESS'; result: string; }; type Error = { type: 'ERROR'; } & Empty; export type T = Success | Error; function foo(x: T) { if (x.type === 'SUCCESS') return x.result; else return x.result; }
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/union_new/issue-824.js
tests/format/flow-repo/union_new/issue-824.js
import { B, C } from "./issue-824-helper"; type K = B | C; type I = { which(): number; }; export default class A { static foo(p: K): bool { return false; } static bar(p: I & K): bool { return this.foo(p); } }
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/union_new/test14.js
tests/format/flow-repo/union_new/test14.js
// @noflow // annotations declare class C<X> { get(): X; } function union(o: { x: string } | { x: number }) { } function foo(c: C<number>) { union({ x: c.get() }); }
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/union_new/test24.js
tests/format/flow-repo/union_new/test24.js
// @noflow // scaling test for full type resolution declare class C { addListener(event: string, listener: Function): C; emit(event: string, ...args:Array<any>): boolean; listeners(event: string): Array<Function>; listenerCount(event: string): number; on(event: string, listener: Function): C; once(event: ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/union_new/test8.js
tests/format/flow-repo/union_new/test8.js
// @noflow /** * Test that shows how the implementation of union types is broken */ ////////////////////// // nested union types ////////////////////// function rec(x: F1 | F2) { } rec({ x: 0 }); type F1 = G1 | G1_; type F2 = G2 | G2_; type G1 = { x: H1 }; type G1_ = { x: H1_ }; type G2 = { x: H2 }; type G2_ = { ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/union_new/issue-1455-helper.js
tests/format/flow-repo/union_new/issue-1455-helper.js
/* @flow */ export class Foobar { }
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/union_new/test31.js
tests/format/flow-repo/union_new/test31.js
// @noflow // make sure tuples are type arguments (as used e.g. when viewing maps as // key/value iterables) work interface SomeIterator<T> { } interface SomeIterable<T> { it(): SomeIterator<T>; } declare class SomeMap<K,V> { it(): SomeIterator<[K,V]>; set(k: K, v: V): void; } declare class ImmutableMap<K,V>...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/union_new/test23.js
tests/format/flow-repo/union_new/test23.js
// @noflow // nested intersections (see also lib/test23_lib.js) type NestedObj = { } & { dummy: SomeLibClass }; type Obj = NestedObj & { x: string }; function foo(obj: Obj) { obj.x; // should be OK obj.x; // should also be OK (the check above shouldn't affect anything) }
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false
prettier/prettier
https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/union_new/test29.js
tests/format/flow-repo/union_new/test29.js
// @noflow // Make sure caching doesn't cause a spurious successful match (e.g., when a // failed match is tried again). This may happen, e.g., when checking // polymorphic definitions, where the same code may be checked multiple times // with different instantiations. type Row = { x: string }; declare class D<T> { ...
javascript
MIT
ae0e00df55d47274cc53db8d2cdcd064849e088d
2026-01-04T14:57:20.107180Z
false