Skip to content

Commit 4def99f

Browse files
committed
rc.5: updating to TypeScript 4.4, tslib 2.3, and adding more overloads
1 parent 2da72d5 commit 4def99f

File tree

4 files changed

+94
-48
lines changed

4 files changed

+94
-48
lines changed

package-lock.json

Lines changed: 73 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@runejs/common",
3-
"version": "2.0.0-rc.3",
3+
"version": "2.0.0-rc.5",
44
"description": "Common logging, networking, compression, and other functionality for RuneJS applications.",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",
@@ -29,12 +29,16 @@
2929
"url": "https://github.com/runejs/core/issues"
3030
},
3131
"homepage": "https://github.com/runejs/core#readme",
32+
"peerDependencies": {
33+
"tslib": ">=2.3.0",
34+
"typescript": ">=4.4.0"
35+
},
3236
"dependencies": {
3337
"compressjs": "^1.0.3",
3438
"js-yaml": "^3.14.1",
3539
"pino": "^6.13.0",
3640
"pino-pretty": "^4.8.0",
37-
"tslib": ">=2.1.0"
41+
"tslib": "^2.3.1"
3842
},
3943
"devDependencies": {
4044
"@runejs/eslint-config": "^1.0.0",
@@ -44,11 +48,8 @@
4448
"@typescript-eslint/parser": "^4.29.3",
4549
"eslint": "^7.32.0",
4650
"rimraf": "^3.0.2",
47-
"ts-node": "^9.1.1",
48-
"typescript": ">=4.2.0"
49-
},
50-
"peerDependencies": {
51-
"tslib": ">=2.1.0"
51+
"ts-node": "^10.3.0",
52+
"typescript": "^4.4.4"
5253
},
5354
"eslintConfig": {
5455
"extends": [

src/buffer/byte-buffer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ export class ByteBuffer extends Uint8Array {
9494
public get(type: Extract<DataType, 'string' | 'STRING'>): string;
9595
public get(type: Extract<DataType, 'long' | 'LONG'>, signed?: Signedness, endian?: Endianness): bigint;
9696
public get(type: Exclude<DataType, 'string' | 'STRING' | 'long' | 'LONG'>, signed?: Signedness, endian?: Endianness): number;
97+
public get(type?: DataType, signed?: Signedness, endian?: Endianness): number | bigint | string;
9798
public get(type: DataType = 'byte', signed: Signedness = 'signed', endian: Endianness = 'be'): number | bigint | string {
9899
type = ByteBuffer.getType(type);
99100
signed = ByteBuffer.getSignage(signed);

src/net/socket-server.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,22 @@ export abstract class SocketServer<T = undefined> {
102102
this.connectionDestroyed();
103103
}
104104

105-
public error(error: any): void {
106-
logger.error('Socket destroyed due to error:');
107-
logger.error(error);
105+
public error(error: Error): void;
106+
public error(error: { message?: string }): void;
107+
public error(error: string): void;
108+
public error(error: any | Error | { message?: string } | string): void;
109+
public error(error: any | Error | { message?: string } | string): void {
110+
if(error && typeof error === 'string') {
111+
error = { message: error };
112+
}
113+
114+
logger.error('Socket destroyed due to error' + error?.message ? `: ${error.message}` : '.');
108115

109116
try {
110117
this.closeConnection();
111118
} catch(closeConnectionError) {
112-
logger.error(`Error closing server connection:`);
113-
logger.error(closeConnectionError);
119+
logger.error('Error closing server connection' +
120+
closeConnectionError?.message ? `: ${closeConnectionError.message}` : '.');
114121
}
115122
}
116123

0 commit comments

Comments
 (0)