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/traits/test2.js | tests/format/flow-repo/traits/test2.js | declare interface I { }
declare class C mixins I { }
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/traits/format.test.js | tests/format/flow-repo/traits/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/rec/test3.js | tests/format/flow-repo/rec/test3.js | type I<X> = () => I<I<X>>;
type J<X> = () => J<J<X>>;
function foo(x: I<number>): J<number> {
return x; // terminate despite expanding types, OK
// I<number> and J<number> both expand to () => () => ...
}
type Q<X> = { x: X; }
type P<X> = () => Q<P<X>>;
function bar(x: P<number>): () => P<number> {
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/rec/test.js | tests/format/flow-repo/rec/test.js | class P<X> { x: X; } // this is like Promise
type Pstar<X> = X | Pstar<P<X>>; // this is like Promise*
var p: P<number> = new P;
(p.x: string); // error
var pstar: Pstar<number> = 0; // OK
(pstar: number); // error, but limit potentially unbounded number of errors!
// e.g., P<number> ~/~ number, P<P... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/rec/test2.js | tests/format/flow-repo/rec/test2.js | var a = []; // Array<X> ~> a
function bar() {
a = a.concat([]); // terminate despite expanding types:
// a ~> .concat(Array<Y>)
// Array<X> ~> .concat(Array<Y>)
// Array<X|Y> ~> a
// Array<X|Y> ~> .concat(Array<Y>)
// Array<X|Y|Y> ~> a
};
class A<X> {
x: A<A<X>>;
}
var a_ = new A;
function foo0() {
a_ ... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/rec/test5.js | tests/format/flow-repo/rec/test5.js | /* @flow */
type NestedArray<T> = Array<T | NestedArray<T>>;
function flatten<T>(arrArg: NestedArray<T>) {
let arr = arrArg;
while (true) {
arr = Array.prototype.concat.apply([], arr);
}
}
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/rec/issue-1228.js | tests/format/flow-repo/rec/issue-1228.js | /* @flow */
type Task <error, value>
= { chain<tagged>(next:(input:value) => Task<error, tagged>):
Task<error, tagged>
}
function id(x: Task<any,any>): Task<any,any> { 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/rec/issue-598.js | tests/format/flow-repo/rec/issue-598.js | /* @flow */
type F<A> = { foo<B>(x: A): F<B> }
declare function foo(x: any): F<any>;
({ foo }: F<any>);
function bar(y: F<number>): F<string> { return y; }
function bar1<X>(y: F<X>): F<any> { return y; }
function bar2<X>(y: F<any>): F<X> { return y; }
type Functor<A> = {
map<B>(f: (val: A) => B): Functor<B>
}
fun... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/rec/test4.js | tests/format/flow-repo/rec/test4.js | type T = T // cycle in type alias should not cause non-termination
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/rec/format.test.js | tests/format/flow-repo/rec/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/demo/2/A.js | tests/format/flow-repo/demo/2/A.js | /* @providesModule Demo */
class A {
x: number; // instance field declaration
constructor(x) { this.x = x; }
getX() { return this.x; }
onLoad(callback) {
return callback(this.getX());
}
}
function callback(x: string) { return x.length; }
var a = new A(42);
a.onLoad(callback);
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/demo/2/B.js | tests/format/flow-repo/demo/2/B.js | var A = require('Demo');
var z = new A("42").getX();
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/demo/2/format.test.js | tests/format/flow-repo/demo/2/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/demo/1/f.js | tests/format/flow-repo/demo/1/f.js | /* demo */
function f(x) { return 42/x; }
var x = null;
//...
f(x);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/demo/1/format.test.js | tests/format/flow-repo/demo/1/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_args_strict/test.js | tests/format/flow-repo/type_args_strict/test.js | /**
* Test strict type param arity checking.
*
* Full type argument lists are required in type expressions,
* such as type annotations and interface extends clauses.
* Type arguments are optional in value expressions, such as
* class extends clauses and calls of polymorphic functions.
*
* @flow
*/
// arity er... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/type_args_strict/format.test.js | tests/format/flow-repo/type_args_strict/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/poly_class_export/A.js | tests/format/flow-repo/poly_class_export/A.js | // @flow
class A<T> {
x: T
}
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/poly_class_export/C.js | tests/format/flow-repo/poly_class_export/C.js | // @flow
// This test exports a function whose return type is the class's `this` type.
// It should be inferred (no annotation required).
class Foo {
foo(): this {
return this;
}
}
export function f(x: Foo) {
return 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/poly_class_export/B.js | tests/format/flow-repo/poly_class_export/B.js | // @flow
let A = require('./A');
class B extends A<string> {
constructor() {
super();
}
}
module.exports = new B();
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/poly_class_export/format.test.js | tests/format/flow-repo/poly_class_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/try/return.js | tests/format/flow-repo/try/return.js | /**
* @flow
*/
function foo(x: ?number): string {
try {
} catch (e) {
return 'bar';
}
console.log();
return 'foo';
}
function bar(): string {
try {
return 'foo';
} catch (e) {
return 'bar';
}
}
function baz(): string {
try {
throw new Error("foo");
} 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/try/abnormals.js | tests/format/flow-repo/try/abnormals.js | /* @flow */
/* This test documents an issue we used to have with merging the environment of
* the try block and the catch block. The error variable, when inspected and in
* the presence of an abnormal, would sometimes kind of leak. It would hit an
* abnormal. It was weird.
*/
function foo() {
try {
} catch(err... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/try/test.js | tests/format/flow-repo/try/test.js | /***
* test env state tracking thru try/catch/finally
* @flow
*/
function foo() {
var x = 0;
var y;
try {
x = "";
} catch(e) {
x = false;
throw -1;
} finally {
y = {};
}
// here via [try; finally] only.
x(); // string ~/> function call (no num or bool ... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/try/init.js | tests/format/flow-repo/try/init.js | /***
* test initialization tracking of hoisted stuff
* @flow
*/
// for illustrative purposes only - Flow considers a throw possible
// anywhere within a block
function might_throw() {}
// local use of annotated var within try is ok
function f() {
try {
var x:number = 0;
var y:number = x;
} 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/try/format.test.js | tests/format/flow-repo/try/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/nullable/maybe.js | tests/format/flow-repo/nullable/maybe.js | // @flow
// unwrapping nested maybes should work
(('foo': ?(?string)): ?string); // ok
((123: ?(?number)): ?string); // error (only num ~> string)
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/nullable/nullable.js | tests/format/flow-repo/nullable/nullable.js | function foo():string { return null; }
function bar():?string { return null; }
function qux(x:string) { }
function corge(x:number) { }
var x = bar(); // x: ?string
if (x != null) qux(x); // x: ?string | null
if (x != null) corge(x); // x: ?string | null
function grault() { x = null; }
if (x != null) {
grault(); ... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/nullable/simple_nullable.js | tests/format/flow-repo/nullable/simple_nullable.js | function foo(x:?string) {}
function bar(x:?number) {}
foo('hmm');
bar('hmm');
function fn(data: ?{}) {}
fn({some: 'literal'});
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/nullable/format.test.js | tests/format/flow-repo/nullable/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/spread/test7.js | tests/format/flow-repo/spread/test7.js | // @flow
let tests = [
function(x: Object) {
({...x}: Object);
({...x}: void); // error, Object
},
];
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/spread/test3.js | tests/format/flow-repo/spread/test3.js | var p = { y: "" };
var q = { z: "" };
var o = {
x: 5,
...p,
...q,
};
var y: number = o.y;
var z: number = o.z;
// test conflicting keys (they get unioned)
var r = { y: 123 };
var s = {
...p,
...r,
};
var t: boolean = s.y; // error, string or number
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/spread/test.js | tests/format/flow-repo/spread/test.js | function parseTimestamp(timestamp: string): number {
return 0;
}
function parseCounter(line: string): number {
return 0;
}
function parseGroup(lines: Array<string>): {
counter: number;
begin: number;
end: number;
text: string;
} {
var counter = parseCounter(lines[0]);
var timeframe = p... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/spread/test6.js | tests/format/flow-repo/spread/test6.js | var o = {
foo: 'bar'
};
o = {...o};
(o: {foo: string});
var p = {
foo: 'bar'
};
(p: {foo: string; abc: string}); // error, p doesn't have `abc` yet
p = {...p, abc: 'def'};
(p: {foo: string; abc: string});
var q = {
foo: 'bar'
};
for (var i = 0; i < 10; i++) {
q = {...q};
}
(q: {foo: string});
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/spread/test2.js | tests/format/flow-repo/spread/test2.js | /**
* @flow
*/
function foo(o) {
bar({...o});
}
function bar(_: {foo:number}) { }
foo({foo: 42});
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/spread/test5.js | tests/format/flow-repo/spread/test5.js | /* @flow */
declare function map<Tv, TNext>(
obj: {[key: string]: Tv},
iterator:((obj: Tv) => TNext),
): Array<TNext>;
/**
* Tests overriding a property via a spread, where the value is a tvar. the
* type of the prop from the object that is being overridden (`x.kind` in the
* case below) should //not// feed ba... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/spread/test4.js | tests/format/flow-repo/spread/test4.js | /* @flow */
function test(...nums: Array<number>) {}
test(0, ...[1, 2, 3]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/spread/format.test.js | tests/format/flow-repo/spread/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_name_reducers_duplicate/A.js | tests/format/flow-repo/incremental_haste_name_reducers_duplicate/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_name_reducers_duplicate/index.js | tests/format/flow-repo/incremental_haste_name_reducers_duplicate/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_name_reducers_duplicate/format.test.js | tests/format/flow-repo/incremental_haste_name_reducers_duplicate/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/predicates-declared/object-invariant.js | tests/format/flow-repo/predicates-declared/object-invariant.js | // @flow
// Sanity check:
// - preserving `havoc` semantics
type Meeting = {
organizer: ?Invitee,
es: Array<Invitee>
}
type Invitee = {
fbid: number
}
function f(_this: { m: ?Meeting }): string {
if (!_this.m) {
return "0";
}
if (_this.m.es.some((a) => a.fbid === 0)) {
}
return "3";
}
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/predicates-declared/sanity-is-string-bug.js | tests/format/flow-repo/predicates-declared/sanity-is-string-bug.js | // @flow
declare function is_string(x: mixed): boolean %checks(typeof x === "string");
declare function is_number(x: mixed): boolean %checks(typeof x === "number");
// Sanity check:
// - Erroneous logic
function bar(x: string | Array<string>): string {
if (is_number(x)) {
return x;
} else {
return x.join... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/predicates-declared/logical-or.js | tests/format/flow-repo/predicates-declared/logical-or.js | // @flow
// Sanity check:
// - conditional functions do not affect behavior of conditional
// expressions (e.g. `||`)
declare function r(x: string): number;
var s = 'a';
var n = r(s) || 1;
(n: number);
var x = "";
if (x = r(s) || 1) {
(x: number);
}
declare var dollars: mixed;
function foo(x: mixed) { return 1... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/predicates-declared/function-union.js | tests/format/flow-repo/predicates-declared/function-union.js | // @flow
declare function f1(x: mixed): boolean %checks(typeof x === "string");
declare function f2(x: mixed): boolean %checks(Array.isArray(x));
declare var cond: boolean;
// Feature check:
function foo(x: number | string | Array<string>): number {
var f = (cond) ? f1 : f2;
if (f(x)) {
return x.length;
... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/predicates-declared/function-bind.js | tests/format/flow-repo/predicates-declared/function-bind.js | // @flow
// Sanity checks:
// - use of bind in a position of a function predicate.
// (This case should fall through, as method calls
// are currently not supported.) The original behavior
// (including `havoc`) should be retained.
class C {
m() {
return true;
}
a: 1;
n() {
if(this.m.bind(t... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/predicates-declared/sanity-return-type.js | tests/format/flow-repo/predicates-declared/sanity-return-type.js | // @flow
declare function f2(x: mixed): string %checks(Array.isArray(x));
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/predicates-declared/sanity-pred-with-body.js | tests/format/flow-repo/predicates-declared/sanity-pred-with-body.js | // @flow
// Sanity check:
// - predicate functions cannot have bodies (can only be declarations)
function pred(x: mixed): boolean %checks(typeof x === "string") { // error: cannot use pred type here
return typeof x === "string";
}
function foo(x: string | Array<string>): string {
if (pred(x)) {
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/predicates-declared/sanity-fall-through.js | tests/format/flow-repo/predicates-declared/sanity-fall-through.js | // @flow
// Sanity check:
// - we should still be getting an error at the second return statement
declare function pred<T>(x: T): boolean;
function foo(s: Array<string>): string {
if (pred(s)) {
return "1";
}
return 1;
}
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/predicates-declared/orig-string-tag-check.js | tests/format/flow-repo/predicates-declared/orig-string-tag-check.js | // @flow
// The original first-order case
function foo(x: string | Array<string>): string {
if (typeof x === "string") {
return x; // [ERROR] x: Array<string> doesn't match return type
}
else {
return x.join(); // [ERROR] x: string doesn't have .join method
}
}
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/predicates-declared/sanity-parameter-mismatch.js | tests/format/flow-repo/predicates-declared/sanity-parameter-mismatch.js | // @flow
// Sanity check: make sure the parameters are checked as usual
declare function foo(
input: mixed,
types: string | Array<string>
): boolean %checks(typeof input === "string" || Array.isArray(input));
foo(3, 3);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/predicates-declared/sanity-invalid-calls.js | tests/format/flow-repo/predicates-declared/sanity-invalid-calls.js | // @flow
// Sanity check:
// - invalid calls at predicate positions
declare function pred<T>(x: T): boolean;
function foo(s: Array<string>): string {
if ((1)(s)) {
return "1";
}
if ((pred + 1)("s")) {
return "1";
}
return "1"
}
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/predicates-declared/is-string-decl.js | tests/format/flow-repo/predicates-declared/is-string-decl.js | // @flow
declare function is_string(x: mixed): boolean %checks(typeof x === "string");
declare function is_number(x: mixed): boolean %checks(typeof x === "number");
// Feature check:
function foo(x: string | Array<string>): string {
if (is_string(x)) {
// The use of `is_string` as a conditional check
// sho... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/predicates-declared/format.test.js | tests/format/flow-repo/predicates-declared/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/enums/declared.js | tests/format/flow-repo/enums/declared.js | // @flow
declare enum E {
A,
B,
}
(E.A: E); // OK
(E.A: empty); // ERROR
declare export enum F {
N,
M,
}
(F.N: F); // OK
(F.N: empty); // ERROR
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/enums/lib.js | tests/format/flow-repo/enums/lib.js | // @flow
declare module 'declared-module' {
declare enum G {
J,
K,
}
declare export enum H {
X,
Y,
}
}
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/enums/format.test.js | tests/format/flow-repo/enums/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_duplicate_delete/A.js | tests/format/flow-repo/incremental_duplicate_delete/A.js | /**
* @providesModule A
* @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_duplicate_delete/format.test.js | tests/format/flow-repo/incremental_duplicate_delete/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/instanceof/instanceof.js | tests/format/flow-repo/instanceof/instanceof.js | /* @flow */
// x instancof t
class X1 { foo: number; };
class X2 { foo: string; };
function x(b) { return b ? new X1 : new X2; }
function consumer1(b) {
var g = x(b);
if (g instanceof X2) g.foo = '1337';
else g.foo = 1337;
}
function consumer2(b) {
var g = x(b);
if (g instanceof X1) g.foo = '133... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/instanceof/format.test.js | tests/format/flow-repo/instanceof/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/find-module/req.js | tests/format/flow-repo/find-module/req.js | module.exports = 0;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/find-module/test.js | tests/format/flow-repo/find-module/test.js | var x = require('./req');
(x: string);
import x from './req';
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/find-module/format.test.js | tests/format/flow-repo/find-module/format.test.js | runFormatTest(import.meta, ["flow"], { errors: { hermes: ["test.js"] } });
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/implements/test.js | tests/format/flow-repo/implements/test.js | /* @noflow */
interface IFoo { foo: string }
class C1 implements IFoo {} // error: property `foo` not found
class C2 implements IFoo { foo: number } // error: number <~> string
class C3 implements IFoo { foo: string } // ok
(new C1: IFoo); // ok, we already errored at def site
interface IBar { bar: number }
class ... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/implements/format.test.js | tests/format/flow-repo/implements/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/typeof/typeof.js | tests/format/flow-repo/typeof/typeof.js | /**
* @flow
*/
//////////////////////////////////
// == typeof <<class value>> == //
//////////////////////////////////
// MyClass1 is a runtime value, a constructor function
//
class MyClass1 {
getNumber(): number { return 42; }
}
// a is an instance of MyClass1 - in runtime terms,
// an object produced by the ... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/typeof/format.test.js | tests/format/flow-repo/typeof/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_fun/test.js | tests/format/flow-repo/declare_fun/test.js | declare function foo(x: number): string;
declare function foo(x: string): number;
declare function foo<X>(x: X): X;
(foo(0): string); // OK
(foo("hello"): number); // OK
(foo(false): void); // error, boolean ~/~ undefined
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/declare_fun/format.test.js | tests/format/flow-repo/declare_fun/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/react/createElementRequiredProp_string.js | tests/format/flow-repo/react/createElementRequiredProp_string.js | // @flow
import React from 'react';
class Bar extends React.Component {
props: {
test: number,
};
render() {
return (
<div>
{this.props.test}
</div>
)
}
}
class Foo extends React.Component {
render() {
const Cmp = Math.random() < 0.5 ? 'div' : Bar;
return (<Cmp/>);
... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/react/proptype_instanceOf.js | tests/format/flow-repo/react/proptype_instanceOf.js | /* @flow */
class A {}
class B extends A {}
class C extends B {}
var React = require('react');
var Example = React.createClass({
propTypes: {
x: React.PropTypes.instanceOf(B),
}
});
(<Example x={new A} />); // error: A ~> B
(<Example x={new B} />); // OK
(<Example x={new C} />); // OK (C ~> B)
(<Example x="w... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/react/proptype_custom_validator.js | tests/format/flow-repo/react/proptype_custom_validator.js | const React = require("react");
// Custom validator must match `ReactPropsCheckType`
var Example = React.createClass({
propTypes: {
foo(props, propName, componentName, href) {
(props: empty); // ok: props is `any`
(propName: empty); // error: propName is a string
(componentName: empty); // erro... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/react/proptype_any.js | tests/format/flow-repo/react/proptype_any.js | const React = require("react");
var AnyExample = React.createClass({
propTypes: {
foo: (0: any), // OK
},
});
(<AnyExample />); // OK
(<AnyExample foo={(0: mixed)} />); // OK
var AnyFunExample = React.createClass({
propTypes: {
foo: (() => {}: Function), // OK
},
});
(<AnyFunExample />); // OK
(<Any... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/react/import_react.js | tests/format/flow-repo/react/import_react.js | /* @flow */
import react from "react";
import {Component} from "react";
var a: Component<*,*,*> = new react.Component();
var b: number = new react.Component(); // Error: ReactComponent ~> number
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/react/create_class_initial_state_sealed.js | tests/format/flow-repo/react/create_class_initial_state_sealed.js | import React from "react";
// initial state = None
React.createClass({
f() {
this.setState({ q: 0 });
},
g() {
(this.state.q: empty); // number ~> empty
}
});
// initial state = Some (exact & sealed) [lit]
React.createClass({
getInitialState() {
return { p: 0 };
},
f() {
this.setState({ ... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/react/proptype_arrayOf.js | tests/format/flow-repo/react/proptype_arrayOf.js | /* @flow */
var React = require('react');
var Example = React.createClass({
propTypes: {
arr: React.PropTypes.arrayOf(React.PropTypes.number).isRequired,
},
});
var ok_empty = <Example arr={[]} />
var ok_numbers = <Example arr={[1, 2]} />
var fail_missing = <Example />
var fail_not_array = <Example arr={2} /... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/react/ArityError.react.js | tests/format/flow-repo/react/ArityError.react.js | /**
* @providesModule ArityError.react
*/
var React = require('react');
var AudienceInsightsContainer = React.createClass({
renderComponent(AudienceInsights: ReactClass<*>) {
return <AudienceInsights />;
},
});
module.exports = AudienceInsightsContainer;
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/react/proptype_shape.js | tests/format/flow-repo/react/proptype_shape.js | /* Shape should be a sealed, inexact object just like a type annotation. The
* below component's `foo` property should be equivalent to `{ bar: string }`,
* which would forbid reads/writes on an unknown `baz` property.
*
* If you see a single "number incompatible with string" error instead of two
* separate "prope... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/react/proptype_missing.js | tests/format/flow-repo/react/proptype_missing.js | /* @flow */
/* If you create a react component with createClass() but don't specify the
* propTypes, what should the type of props be?
*
* It used to be an empty object, but we didn't enforce that correctly, so
* people could do whatever they wanted with this.props.
*
* As of 0.21.0 it started to be an error whe... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/react/create_class.js | tests/format/flow-repo/react/create_class.js | import React from "react";
const A = React.createClass({
mixins: [{ propTypes: { foo: React.PropTypes.string.isRequired } }],
propTypes: { bar: React.PropTypes.number.isRequired },
m() {
(this.props.foo: empty); // error: string ~> empty
(this.props.bar: empty); // error: number ~> empty
}
});
const B... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/react/proptype_incompatible.js | tests/format/flow-repo/react/proptype_incompatible.js | const React = require("react");
var Example = React.createClass({
propTypes: {
foo: 0, // error: `0` is not a prop type
},
});
(<Example />); // OK: don't cascade errors
(<Example foo={(0:mixed)} />); // OK: don't cascade errors
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/react/proptype_objectOf.js | tests/format/flow-repo/react/proptype_objectOf.js | /* @flow */
var React = require('react');
var Example = React.createClass({
propTypes: {
obj: React.PropTypes.objectOf(React.PropTypes.number).isRequired
},
});
var ok_empty = <Example obj={{}} />
var ok_numbers = <Example obj={{foo: 1, bar: 2}} />
var fail_missing = <Example />
var fail_not_object = <Exampl... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/react/proptypes_builtins.js | tests/format/flow-repo/react/proptypes_builtins.js | import React from "react";
type NoFun = mixed => empty;
// error: mixed ~> ReactPropsCheckType
// error: ReactPropsChainableTypeChecker ~> empty
(React.PropTypes.arrayOf : NoFun);
// OK: mixed ~> any
// error: ReactPropsChainableTypeChecker ~> empty
(React.PropTypes.instanceOf : NoFun);
// error: mixed ~> ReactProp... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/react/proptype_oneOfType.js | tests/format/flow-repo/react/proptype_oneOfType.js | /* @flow */
var React = require('react');
var Example = React.createClass({
propTypes: {
prop: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.number
]).isRequired
},
render() {
if (typeof this.props.prop === "string") {
return <div>{this.props.prop}</div>
} ... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/react/proptype_object.js | tests/format/flow-repo/react/proptype_object.js | /* @flow */
var React = require('react');
var Example = React.createClass({
propTypes: {
object: React.PropTypes.object.isRequired
},
});
var ok_empty = <Example object={{}} />;
var ok_props = <Example object={{foo: "bar"}} />;
var fail_mistyped = <Example object={2} />
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/react/create_class_statics_sealed.js | tests/format/flow-repo/react/create_class_statics_sealed.js | import React from "react";
// statics = None
const A = React.createClass({ p: 0 });
(A.bar: empty); // number ~> empty (inflow below)
A.bar = 0;
// statics = Some (exact & sealed) [lit]
const B = React.createClass({
statics: { foo: 0 },
});
(B.foo: empty); // number ~> empty
(B.bar: empty); // number ~> empty (infl... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/react/createElement_string.js | tests/format/flow-repo/react/createElement_string.js | // @flow
import React from 'react';
class Bar extends React.Component {}
class Foo extends React.Component {
render() {
const Cmp = Math.random() < 0.5 ? 'div' : Bar;
return (<Cmp/>);
}
}
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/react/proptype_oneOf.js | tests/format/flow-repo/react/proptype_oneOf.js | /* @flow */
var React = require('react');
var Example = React.createClass({
propTypes: {
str: React.PropTypes.oneOf(["foo", "bar"]),
num: React.PropTypes.oneOf([0, 1, 2]),
bool: React.PropTypes.oneOf([true]),
mixed: React.PropTypes.oneOf(["foo", 0, true]),
},
});
(<Example str="foo" />); // OK
(<E... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/react/proptype_func.js | tests/format/flow-repo/react/proptype_func.js | /* @flow */
var React = require('react');
var Example = React.createClass({
propTypes: {
func: React.PropTypes.func.isRequired
},
});
var ok_void = <Example func={() => {}} />;
var ok_args = <Example func={(x) => {}} />;
var ok_retval = <Example func={() => 1} />
var fail_mistyped = <Example func={2} />
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/react/jsx_spread.js | tests/format/flow-repo/react/jsx_spread.js | /* @flow */
var React = require('react');
var Foo = React.createClass({
propTypes: {
bar: React.PropTypes.string.isRequired,
},
});
var props = {bar: 42};
var blah = <Foo {...props} />; // error bar, number given string expected
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/flow-repo/react/format.test.js | tests/format/flow-repo/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/react/proptypes_sealed.js | tests/format/flow-repo/react/proptypes_sealed.js | /* propTypes should be a sealed, inexact object just like a type annotation. The
* below component's propTypes should be equivalent to `{ bar: string }`, which
* would forbid reads/writes on an unknown `baz` property.
*
* If you see a single "number incompatible with string" error instead of two
* separate "proper... | javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/stylefmt-repo/content/format.test.js | tests/format/stylefmt-repo/content/format.test.js | runFormatTest(import.meta, ["css"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/stylefmt-repo/nested-2/format.test.js | tests/format/stylefmt-repo/nested-2/format.test.js | runFormatTest(import.meta, ["css"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/stylefmt-repo/comment-in-rules/format.test.js | tests/format/stylefmt-repo/comment-in-rules/format.test.js | runFormatTest(import.meta, ["css"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/stylefmt-repo/media-queries-ranges/format.test.js | tests/format/stylefmt-repo/media-queries-ranges/format.test.js | runFormatTest(import.meta, ["css"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/stylefmt-repo/nested-atrule/format.test.js | tests/format/stylefmt-repo/nested-atrule/format.test.js | runFormatTest(import.meta, ["css"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/stylefmt-repo/non-nested-combinator/format.test.js | tests/format/stylefmt-repo/non-nested-combinator/format.test.js | runFormatTest(import.meta, ["css"]);
| javascript | MIT | ae0e00df55d47274cc53db8d2cdcd064849e088d | 2026-01-04T14:57:20.107180Z | false |
prettier/prettier | https://github.com/prettier/prettier/blob/ae0e00df55d47274cc53db8d2cdcd064849e088d/tests/format/stylefmt-repo/charset/format.test.js | tests/format/stylefmt-repo/charset/format.test.js | runFormatTest(import.meta, ["css"]);
| 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.