import { ValidationError, SanitizationResultValidIp, Validation } from "./sanitize.js"; import { NO_HOSTNAME } from "./from-url.js"; export declare const RESERVED_TOP_LEVEL_DOMAINS: string[]; export type Label = string; export declare enum ParseResultType { /** * This parse result is returned in case the given hostname does not adhere to [RFC 1034](https://tools.ietf.org/html/rfc1034). */ Invalid = "INVALID", /** * This parse result is returned if the given hostname was an IPv4 or IPv6. */ Ip = "IP", /** * This parse result is returned when the given hostname * - is the root domain (the empty string `""`) * - belongs to the top-level domain `localhost`, `local`, `example`, `invalid` or `test` */ Reserved = "RESERVED", /** * This parse result is returned when the given hostname is valid and does not belong to a reserved top-level domain, but is not listed in the public suffix list. */ NotListed = "NOT_LISTED", /** * This parse result is returned when the given hostname belongs to a top-level domain that is listed in the public suffix list. */ Listed = "LISTED" } type ParseResultCommon = { /** * The type of the parse result. Use switch or if to distinguish between different results. */ type: Type; /** * The original hostname that was passed to parseDomain(). */ hostname: Type extends ParseResultType.Invalid ? string | typeof NO_HOSTNAME : string; }; export type ParseResultInvalid = ParseResultCommon & { /** * An array of validation errors. */ errors: Array; }; type ParseResultCommonValidDomain = { /** * An array of labels that were separated by a dot character in the given hostname. */ labels: Array