Skip to content

Commit fb0ed43

Browse files
committed
.
1 parent 99cbd95 commit fb0ed43

File tree

10 files changed

+42
-42
lines changed

10 files changed

+42
-42
lines changed

generated/api_pb.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ export class Check extends jspb.Message {
365365
}
366366

367367
export namespace Check {
368-
export type AsObject = {}
368+
export type AsObject = object
369369
}
370370

371371
export class Version extends jspb.Message {

lib/client.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ export declare class DgraphClient {
1717
debug(msg: string): void
1818
anyClient(): DgraphClientStub
1919
}
20-
export declare function isJwtExpired(err: any): boolean
20+
export declare function isJwtExpired(err: unknown): boolean
2121
export declare function deleteEdges(mu: types.Mutation, uid: string, ...predicates: string[]): void

lib/txn.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export declare class Txn {
1818
queryWithVars(
1919
q: string,
2020
vars?: {
21-
[k: string]: any
21+
[k: string]: unknown
2222
},
2323
metadata?: grpc.Metadata,
2424
options?: grpc.CallOptions,
@@ -27,7 +27,7 @@ export declare class Txn {
2727
queryRDFWithVars(
2828
q: string,
2929
vars?: {
30-
[k: string]: any
30+
[k: string]: unknown
3131
},
3232
metadata?: grpc.Metadata,
3333
options?: grpc.CallOptions,

lib/types.d.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
import * as messages from "../generated/api_pb"
22
export declare class Payload extends messages.Payload {
3-
getData(): any
3+
getData(): unknown
44
getData_asB64(): string
55
getData_asU8(): Uint8Array
6-
setData(value: any): void
6+
setData(value: unknown): void
77
}
88
export declare function createPayload(oldPayload: messages.Payload): Payload
99
export declare class Response extends messages.Response {
10-
getJson(): any
10+
getJson(): unknown
1111
getJson_asB64(): string
1212
getJson_asU8(): Uint8Array
13-
setJson(value: any): void
13+
setJson(value: unknown): void
1414
}
1515
export declare function createResponse(oldResponse: messages.Response): Response
1616
export declare class Mutation extends messages.Mutation {
17-
getSetJson(): any
17+
getSetJson(): unknown
1818
getSetJson_asB64(): string
1919
getSetJson_asU8(): Uint8Array
20-
setSetJson(value: any): void
21-
getDeleteJson(): any
20+
setSetJson(value: unknown): void
21+
getDeleteJson(): unknown
2222
getDeleteJson_asB64(): string
2323
getDeleteJson_asU8(): Uint8Array
24-
setDeleteJson(value: any): void
24+
setDeleteJson(value: unknown): void
2525
getSetNquads(): Uint8Array | string
2626
getSetNquads_asB64(): string
2727
getSetNquads_asU8(): Uint8Array

lib/util.d.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
import * as jspb from "google-protobuf"
2-
export declare function errorCode(err: any): {
2+
export declare function errorCode(err: unknown): {
33
valid: boolean
44
code: number
55
}
6-
export declare function isAbortedError(err: any): boolean
7-
export declare function isConflictError(err: any): boolean
8-
export declare function isUnauthenticatedError(err: any): boolean
6+
export declare function isAbortedError(err: unknown): boolean
7+
export declare function isConflictError(err: unknown): boolean
8+
export declare function isUnauthenticatedError(err: unknown): boolean
99
export declare function promisify1<A, T>(
1010
f: (arg: A, cb: (err?: Error, res?: T) => void) => void,
11-
thisContext?: any,
11+
thisContext?: unknown,
1212
): (arg: A) => Promise<T>
1313
export declare function promisify3<A, B, C, T>(
1414
f: (argA: A, argB: B, argC: C, cb: (err?: Error, res?: T) => void) => void,
15-
thisContext?: any,
15+
thisContext?: unknown,
1616
): (argA: A, argB: B, argC: C) => Promise<T>
1717
export declare function stringifyMessage(msg: jspb.Message): string
1818
export { isBase64 } from "is-base64"
1919
export declare function strToB64(str: string): string
2020
export declare function strToU8(str: string): Uint8Array
2121
export declare function b64ToStr(b64Str: string): string
2222
export declare function u8ToStr(arr: Uint8Array): string
23-
export declare function strToJson(jsonStr: string): any
23+
export declare function strToJson(jsonStr: string): unknown

src/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export class DgraphClient {
9595
}
9696

9797
// isJwtExpired returns true if the error indicates that the jwt has expired.
98-
export function isJwtExpired(err: any): boolean {
98+
export function isJwtExpired(err: unknown): boolean {
9999
if (!err) {
100100
return false
101101
}

src/txn.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export class Txn {
7676
*/
7777
public async queryWithVars(
7878
q: string,
79-
vars?: { [k: string]: any },
79+
vars?: { [k: string]: unknown },
8080
metadata?: grpc.Metadata,
8181
options?: grpc.CallOptions,
8282
): Promise<types.Response> {
@@ -123,7 +123,7 @@ export class Txn {
123123
*/
124124
public async queryRDFWithVars(
125125
q: string,
126-
vars?: { [k: string]: any },
126+
vars?: { [k: string]: unknown },
127127
metadata?: grpc.Metadata,
128128
options?: grpc.CallOptions,
129129
): Promise<types.Response> {
@@ -220,7 +220,7 @@ export class Txn {
220220
// Discarding the transaction enforces that the user cannot use the txn further.
221221
try {
222222
await this.discard(metadata, options)
223-
} catch (e) {
223+
} catch {
224224
// Ignore error - user should see the original error.
225225
}
226226

src/types.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { b64ToStr, isBase64, strToB64, strToJson, strToU8, u8ToStr } from "./uti
1010
* Payload represents the return value of an alter operation.
1111
*/
1212
export class Payload extends messages.Payload {
13-
public getData(): any {
13+
public getData(): unknown {
1414
let jsonStr: string
1515
const value = super.getData()
1616
if (value instanceof Uint8Array) {
@@ -40,7 +40,7 @@ export class Payload extends messages.Payload {
4040
return value
4141
}
4242

43-
public setData(value: any): void {
43+
public setData(value: unknown): void {
4444
if (value instanceof Uint8Array) {
4545
super.setData(value)
4646
return
@@ -68,7 +68,7 @@ export function createPayload(oldPayload: messages.Payload): Payload {
6868
* Response represents the return value of a mutation or query operations.
6969
*/
7070
export class Response extends messages.Response {
71-
public getJson(): any {
71+
public getJson(): unknown {
7272
let jsonStr: string
7373
const value = super.getJson()
7474
if (value instanceof Uint8Array) {
@@ -98,7 +98,7 @@ export class Response extends messages.Response {
9898
return value
9999
}
100100

101-
public setJson(value: any): void {
101+
public setJson(value: unknown): void {
102102
if (value instanceof Uint8Array) {
103103
super.setJson(value)
104104
return
@@ -126,7 +126,7 @@ export function createResponse(oldResponse: messages.Response): Response {
126126
* Mutation represents the request value of a muatate operation.
127127
*/
128128
export class Mutation extends messages.Mutation {
129-
public getSetJson(): any {
129+
public getSetJson(): unknown {
130130
let jsonStr: string
131131
const value = super.getSetJson()
132132
if (value instanceof Uint8Array) {
@@ -156,7 +156,7 @@ export class Mutation extends messages.Mutation {
156156
return value
157157
}
158158

159-
public setSetJson(value: any): void {
159+
public setSetJson(value: unknown): void {
160160
if (value instanceof Uint8Array) {
161161
super.setSetJson(value)
162162
return
@@ -170,7 +170,7 @@ export class Mutation extends messages.Mutation {
170170
super.setSetJson(strToU8(jsonStr))
171171
}
172172

173-
public getDeleteJson(): any {
173+
public getDeleteJson(): unknown {
174174
let jsonStr: string
175175
const value = super.getDeleteJson()
176176
if (value instanceof Uint8Array) {
@@ -200,7 +200,7 @@ export class Mutation extends messages.Mutation {
200200
return value
201201
}
202202

203-
public setDeleteJson(value: any): void {
203+
public setDeleteJson(value: unknown): void {
204204
if (value instanceof Uint8Array) {
205205
super.setDeleteJson(value)
206206
return

src/util.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as grpc from "@grpc/grpc-js"
22
import * as jspb from "google-protobuf"
33

4-
export function errorCode(err: any): { valid: boolean; code: number } {
4+
export function errorCode(err: unknown): { valid: boolean; code: number } {
55
if (
66
err === undefined ||
77
typeof err !== "object" ||
@@ -20,30 +20,30 @@ export function errorCode(err: any): { valid: boolean; code: number } {
2020
}
2121
}
2222

23-
export function isAbortedError(err: any): boolean {
23+
export function isAbortedError(err: unknown): boolean {
2424
const ec = errorCode(err)
2525
return ec.valid && ec.code === grpc.status.ABORTED
2626
}
2727

28-
export function isConflictError(err: any): boolean {
28+
export function isConflictError(err: unknown): boolean {
2929
const ec = errorCode(err)
3030
return (
3131
ec.valid && (ec.code === grpc.status.ABORTED || ec.code === grpc.status.FAILED_PRECONDITION)
3232
)
3333
}
3434

35-
export function isUnauthenticatedError(err: any): boolean {
35+
export function isUnauthenticatedError(err: unknown): boolean {
3636
const ec = errorCode(err)
3737
return ec.valid && ec.code === grpc.status.UNAUTHENTICATED
3838
}
3939

4040
export function promisify1<A, T>(
4141
f: (arg: A, cb: (err?: Error, res?: T) => void) => void,
42-
thisContext?: any,
42+
thisContext?: unknown,
4343
): (arg: A) => Promise<T> {
4444
return (arg: A) => {
4545
return new Promise(
46-
(resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void): void => {
46+
(resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: unknown) => void): void => {
4747
f.call(thisContext, arg, (err?: Error, result?: T): void =>
4848
err !== undefined && err !== null ? reject(err) : resolve(result),
4949
)
@@ -54,11 +54,11 @@ export function promisify1<A, T>(
5454

5555
export function promisify3<A, B, C, T>(
5656
f: (argA: A, argB: B, argC: C, cb: (err?: Error, res?: T) => void) => void,
57-
thisContext?: any,
57+
thisContext?: unknown,
5858
): (argA: A, argB: B, argC: C) => Promise<T> {
5959
return (argA: A, argB: B, argC: C) => {
6060
return new Promise(
61-
(resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void): void => {
61+
(resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: unknown) => void): void => {
6262
f.call(thisContext, argA, argB, argC, (err?: Error, result?: T): void =>
6363
err !== undefined && err !== null ? reject(err) : resolve(result),
6464
)
@@ -95,10 +95,10 @@ export function u8ToStr(arr: Uint8Array): string {
9595
return buf.toString()
9696
}
9797

98-
export function strToJson(jsonStr: string): any {
98+
export function strToJson(jsonStr: string): unknown {
9999
try {
100100
return JSON.parse(jsonStr)
101-
} catch (e) {
101+
} catch {
102102
return {}
103103
}
104104
}

tests/integration/bank.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ async function runTxnInLoop(): Promise<void> {
117117
finished = true
118118
return
119119
}
120-
} catch (e) {
120+
} catch {
121121
aborts += 1
122122
}
123123
}

0 commit comments

Comments
 (0)