any
type JS-0323363 return (await this._vault.submitTransaction(
364 requestData,
365 )) as unknown as T
366 } catch (error: any) {367 throw this.createProviderRpcError(
368 4100,
369 "Unauthorized. Coudldn't broadscast transaction. Make sure nonce is correct.",
340 throw this.createProviderRpcError(4001, "User Rejected Request")
341 }
342 const requestData = params as Validation.SetStateData
343 await this._vault.setState(requestData as any)344 return { success: true } as unknown as T
345 }
346
314
315 case "mina_getState": {
316 const { query, props } = params as Validation.GetStateData
317 const credentials = await this._vault.getState(query as any, props)318 const confirmation = await this.userPrompt({
319 inputType: "confirmation",
320 metadata: {
225 if (args.method === "mina_signFields") {
226 const requestData = params as Validation.SignFieldsData
227 const signable = {
228 fields: requestData.fields.map((item: any) => {229 // Convert to BigInt only if the item is a number
230 if (typeof item === "number") {
231 return BigInt(item)
19
20 const request = async <T = any>(
21 query: string,
22 variables: Record<string, any> = {},23 ): Promise<{ ok: boolean; data?: T; message?: string }> => {
24 try {
25 const response = await graphqlClient.request<T>(query, variables)
The any
type can sometimes leak into your codebase. TypeScript compiler skips the type checking of the any
typed variables, so it creates a potential safety hole, and source of bugs in your codebase. We recommend using unknown
or never
type variable.
In TypeScript, every type is assignable to any
. This makes any
a top type (also known as a universal supertype) of the type system.
The any
type is essentially an escape hatch from the type system. As developers, this gives us a ton of freedom: TypeScript lets us perform any operation we want on values of type any
without having to perform any checking beforehand.
The developers should not assign any
typed value to variables and properties, which can be hard to pick up on, especially from the external library; instead, developers can use the never
or unknown
type variable.
const age: any = 'seventeen';
const ages: any[] = ['seventeen'];
const ages: Array<any> = ['seventeen'];
function greet(): any {}
function greet(): any[] {}
function greet(): Array<any> {}
function greet(): Array<Array<any>> {}
function greet(param: Array<any>): string {}
function greet(param: Array<any>): Array<any> {}
const age: number = 17;
const ages: number[] = [17];
const ages: Array<number> = [17];
function greet(): string {}
function greet(): string[] {}
function greet(): Array<string> {}
function greet(): Array<Array<string>> {}
function greet(param: Array<string>): string {}
function greet(param: Array<string>): Array<string> {}