Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
fixup! typings: define types for os binding
  • Loading branch information
targos committed Sep 27, 2021
commit 795db39025ef6e60b4bef34d4259a23ac234c056
14 changes: 7 additions & 7 deletions typings/internalBinding/os.d.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
declare function InternalBinding(binding: 'os'): {
getHostname(ctx: object): string | undefined;
getHostname(ctx: {}): string | undefined;
getLoadAvg(array: Float64Array): void;
getUptime(): number;
getTotalMem(): number;
getFreeMem(): number;
getCPUs(): Array<string | number>;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
getCPUs(): Array<string | number>;
getCPUs(): (string | number)[];

for consistency with other dts

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a preference to use type[] for simple types and Array<types> for more complex ones

getInterfaceAddresses(ctx: object): Array<string | number | boolean> | undefined;
getHomeDirectory(ctx: object): string | undefined;
getUserInfo(options: {encoding?: string} | undefined, ctx: object): {
getInterfaceAddresses(ctx: {}): Array<string | number | boolean> | undefined;
getHomeDirectory(ctx: {}): string | undefined;
getUserInfo(options: { encoding?: string } | undefined, ctx: {}): {
uid: number;
gid: number;
username: string;
homedir: string;
shell: string | null;
} | undefined;
setPriority(pid: number, priority: number, ctx: object): number;
getPriority(pid: number, ctx: object): number | undefined;
getOSInformation(ctx: object): [sysname: string, version: string, release: string];
setPriority(pid: number, priority: number, ctx: {}): number;
getPriority(pid: number, ctx: {}): number | undefined;
getOSInformation(ctx: {}): [sysname: string, version: string, release: string];
isBigEndian: boolean;
};