-
Notifications
You must be signed in to change notification settings - Fork 29.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
typings: add types for internalBinding('util')
PR-URL: #38200 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
- Loading branch information
1 parent
76d3ab8
commit 34d6502
Showing
2 changed files
with
48 additions
and
0 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
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
declare namespace InternalUtilBinding { | ||
class WeakReference<T extends object> { | ||
constructor(value: T); | ||
get(): undefined | T; | ||
incRef(): void; | ||
decRef(): void; | ||
} | ||
} | ||
|
||
declare function InternalBinding(binding: 'util'): { | ||
// PER_ISOLATE_PRIVATE_SYMBOL_PROPERTIES, defined in src/env.h | ||
alpn_buffer_private_symbol: 0; | ||
arrow_message_private_symbol: 1; | ||
contextify_context_private_symbol: 2; | ||
contextify_global_private_symbol: 3; | ||
decorated_private_symbol: 4; | ||
napi_type_tag: 5; | ||
napi_wrapper: 6; | ||
untransferable_object_private_symbol: 7; | ||
|
||
kPending: 0; | ||
kFulfilled: 1; | ||
kRejected: 2; | ||
|
||
getHiddenValue(object: object, index: number): any; | ||
setHiddenValue(object: object, index: number, value: any): boolean; | ||
getPromiseDetails(promise: any): undefined | [state: 0] | [state: 1 | 2, result: any]; | ||
getProxyDetails(proxy: any, fullProxy?: boolean): undefined | any | [target: any, handler: any]; | ||
previewEntries(object: object, slowPath?: boolean): undefined | any[] | [entries: any[], isKeyValue: boolean]; | ||
getOwnNonIndexProperties(object: object, filter: number): Array<string | symbol>; | ||
getConstructorName(object: object): string; | ||
getExternalValue(value: any): bigint; | ||
sleep(msec: number): void; | ||
isConstructor(fn: Function): boolean; | ||
arrayBufferViewHasBuffer(view: ArrayBufferView): boolean; | ||
propertyFilter: { | ||
ALL_PROPERTIES: 0; | ||
ONLY_WRITABLE: 1; | ||
ONLY_ENUMERABLE: 2; | ||
ONLY_CONFIGURABLE: 4; | ||
SKIP_STRINGS: 8; | ||
SKIP_SYMBOLS: 16; | ||
}; | ||
shouldAbortOnUncaughtToggle: [shouldAbort: 0 | 1]; | ||
WeakReference: typeof InternalUtilBinding.WeakReference; | ||
guessHandleType(fd: number): 'TCP' | 'TTY' | 'UDP' | 'FILE' | 'PIPE' | 'UNKNOWN'; | ||
}; |