index.d.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. export { N as NumberInput, _ as _isNumberValue, c as coerceNumberProperty } from '../number-property.d-CJVxXUcb.js';
  2. import { ElementRef } from '@angular/core';
  3. /**
  4. * Type describing the allowed values for a boolean input.
  5. * @docs-private
  6. */
  7. type BooleanInput = string | boolean | null | undefined;
  8. /** Coerces a data-bound value (typically a string) to a boolean. */
  9. declare function coerceBooleanProperty(value: any): boolean;
  10. /** Wraps the provided value in an array, unless the provided value is an array. */
  11. declare function coerceArray<T>(value: T | T[]): T[];
  12. declare function coerceArray<T>(value: T | readonly T[]): readonly T[];
  13. /** Coerces a value to a CSS pixel value. */
  14. declare function coerceCssPixelValue(value: any): string;
  15. /**
  16. * Coerces an ElementRef or an Element into an element.
  17. * Useful for APIs that can accept either a ref or the native element itself.
  18. */
  19. declare function coerceElement<T>(elementOrRef: ElementRef<T> | T): T;
  20. /**
  21. * Coerces a value to an array of trimmed non-empty strings.
  22. * Any input that is not an array, `null` or `undefined` will be turned into a string
  23. * via `toString()` and subsequently split with the given separator.
  24. * `null` and `undefined` will result in an empty array.
  25. * This results in the following outcomes:
  26. * - `null` -&gt; `[]`
  27. * - `[null]` -&gt; `["null"]`
  28. * - `["a", "b ", " "]` -&gt; `["a", "b"]`
  29. * - `[1, [2, 3]]` -&gt; `["1", "2,3"]`
  30. * - `[{ a: 0 }]` -&gt; `["[object Object]"]`
  31. * - `{ a: 0 }` -&gt; `["[object", "Object]"]`
  32. *
  33. * Useful for defining CSS classes or table columns.
  34. * @param value the value to coerce into an array of strings
  35. * @param separator split-separator if value isn't an array
  36. */
  37. declare function coerceStringArray(value: any, separator?: string | RegExp): string[];
  38. export { coerceArray, coerceBooleanProperty, coerceCssPixelValue, coerceElement, coerceStringArray };
  39. export type { BooleanInput };