utils.d.ts 937 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * @template T
  3. * @param {T} value
  4. * @return {
  5. T extends (null | undefined)
  6. ? []
  7. : T extends string
  8. ? [string]
  9. : T extends readonly unknown[]
  10. ? T
  11. : T extends Iterable<infer T>
  12. ? T[]
  13. : [T]
  14. }
  15. */
  16. export function arrify<T>(
  17. value: T
  18. ): T extends null | undefined
  19. ? []
  20. : T extends string
  21. ? [string]
  22. : T extends readonly unknown[]
  23. ? T
  24. : T extends Iterable<infer T_1>
  25. ? T_1[]
  26. : [T];
  27. /**
  28. * @param {string|string[]} files
  29. * @param {string} context
  30. * @returns {string[]}
  31. */
  32. export function parseFiles(files: string | string[], context: string): string[];
  33. /**
  34. * @param {string|string[]} patterns
  35. * @param {string|string[]} extensions
  36. * @returns {string[]}
  37. */
  38. export function parseFoldersToGlobs(
  39. patterns: string | string[],
  40. extensions?: string | string[]
  41. ): string[];
  42. export function jsonStringifyReplacerSortKeys(_: string, value: any): any;