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/union_new/issue-1462-i.js | tests/format/flow-repo/union_new/issue-1462-i.js | type Common = {
};
type A = Common & {
type: 'A',
foo: number
};
type B = Common & {
type: 'B',
foo: Array<number>
}
type MyType = A | B;
function print(x: number) {
console.log(x);
}
function printAll(val: MyType) {
print(val.foo); // <--- foo could be an array
}
| 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.js | tests/format/flow-repo/union_new/issue-1455.js | /* @flow */
import type {Foobar} from "./issue-1455-helper"
function create(content: ?Foobar | String | Array<String>) {
}
function node(content: ?Foobar | String | Array<String>) {
create(content)
}
| 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/test6.js | tests/format/flow-repo/union_new/test6.js | // @noflow
/**
* Test that shows how the implementation of union types is broken
*/
//////////////////////////////////////////
// example with generic class inheritance
//////////////////////////////////////////
function inst(a: E<B4>): C<number> | C<string> { return a; }
const mk_C = () => C;
const mk_D = () => ... | 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/test26.js | tests/format/flow-repo/union_new/test26.js | // @noflow
declare function foo(x: number): number;
declare function foo(x: string): string;
declare var x: number | string;
(foo(x): number | string);
type T = number | string;
declare var y: T;
(foo(y): T);
declare class Record {
set(x: 'foo', y: number): void;
set(x: 'bar', y: string): void;
}
new Record(... | 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/test2.js | tests/format/flow-repo/union_new/test2.js | // @noflow
/**
* Test that shows how the implementation of union types is broken
*/
//////////////////////////////
// example with object types
//////////////////////////////
function obj(a: { x: number } | { x: string }) { }
obj(({ x: "" }: A1));
type A1 = { x: B1 };
type B1 = 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-1371.js | tests/format/flow-repo/union_new/issue-1371.js | function create(a: any): { type: 'B', data: number } | { type: 'A', data: string }
{
return {
type: 'A',
data: a
}
}
| 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/test5.js | tests/format/flow-repo/union_new/test5.js | // @noflow
/**
* Test that shows how the implementation of union types is broken
*/
///////////////////////////////
// example with function types
///////////////////////////////
function fun(a: ((x: number) => number) | ((x: string) => string)) { }
function a1(x) { return x; }
fun(a1);
function fun_call(x: stri... | 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/test27.js | tests/format/flow-repo/union_new/test27.js | // @noflow
type X = ({a:true} & {b:string}) | ({a:false} & {c:string});
//type X = {a:true, b:string} | {a:false, c:string}; // this works.
function hello1(x:X): string {
if (x.a === true) return x.b; else return x.c;
}
function hello2(x:X): string {
if (x.a === false) return x.c; else return x.b;
}
function he... | 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/test18.js | tests/format/flow-repo/union_new/test18.js | // @noflow
// method overloads
declare class C {
m(x: number): void;
m(x: string): void;
}
function f() { return 0; }
new C().m(f());
| 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/test12.js | tests/format/flow-repo/union_new/test12.js | // @noflow
// polymorphic recursive types
type F<X> = { f: F<X>, x: X }
type G = { x: number }
type H = { x: string }
function rec(x: F<string>): G | H { return x; }
| 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-1759.js | tests/format/flow-repo/union_new/issue-1759.js | // @flow
type X = ({a:true} & {b:string}) | ({a:false} & {c:string});
//type X = {a:true, b:string} | {a:false, c:string}; // this works.
function hello(x:X): string {
if (x.a === true) return x.b; else return x.c;
}
| 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/test16.js | tests/format/flow-repo/union_new/test16.js | // @noflow
// annotations
type T = number | (() => string);
type Foo = T | (() => bool);
type Bar = number | (() => string) | (() => bool);
function foo(x: Foo) { }
foo(() => qux());
function bar(x: Bar) { }
bar(() => qux());
var x = false;
function qux() { return x; }
x = "";
| 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/test32.js | tests/format/flow-repo/union_new/test32.js | // @flow
// make sure that full resolution jobs don't cache improperly to signal success
// when they have failed earlier
function foo(value: Indirect<string> | number): Indirect<string> | number {
const castedValue: number = typeof value === 'number' ? value : 0;
return castedValue;
}
| 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-2232.js | tests/format/flow-repo/union_new/issue-2232.js | /* @flow */
declare type Entity<T> = {
id: T,
name: string
}
declare type StringEntity = Entity<string>
declare type Foo = StringEntity & {
bars: Object,
kind: 1
}
declare type EmptyFoo = StringEntity & {
bars: null,
kind: 2
}
function test(f: Foo| EmptyFoo) {
if (f.kind === 1) {
(f: Foo)
}
}
| 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/test10.js | tests/format/flow-repo/union_new/test10.js | // @noflow
function id<X>(x: X): X { return x; }
/////////////////////////
// primitive annotations
/////////////////////////
function check_prim(_: number | string) { }
// ok
check_prim("");
// ...even when they "flow" in
check_prim(id(""));
//////////////////////////////
// class instance annotations
//////////... | 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/test17.js | tests/format/flow-repo/union_new/test17.js | // @noflow
// Array#concat
[].concat([]);
([].concat([0,1])[1]: 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/test25.js | tests/format/flow-repo/union_new/test25.js | // @noflow
// termination test (see also lib/test25_lib.js)
function foo(rows: Rows, set: Set<number>) {
return rows.reduce_rows(
(set, row) => row.reduce_row(
(set, i) => set.add(i),
set,
),
set,
);
}
| 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.js | tests/format/flow-repo/union_new/test30.js | // @noflow
const Constants = require('./test30-helper');
type ActionType =
| { type: 'foo', x: number }
| { type: 'bar', x: number }
({ type: Constants.BAR, x: 0 }: ActionType);
| 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-815.js | tests/format/flow-repo/union_new/issue-815.js | /* @flow */
type T = A|B;
class U {};
declare var children: U;
(children: T|U);
class A {};
class B {};
type VirtualElement = Thunk|VirtualNode;
type Child = VirtualElement;
type Children = Array<Child>;
class Thunk {}
class VirtualNode {
children: Child|Children;
constructor(type, children/*:Children*/) {
t... | 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-helper.js | tests/format/flow-repo/union_new/issue-824-helper.js | import A from "./issue-824";
export class B extends A {
which(): number {
return 1;
}
}
export class C extends A {
which(): number {
return 2;
}
}
| 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/test1.js | tests/format/flow-repo/union_new/test1.js | // @noflow
/**
* Test that shows how the implementation of union types is broken
*/
//////////////////////////////
// example with object types
//////////////////////////////
function obj(a: A1 | A2) {
return a.x;
}
const obj_result = obj({ x: "" }); // currently an error! (expect it to be OK)
// Type definiti... | 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-1462-ii.js | tests/format/flow-repo/union_new/issue-1462-ii.js | type Common = {
};
type A = {
type: 'A',
foo: number
} & Common;
type B = {
type: 'B',
foo: Array<number>
} & Common;
type MyType = A | B;
function print(x: number) {
console.log(x);
}
function printAll(val: MyType) {
if (val.type === 'A') {
print(val.foo);
} else {
val.foo.forEach(print);
... | 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/test9.js | tests/format/flow-repo/union_new/test9.js | // @noflow
/**
* Test that shows how the implementation of union types is broken
*/
////////////////
// interference
////////////////
function square(x? = 0) {
return x * x;
}
function foo(f: ((_: ?number) => ?number) | (() => void)) { }
foo((x): number => square(x))
| 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/test20.js | tests/format/flow-repo/union_new/test20.js | // @noflow
// Array#reduce
[0,1].reduce((x,y,i) => y);
["a", "b"].reduce(
(regex, representation, index) => {
return regex + (index ? '|' : '') + '(' + representation + ')';
},
'',
);
[""].reduce((acc,str) => acc * str.length);
| 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/test4.js | tests/format/flow-repo/union_new/test4.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)) { }
const a1 = ((x) => {}: A1);
fun(a1);
function fun_call(x: 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/test11.js | tests/format/flow-repo/union_new/test11.js | // @noflow
// disjoint unions
function length(list: List) {
if (list.kind === "cons") return length(list.next) + 1;
else return 0;
}
length({ kind: "nil" });
length({ kind: "cons" }); // missing `next`
length({ kind: "cons", next: { kind: "nil" } });
length({ kind: "empty" }); // `kind` not found
type List = N... | 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/format.test.js | tests/format/flow-repo/union_new/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/lib/test32_lib.js | tests/format/flow-repo/union_new/lib/test32_lib.js | type Indirect<T> = Array<T>;
| 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/lib/test23_lib.js | tests/format/flow-repo/union_new/lib/test23_lib.js | declare class SomeLibClass { }
| 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/lib/test25_lib.js | tests/format/flow-repo/union_new/lib/test25_lib.js | declare class Set<T> {
add(x: any): Set<T>;
}
declare class Row {
reduce_row(
callbackfn: (previousValue: number, currentValue: number) => number,
initialValue: void
): number;
reduce_row<U>(
callbackfn: (previousValue: U, currentValue: number) => U,
initialValue: U
): U;
}
... | 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/lib/format.test.js | tests/format/flow-repo/union_new/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/more_react/JSX.js | tests/format/flow-repo/more_react/JSX.js |
/* @providesModule JSX */
var React = require('react');
var App = require('App.react');
var app =
<App y={42}> // error, y: number but foo expects string in App.react
Some text.
</App>;
module.exports = app;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/more_react/App.react.js | tests/format/flow-repo/more_react/App.react.js |
/**
* @providesModule App.react
* @jsx React.DOM
*/
var React = require('react');
// expect args to be strings
function foo(p:string,q:string):string { return p+q; }
var App = React.createClass({
getDefaultProps: function(): { y: string } {
return {y:""}; // infer props.y: string
},
getInitialState: ... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/more_react/API.react.js | tests/format/flow-repo/more_react/API.react.js |
var app = require('JSX');
app.setProps({y:42}); // error, y:number but foo expects string in App.react
app.setState({z:42}); // error, z:number but foo expects string in App.react
function bar(x:number) { }
bar(app.props.children); // No error, App doesn't specify propTypes so anything goes
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/more_react/checkPropTypes.js | tests/format/flow-repo/more_react/checkPropTypes.js | /* @flow */
import { PropTypes, checkPropTypes } from "react";
checkPropTypes({ foo: PropTypes.string }, { foo: 'foo' }, 'value', 'TestComponent'); // OK
checkPropTypes({ foo: PropTypes.string }, { foo: 'foo' }); // error: missing arguments
checkPropTypes({ foo: PropTypes.string }, { foo: 'foo' }, 'value'); // error... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/more_react/propTypes.js | tests/format/flow-repo/more_react/propTypes.js | var React = require('React');
var C = React.createClass({
propTypes: {
title: React.PropTypes.string.isRequired,
}
});
var D = React.createClass({
propTypes: {
name: React.PropTypes.string.isRequired,
...C.propTypes,
}
});
<D />; // errors: properties `name` and `title` not found
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/more_react/InitializedFields.js | tests/format/flow-repo/more_react/InitializedFields.js | /**
* @providesModule InitializedFields.react
*/
var React = require('react');
/** This is a regression test for a bug where we forgot to mark the fields of
* react classes as initialized, when the class was created with createClass().
* This would manifest as complaining that metric requires an annotation */
var... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/more_react/format.test.js | tests/format/flow-repo/more_react/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/config_all_false/no_at_flow.js | tests/format/flow-repo/config_all_false/no_at_flow.js | var x: number = "not a number"; // No error
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/config_all_false/format.test.js | tests/format/flow-repo/config_all_false/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/for/abnormal_for_of.js | tests/format/flow-repo/for/abnormal_for_of.js | function foo(x: boolean) {
var arr = [1, 2, 3];
for (var elem of arr) {
if (x) {
continue;
}
return;
}
console.log('this is still reachable');
}
function bar(x: boolean) {
for (var elem of []) {
return;
}
console.log('this is still reachable');
}
function baz(x: boolean) {
for (v... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/for/abnormal.js | tests/format/flow-repo/for/abnormal.js | /* @flow */
function foo(x: boolean) {
var max = 10;
for (var ii = 0; ii < max; ii++) {
if (x) {
continue;
}
return;
}
console.log('this is still reachable');
}
function bar(x: boolean) {
var max = 0;
for (var ii = 0; ii < max; ii++) {
return;
}
console.log('this is still reachab... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/for/abnormal_for_in.js | tests/format/flow-repo/for/abnormal_for_in.js | function foo(x: boolean) {
var obj = { a: 1, b: 2};
for (var prop in obj) {
if (x) {
continue;
}
return;
}
console.log('this is still reachable');
}
function bar(x: boolean) {
for (var prop in {}) {
return;
}
console.log('this is still reachable');
}
function baz(x: boolean) {
fo... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/for/format.test.js | tests/format/flow-repo/for/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/typeapp_perf/test2.js | tests/format/flow-repo/typeapp_perf/test2.js | /* This test ensures that the code below does not take a long time to check. If
* this test is taking a very long time to complete, there is a bug. */
class A {}
type B<T> = A & {
+a: (x: B<T>) => void;
+b: (x: B<T>) => void;
+c: (x: B<T>) => void;
+d: (x: B<T>) => void;
+e: (x: B<T>) => void;
+f: (x: B<... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/typeapp_perf/test1.js | tests/format/flow-repo/typeapp_perf/test1.js | /* This test ensures that the code below does not take a long time to check. If
* this test is taking a very long time to complete, there is a bug. */
class A {}
type B<T> = A & {
+a: () => B<T>;
+b: () => B<T>;
+c: () => B<T>;
+d: () => B<T>;
+e: () => B<T>;
+f: () => B<T>;
+g: () => B<T>;
+h: () =>... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/typeapp_perf/format.test.js | tests/format/flow-repo/typeapp_perf/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/declare_export/ES6_Named1.js | tests/format/flow-repo/declare_export/ES6_Named1.js | /**
* @providesModule ES6_Named1
* @flow
*/
var specifierNumber1 = 1;
var specifierNumber2 = 2;
var specifierNumber3 = 3;
var groupedSpecifierNumber1 = 1;
var groupedSpecifierNumber2 = 2;
declare export {specifierNumber1};
declare export {specifierNumber2 as specifierNumber2Renamed};
declare export {specifierNumbe... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/ES6_Default_AnonFunction2.js | tests/format/flow-repo/declare_export/ES6_Default_AnonFunction2.js | /**
* @providesModule ES6_Default_AnonFunction2
* @flow
*/
declare export default () =>number;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/SideEffects.js | tests/format/flow-repo/declare_export/SideEffects.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/declare_export/ES6_ExportAllFrom_Source2.js | tests/format/flow-repo/declare_export/ES6_ExportAllFrom_Source2.js | /**
* @providesModule ES6_ExportAllFrom_Source2
* @flow
*/
declare export var numberValue2: number;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/ProvidesModuleD.js | tests/format/flow-repo/declare_export/ProvidesModuleD.js | /**
* @providesModule D
* @flow
*/
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/ES6_DefaultAndNamed.js | tests/format/flow-repo/declare_export/ES6_DefaultAndNamed.js | /* @flow */
declare export default number;
declare export var str: string;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/ES6_ExportFrom_Source2.js | tests/format/flow-repo/declare_export/ES6_ExportFrom_Source2.js | /**
* @providesModule ES6_ExportFrom_Source2
* @flow
*/
declare export var numberValue1: number;
declare export var numberValue2: number;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/ES6_Default_AnonFunction1.js | tests/format/flow-repo/declare_export/ES6_Default_AnonFunction1.js | /**
* @providesModule ES6_Default_AnonFunction1
* @flow
*/
declare export default () => number;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/ES6_Default_NamedFunction2.js | tests/format/flow-repo/declare_export/ES6_Default_NamedFunction2.js | /**
* @providesModule ES6_Default_NamedFunction2
* @flow
*/
declare export default function foo():number;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/ProvidesModuleCJSDefault.js | tests/format/flow-repo/declare_export/ProvidesModuleCJSDefault.js | /**
* @providesModule CJSDefault
* @flow
*/
module.exports = {
numberValue: 42
};
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/C.js | tests/format/flow-repo/declare_export/C.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/declare_export/ES6_Default_NamedClass2.js | tests/format/flow-repo/declare_export/ES6_Default_NamedClass2.js | /**
* @providesModule ES6_Default_NamedClass2
* @flow
*/
declare export default class Foo { givesANum(): number; };
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/ES6_ExportAllFrom_Intermediary2.js | tests/format/flow-repo/declare_export/ES6_ExportAllFrom_Intermediary2.js | /**
* @providesModule ES6_ExportAllFrom_Intermediary2
* @flow
*/
declare export * from "ES6_ExportAllFrom_Source2";
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/ProvidesModuleES6Default.js | tests/format/flow-repo/declare_export/ProvidesModuleES6Default.js | /**
* @providesModule ES6Default
* @flow
*/
/*
export default {
numberValue: 42,
};
*/
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/ProvidesModuleA.js | tests/format/flow-repo/declare_export/ProvidesModuleA.js | /**
* @providesModule A
* @flow
*/
exports.numberValue1 = 42;
exports.numberValue2 = 42;
exports.numberValue3 = 42;
exports.numberValue4 = 42;
exports.stringValue = "str";
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/CommonJS_Named.js | tests/format/flow-repo/declare_export/CommonJS_Named.js | /**
* @providesModule CommonJS_Named
* @flow
*/
exports.numberValue1 = 1;
exports.numberValue2 = 2;
exports.numberValue3 = 3;
exports.numberValue4 = 4;
exports.numberValue5 = 5;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/ES6_Named2.js | tests/format/flow-repo/declare_export/ES6_Named2.js | /**
* @providesModule ES6_Named2
* @flow
*/
var specifierNumber4 = 1;
var specifierNumber5 = 2;
var groupedSpecifierNumber3 = 1;
var groupedSpecifierNumber4 = 2;
declare export {specifierNumber4};
declare export {specifierNumber5 as specifierNumber5Renamed};
declare export {groupedSpecifierNumber3, groupedSpecifie... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/B.js | tests/format/flow-repo/declare_export/B.js | /* @flow */
exports.numberValue = 42;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/ES6_ExportAllFrom_Intermediary1.js | tests/format/flow-repo/declare_export/ES6_ExportAllFrom_Intermediary1.js | /**
* @providesModule ES6_ExportAllFrom_Intermediary1
* @flow
*/
declare export * from "ES6_ExportAllFrom_Source1";
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/ES6_ExportAllFrom_Source1.js | tests/format/flow-repo/declare_export/ES6_ExportAllFrom_Source1.js | /**
* @providesModule ES6_ExportAllFrom_Source1
* @flow
*/
declare export var numberValue1: number;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/CommonJS_Clobbering_Class.js | tests/format/flow-repo/declare_export/CommonJS_Clobbering_Class.js | /**
* @providesModule CommonJS_Clobbering_Class
* @flow
*/
class Base {
static baseProp: number;
}
class Test extends Base {
static childProp: number;
static staticNumber1():number { return 1; }
static staticNumber2():number { return 2; }
static staticNumber3():number { return 3; }
instNumber1():numb... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/ES6_ExportFrom_Source1.js | tests/format/flow-repo/declare_export/ES6_ExportFrom_Source1.js | /**
* @providesModule ES6_ExportFrom_Source1
* @flow
*/
declare export var numberValue1: number;
declare export var numberValue2: number;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/ES6_ExportFrom_Intermediary2.js | tests/format/flow-repo/declare_export/ES6_ExportFrom_Intermediary2.js | /**
* @providesModule ES6_ExportFrom_Intermediary2
* @flow
*/
declare export {
numberValue1,
numberValue2 as numberValue2_renamed2
} from "ES6_ExportFrom_Source2";
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/ES6_Default_NamedFunction1.js | tests/format/flow-repo/declare_export/ES6_Default_NamedFunction1.js | /**
* @providesModule ES6_Default_NamedFunction1
* @flow
*/
declare export default function foo():number;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/ES6_ExportAllFromMulti.js | tests/format/flow-repo/declare_export/ES6_ExportAllFromMulti.js | // @flow
declare export * from "./ES6_ExportAllFrom_Source1";
declare export * from "./ES6_ExportAllFrom_Source2";
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/CommonJS_Clobbering_Lit.js | tests/format/flow-repo/declare_export/CommonJS_Clobbering_Lit.js | /**
* @providesModule CommonJS_Clobbering_Lit
* @flow
*/
module.exports = {
numberValue1: 1,
numberValue2: 2,
numberValue3: 3,
numberValue4: 4,
numberValue5: 5
};
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/ES6_ExportFrom_Intermediary1.js | tests/format/flow-repo/declare_export/ES6_ExportFrom_Intermediary1.js | /**
* @providesModule ES6_ExportFrom_Intermediary1
* @flow
*/
declare export {
numberValue1,
numberValue2 as numberValue2_renamed
} from "ES6_ExportFrom_Source1";
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/ES6_Default_NamedClass1.js | tests/format/flow-repo/declare_export/ES6_Default_NamedClass1.js | /**
* @providesModule ES6_Default_NamedClass1
* @flow
*/
declare export default class FooImpl { givesANum(): number; };
// Regression test for https://github.com/facebook/flow/issues/511
//
// Default-exported class should also be available in local scope
declare export { FooImpl as Foo }
declare export function g... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/es6modules.js | tests/format/flow-repo/declare_export/es6modules.js | /* @flow */
// ===================== //
// == Path Resolution == //
// ===================== //
// @providesModule
import * as DefaultA from "A";
var a1: number = DefaultA.numberValue1;
var a2: string = DefaultA.numberValue1; // Error: number ~> string
// File path
import * as DefaultB from "./B";
var b1: number = D... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_export/format.test.js | tests/format/flow-repo/declare_export/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_iteration/return.js | tests/format/flow-repo/async_iteration/return.js | declare var gen: AsyncGenerator<void,string,void>;
// You can pass whatever you like to return, it doesn't need to be related to
// the AsyncGenerator's return type
gen.return(0).then(result => {
(result.value: void); // error: string | number ~> void
});
// However, a generator can "refuse" the return by catching ... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/async_iteration/generator.js | tests/format/flow-repo/async_iteration/generator.js | declare interface File {
readLine(): Promise<string>;
close(): void;
EOF: boolean;
}
declare function fileOpen(path: string): Promise<File>;
async function* readLines(path) {
let file: File = await fileOpen(path);
try {
while (!file.EOF) {
yield await file.readLine();
}
} finally {
file... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/async_iteration/delegate_yield.js | tests/format/flow-repo/async_iteration/delegate_yield.js | async function *delegate_next() {
async function *inner() {
var x: void = yield; // error: number ~> void
}
yield *inner();
}
delegate_next().next(0);
async function *delegate_yield() {
async function *inner() {
yield 0;
}
yield *inner();
}
(async () => {
for await (const x of delegate_yield()) {... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/async_iteration/throw.js | tests/format/flow-repo/async_iteration/throw.js | async function *catch_return() {
try {
yield 0;
} catch (e) {
return e;
}
}
(async () => {
catch_return().throw("").then(({value}) => {
if (value !== undefined) {
(value: void); // error: number ~> void
}
});
});
async function *yield_return() {
try {
yield 0;
return;
} cat... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/async_iteration/format.test.js | tests/format/flow-repo/async_iteration/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/unary/update.js | tests/format/flow-repo/unary/update.js | // @flow
let tests = [
function(y: number) {
y++;
y--;
++y;
--y;
},
function(y: string) {
y++; // error, we don't allow coercion here
(y: number); // ok, y is a number now
y++; // error, but you still can't write a number to a string
},
function(y: string) {
y--; // error, w... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/unary/unary.js | tests/format/flow-repo/unary/unary.js | /* @flow */
function x0(y: string): number {
return +y; // ok, + exists solely for coercion
}
function x1(y: string): number {
return -y; // error, we don't allow coercion here
}
function x3(y: string) {
return ~y; // error, we don't allow coercion here
}
function x4(y: string): boolean {
return !y; // ok,... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/unary/format.test.js | tests/format/flow-repo/unary/format.test.js | runFormatTest(import.meta, ["flow"], {
errors: {
hermes: ["update.js"],
},
});
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/seal/imp.js | tests/format/flow-repo/seal/imp.js | /* @flow */
var imp = require('./obj_annot');
imp({ name: "imp" });
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/seal/obj_annot.js | tests/format/flow-repo/seal/obj_annot.js | /* @flow */
function foo(param: { name: string; }): number {
return param.id;
}
foo({ name: "test" });
module.exports = foo;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/seal/format.test.js | tests/format/flow-repo/seal/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/type-destructors/property_type.js | tests/format/flow-repo/type-destructors/property_type.js | type Malformed = $PropertyType<any, number>;
type Obj = { x: string };
type Obj_Prop_x = $PropertyType<Obj, 'x'>;
(42: Obj_Prop_x);
function foo(o: Obj): $PropertyType<Obj, 'x'> {
if (false) return o.x;
else return 0;
}
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/type-destructors/union.js | tests/format/flow-repo/type-destructors/union.js | var x0: $NonMaybeType<number|string> = 0; // ok, number ~> number|string
var x1: $NonMaybeType<number|string> = true; // err, boolean ~> number|string
var x2: $PropertyType<{p:number}|{p:string},'p'> = 0; // ok, number ~> number|string
var x3: $PropertyType<{p:number}|{p:string},'p'> = true; // err, boolean ~> number|s... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/type-destructors/format.test.js | tests/format/flow-repo/type-destructors/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/type-destructors/non_maybe_type.js | tests/format/flow-repo/type-destructors/non_maybe_type.js | // @flow
function foo(x: ?string): $NonMaybeType<?string> {
if (x != null) { return x; }
else return 0; // this should be an error
}
//(foo(): string); // should not be necessary to expose the error above
(0: $NonMaybeType<null>); // error
(0: $NonMaybeType<?number>); // ok
(0: $NonMaybeType<number | null>); // ... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/getters_and_setters_disabled/getters_and_setters.js | tests/format/flow-repo/getters_and_setters_disabled/getters_and_setters.js | /**
* @flow
*/
var f = {
get a() { return 4; },
set b(x: number) { this.c = x; },
c: 10,
get ['d']() { return 'foo'; },
set ['d'](x: number) {},
};
type T = {
get a(): number,
set b(x: number): void,
c: 10,
}
declare class Foo {
get a(): number;
set b(x: number): void;
c: 10;
}
class Bar {
... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/getters_and_setters_disabled/format.test.js | tests/format/flow-repo/getters_and_setters_disabled/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/esproposal_class_instance_fields.ignore/test.js | tests/format/flow-repo/esproposal_class_instance_fields.ignore/test.js | /* @flow */
class Foo {
annotationOnly: string;
initOnly = 'asdf'
initWithAnnotation: string = 'asdf';
[computed]: string;
}
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/esproposal_class_instance_fields.ignore/format.test.js | tests/format/flow-repo/esproposal_class_instance_fields.ignore/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/number_constants/number_constants.js | tests/format/flow-repo/number_constants/number_constants.js | var a: number = Number.MAX_SAFE_INTEGER;
var b: string = Number.MAX_SAFE_INTEGER;
var c: number = Number.MIN_SAFE_INTEGER;
var d: string = Number.MIN_SAFE_INTEGER;
var e: number = Number.MAX_VALUE;
var f: string = Number.MAX_VALUE;
var g: number = Number.MIN_VALUE;
var h: string = Number.MIN_VALUE;
var i: number = Numb... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/number_constants/format.test.js | tests/format/flow-repo/number_constants/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_assign/A.js | tests/format/flow-repo/object_assign/A.js | /**
* @flow
*/
var EventEmitter = require('events').EventEmitter;
// This pattern seems to cause the trouble.
var Bad = Object.assign({}, EventEmitter.prototype, {
foo: function(): string { return 'hi'; }
});
// Calling Bad.foo() in the same file doesn't error
var bad: number = Bad.foo();
// Doesn't repro if I ... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/object_assign/B.js | tests/format/flow-repo/object_assign/B.js | /**
* @flow
*/
var A = require('./A.js');
var good: number = A.Good.foo();
var f = A.Bad.foo; // Property access is fine
var bad_: number = f(); // Calling the function is fine
var bad: number = A.Bad.foo(); // Method call is not fine
/*
B.js|12 col 1 error| call of method foo
|| Property not found in
A.js|8 col... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.