Comparing version 0.0.0-canary.20240303T001930 to 0.0.0-canary.20240315T080912
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = void 0; | ||
exports.version = '0.0.0-canary.20240303T001930'; | ||
exports.version = '0.0.0-canary.20240315T080912'; | ||
//# sourceMappingURL=version.js.map |
@@ -1,2 +0,2 @@ | ||
export const version = '0.0.0-canary.20240303T001930'; | ||
export const version = '0.0.0-canary.20240315T080912'; | ||
//# sourceMappingURL=version.js.map |
@@ -31,4 +31,16 @@ import type { AbiParameter } from '../abi.js'; | ||
}> : never; | ||
} extends infer Mapped extends readonly unknown[] ? Filter<Mapped, never>[0] extends infer Result ? Result extends undefined ? never : Result : never : never : never : never); | ||
} extends infer Mapped extends readonly unknown[] ? Filter<Mapped, never> extends readonly [...infer Content] ? Content['length'] extends 0 ? never : DeepFlatten<Content> : never : never : never : never); | ||
/** | ||
* Flatten all members of {@link T} | ||
* | ||
* @param T - List of items to flatten | ||
* @param Acc - The accumulator used while recursing | ||
* @returns The flattened array | ||
* | ||
* @example | ||
* type Result = DeepFlatten<[['a', 'b'], [['c']]]> | ||
* // ^? type Result = ['a', 'b', 'c'] | ||
*/ | ||
type DeepFlatten<T extends readonly unknown[], Acc extends readonly unknown[] = readonly []> = T extends readonly [infer Head, ...infer Tail] ? Tail extends undefined ? never : Head extends readonly unknown[] ? DeepFlatten<Tail, readonly [...Acc, ...DeepFlatten<Head>]> : DeepFlatten<Tail, readonly [...Acc, Head]> : Acc; | ||
/** | ||
* Parses human-readable ABI parameters into {@link AbiParameter}s | ||
@@ -51,2 +63,3 @@ * | ||
export declare function parseAbiParameters<TParams extends string | readonly string[] | readonly unknown[]>(params: Narrow<TParams> & ((TParams extends string ? TParams extends '' ? Error<'Empty string is not allowed.'> : unknown : never) | (TParams extends readonly string[] ? TParams extends readonly [] ? Error<'At least one parameter required.'> : string[] extends TParams ? unknown : unknown : never))): ParseAbiParameters<TParams>; | ||
export {}; | ||
//# sourceMappingURL=parseAbiParameters.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export declare const version = "0.0.0-canary.20240303T001930"; | ||
export declare const version = "0.0.0-canary.20240315T080912"; | ||
//# sourceMappingURL=version.d.ts.map |
{ | ||
"name": "abitype", | ||
"description": "Strict TypeScript types for Ethereum ABIs", | ||
"version": "0.0.0-canary.20240303T001930", | ||
"version": "0.0.0-canary.20240315T080912", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "repository": "wevm/abitype", |
@@ -54,6 +54,6 @@ import type { AbiParameter } from '../abi.js' | ||
} extends infer Mapped extends readonly unknown[] | ||
? Filter<Mapped, never>[0] extends infer Result | ||
? Result extends undefined | ||
? Filter<Mapped, never> extends readonly [...infer Content] | ||
? Content['length'] extends 0 | ||
? never | ||
: Result | ||
: DeepFlatten<Content> | ||
: never | ||
@@ -65,2 +65,24 @@ : never | ||
/** | ||
* Flatten all members of {@link T} | ||
* | ||
* @param T - List of items to flatten | ||
* @param Acc - The accumulator used while recursing | ||
* @returns The flattened array | ||
* | ||
* @example | ||
* type Result = DeepFlatten<[['a', 'b'], [['c']]]> | ||
* // ^? type Result = ['a', 'b', 'c'] | ||
*/ | ||
type DeepFlatten< | ||
T extends readonly unknown[], | ||
Acc extends readonly unknown[] = readonly [], | ||
> = T extends readonly [infer Head, ...infer Tail] | ||
? Tail extends undefined | ||
? never | ||
: Head extends readonly unknown[] | ||
? DeepFlatten<Tail, readonly [...Acc, ...DeepFlatten<Head>]> | ||
: DeepFlatten<Tail, readonly [...Acc, Head]> | ||
: Acc | ||
/** | ||
* Parses human-readable ABI parameters into {@link AbiParameter}s | ||
@@ -67,0 +89,0 @@ * |
@@ -1,1 +0,1 @@ | ||
export const version = '0.0.0-canary.20240303T001930' | ||
export const version = '0.0.0-canary.20240315T080912' |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1157897
23933