UNPKG

@harmoniclabs/plu-ts-onchain

Version:

An embedded DSL for Cardano smart contracts creation coupled with a library for Cardano transactions, all in Typescript

15 lines (14 loc) 1.18 kB
import type { PType } from "../../../PType/index.js"; import type { PAlias } from "../../../PTypes/index.js"; import type { Term } from "../../../Term/index.js"; import type { Methods } from "../../../type_system/index.js"; import type { UtilityTermOf } from "./addUtilityForType.js"; import type { BaseUtilityTermExtension } from "./BaseUtilityTerm.js"; import type { FilterMethodsByInput, LiftMethods, MethodsAsTerms } from "./userMethods/methodsTypes.js"; /** * basically unwraps the alias until it finds an actual type **/ type ActualTermUtility<PT extends PType> = PT extends PAlias<infer ActualT extends PType, any> ? ActualTermUtility<ActualT> : UtilityTermOf<PT>; type ActualTermAlias<PT extends PType, AMethods extends Methods> = Term<PAlias<PT, AMethods>> & ActualTermUtility<PT> & LiftMethods<FilterMethodsByInput<AMethods, PAlias<PT, any>>> & MethodsAsTerms<FilterMethodsByInput<AMethods, PAlias<PT, any>>>; export type TermAlias<PT extends PType, AMethods extends Methods> = (PT extends PAlias<infer PAliased extends PType, infer AMethods extends Methods> ? ActualTermAlias<PAliased, AMethods> : ActualTermAlias<PT, AMethods>) & BaseUtilityTermExtension; export {};