Docs

AbiParameterToPrimitiveType

Converts AbiParameter to corresponding TypeScript primitive type.

type AbiParameterToPrimitiveType<
TAbiParameter extends
| AbiParameter
| { name: string; type: unknown },
TAbiParameterKind extends AbiParameterKind = AbiParameterKind,
> = TAbiParameter["type"] extends AbiBasicType
? AbiTypeToPrimitiveType<TAbiParameter["type"], TAbiParameterKind>
: TAbiParameter extends {
components: infer TComponents;
type: SolidityTuple;
}
? AbiComponentsToPrimitiveType<TComponents, TAbiParameterKind>
: MaybeExtractArrayParameterType<TAbiParameter["type"]> extends [
infer Head,
infer Size,
]
? AbiArrayToPrimitiveType<
TAbiParameter,
TAbiParameterKind,
Head,
Size
>
: ResolvedRegister["StrictAbiType"] extends true
? Error<`Unknown type '${TAbiParameter["type"] & string}'.`>
: TAbiParameter extends { components: Error<string> }
? TAbiParameter["components"]
: unknown;