import type { MaybePromise } from '../promise'; import type { StartInfo } from '../startInfo'; import type { Void } from '../undefined'; import type { Any } from '../utils'; import type { FullPackConfigWithoutDoBeforePack, UserlandPack, UserlandPackWithoutDoBeforePack } from './config'; /** * Typed parameters of pack, defined in userland. */ type PackParameters = Readonly<{ CustomPackProperties: CustomPackProperties; CustomReportProperties: CustomReportProperties; SkipTests: SkipTests; TestMeta: TestMeta; }>; /** * Get pack type parameters from given Pack type (without extends of AnyPackParameters). */ type UntypedGetPackParameters = Pack extends UserlandPack ? PackParameters : never; /** * Separate property `doBeforePack` of userland pack config. */ export type WithDoBeforePack> = Readonly<{ /** * An array of functions that will be executed, in order, before the pack starts. * The functions accept a start info object, and can return new full pack config, * which in this case will be included in the start info object, * and will be used for running pack. * Each function can thus access the results of the previous function. */ doBeforePack: readonly ((this: void, startInfo: StartInfo) => MaybePromise)[]; }>; /** * Common type of any pack for extends constraint. */ export type AnyPack = Omit, 'doAfterPack'>; /** * Common type of any pack parameters. */ export type AnyPackParameters = PackParameters; /** * The complete pack configuration object. */ export type FullPackConfig = FullPackConfigWithoutDoBeforePack & WithDoBeforePack; /** * Type of complete pack configuration object, get by type of Pack (userland part of config). */ export type FullPackConfigByPack> = FullPackConfig; /** * Get pack type parameters (CustomPackProperties, SkipTests and TestMeta) from given Pack type. */ export type GetPackParameters> = UntypedPackParameters extends AnyPackParameters ? UntypedPackParameters : never; export {};