Skip to content

Commit

Permalink
fix build arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
nialexsan committed Nov 2, 2023
1 parent 3ce27e2 commit 3aca2d3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/sdk/src/build/build-arguments.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {pipe, makeArgument} from "../interaction/interaction"
import {TypeDescriptorInput, TypeDescriptor} from "@onflow/types"

/**
* @description - A utility builder to be used with other builders to pass in arguments with a value and supported type
Expand All @@ -15,6 +16,9 @@ export function args(ax = []) {
* @param {Function} xform - A function to transform the value
* @returns {object} - An argument object
*/
export function arg(value: any, xform: any) {
export function arg<T extends TypeDescriptor<any, {
type: string;
value: string;
}>>(value: TypeDescriptorInput<T>, xform: T) {
return {value, xform}
}
2 changes: 1 addition & 1 deletion packages/types/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface TypeDescriptor<T, V extends JsonCdc<string, unknown>> {
asInjection: (x: T) => T
}

type TypeDescriptorInput<
export type TypeDescriptorInput<
X extends TypeDescriptor<any, JsonCdc<string, unknown>>
> = X extends TypeDescriptor<infer T, JsonCdc<string, unknown>> ? T : never

Expand Down

0 comments on commit 3aca2d3

Please sign in to comment.