index.d.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * Contents of the file.
  3. *
  4. * Can either be text or a `Uint8Array` structure.
  5. */
  6. export type Value = Uint8Array | string
  7. /**
  8. * This map registers the type of the `data` key of a `VFile`.
  9. *
  10. * This type can be augmented to register custom `data` types.
  11. *
  12. * @example
  13. * declare module 'vfile' {
  14. * interface DataMap {
  15. * // `file.data.name` is typed as `string`
  16. * name: string
  17. * }
  18. * }
  19. */
  20. // eslint-disable-next-line @typescript-eslint/consistent-type-definitions, @typescript-eslint/no-empty-interface
  21. export interface DataMap {}
  22. /**
  23. * Custom information.
  24. *
  25. * Known attributes can be added to @see {@link DataMap}
  26. */
  27. export type Data = Record<string, unknown> & Partial<DataMap>
  28. // To do: next major: remove.
  29. // Deprecated names (w/ prefix):
  30. export type {Data as VFileData, DataMap as VFileDataMap, Value as VFileValue}
  31. export {VFile} from './lib/index.js'
  32. export type {
  33. Compatible,
  34. Map,
  35. MessageOptions,
  36. Options,
  37. Reporter,
  38. ReporterSettings,
  39. // To do: next major: remove.
  40. // Deprecated names (w/ prefix):
  41. Compatible as VFileCompatible,
  42. Options as VFileOptions,
  43. Reporter as VFileReporter,
  44. ReporterSettings as VFileReporterSettings
  45. } from './lib/index.js'