-
Notifications
You must be signed in to change notification settings - Fork 30.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
typings: improve internal bindings typings
PR-URL: #40411 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent
eea061f
commit fbe0323
Showing
11 changed files
with
501 additions
and
442 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,12 @@ | ||
declare type TypedArray = Uint16Array | Uint32Array | Uint8Array | Uint8ClampedArray | Int16Array | Int32Array | Int8Array | BigInt64Array | Float32Array | Float64Array | BigUint64Array; | ||
declare type TypedArray = | ||
| Uint8Array | ||
| Uint8ClampedArray | ||
| Uint16Array | ||
| Uint32Array | ||
| Int8Array | ||
| Int16Array | ||
| Int32Array | ||
| Float32Array | ||
| Float64Array | ||
| BigUint64Array | ||
| BigInt64Array; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
declare function InternalBinding(binding: 'config'): { | ||
isDebugBuild: boolean, | ||
hasOpenSSL: boolean, | ||
fipsMode: boolean, | ||
hasIntl: boolean, | ||
hasTracing: boolean, | ||
hasNodeOptions: boolean, | ||
hasInspector: boolean, | ||
noBrowserGlobals: boolean, | ||
bits: number, | ||
hasDtrace: boolean | ||
} | ||
isDebugBuild: boolean; | ||
hasOpenSSL: boolean; | ||
fipsMode: boolean; | ||
hasIntl: boolean; | ||
hasTracing: boolean; | ||
hasNodeOptions: boolean; | ||
hasInspector: boolean; | ||
noBrowserGlobals: boolean; | ||
bits: number; | ||
hasDtrace: boolean; | ||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,25 @@ | ||
declare namespace InternalOSBinding { | ||
type OSContext = {}; | ||
} | ||
|
||
declare function InternalBinding(binding: 'os'): { | ||
getHostname(ctx: {}): string | undefined; | ||
getHostname(ctx: InternalOSBinding.OSContext): string | undefined; | ||
getLoadAvg(array: Float64Array): void; | ||
getUptime(): number; | ||
getTotalMem(): number; | ||
getFreeMem(): number; | ||
getCPUs(): Array<string | number>; | ||
getInterfaceAddresses(ctx: {}): Array<string | number | boolean> | undefined; | ||
getHomeDirectory(ctx: {}): string | undefined; | ||
getUserInfo(options: { encoding?: string } | undefined, ctx: {}): { | ||
getInterfaceAddresses(ctx: InternalOSBinding.OSContext): Array<string | number | boolean> | undefined; | ||
getHomeDirectory(ctx: InternalOSBinding.OSContext): string | undefined; | ||
getUserInfo(options: { encoding?: string } | undefined, ctx: InternalOSBinding.OSContext): { | ||
uid: number; | ||
gid: number; | ||
username: string; | ||
homedir: string; | ||
shell: string | null; | ||
} | undefined; | ||
setPriority(pid: number, priority: number, ctx: {}): number; | ||
getPriority(pid: number, ctx: {}): number | undefined; | ||
getOSInformation(ctx: {}): [sysname: string, version: string, release: string]; | ||
setPriority(pid: number, priority: number, ctx: InternalOSBinding.OSContext): number; | ||
getPriority(pid: number, ctx: InternalOSBinding.OSContext): number | undefined; | ||
getOSInformation(ctx: InternalOSBinding.OSContext): [sysname: string, version: string, release: string]; | ||
isBigEndian: boolean; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,27 @@ | ||
declare function InternalBinding(binding: 'symbols'): { | ||
[name: string]: symbol; | ||
declare namespace InternalSymbolsBinding { | ||
const async_id_symbol: unique symbol; | ||
const handle_onclose_symbol: unique symbol; | ||
const no_message_symbol: unique symbol; | ||
const messaging_deserialize_symbol: unique symbol; | ||
const messaging_transfer_symbol: unique symbol; | ||
const messaging_clone_symbol: unique symbol; | ||
const messaging_transfer_list_symbol: unique symbol; | ||
const oninit_symbol: unique symbol; | ||
const owner_symbol: unique symbol; | ||
const onpskexchange_symbol: unique symbol; | ||
const trigger_async_id_symbol: unique symbol; | ||
} | ||
|
||
declare function InternalBinding(binding: 'symbols'): { | ||
async_id_symbol: typeof InternalSymbolsBinding.async_id_symbol; | ||
handle_onclose_symbol: typeof InternalSymbolsBinding.handle_onclose_symbol; | ||
no_message_symbol: typeof InternalSymbolsBinding.no_message_symbol; | ||
messaging_deserialize_symbol: typeof InternalSymbolsBinding.messaging_deserialize_symbol; | ||
messaging_transfer_symbol: typeof InternalSymbolsBinding.messaging_transfer_symbol; | ||
messaging_clone_symbol: typeof InternalSymbolsBinding.messaging_clone_symbol; | ||
messaging_transfer_list_symbol: typeof InternalSymbolsBinding.messaging_transfer_list_symbol; | ||
oninit_symbol: typeof InternalSymbolsBinding.oninit_symbol; | ||
owner_symbol: typeof InternalSymbolsBinding.owner_symbol; | ||
onpskexchange_symbol: typeof InternalSymbolsBinding.onpskexchange_symbol; | ||
trigger_async_id_symbol: typeof InternalSymbolsBinding.trigger_async_id_symbol; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
declare function InternalBinding(binding: 'types'): { | ||
isAsyncFunction(value: unknown): value is (...args: unknown[]) => Promise<unknown>, | ||
isGeneratorFunction(value: unknown): value is GeneratorFunction, | ||
isAnyArrayBuffer(value: unknown): value is (ArrayBuffer | SharedArrayBuffer), | ||
isArrayBuffer(value: unknown): value is ArrayBuffer, | ||
isArgumentsObject(value: unknown): value is ArrayLike<unknown>, | ||
isBoxedPrimitive(value: unknown): value is (BigInt | Boolean | Number | String | Symbol), | ||
isDataView(value: unknown): value is DataView, | ||
isExternal(value: unknown): value is Object, | ||
isMap(value: unknown): value is Map<unknown, unknown>, | ||
isMapIterator: (value: unknown) => value is IterableIterator<unknown>, | ||
isModuleNamespaceObject: (value: unknown) => value is {[Symbol.toStringTag]: 'Module', [key: string]: any}, | ||
isNativeError: (value: unknown) => Error, | ||
isPromise: (value: unknown) => value is Promise<unknown>, | ||
isSet: (value: unknown) => value is Set<unknown>, | ||
isSetIterator: (value: unknown) => value is IterableIterator<unknown>, | ||
isWeakMap: (value: unknown) => value is WeakMap<object, unknown>, | ||
isWeakSet: (value: unknown) => value is WeakSet<object>, | ||
isRegExp: (value: unknown) => RegExp, | ||
isDate: (value: unknown) => Date, | ||
isTypedArray: (value: unknown) => value is TypedArray, | ||
isStringObject: (value: unknown) => value is String, | ||
isNumberObject: (value: unknown) => value is Number, | ||
isAsyncFunction(value: unknown): value is (...args: unknown[]) => Promise<unknown>; | ||
isGeneratorFunction(value: unknown): value is GeneratorFunction; | ||
isAnyArrayBuffer(value: unknown): value is (ArrayBuffer | SharedArrayBuffer); | ||
isArrayBuffer(value: unknown): value is ArrayBuffer; | ||
isArgumentsObject(value: unknown): value is ArrayLike<unknown>; | ||
isBoxedPrimitive(value: unknown): value is (BigInt | Boolean | Number | String | Symbol); | ||
isDataView(value: unknown): value is DataView; | ||
isExternal(value: unknown): value is Object; | ||
isMap(value: unknown): value is Map<unknown, unknown>; | ||
isMapIterator: (value: unknown) => value is IterableIterator<unknown>; | ||
isModuleNamespaceObject: (value: unknown) => value is { [Symbol.toStringTag]: 'Module' }; | ||
isNativeError: (value: unknown) => Error; | ||
isPromise: (value: unknown) => value is Promise<unknown>; | ||
isSet: (value: unknown) => value is Set<unknown>; | ||
isSetIterator: (value: unknown) => value is IterableIterator<unknown>; | ||
isWeakMap: (value: unknown) => value is WeakMap<object, unknown>; | ||
isWeakSet: (value: unknown) => value is WeakSet<object>; | ||
isRegExp: (value: unknown) => RegExp; | ||
isDate: (value: unknown) => Date; | ||
isTypedArray: (value: unknown) => value is TypedArray; | ||
isStringObject: (value: unknown) => value is String; | ||
isNumberObject: (value: unknown) => value is Number; | ||
isBooleanObject: (value: unknown) => value is Boolean, | ||
isBigIntObject: (value: unknown) => value is BigInt, | ||
isBigIntObject: (value: unknown) => value is BigInt; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters