import { MalformedExpressionException } from "./discrimination"; import { DFAAccepts } from "./dfa"; import { EmailDFA } from "./email.dfa"; declare const emailDisc: unique symbol; /** * A nominal string type for emails */ export declare type Email = string & { readonly [emailDisc]: unique symbol; }; export declare class InvalidEmailException extends MalformedExpressionException { } export declare namespace Email { /** * RFC 5322 email validation * * https://stackoverflow.com/questions/201323/how-to-validate-an-email-address-using-a-regular-expression * * https://stackoverflow.com/a/201378/6698132 * * https://emailregex.com/ * * https://www.ietf.org/rfc/rfc5322.txt * @warn Not very restrictive; only checks syntax * @see [[`IsEmail`]] for a compile-time analogue */ const roughValidate: (str: string) => str is Email; /** * Assert using RFC 5322 email validation * @throws {InvalidEmailException} If {@param str} is not a syntactically valid email * @warn Not restrictive; see {@linkcode roughValidate} */ const roughAssert: (str: string) => asserts str is Email; } /** * RFC 5322 email validation * * https://stackoverflow.com/questions/201323/how-to-validate-an-email-address-using-a-regular-expression * * https://stackoverflow.com/a/201378/6698132 * * https://emailregex.com/ * * https://www.ietf.org/rfc/rfc5322.txt * @warn Not very restrictive; only checks syntax * @see [[`Email`]] for a run-time analogue */ export declare type IsEmail = DFAAccepts; export {};