export type { InjectFunction, ConstantsRecord, MacrosRecord }; import type { UserTypes } from '../translationLayer/constants.js'; import type { MacroValue } from '../translationLayer/macros.js'; type ConstantsRecord = Record; type MacrosRecord = Record; /** The type of the `inject` function for a given shader, providing good auto-completion. */ type InjectFunction = >(input: T, macros?: [T] extends [OptionsForm] ? never : Macros) => string; type OptionsForm = { constants?: unknown; macros?: unknown; }; type ConstantsOrOptions = Constants & { constants?: never; macros?: never; } | UnionToIntersection<(keyof Constants extends never ? never : { constants?: Constants; }) | (keyof Macros extends never ? never : { macros?: Macros; })>; type UnionToIntersection = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;