Skip to content

Commit 280568d

Browse files
committed
fix slow types
1 parent 2e2801d commit 280568d

File tree

7 files changed

+74
-71
lines changed

7 files changed

+74
-71
lines changed

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 YieldRay
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

deno.json

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
{
2+
"name": "@ray/json-rpc-ts",
3+
"version": "0.1.3",
4+
"exports": "./mod.ts",
5+
"publish": {
6+
"include": [
7+
"LICENSE",
8+
"README.md",
9+
"src/**/*.ts"
10+
],
11+
"exclude": [
12+
".github",
13+
"src/**/*.test.ts"
14+
]
15+
},
216
"compilerOptions": {
317
"strict": true,
418
"useUnknownInCatchVariables": true,
519
"noImplicitOverride": true
620
},
721
"imports": {
8-
"std/": "https://deno.land/std@0.213.0/"
22+
"std/": "https://deno.land/std@0.220.1/"
923
},
1024
"tasks": {
1125
"lint": "deno lint",

deno.lock

+32-64
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/dto/request.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class JSONRPCNotification {
2424
this.params = object.params
2525
}
2626

27-
public toString() {
27+
public toString(): string {
2828
return JSON.stringify({
2929
jsonrpc: this.jsonrpc,
3030
method: this.method,
@@ -49,7 +49,7 @@ export class JSONRPCRequest extends JSONRPCNotification {
4949
this.id = object.id
5050
}
5151

52-
public override toString() {
52+
public override toString(): string {
5353
return JSON.stringify({
5454
jsonrpc: this.jsonrpc,
5555
method: this.method,

src/dto/response.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class JSONRPCSuccessResponse {
1717
this.result = object.result
1818
}
1919

20-
public toString() {
20+
public toString(): string {
2121
return JSON.stringify({
2222
jsonrpc: this.jsonrpc,
2323
id: this.id,
@@ -41,7 +41,7 @@ export class JSONRPCErrorResponse {
4141
this.error = object.error
4242
}
4343

44-
public toString() {
44+
public toString(): string {
4545
return JSON.stringify({
4646
jsonrpc: this.jsonrpc,
4747
id: this.id,

src/id.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export type JSONRPCID =
33
| number // SHOULD NOT contain fractional parts
44
| null // unknown id
55

6-
export function* selfAddIdGenerator() {
6+
export function* selfAddIdGenerator(): Generator<number, void, unknown> {
77
let count = 0
88
for (;;) {
99
yield ++count

src/server.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export class JSONRPCServer<
7575
public setMethod<T extends keyof Methods>(
7676
method: T,
7777
fn: Methods[T],
78-
) {
78+
): this {
7979
Reflect.set(this.methods, method, fn)
8080
return this
8181
}

0 commit comments

Comments
 (0)