Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions flow-typed/environment/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -2549,7 +2549,7 @@ declare module 'fs' {
...
}>,
writeFile(
FSPromisePath | FileHandle,
v0: FSPromisePath | FileHandle,
data: string | Buffer | Uint8Array,
options?: string | WriteOptions,
): Promise<void>,
Expand Down Expand Up @@ -3343,9 +3343,9 @@ declare module 'perf_hooks' {
setResourceTimingBufferSize(maxSize: number): void;
readonly timeOrigin: number;
timerify<TArgs extends Iterable<unknown>, TReturn>(
fn: (...TArgs) => TReturn,
fn: (...rest: TArgs) => TReturn,
options?: Readonly<{histogram?: RecordableHistogram}>,
): (...TArgs) => TReturn;
): (...rest: TArgs) => TReturn;
toJSON(): unknown;
}

Expand Down Expand Up @@ -3537,7 +3537,7 @@ type readline$InterfaceCompleter = (
| [Array<string>, string]
| ((
line: string,
((err: ?Error, data: [Array<string>, string]) => void),
v1: (err: ?Error, data: [Array<string>, string]) => void,
) => void);

declare class readline$Interface extends events$EventEmitter {
Expand Down Expand Up @@ -5630,18 +5630,18 @@ declare class Process extends events$EventEmitter {
emitWarning(warning: string | Error): void;
emitWarning(
warning: string,
typeOrCtor: string | ((...empty) => unknown),
typeOrCtor: string | ((...rest: empty) => unknown),
): void;
emitWarning(
warning: string,
type: string,
codeOrCtor: string | ((...empty) => unknown),
codeOrCtor: string | ((...rest: empty) => unknown),
): void;
emitWarning(
warning: string,
type: string,
code: string,
ctor?: (...empty) => unknown,
ctor?: (...rest: empty) => unknown,
): void;
execArgv: Array<string>;
execPath: string;
Expand Down Expand Up @@ -5671,7 +5671,7 @@ declare class Process extends events$EventEmitter {
},
rss: () => number,
};
nextTick: <T>(cb: (...T) => unknown, ...T) => void;
nextTick: <T>(cb: (...rest: T) => unknown, ...rest: T) => void;
pid: number;
platform: string;
release: {
Expand Down
2 changes: 1 addition & 1 deletion flow-typed/npm/babel-traverse_v7.x.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ declare module '@babel/traverse' {

constructor(hub: HubInterface, parent: BabelNode): NodePath<TNode>;

static get({
static get(v: {
hub: HubInterface,
parentPath: ?NodePath<>,
parent: BabelNode,
Expand Down
30 changes: 17 additions & 13 deletions flow-typed/npm/babel_v7.x.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ declare module '@babel/core' {
buildCodeFrameError<TError extends Error>(
node: BabelNode,
msg: string,
Class<TError>,
v2: Class<TError>,
): TError;

mergeSourceMap(map: _BabelSourceMap): _BabelSourceMap;
Expand All @@ -408,7 +408,7 @@ declare module '@babel/core' {

parseShebang(): void;

makeResult<T>(TransformResult<T>): TransformResult<T>;
makeResult<T>(v: TransformResult<T>): TransformResult<T>;

generate(): TransformResult<>;
}
Expand Down Expand Up @@ -955,8 +955,8 @@ declare module '@babel/core' {
|};

declare type TransformCallback<TMetadata> =
| ((Error, null) => unknown)
| ((null, TransformResult<TMetadata> | null) => unknown);
| ((v0: Error, v1: null) => unknown)
| ((v0: null, v1: TransformResult<TMetadata> | null) => unknown);

/**
* Transforms the passed in code. Calling a callback with an object with the generated code, source map, and AST.
Expand Down Expand Up @@ -1042,7 +1042,8 @@ declare module '@babel/core' {
declare export function parse(
code: string,
options?: BabelCoreOptions,
callback: ((error: Error) => void) | ((void, BabelNodeFile) => void),
callback:
((error: Error) => void) | ((v0: void, v1: BabelNodeFile) => void),
): void;

declare export function parseSync(
Expand Down Expand Up @@ -1096,8 +1097,8 @@ declare module '@babel/core' {
declare export function loadOptions(
options?: unknown,
callback:
| ((error: Error, null) => unknown)
| ((null, config: ResolvedConfig | null) => unknown),
| ((error: Error, v1: null) => unknown)
| ((v0: null, config: ResolvedConfig | null) => unknown),
): void;
declare export function loadOptionsSync(
options?: unknown,
Expand Down Expand Up @@ -1125,8 +1126,8 @@ declare module '@babel/core' {
declare export function loadPartialConfig(
options?: unknown,
callback:
| ((error: Error, null) => unknown)
| ((null, config: PartialConfig | null) => unknown),
| ((error: Error, v1: null) => unknown)
| ((v0: null, config: PartialConfig | null) => unknown),
): void;
declare export function loadPartialConfigSync(
options?: unknown,
Expand Down Expand Up @@ -1314,10 +1315,13 @@ declare module '@babel/template' {
(opts: PublicOpts): TemplateBuilder<T>,

// Building from a string produces an AST builder function by default.
(tpl: string, opts: ?PublicOpts): (?PublicReplacements) => T,
(tpl: string, opts: ?PublicOpts): (v: ?PublicReplacements) => T,

// Building from a template literal produces an AST builder function by default.
(tpl: Array<string>, ...args: Array<unknown>): (?PublicReplacements) => T,
(
tpl: Array<string>,
...args: Array<unknown>
): (v: ?PublicReplacements) => T,

// Allow users to explicitly create templates that produce ASTs, skipping
// the need for an intermediate function.
Expand Down Expand Up @@ -1350,13 +1354,13 @@ declare module '@babel/template' {
(
tpl: string,
opts: ?PublicOpts,
): (?PublicReplacements) => Statement | Array<Statement>,
): (v: ?PublicReplacements) => Statement | Array<Statement>,

// Building from a template literal produces an AST builder function by default.
(
tpl: Array<string>,
...args: Array<unknown>
): (?PublicReplacements) => Statement | Array<Statement>,
): (v: ?PublicReplacements) => Statement | Array<Statement>,

// Allow users to explicitly create templates that produce ASTs, skipping
// the need for an intermediate function.
Expand Down
6 changes: 3 additions & 3 deletions flow-typed/npm/base64-js_v1.x.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

declare module 'base64-js' {
declare module.exports: {
byteLength: string => number,
fromByteArray: (Uint8Array | Array<number>) => string,
toByteArray: string => Uint8Array,
byteLength: (v: string) => number,
fromByteArray: (v: Uint8Array | Array<number>) => string,
toByteArray: (v: string) => Uint8Array,
};
}
6 changes: 3 additions & 3 deletions flow-typed/npm/jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -1191,9 +1191,9 @@ type JestPrettyFormatColors = {
...
};

type JestPrettyFormatIndent = string => string;
type JestPrettyFormatIndent = (v: string) => string;
type JestPrettyFormatRefs = Array<any>;
type JestPrettyFormatPrint = any => string;
type JestPrettyFormatPrint = (v: any) => string;
type JestPrettyFormatStringOrNull = string | null;

type JestPrettyFormatOptions = {
Expand Down Expand Up @@ -1224,7 +1224,7 @@ type JestPrettyFormatPlugin = {
opts: JestPrettyFormatOptions,
colors: JestPrettyFormatColors,
) => string,
test: any => boolean,
test: (v: any) => boolean,
...
};

Expand Down
3 changes: 2 additions & 1 deletion flow-typed/npm/node-fetch_v2.x.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ declare module 'node-fetch' {
signal?: AbortSignal | null,

// node-fetch extensions
agent?: (URL => http.Agent | https.Agent) | http.Agent | https.Agent | null,
agent?:
((v: URL) => http.Agent | https.Agent) | http.Agent | https.Agent | null,
compress?: boolean,
follow?: number,
size?: number,
Expand Down
4 changes: 2 additions & 2 deletions flow-typed/npm/promise_v8.x.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ declare module 'promise/setimmediate/rejection-tracking' {
options?: ?{
whitelist?: ?Array<unknown>,
allRejections?: ?boolean,
onUnhandled?: ?(number, unknown) => void,
onHandled?: ?(number, unknown) => void,
onUnhandled?: ?(v0: number, v1: unknown) => void,
onHandled?: ?(v0: number, v1: unknown) => void,
},
) => void,
disable: () => void,
Expand Down
2 changes: 1 addition & 1 deletion flow-typed/npm/stacktrace-parser_v0.1.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ type StackFrame = {

declare module 'stacktrace-parser' {
declare module.exports: {
parse: string => Array<StackFrame>,
parse: (v: string) => Array<StackFrame>,
};
}
36 changes: 18 additions & 18 deletions flow-typed/npm/ws_v7.x.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,34 +47,34 @@ declare class ws$WebSocketServer extends events$EventEmitter {
/**
* Emitted when the server closes.
*/
on(event: 'close', () => unknown): this;
on(event: 'close', v1: () => unknown): this;

/**
* Emitted when the handshake is complete.
*/
on(
event: 'connection',
(socket: ws$WebSocket, request: http$IncomingMessage<>) => unknown,
v1: (socket: ws$WebSocket, request: http$IncomingMessage<>) => unknown,
): this;

/**
* Emitted when an error occurs on the underlying server.
*/
on(event: 'error', (error: Error) => unknown): this;
on(event: 'error', v1: (error: Error) => unknown): this;

/**
* Emitted before the response headers are written to the socket as part of
* the handshake.
*/
on(
event: 'headers',
(headers: Array<string>, request: http$IncomingMessage<>) => unknown,
v1: (headers: Array<string>, request: http$IncomingMessage<>) => unknown,
): this;

/**
* Emitted when the underlying server has been bound.
*/
on(event: 'listening', () => unknown): this;
on(event: 'listening', v1: () => unknown): this;

/**
* Returns the bound address, the address family name, and port of the server
Expand Down Expand Up @@ -102,7 +102,7 @@ declare class ws$WebSocketServer extends events$EventEmitter {
request: http$IncomingMessage<>,
socket: net$Socket,
head: Buffer,
callback: (?ws$WebSocket) => unknown,
callback: (v: ?ws$WebSocket) => unknown,
): void;

/**
Expand Down Expand Up @@ -137,8 +137,8 @@ declare type ws$MessageListener = (
isBinary: boolean,
) => unknown;
declare type ws$OpenListener = () => unknown;
declare type ws$PingListener = (Buffer) => unknown;
declare type ws$PongListener = (Buffer) => unknown;
declare type ws$PingListener = (v: Buffer) => unknown;
declare type ws$PongListener = (v: Buffer) => unknown;
declare type ws$UnexpectedResponseListener = (
request: http$ClientRequest<>,
response: http$IncomingMessage<>,
Expand Down Expand Up @@ -173,44 +173,44 @@ declare class ws$WebSocket extends events$EventEmitter {
/*
* Emitted when the connection is closed.
*/
on('close', ws$CloseListener): this;
on(v0: 'close', v1: ws$CloseListener): this;

/*
* Emitted when an error occurs.
*/
on('error', ws$ErrorListener): this;
on(v0: 'error', v1: ws$ErrorListener): this;

/*
* Emitted when a message is received from the server.
*/
on('message', ws$MessageListener): this;
on(v0: 'message', v1: ws$MessageListener): this;

/*
* Emitted when the connection is established.
*/
on('open', ws$OpenListener): this;
on(v0: 'open', v1: ws$OpenListener): this;

/*
* Emitted when a ping is received from the server.
*/
on('ping', ws$PingListener): this;
on(v0: 'ping', v1: ws$PingListener): this;

/*
* Emitted when a pong is received from the server.
*/
on('pong', ws$PongListener): this;
on(v0: 'pong', v1: ws$PongListener): this;

/*
* Emitted when the server response is not the expected one,
* for example a 401 response.
*/
on('unexpected-response', ws$UnexpectedResponseListener): this;
on(v0: 'unexpected-response', v1: ws$UnexpectedResponseListener): this;

/*
* Emitted when response headers are received from the server as part of the
* handshake.
*/
on('upgrade', ws$UpgradeListener): this;
on(v0: 'upgrade', v1: ws$UpgradeListener): this;

/**
* Register an event listener emulating the `EventTarget` interface.
Expand Down Expand Up @@ -247,7 +247,7 @@ declare class ws$WebSocket extends events$EventEmitter {
): this;
addEventListener(
type: 'unexpected-response',
ws$UnexpectedResponseListener,
v1: ws$UnexpectedResponseListener,
options?: {once?: boolean},
): this;
addEventListener(
Expand Down Expand Up @@ -313,7 +313,7 @@ declare class ws$WebSocket extends events$EventEmitter {
removeEventListener(type: 'pong', listener: ws$PongListener): this;
removeEventListener(
type: 'unexpected-response',
ws$UnexpectedResponseListener,
v1: ws$UnexpectedResponseListener,
): this;
removeEventListener(type: 'upgrade', listener: ws$UpgradeListener): this;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export default class InspectorProxy implements InspectorProxyQueries {
processRequest(
request: IncomingMessage,
response: ServerResponse,
next: (?Error) => unknown,
next: (v: ?Error) => unknown,
) {
const pathname = new URL(request.url, 'http://example.com').pathname;
if (
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-preset/jest/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Object.defineProperties(global, {
requestAnimationFrame: {
configurable: true,
enumerable: true,
value(callback: number => void): ReturnType<typeof setTimeout> {
value(callback: (v: number) => void): ReturnType<typeof setTimeout> {
return setTimeout(() => callback(jest.now()), 0);
},
writable: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/polyfills/error-guard.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
let _inGuard = 0;

type ErrorHandler = (error: unknown, isFatal: boolean) => void;
type Fn<Args, Return> = (...Args) => Return;
type Fn<Args, Return> = (...rest: Args) => Return;

/**
* This is the error handler that is called when we encounter an exception
Expand Down Expand Up @@ -98,7 +98,7 @@ const ErrorUtils = {
fun: Fn<TArgs, TOut>,
name?: ?string,
context?: ?unknown,
): ?(...TArgs) => ?TOut {
): ?(...rest: TArgs) => ?TOut {
// TODO: (moti) T48204753 Make sure this warning is never hit and remove it - types
// should be sufficient.
if (typeof fun !== 'function') {
Expand Down
Loading
Loading