AbiParameterToPrimitiveType

Converts AbiParameter to corresponding TypeScript primitive type.

type AbiParameterToPrimitiveType<
abiParameter extends AbiParameter | { name: string; type: unknown },
abiParameterKind extends AbiParameterKind = AbiParameterKind,
> = abiParameter["type"] extends AbiBasicType
? AbiTypeToPrimitiveType<abiParameter["type"], abiParameterKind>
: abiParameter extends {
components: infer components;
type: SolidityTuple;
}
? AbiComponentsToPrimitiveType<components, abiParameterKind>
: MaybeExtractArrayParameterType<abiParameter["type"]> extends [
infer head,
infer size,
]
? AbiArrayToPrimitiveType<
abiParameter,
abiParameterKind,
head,
size
>
: ResolvedRegister["strictAbiType"] extends true
? Error<`Unknown type '${abiParameter["type"] & string}'.`>
: abiParameter extends { components: Error<string> }
? abiParameter["components"]
: unknown;