RequestWithFilSnap: <
    MethodName extends keyof CustomSnapsMethods,
    SnapMethod extends keyof FilSnapMethods = keyof FilSnapMethods,
>(
    args: MethodName extends "wallet_invokeSnap"
        ? {
            method: MethodName;
            params: {
                request: Parameters<FilSnapMethods[SnapMethod]>[1] extends undefined
                    ? { method: SnapMethod }
                    : {
                        method: SnapMethod;
                        params: Parameters<FilSnapMethods[SnapMethod]>[1];
                    };
                snapId: string;
            };
        }
        : Method<MethodName, CustomSnapsMethods[MethodName][0]>,
) => MethodName extends "wallet_invokeSnap"
    ? ReturnType<FilSnapMethods[SnapMethod]>
    : Promise<CustomSnapsMethods[MethodName][1]>

Type declaration