-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Refactor] Minor Typescript Improvements (#355)
* perf: use export from syntax for proper tree-shaking Signed-off-by: Jonah Snider <jonah@jonah.pw> * refactor: use actual ShardClientUtil class for Discord.js extension Signed-off-by: Jonah Snider <jonah@jonah.pw> * refactor(Util): use type guards in `isPrimitive` function Signed-off-by: Jonah Snider <jonah@jonah.pw> * refactor(Util): use built-in TypeScript Record generic type instead of UnknownObject custom type Signed-off-by: Jonah Snider <jonah@jonah.pw> * build: fix reference to @types/node Signed-off-by: Jonah Snider <jonah@jonah.pw> * refactor(Util): check if value is strictly equal to undefined rather than using typeof Signed-off-by: Jonah Snider <jonah@jonah.pw>
- Loading branch information
Showing
3 changed files
with
15 additions
and
54 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 |
---|---|---|
@@ -1,49 +1,14 @@ | ||
import { ShardingManager, SessionObject, SharderOptions, CloseEvent } from './Sharding/ShardingManager'; | ||
import { ShardClientUtil, IPCResult } from './Sharding/ShardClientUtil'; | ||
import { BaseCluster } from './Cluster/BaseCluster'; | ||
import { version, http, IPCEvents, SharderEvents } from './Util/Constants'; | ||
import { Cluster, ClusterOptions } from './Cluster/Cluster'; | ||
import { ClusterIPC } from './IPC/ClusterIPC'; | ||
import { MasterIPC } from './IPC/MasterIPC'; | ||
import * as Util from './Util/Util'; | ||
import { SendOptions } from 'veza'; | ||
import { ShardClientUtil as KurasutaShardClientUtil } from './Sharding/ShardClientUtil'; | ||
|
||
declare module 'discord.js' { | ||
interface ShardClientUtil { | ||
ipcSocket: string | number; | ||
readonly clusterCount: number; | ||
readonly shardCount: number; | ||
readonly id: number; | ||
readonly ipc: ClusterIPC; | ||
broadcastEval(script: string | Function): Promise<unknown[]>; | ||
masterEval(script: string | Function): Promise<unknown>; | ||
fetchClientValues(prop: string): Promise<unknown[]>; | ||
fetchGuild(id: string): Promise<object>; | ||
fetchUser(id: string): Promise<object>; | ||
fetchChannel(id: string): Promise<object>; | ||
restartAll(): Promise<void>; | ||
restart(clusterID: number): Promise<void>; | ||
respawnAll(): Promise<void>; | ||
send(data: any, options?: SendOptions): Promise<unknown>; | ||
init(): Promise<void>; | ||
} | ||
interface ShardClientUtil extends KurasutaShardClientUtil {} | ||
} | ||
|
||
export { | ||
BaseCluster, | ||
ShardingManager, | ||
Util, | ||
ShardClientUtil, | ||
SessionObject, | ||
SharderOptions, | ||
IPCResult, | ||
CloseEvent, | ||
http, | ||
IPCEvents, | ||
Cluster, | ||
ClusterOptions, | ||
ClusterIPC, | ||
MasterIPC, | ||
SharderEvents, | ||
version | ||
}; | ||
export { BaseCluster } from './Cluster/BaseCluster'; | ||
export { Cluster, ClusterOptions } from './Cluster/Cluster'; | ||
export { ClusterIPC } from './IPC/ClusterIPC'; | ||
export { MasterIPC } from './IPC/MasterIPC'; | ||
export { IPCResult, ShardClientUtil } from './Sharding/ShardClientUtil'; | ||
export { CloseEvent, SessionObject, SharderOptions, ShardingManager } from './Sharding/ShardingManager'; | ||
export { http, IPCEvents, SharderEvents, version } from './Util/Constants'; | ||
export * from './Util/Util'; |
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