@aws-amplify/core
Version:
Core category of aws-amplify
20 lines (19 loc) • 655 B
TypeScript
import { AmplifyContext } from './AmplifyContext';
/**
* Resolves the optional leading `AmplifyContext` argument from a function's
* arguments array. Used by category functions that accept an optional context
* as their first positional parameter.
*
* @returns A tuple of `[AmplifyContext, ...T]` where `T` is the remaining args.
*
* @example
* ```ts
* export function signIn(...args: any[]) {
* const [ctx, input] = resolveCtxArgs<[SignInInput]>(args);
* // ctx is guaranteed to be a valid AmplifyContext
* }
* ```
*
* @internal
*/
export declare function resolveCtxArgs<T extends unknown[]>(args: unknown[]): [AmplifyContext, ...T];