cheerio.d.ts 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import { InternalOptions } from './options';
  2. import type { Node, Document } from 'domhandler';
  3. import { BasicAcceptedElems } from './types';
  4. import * as Attributes from './api/attributes';
  5. import * as Traversing from './api/traversing';
  6. import * as Manipulation from './api/manipulation';
  7. import * as Css from './api/css';
  8. import * as Forms from './api/forms';
  9. declare type AttributesType = typeof Attributes;
  10. declare type TraversingType = typeof Traversing;
  11. declare type ManipulationType = typeof Manipulation;
  12. declare type CssType = typeof Css;
  13. declare type FormsType = typeof Forms;
  14. export declare class Cheerio<T> implements ArrayLike<T> {
  15. length: number;
  16. [index: number]: T;
  17. options: InternalOptions;
  18. /**
  19. * The root of the document. Can be set by using the `root` argument of the constructor.
  20. *
  21. * @private
  22. */
  23. _root: Cheerio<Document> | undefined;
  24. /** @function */
  25. find: typeof Traversing.find;
  26. /**
  27. * Instance of cheerio. Methods are specified in the modules. Usage of this
  28. * constructor is not recommended. Please use $.load instead.
  29. *
  30. * @private
  31. * @param selector - The new selection.
  32. * @param context - Context of the selection.
  33. * @param root - Sets the root node.
  34. * @param options - Options for the instance.
  35. */
  36. constructor(selector?: T extends Node ? BasicAcceptedElems<T> : Cheerio<T> | T[], context?: BasicAcceptedElems<Node> | null, root?: BasicAcceptedElems<Document> | null, options?: InternalOptions);
  37. prevObject: Cheerio<Node> | undefined;
  38. /**
  39. * Make a cheerio object.
  40. *
  41. * @private
  42. * @param dom - The contents of the new object.
  43. * @param context - The context of the new object.
  44. * @returns The new cheerio object.
  45. */
  46. _make<T>(dom: Cheerio<T> | T[] | T | string, context?: BasicAcceptedElems<Node>): Cheerio<T>;
  47. }
  48. export interface Cheerio<T> extends AttributesType, TraversingType, ManipulationType, CssType, FormsType, Iterable<T> {
  49. cheerio: '[cheerio object]';
  50. splice: typeof Array.prototype.slice;
  51. }
  52. export {};
  53. //# sourceMappingURL=cheerio.d.ts.map