Skip to content

Commit 8011106

Browse files
committed
better types
1 parent 883d52f commit 8011106

File tree

6 files changed

+7
-27
lines changed

6 files changed

+7
-27
lines changed

dist/API/app.js

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

dist/API/app.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
"node": ">=20"
1313
},
1414
"scripts": {
15+
"3000": "tsx ./src/API/app.ts --host 'http://127.0.0.1:3000' --nodes 'http://127.0.0.1:3001' --dbPath './assets/db/' --minerKeysFile './assets/keys/miner.json' --name 'GoodChain'",
16+
"3001": "tsx ./src/API/app.ts --host 'http://127.0.0.1:3001' --nodes 'http://127.0.0.1:3000' --dbPath './assets/db/' --minerKeysFile './assets/keys/miner.json' --name 'GoodChain'",
17+
"3002": "tsx ./src/API/app.ts --host 'http://127.0.0.1:3002' --nodes 'http://127.0.0.1:3000' --dbPath './assets/db/' --minerKeysFile './assets/keys/miner.json' --name 'GoodChain'",
1518
"build": "rm -r dist && tsc",
1619
"watch": "rm -r dist && tsc --watch",
1720
"dev": "tsc && nodemon ./src/API/app.ts",
1821
"start": "tsx ./src/API/app.ts",
1922
"startjs": "node ./src/API/app.js",
20-
"3000": "tsx ./src/API/app.ts --host 'http://127.0.0.1:3000' --nodes 'http://127.0.0.1:3001' --dbPath './assets/db/' --minerKeysFile './assets/keys/miner.json' --name 'GoodChain'",
21-
"3001": "tsx ./src/API/app.ts --host 'http://127.0.0.1:3001' --nodes 'http://127.0.0.1:3000' --dbPath './assets/db/' --minerKeysFile './assets/keys/miner.json' --name 'GoodChain'",
22-
"3002": "tsx ./src/API/app.ts --host 'http://127.0.0.1:3002' --nodes 'http://127.0.0.1:3000' --dbPath './assets/db/' --minerKeysFile './assets/keys/miner.json' --name 'GoodChain'",
2323
"test": "vitest run",
2424
"test-ui": "vitest --ui"
2525
},
@@ -69,4 +69,4 @@
6969
"start": "tsc"
7070
}
7171
}
72-
}
72+
}

src/API/app.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function onListening ()
4040
console.log( "Listening on", ( server.address() as AddressInfo ).address, ( server.address() as AddressInfo ).port );
4141
}
4242

43-
function onError ( error: AnyError )
43+
function onError ( error: NodeJS.ErrnoException )
4444
{
4545
if ( error.syscall !== "listen" )
4646
{
@@ -51,17 +51,9 @@ function onError ( error: AnyError )
5151
{
5252
case "EACCES":
5353
console.error( `${hostPort} requires elevated privileges` );
54-
if ( !process.exit( 1 ) )
55-
{
56-
console.error( "Cant Exit" );
57-
}
5854
break;
5955
case "EADDRINUSE":
6056
console.error( `${hostPort} is already in use` );
61-
if ( !process.exit( 1 ) )
62-
{
63-
console.error( "Cant Exit" );
64-
}
6557
break;
6658
default:
6759
throw error;

src/global.d.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,4 @@ interface SimpleError
7474
message?: string;
7575
stack?: string;
7676
[key: string]: SimpleError;
77-
}
78-
79-
interface AnyError extends Error
80-
{
81-
[x: string]: string;
82-
[key: string]: string;
8377
}

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"skipLibCheck": true,
1616
"sourceMap": true,
1717
"useUnknownInCatchVariables": true,
18-
"noUnusedLocals": true,
18+
"noUnusedLocals": true
1919
// "isolatedModules": true
2020
},
2121
// "include": [

0 commit comments

Comments
 (0)