Skip to content

Commit 2624e2f

Browse files
marcoww6meta-codesync[bot]
authored andcommitted
Transform mixed to unknown in xplat/js (#54955)
Summary: Pull Request resolved: #54955 We are transforming the following utility types to be more consistent with typescript and better AI integration: * `$NonMaybeType` -> `NonNullable` * `$ReadOnly` -> `Readonly` * `$ReadOnlyArray` -> `ReadonlyArray` * `$ReadOnlyMap` -> `ReadonlyMap` * `$ReadOnlySet` -> `ReadonlySet` * `$Keys` -> `keyof` * `$Values` -> `Values` * `mixed` -> `unknown` See details in https://fb.workplace.com/groups/flowlang/permalink/1837907750148213/. drop-conflicts Reviewed By: SamChou19815 Differential Revision: D89581584 fbshipit-source-id: cc5953ffea6cf1060f69efc714508e8ba93a040c
1 parent c8e09e9 commit 2624e2f

87 files changed

Lines changed: 476 additions & 455 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

flow-typed/environment/node.js

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -847,15 +847,15 @@ declare class dgram$Socket extends events$EventEmitter {
847847
msg: Buffer,
848848
port: number,
849849
address: string,
850-
callback?: (err: ?Error, bytes: any) => mixed,
850+
callback?: (err: ?Error, bytes: any) => unknown,
851851
): void;
852852
send(
853853
msg: Buffer,
854854
offset: number,
855855
length: number,
856856
port: number,
857857
address: string,
858-
callback?: (err: ?Error, bytes: any) => mixed,
858+
callback?: (err: ?Error, bytes: any) => unknown,
859859
): void;
860860
setBroadcast(flag: boolean): void;
861861
setMulticastLoopback(flag: boolean): void;
@@ -2021,7 +2021,7 @@ declare class http$Server extends net$Server {
20212021
callback?: Function,
20222022
): this;
20232023
listening: boolean;
2024-
close(callback?: (error: ?Error) => mixed): this;
2024+
close(callback?: (error: ?Error) => unknown): this;
20252025
closeAllConnections(): void;
20262026
closeIdleConnections(): void;
20272027
maxHeadersCount: number;
@@ -2057,7 +2057,7 @@ declare class https$Server extends tls$Server {
20572057
},
20582058
callback?: Function,
20592059
): this;
2060-
close(callback?: (error: ?Error) => mixed): this;
2060+
close(callback?: (error: ?Error) => unknown): this;
20612061
closeAllConnections(): void;
20622062
closeIdleConnections(): void;
20632063
keepAliveTimeout: number;
@@ -2070,7 +2070,7 @@ type requestOptions = {|
20702070
auth?: string,
20712071
defaultPort?: number,
20722072
family?: number,
2073-
headers?: {[key: string]: mixed, ...},
2073+
headers?: {[key: string]: unknown, ...},
20742074
host?: string,
20752075
hostname?: string,
20762076
localAddress?: string,
@@ -2208,14 +2208,14 @@ declare class net$Socket extends stream$Duplex {
22082208
bufferSize: number;
22092209
bytesRead: number;
22102210
bytesWritten: number;
2211-
connect(path: string, connectListener?: () => mixed): net$Socket;
2211+
connect(path: string, connectListener?: () => unknown): net$Socket;
22122212
connect(
22132213
port: number,
22142214
host?: string,
2215-
connectListener?: () => mixed,
2215+
connectListener?: () => unknown,
22162216
): net$Socket;
2217-
connect(port: number, connectListener?: () => mixed): net$Socket;
2218-
connect(options: Object, connectListener?: () => mixed): net$Socket;
2217+
connect(port: number, connectListener?: () => unknown): net$Socket;
2218+
connect(options: Object, connectListener?: () => unknown): net$Socket;
22192219
destroyed: boolean;
22202220
end(
22212221
chunkOrEncodingOrCallback?:
@@ -2275,7 +2275,7 @@ type net$connectOptions = {
22752275
domain: string,
22762276
options?: ?number | ?Object,
22772277
callback?: (err: ?Error, address: string, family: number) => void,
2278-
) => mixed,
2278+
) => unknown,
22792279
path?: string,
22802280
...
22812281
};
@@ -2893,7 +2893,7 @@ type tls$connectOptions = {
28932893
domain: string,
28942894
options?: ?number | ?Object,
28952895
callback?: (err: ?Error, address: string, family: number) => void,
2896-
) => mixed,
2896+
) => unknown,
28972897
requestOCSP?: boolean,
28982898
...
28992899
};
@@ -3095,7 +3095,7 @@ declare module 'url' {
30953095
value: string,
30963096
name: string,
30973097
searchParams: URLSearchParams,
3098-
) => mixed,
3098+
) => unknown,
30993099
thisArg?: This,
31003100
): void;
31013101
get(name: string): string | null;
@@ -3270,45 +3270,45 @@ declare module 'util' {
32703270
}
32713271

