@typespec/compiler
Version:
TypeSpec compiler and standard library
32 lines • 1.52 kB
TypeScript
import type { DecoratorApplication, DecoratorFunction, RekeyableMap } from "../core/types.js";
import { type Typekit } from "./define-kit.js";
/**
* Creates a shallow copy of a rekeyable map.
*
* @experimental
*/
export declare function copyMap<T, U>(map: RekeyableMap<T, U>): RekeyableMap<T, U>;
/**
* Decorator arguments can be either a single decorator (treated as a decorator with no arguments) or an array where the
* first element is the decorator and the rest of the elements are the JavaScript values of the arguments.
*
* @experimental
*/
export type DecoratorArgs = DecoratorFunction | [DecoratorFunction, ...any[]];
/**
* Utility function for converting a list of decorators and arguments into structure decorator applications that are
* compatible with the TypeSpec type graph.
*
* Note: Not all JavaScript values can be converted faithfully to TypeSpec values. This function will attempt to convert
* the value to a literal TypeSpec value if it is a primitive value, otherwise it will be left as a JavaScript value.
* The `jsValue` property of the argument will always contain the original JavaScript value passed to the decorator.
*
* @param typekit - The Typekit instance to use for creating types and values.
* @param decorators - The list of decorators and arguments to apply.
*
* @see {@link DecoratorArgs}
*
* @experimental
*/
export declare function decoratorApplication(typekit: Typekit, decorators?: DecoratorArgs[]): DecoratorApplication[];
//# sourceMappingURL=utils.d.ts.map