32723272
declare var types: {
3273-
isAnyArrayBuffer: (value: mixed) => boolean,
3274-
isArgumentsObject: (value: mixed) => boolean,
3275-
isArrayBuffer: (value: mixed) => boolean,
3276-
isAsyncFunction: (value: mixed) => boolean,
3277-
isBigInt64Array: (value: mixed) => boolean,
3278-
isBigUint64Array: (value: mixed) => boolean,
3279-
isBooleanObject: (value: mixed) => boolean,
3280-
isBoxedPrimitive: (value: mixed) => boolean,
3281-
isDataView: (value: mixed) => boolean,
3282-
isDate: (value: mixed) => boolean,
3283-
isExternal: (value: mixed) => boolean,
3284-
isFloat32Array: (value: mixed) => boolean,
3285-
isFloat64Array: (value: mixed) => boolean,
3286-
isGeneratorFunction: (value: mixed) => boolean,
3287-
isGeneratorObject: (value: mixed) => boolean,
3288-
isInt8Array: (value: mixed) => boolean,
3289-
isInt16Array: (value: mixed) => boolean,
3290-
isInt32Array: (value: mixed) => boolean,
3291-
isMap: (value: mixed) => boolean,
3292-
isMapIterator: (value: mixed) => boolean,
3293-
isModuleNamespaceObject: (value: mixed) => boolean,
3294-
isNativeError: (value: mixed) => boolean,
3295-
isNumberObject: (value: mixed) => boolean,
3296-
isPromise: (value: mixed) => boolean,
3297-
isProxy: (value: mixed) => boolean,
3298-
isRegExp: (value: mixed) => boolean,
3299-
isSet: (value: mixed) => boolean,
3300-
isSetIterator: (value: mixed) => boolean,
3301-
isSharedArrayBuffer: (value: mixed) => boolean,
3302-
isStringObject: (value: mixed) => boolean,
3303-
isSymbolObject: (value: mixed) => boolean,
3304-
isTypedArray: (value: mixed) => boolean,
3305-
isUint8Array: (value: mixed) => boolean,
3306-
isUint8ClampedArray: (value: mixed) => boolean,
3307-
isUint16Array: (value: mixed) => boolean,
3308-
isUint32Array: (value: mixed) => boolean,
3309-
isWeakMap: (value: mixed) => boolean,
3310-
isWeakSet: (value: mixed) => boolean,
3311-
isWebAssemblyCompiledModule: (value: mixed) => boolean,
3273+
isAnyArrayBuffer: (value: unknown) => boolean,
3274+
isArgumentsObject: (value: unknown) => boolean,
3275+
isArrayBuffer: (value: unknown) => boolean,
3276+
isAsyncFunction: (value: unknown) => boolean,
3277+
isBigInt64Array: (value: unknown) => boolean,
3278+
isBigUint64Array: (value: unknown) => boolean,
3279+
isBooleanObject: (value: unknown) => boolean,
3280+
isBoxedPrimitive: (value: unknown) => boolean,
3281+
isDataView: (value: unknown) => boolean,
3282+
isDate: (value: unknown) => boolean,
3283+
isExternal: (value: unknown) => boolean,
3284+
isFloat32Array: (value: unknown) => boolean,
3285+
isFloat64Array: (value: unknown) => boolean,
3286+
isGeneratorFunction: (value: unknown) => boolean,
3287+
isGeneratorObject: (value: unknown) => boolean,
3288+
isInt8Array: (value: unknown) => boolean,
3289+
isInt16Array: (value: unknown) => boolean,
3290+
isInt32Array: (value: unknown) => boolean,
3291+
isMap: (value: unknown) => boolean,
3292+
isMapIterator: (value: unknown) => boolean,
3293+
isModuleNamespaceObject: (value: unknown) => boolean,
3294+
isNativeError: (value: unknown) => boolean,
3295+
isNumberObject: (value: unknown) => boolean,
3296+
isPromise: (value: unknown) => boolean,
3297+
isProxy: (value: unknown) => boolean,
3298+
isRegExp: (value: unknown) => boolean,
3299+
isSet: (value: unknown) => boolean,
3300+
isSetIterator: (value: unknown) => boolean,
3301+
isSharedArrayBuffer: (value: unknown) => boolean,
3302+
isStringObject: (value: unknown) => boolean,
3303+
isSymbolObject: (value: unknown) => boolean,
3304+
isTypedArray: (value: unknown) => boolean,
3305+
isUint8Array: (value: unknown) => boolean,
3306+
isUint8ClampedArray: (value: unknown) => boolean,
3307+
isUint16Array: (value: unknown) => boolean,
3308+
isUint32Array: (value: unknown) => boolean,
3309+
isWeakMap: (value: unknown) => boolean,
3310+
isWeakSet: (value: unknown) => boolean,
3311+
isWebAssemblyCompiledModule: (value: unknown) => boolean,
33123312
...
33133313
};
33143314

@@ -4047,18 +4047,18 @@ declare class Process extends events$EventEmitter {
40474047
emitWarning(warning: string | Error): void;
40484048
emitWarning(
40494049
warning: string,
4050-
typeOrCtor: string | ((...empty) => mixed),
4050+
typeOrCtor: string | ((...empty) => unknown),
40514051
): void;
40524052
emitWarning(
40534053
warning: string,
40544054
type: string,
4055-
codeOrCtor: string | ((...empty) => mixed),
4055+
codeOrCtor: string | ((...empty) => unknown),
40564056
): void;
40574057
emitWarning(
40584058
warning: string,
40594059
type: string,
40604060
code: string,
4061-
ctor?: (...empty) => mixed,
4061+
ctor?: (...empty) => unknown,
40624062
): void;
40634063
execArgv: Array<string>;
40644064
execPath: string;
@@ -4088,7 +4088,7 @@ declare class Process extends events$EventEmitter {
40884088
},
40894089
rss: () => number,
40904090
};
4091-
nextTick: <T>(cb: (...T) => mixed, ...T) => void;
4091+
nextTick: <T>(cb: (...T) => unknown, ...T) => void;
40924092
pid: number;
40934093
platform: string;
40944094
release: {
@@ -4129,7 +4129,7 @@ declare var __filename: string;
41294129
declare var __dirname: string;
41304130

41314131
declare function setImmediate(
4132-
callback: (...args: Array<any>) => mixed,
4132+
callback: (...args: Array<any>) => unknown,
41334133
...args: Array<any>
41344134
): Object;
41354135
declare function clearImmediate(immediateObject: any): Object;

flow-typed/npm/@octokit/rest_v22.x.x.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ declare module '@octokit/rest' {
5353
repo: string,
5454
asset_id: string,
5555
...
56-
}) => Promise<mixed>,
56+
}) => Promise<unknown>,
5757
}>;
5858
}
5959

flow-typed/npm/@react-native-community/cli-server-api_v19.x.x.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ declare module '@react-native-community/cli-server-api' {
3232
server: ws$WebSocketServer,
3333
broadcast: (
3434
method: string,
35-
params?: Record<string, mixed> | null,
35+
params?: Record<string, unknown> | null,
3636
) => void,
3737
},
3838
eventsSocketEndpoint: {

flow-typed/npm/babel-traverse_v7.x.x.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ declare module '@babel/traverse' {
5353

5454
constructor(
5555
scope: Scope,
56-
opts: TraverseOptions<mixed>,
56+
opts: TraverseOptions<unknown>,
5757
state: any,
5858
parentPath: NodePath<>,
5959
): TraversalContext;
@@ -298,12 +298,12 @@ declare module '@babel/traverse' {
298298
parent: BabelNode;
299299
hub: HubInterface;
300300
contexts: Array<TraversalContext>;
301-
data: {[key: string]: mixed} | null;
301+
data: {[key: string]: unknown} | null;
302302
shouldSkip: boolean;
303303
shouldStop: boolean;
304304
removed: boolean;
305-
state: mixed;
306-
+opts: $ReadOnly<TraverseOptions<mixed>> | null;
305+
state: unknown;
306+
+opts: $ReadOnly<TraverseOptions<unknown>> | null;
307307
skipKeys: null | {[key: string]: boolean};
308308
parentPath: ?NodePath<>;
309309
context: TraversalContext;
@@ -338,7 +338,7 @@ declare module '@babel/traverse' {
338338
getScope(scope: Scope): Scope;
339339

340340
setData<TVal>(key: string, val: TVal): TVal;
341-
getData<TVal = mixed>(key: string, def?: TVal): TVal;
341+
getData<TVal = unknown>(key: string, def?: TVal): TVal;
342342

343343
buildCodeFrameError<TError: Error>(
344344
msg: string,
@@ -1881,8 +1881,8 @@ declare module '@babel/traverse' {
18811881
declare export var visitors: Visitors;
18821882

18831883
declare export type Cache = {
1884-
path: $ReadOnlyWeakMap<BabelNode, mixed>,
1885-
scope: $ReadOnlyWeakMap<BabelNode, mixed>,
1884+
path: $ReadOnlyWeakMap<BabelNode, unknown>,
1885+
scope: $ReadOnlyWeakMap<BabelNode, unknown>,
18861886
clear(): void,
18871887
clearPath(): void,
18881888
clearScope(): void,

0 commit comments

Comments
 (0)