text
stringlengths
2
4k
import { defineConfig } from "cypress"; export default defineConfig({ component: { devServer: { framework: "react", bundler: "vite", }, supportFile: false, }, });
/// <reference types="cypress" /> // *********************************************** // This example commands.ts shows you how to // create various custom commands and overwrite // existing commands. // // For more comprehensive examples of custom // commands please read more here: // https://on.cypress.io/custom-commands // *********************************************** // // // -- This is a parent command -- // Cypress.Commands.add('login', (email, password) => { ... }) // // // -- This is a child command -- // Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) // // // -- This is a dual command -- // Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) // // // -- This will overwrite an existing command -- // Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) // // declare global { // namespace Cypress { // interface Chainable { // login(email: string, password: string): Chainable<void> // drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element> // dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element> // visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element> // } // } // }
/** Convert a tilde path to an absolute path: `~/dev` → `/Users/sindresorhus/dev`. @example ``` import untildify = require('untildify'); untildify('~/dev'); //=> '/Users/sindresorhus/dev' ``` */ declare function untildify(pathWithTilde: string): string; export = untildify;
declare namespace ansiStyles { interface CSPair { /** The ANSI terminal control sequence for starting this style. */ readonly open: string; /** The ANSI terminal control sequence for ending this style. */ readonly close: string; } interface ColorBase { /** The ANSI terminal control sequence for ending this color. */ readonly close: string; ansi256(code: number): string; ansi16m(red: number, green: number, blue: number): string; } interface Modifier { /** Resets the current color chain. */ readonly reset: CSPair; /** Make text bold. */ readonly bold: CSPair; /** Emitting only a small amount of light. */ readonly dim: CSPair; /** Make text italic. (Not widely supported) */ readonly italic: CSPair; /** Make text underline. (Not widely supported) */ readonly underline: CSPair; /** Make text overline. Supported on VTE-based terminals, the GNOME terminal, mintty, and Git Bash. */ readonly overline: CSPair; /** Inverse background and foreground colors. */ readonly inverse: CSPair; /** Prints the text, but makes it invisible. */ readonly hidden: CSPair; /** Puts a horizontal line through the center of the text. (Not widely supported) */ readonly strikethrough: CSPair; } interface ForegroundColor { readonly black: CSPair; readonly red: CSPair; readonly green: CSPair; readonly yellow: CSPair; readonly blue: CSPair; readonly cyan: CSPair; readonly magenta: CSPair; readonly white: CSPair; /** Alias for `blackBright`. */ readonly gray: CSPair; /** Alias for `blackBright`. */ readonly grey: CSPair; readonly blackBright: CSPair; readonly redBright: CSPair; readonly greenBright: CSPair; readonly yellowBright: CSPair; readonly blueBright: CSPair; readonly cyanBright: CSPair; readonly magentaBright: CSPair; readonly whiteBright: CSPair; } interface BackgroundColor { readonly bgBlack: CSPair; readonly bgRed: CSPair; readonly bgGreen: CSPair; readonly bgYellow: CSPair; readonly bgBlue: CSPair; readonly bgCyan: CSPair; readonly bgMagenta: CSPair; readonly bgWhite: CSPair; /** Alias for `bgBlackBright`. */ readonly bgGray: CSPair; /** Alias for `bgBlackBright`. */ readonly bgGrey: CSPair; readonly bgBlackBright: CSPair; readonly bgRedBright: CSPair; readonly bgGreenBright: CSPair; readonly bgYellowBright: CSPair; readonly bgBlueBright: CSPair; readonly bgCyanBright: CSPair; readonly bgMagentaBright: CSPair; readonly bgWhiteBright: CSPair; } interface ConvertColor { /** Convert from the RGB color space to the ANSI 256 color space. @param red - (`0...255`) @param green - (`0...255`) @param blue - (`0...255`) */ rgbToAnsi256(red: number, green: number, blue: number): number; /** Convert from the RGB HEX color space to the RGB color space. @param hex - A hexadecimal string containing RGB data. */ hexToRgb(hex: string): [red: number, green: number, blue: number]; /** Convert from the RGB HEX color space to the ANSI 256 color space. @param hex - A hexadecimal string containing RGB data. */ hexToAnsi256(hex: string): number; } } declare const ansiStyles: { readonly modifier: ansiStyles.Modifier; readonly color: ansiStyles.ForegroundColor & ansiStyles.ColorBase; readonly bgColor: ansiStyles.BackgroundColor & ansiStyles.ColorBase; readonly codes: ReadonlyMap<number, number>; } & ansiStyles.BackgroundColor & ansiStyles.ForegroundColor & ansiStyles.Modifier & ansiStyles.ConvertColor; export = ansiStyles;
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import type {SnapshotFormat} from '@jest/schemas'; export declare type Colors = { comment: { close: string; open: string; }; content: { close: string; open: string; }; prop: { close: string; open: string; }; tag: { close: string; open: string; }; value: { close: string; open: string; }; }; export declare type CompareKeys = | ((a: string, b: string) => number) | null | undefined; export declare type Config = { callToJSON: boolean; compareKeys: CompareKeys; colors: Colors; escapeRegex: boolean; escapeString: boolean; indent: string; maxDepth: number; maxWidth: number; min: boolean; plugins: Plugins; printBasicPrototype: boolean; printFunctionName: boolean; spacingInner: string; spacingOuter: string; }; export declare const DEFAULT_OPTIONS: { callToJSON: true; compareKeys: undefined; escapeRegex: false; escapeString: true; highlight: false; indent: number; maxDepth: number; maxWidth: number; min: false; plugins: never[]; printBasicPrototype: true; printFunctionName: true; theme: Required<{ readonly comment?: string | undefined; readonly content?: string | undefined; readonly prop?: string | undefined; readonly tag?: string | undefined; readonly value?: string | undefined; }>; }; /** * Returns a presentation string of your `val` object * @param val any potential JavaScript object * @param options Custom settings */ declare function format(val: unknown, options?: OptionsReceived): string; export default format; export {format}; declare type Indent = (arg0: string) => string; export declare type NewPlugin = { serialize: ( val: any, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer, ) => string; test: Test; }; export declare type OldPlugin = { print: ( val: unknown, print: Print, indent: Indent, options: PluginOptions, colors: Colors, ) => string; test: Test; }; export declare interface Options extends Omit<RequiredOptions, 'compareKeys' | 'theme'> { compareKeys: CompareKeys; theme: Required<RequiredOptions['theme']>; } export declare type OptionsReceived = PrettyFormatOptions; declare type Plugin_2 = NewPlugin | OldPlugin; export {Plugin_2 as Plugin}; declare type PluginOptions = { edgeSpacing: string; min: boolean; spacing: string; }; export declare type Plugins = Array<Plugin_2>; export declare const plugins: { AsymmetricMatcher: NewPlugin; DOMCollection: NewPlugin; DOMElement: NewPlugin; Immutable: NewPlugin; ReactElement: NewPlugin; ReactTestComponent: NewPlugin; }; export declare interface PrettyFormatOptions extends Omit<SnapshotFormat, 'compareKeys'> { compareKeys?: CompareKeys; plugins?: Plugins; } declare type Print = (arg0: unknown) => string; export declare type Printer = ( val: unknown, config: Config, indentation: string, depth: number, refs: Refs, hasCalledToJSON?: boolean, ) => string; export declare type Refs = Array<unknown>; declare type RequiredOptions = Required<PrettyFormatOptions>; declare type Test = (arg0: any) => boolean; export declare type Theme = Options['theme']; export {};
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import chalk = require('chalk'); import {DiffOptions as DiffOptions_2} from 'jest-diff'; export declare const BOLD_WEIGHT: chalk.Chalk; export declare const diff: ( a: unknown, b: unknown, options?: DiffOptions, ) => string | null; export declare type DiffOptions = DiffOptions_2; export declare const DIM_COLOR: chalk.Chalk; /** * Ensures that `actual` is of type `number | bigint` */ export declare const ensureActualIsNumber: ( actual: unknown, matcherName: string, options?: MatcherHintOptions, ) => void; export declare const ensureExpectedIsNonNegativeInteger: ( expected: unknown, matcherName: string, options?: MatcherHintOptions, ) => void; /** * Ensures that `expected` is of type `number | bigint` */ export declare const ensureExpectedIsNumber: ( expected: unknown, matcherName: string, options?: MatcherHintOptions, ) => void; export declare const ensureNoExpected: ( expected: unknown, matcherName: string, options?: MatcherHintOptions, ) => void; /** * Ensures that `actual` & `expected` are of type `number | bigint` */ export declare const ensureNumbers: ( actual: unknown, expected: unknown, matcherName: string, options?: MatcherHintOptions, ) => void; export declare const EXPECTED_COLOR: chalk.Chalk; export declare const getLabelPrinter: (...strings: Array<string>) => PrintLabel; export declare const highlightTrailingWhitespace: (text: string) => string; export declare const INVERTED_COLOR: chalk.Chalk; export declare const matcherErrorMessage: ( hint: string, generic: string, specific?: string, ) => string; export declare const matcherHint: ( matcherName: string, received?: string, expected?: string, options?: MatcherHintOptions, ) => string; declare type MatcherHintColor = (arg: string) => string; export declare type MatcherHintOptions = { comment?: string; expectedColor?: MatcherHintColor; isDirectExpectCall?: boolean; isNot?: boolean; promise?: string; receivedColor?: MatcherHintColor; secondArgument?: string; secondArgumentColor?: MatcherHintColor; }; export declare const pluralize: (word: string, count: number) => string; export declare const printDiffOrStringify: ( expected: unknown, received: unknown, expectedLabel: string, receivedLabel: string, expand: boolean, ) => string; export declare const printExpected: (value: unknown) => string; declare type PrintLabel = (string: string) => string; export declare const printReceived: (object: unknown) => string; export declare function printWithType<T>( name: string, value: T, print: (value: T) => string, ): string; export declare const RECEIVED_COLOR: chalk.Chalk; export declare function replaceMatchedToAsymmetricMatcher( replacedExpected: unknown, replacedReceived: unknown, expectedCycles: Array<unknown>, receivedCycles: Array<unknown>, ): { replacedExpected: unknown; replacedReceived: unknown; }; export declare const stringify: ( object: unknown, maxDepth?: number, maxWidth?: number, ) => string; export declare const SUGGEST_TO_CONTAIN_EQUAL: string; export {};
declare namespace callsites { interface CallSite { /** Returns the value of `this`. */ getThis(): unknown | undefined; /** Returns the type of `this` as a string. This is the name of the function stored in the constructor field of `this`, if available, otherwise the object's `[[Class]]` internal property. */ getTypeName(): string | null; /** Returns the current function. */ getFunction(): Function | undefined; /** Returns the name of the current function, typically its `name` property. If a name property is not available an attempt will be made to try to infer a name from the function's context. */ getFunctionName(): string | null; /** Returns the name of the property of `this` or one of its prototypes that holds the current function. */ getMethodName(): string | undefined; /** Returns the name of the script if this function was defined in a script. */ getFileName(): string | null; /** Returns the current line number if this function was defined in a script. */ getLineNumber(): number | null; /** Returns the current column number if this function was defined in a script. */ getColumnNumber(): number | null; /** Returns a string representing the location where `eval` was called if this function was created using a call to `eval`. */ getEvalOrigin(): string | undefined; /** Returns `true` if this is a top-level invocation, that is, if it's a global object. */ isToplevel(): boolean; /** Returns `true` if this call takes place in code defined by a call to `eval`. */ isEval(): boolean; /** Returns `true` if this call is in native V8 code. */ isNative(): boolean; /** Returns `true` if this is a constructor call. */ isConstructor(): boolean; } } declare const callsites: { /** Get callsites from the V8 stack trace API. @returns An array of `CallSite` objects. @example ``` import callsites = require('callsites'); function unicorn() { console.log(callsites()[0].getFileName()); //=> '/Users/sindresorhus/dev/callsites/test.js' } unicorn(); ``` */ (): callsites.CallSite[]; // TODO: Remove this for the next major release, refactor the whole definition to: // declare function callsites(): callsites.CallSite[]; // export = callsites; default: typeof callsites; }; export = callsites;
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ export declare function extract(contents: string): string; export declare function parse(docblock: string): Pragmas; export declare function parseWithComments(docblock: string): { comments: string; pragmas: Pragmas; }; declare type Pragmas = Record<string, string | Array<string>>; declare function print_2({ comments, pragmas, }: { comments?: string; pragmas?: Pragmas; }): string; export {print_2 as print}; export declare function strip(contents: string): string; export {};
declare function defineDataProperty( obj: Record<PropertyKey, unknown>, property: keyof typeof obj, value: typeof obj[typeof property], nonEnumerable?: boolean | null, nonWritable?: boolean | null, nonConfigurable?: boolean | null, loose?: boolean ): void; export = defineDataProperty;
/* (c) 2015 Ari Porad (@ariporad) <http://ariporad.com>. License: ariporad.mit-license.org */ /** * The hook. Accepts the code of the module and the filename. */ declare type Hook = (code: string, filename: string) => string; /** * A matcher function, will be called with path to a file. * * Should return truthy if the file should be hooked, falsy otherwise. */ declare type Matcher = (path: string) => boolean; /** * Reverts the hook when called. */ declare type RevertFunction = () => void; interface Options { /** * The extensions to hook. Should start with '.' (ex. ['.js']). * * Takes precedence over `exts`, `extension` and `ext`. * * @alias exts * @alias extension * @alias ext * @default ['.js'] */ extensions?: ReadonlyArray<string> | string; /** * The extensions to hook. Should start with '.' (ex. ['.js']). * * Takes precedence over `extension` and `ext`. * * @alias extension * @alias ext * @default ['.js'] */ exts?: ReadonlyArray<string> | string; /** * The extensions to hook. Should start with '.' (ex. ['.js']). * * Takes precedence over `ext`. * * @alias ext * @default ['.js'] */ extension?: ReadonlyArray<string> | string; /** * The extensions to hook. Should start with '.' (ex. ['.js']). * * @default ['.js'] */ ext?: ReadonlyArray<string> | string; /** * A matcher function, will be called with path to a file. * * Should return truthy if the file should be hooked, falsy otherwise. */ matcher?: Matcher | null; /** * Auto-ignore node_modules. Independent of any matcher. * * @default true */ ignoreNodeModules?: boolean; } /** * Add a require hook. * * @param hook The hook. Accepts the code of the module and the filename. Required. * @returns The `revert` function. Reverts the hook when called. */ export declare function addHook(hook: Hook, opts?: Options): RevertFunction; export {};
declare namespace matchers { interface TestingLibraryMatchers<E, R> extends Record<string, any> { /** * @deprecated * since v1.9.0 * @description * Assert whether a value is a DOM element, or not. Contrary to what its name implies, this matcher only checks * that you passed to it a valid DOM element. * * It does not have a clear definition of what "the DOM" is. Therefore, it does not check whether that element * is contained anywhere. * @see * [testing-library/jest-dom#toBeInTheDom](https://github.com/testing-library/jest-dom#toBeInTheDom) */ toBeInTheDOM(container?: HTMLElement | SVGElement): R; /** * @description * Assert whether an element is present in the document or not. * @example * <svg data-testid="svg-element"></svg> * * expect(queryByTestId('svg-element')).toBeInTheDocument() * expect(queryByTestId('does-not-exist')).not.toBeInTheDocument() * @see * [testing-library/jest-dom#tobeinthedocument](https://github.com/testing-library/jest-dom#tobeinthedocument) */ toBeInTheDocument(): R; /** * @description * This allows you to check if an element is currently visible to the user. * * An element is visible if **all** the following conditions are met: * * it does not have its css property display set to none * * it does not have its css property visibility set to either hidden or collapse * * it does not have its css property opacity set to 0 * * its parent element is also visible (and so on up to the top of the DOM tree) * * it does not have the hidden attribute * * if `<details />` it has the open attribute * @example * <div * data-testid="zero-opacity" * style="opacity: 0" * > * Zero Opacity * </div> * * <div data-testid="visible">Visible Example</div> * * expect(getByTestId('zero-opacity')).not.toBeVisible() * expect(getByTestId('visible')).toBeVisible() * @see * [testing-library/jest-dom#tobevisible](https://github.com/testing-library/jest-dom#tobevisible) */ toBeVisible(): R; /** * @deprecated * since v5.9.0 * @description * Assert whether an element has content or not. * @example * <span data-testid="not-empty"> * <span data-testid="empty"></span> * </span> * * expect(getByTestId('empty')).toBeEmpty() * expect(getByTestId('not-empty')).not.toBeEmpty() * @see * [testing-library/jest-dom#tobeempty](https://github.com/testing-library/jest-dom#tobeempty) */ toBeEmpty(): R; /** * @description * Assert whether an element has content or not. * @example * <span data-testid="not-empty"> * <span data-testid="empty"></span> * </span> * * expect(getByTestId('empty')).toBeEmptyDOMElement() * expect(getByTestId('not-empty')).not.toBeEmptyDOMElement() * @see * [testing-library/jest-dom#tobeemptydomelement](https://github.com/testing-library/jest-dom#tobeemptydomelement) */ toBeEmptyDOMElement(): R; /** * @description * Allows you to check whether an element is disabled from the user's perspective. * * Matches if the element is a form control and the `disabled` attribute is specified on this element or the * element is a descendant of a form element with a `disabled` attribute. * @example * <button * data-testid="button" * type="submit" * disabled * > * submit * </button>
* * expect(getByTestId('button')).toBeDisabled() * @see * [testing-library/jest-dom#tobedisabled](https://github.com/testing-library/jest-dom#tobedisabled) */ toBeDisabled(): R; /** * @description * Allows you to check whether an element is not disabled from the user's perspective. * * Works like `not.toBeDisabled()`. * * Use this matcher to avoid double negation in your tests. * @example * <button * data-testid="button" * type="submit" * > * submit * </button> * * expect(getByTestId('button')).toBeEnabled() * @see * [testing-library/jest-dom#tobeenabled](https://github.com/testing-library/jest-dom#tobeenabled) */ toBeEnabled(): R; /** * @description * Check if a form element, or the entire `form`, is currently invalid. * * An `input`, `select`, `textarea`, or `form` element is invalid if it has an `aria-invalid` attribute with no * value or a value of "true", or if the result of `checkValidity()` is false. * @example * <input data-testid="no-aria-invalid" /> * * <form data-testid="invalid-form"> * <input required /> * </form> * * expect(getByTestId('no-aria-invalid')).not.toBeInvalid() * expect(getByTestId('invalid-form')).toBeInvalid() * @see * [testing-library/jest-dom#tobeinvalid](https://github.com/testing-library/jest-dom#tobeinvalid) */ toBeInvalid(): R; /** * @description * This allows you to check if a form element is currently required. * * An element is required if it is having a `required` or `aria-required="true"` attribute. * @example * <input data-testid="required-input" required /> * <div * data-testid="supported-role" * role="tree" * required /> * * expect(getByTestId('required-input')).toBeRequired() * expect(getByTestId('supported-role')).not.toBeRequired() * @see * [testing-library/jest-dom#toberequired](https://github.com/testing-library/jest-dom#toberequired) */ toBeRequired(): R; /** * @description * Allows you to check if a form element is currently required. * * An `input`, `select`, `textarea`, or `form` element is invalid if it has an `aria-invalid` attribute with no * value or a value of "false", or if the result of `checkValidity()` is true. * @example * <input data-testid="aria-invalid" aria-invalid /> * * <form data-testid="valid-form"> * <input /> * </form> * * expect(getByTestId('no-aria-invalid')).not.toBeValid() * expect(getByTestId('invalid-form')).toBeInvalid() * @see * [testing-library/jest-dom#tobevalid](https://github.com/testing-library/jest-dom#tobevalid) */ toBeValid(): R; /** * @description * Allows you to assert whether an element contains another element as a descendant or not. * @example * <span data-testid="ancestor"> * <span data-testid="descendant"></span> * </span> * * const ancestor = getByTestId('ancestor') * const descendant = getByTestId('descendant') * const nonExistantElement = getByTestId('does-not-exist') * expect(ancestor).toContainElement(descendant) * expect(descendant).not.toContainElement(ancestor) * expect(ancestor).not.toContainElement(nonExistantElement) * @see * [testing-library/jest-dom#tocontainelement](https://github.com/testing-library/jest-dom#tocontainelement) */ toC
ontainElement(element: HTMLElement | SVGElement | null): R; /** * @description * Assert whether a string representing a HTML element is contained in another element. * @example * <span data-testid="parent"><span data-testid="child"></span></span> * * expect(getByTestId('parent')).toContainHTML('<span data-testid="child"></span>') * @see * [testing-library/jest-dom#tocontainhtml](https://github.com/testing-library/jest-dom#tocontainhtml) */ toContainHTML(htmlText: string): R; /** * @description * Allows you to check if a given element has an attribute or not. * * You can also optionally check that the attribute has a specific expected value or partial match using * [expect.stringContaining](https://jestjs.io/docs/en/expect.html#expectnotstringcontainingstring) or * [expect.stringMatching](https://jestjs.io/docs/en/expect.html#expectstringmatchingstring-regexp). * @example * <button * data-testid="ok-button" * type="submit" * disabled * > * ok * </button> * * expect(button).toHaveAttribute('disabled') * expect(button).toHaveAttribute('type', 'submit') * expect(button).not.toHaveAttribute('type', 'button') * @see * [testing-library/jest-dom#tohaveattribute](https://github.com/testing-library/jest-dom#tohaveattribute) */ toHaveAttribute(attr: string, value?: unknown): R; /** * @description * Check whether the given element has certain classes within its `class` attribute. * * You must provide at least one class, unless you are asserting that an element does not have any classes. * @example * <button * data-testid="delete-button" * class="btn xs btn-danger" * > * delete item * </button> * * <div data-testid="no-classes">no classes</div> * * const deleteButton = getByTestId('delete-button') * const noClasses = getByTestId('no-classes') * expect(deleteButton).toHaveClass('btn') * expect(deleteButton).toHaveClass('btn-danger xs') * expect(deleteButton).toHaveClass('btn xs btn-danger', {exact: true}) * expect(deleteButton).not.toHaveClass('btn xs btn-danger', {exact: true}) * expect(noClasses).not.toHaveClass() * @see * [testing-library/jest-dom#tohaveclass](https://github.com/testing-library/jest-dom#tohaveclass) */ toHaveClass(...classNames: string[]): R; toHaveClass(classNames: string, options?: { exact: boolean }): R; /** * @description * This allows you to check whether the given form element has the specified displayed value (the one the * end user will see). It accepts <input>, <select> and <textarea> elements with the exception of <input type="checkbox"> * and <input type="radio">, which can be meaningfully matched only using toBeChecked or toHaveFormValues. * @example * <label for="input-example">First name</label> * <input type="text" id="input-example" value="Luca" /> * * <label for="textarea-example">Description</label> * <textarea id="textarea-example">An example description here.</textarea> * * <label for="single-select-example">Fruit</label> * <select id="single-select-example"> * <option value="">Select a fruit...</option> * <option value="banana">Banana</option> * <option value="ananas">Ananas</option> * <option value="avocado">Avocado</option> * </select> * * <label for="mutiple-select-example">Fruits</label> * <select id="multiple-select-example" multiple> * <
option value="">Select a fruit...</option> * <option value="banana" selected>Banana</option> * <option value="ananas">Ananas</option> * <option value="avocado" selected>Avocado</option> * </select> * * const input = screen.getByLabelText('First name') * const textarea = screen.getByLabelText('Description') * const selectSingle = screen.getByLabelText('Fruit') * const selectMultiple = screen.getByLabelText('Fruits') * * expect(input).toHaveDisplayValue('Luca') * expect(textarea).toHaveDisplayValue('An example description here.') * expect(selectSingle).toHaveDisplayValue('Select a fruit...') * expect(selectMultiple).toHaveDisplayValue(['Banana', 'Avocado']) * * @see * [testing-library/jest-dom#tohavedisplayvalue](https://github.com/testing-library/jest-dom#tohavedisplayvalue) */ toHaveDisplayValue(value: string | RegExp | Array<string | RegExp>): R; /** * @description * Assert whether an element has focus or not. * @example * <div> * <input type="text" data-testid="element-to-focus" /> * </div> * * const input = getByTestId('element-to-focus') * input.focus() * expect(input).toHaveFocus() * input.blur() * expect(input).not.toHaveFocus() * @see * [testing-library/jest-dom#tohavefocus](https://github.com/testing-library/jest-dom#tohavefocus) */ toHaveFocus(): R; /** * @description * Check if a form or fieldset contains form controls for each given name, and having the specified value. * * Can only be invoked on a form or fieldset element. * @example * <form data-testid="login-form"> * <input type="text" name="username" value="jane.doe" /> * <input type="password" name="password" value="123" /> * <input type="checkbox" name="rememberMe" checked /> * <button type="submit">Sign in</button> * </form> * * expect(getByTestId('login-form')).toHaveFormValues({ * username: 'jane.doe', * rememberMe: true, * }) * @see * [testing-library/jest-dom#tohaveformvalues](https://github.com/testing-library/jest-dom#tohaveformvalues) */ toHaveFormValues(expectedValues: Record<string, unknown>): R; /** * @description * Check if an element has specific css properties with specific values applied. * * Only matches if the element has *all* the expected properties applied, not just some of them. * @example * <button * data-test-id="submit-button" * style="background-color: green; display: none" * > * submit * </button> * * const button = getByTestId('submit-button') * expect(button).toHaveStyle('background-color: green') * expect(button).toHaveStyle({ * 'background-color': 'green', * display: 'none' * }) * @see * [testing-library/jest-dom#tohavestyle](https://github.com/testing-library/jest-dom#tohavestyle) */ toHaveStyle(css: string | Record<string, unknown>): R; /** * @description * Check whether the given element has a text content or not. * * When a string argument is passed through, it will perform a partial case-sensitive match to the element * content. * * To perform a case-insensitive match, you can use a RegExp with the `/i` modifier. * * If you want to match the whole content, you can use a RegExp to do it. * @example * <span data-testid="text-content">Text Content</span> * * const element = get
ByTestId('text-content') * expect(element).toHaveTextContent('Content') * // to match the whole content * expect(element).toHaveTextContent(/^Text Content$/) * // to use case-insentive match * expect(element).toHaveTextContent(/content$/i) * expect(element).not.toHaveTextContent('content') * @see * [testing-library/jest-dom#tohavetextcontent](https://github.com/testing-library/jest-dom#tohavetextcontent) */ toHaveTextContent(text: string | RegExp, options?: { normalizeWhitespace: boolean }): R; /** * @description * Check whether the given form element has the specified value. * * Accepts `<input>`, `<select>`, and `<textarea>` elements with the exception of `<input type="checkbox">` and * `<input type="radiobox">`, which can be matched only using * [toBeChecked](https://github.com/testing-library/jest-dom#tobechecked) or * [toHaveFormValues](https://github.com/testing-library/jest-dom#tohaveformvalues). * @example * <input * type="number" * value="5" * data-testid="input-number" /> * * const numberInput = getByTestId('input-number') * expect(numberInput).toHaveValue(5) * @see * [testing-library/jest-dom#tohavevalue](https://github.com/testing-library/jest-dom#tohavevalue) */ toHaveValue(value?: string | string[] | number | null): R; /** * @description * Assert whether the given element is checked. * * It accepts an `input` of type `checkbox` or `radio` and elements with a `role` of `radio` with a valid * `aria-checked` attribute of "true" or "false". * @example * <input * type="checkbox" * checked * data-testid="input-checkbox" /> * <input * type="radio" * value="foo" * data-testid="input-radio" /> * * const inputCheckbox = getByTestId('input-checkbox') * const inputRadio = getByTestId('input-radio') * expect(inputCheckbox).toBeChecked() * expect(inputRadio).not.toBeChecked() * @see * [testing-library/jest-dom#tobechecked](https://github.com/testing-library/jest-dom#tobechecked) */ toBeChecked(): R; /** * @deprecated * since v5.14.1 * @description * Check the accessible description for an element. * This allows you to check whether the given element has a description or not. * * An element gets its description via the * [`aria-describedby` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-describedby_attribute). * Set this to the `id` of one or more other elements. These elements may be nested * inside, be outside, or a sibling of the passed in element. * * Whitespace is normalized. Using multiple ids will * [join the referenced elements’ text content separated by a space](https://www.w3.org/TR/accname-1.1/#mapping_additional_nd_description). * * When a `string` argument is passed through, it will perform a whole * case-sensitive match to the description text. * * To perform a case-insensitive match, you can use a `RegExp` with the `/i` * modifier. * * To perform a partial match, you can pass a `RegExp` or use * `expect.stringContaining("partial string")`. * * @example * <button aria-label="Close" aria-describedby="description-close"> * X * </button> * <div id="description-close"> * Closing will discard any changes * </div> * * <button>Delete</button> * * const closeButt
on = getByRole('button', {name: 'Close'}) * * expect(closeButton).toHaveDescription('Closing will discard any changes') * expect(closeButton).toHaveDescription(/will discard/) // to partially match * expect(closeButton).toHaveDescription(expect.stringContaining('will discard')) // to partially match * expect(closeButton).toHaveDescription(/^closing/i) // to use case-insensitive match * expect(closeButton).not.toHaveDescription('Other description') * * const deleteButton = getByRole('button', {name: 'Delete'}) * expect(deleteButton).not.toHaveDescription() * expect(deleteButton).toHaveDescription('') // Missing or empty description always becomes a blank string * @see * [testing-library/jest-dom#tohavedescription](https://github.com/testing-library/jest-dom#tohavedescription) */ toHaveDescription(text?: string | RegExp | E): R; /** * @description * This allows to assert that an element has the expected [accessible description](https://w3c.github.io/accname/). * * You can pass the exact string of the expected accessible description, or you can make a * partial match passing a regular expression, or by using either * [expect.stringContaining](https://jestjs.io/docs/en/expect.html#expectnotstringcontainingstring) * or [expect.stringMatching](https://jestjs.io/docs/en/expect.html#expectstringmatchingstring-regexp). * @example * <a data-testid="link" href="/" aria-label="Home page" title="A link to start over">Start</a> * <a data-testid="extra-link" href="/about" aria-label="About page">About</a> * <img src="avatar.jpg" data-testid="avatar" alt="User profile pic" /> * <img src="logo.jpg" data-testid="logo" alt="Company logo" aria-describedby="t1" /> * <span id="t1" role="presentation">The logo of Our Company</span> * * expect(getByTestId('link')).toHaveAccessibleDescription() * expect(getByTestId('link')).toHaveAccessibleDescription('A link to start over') * expect(getByTestId('link')).not.toHaveAccessibleDescription('Home page') * expect(getByTestId('extra-link')).not.toHaveAccessibleDescription() * expect(getByTestId('avatar')).not.toHaveAccessibleDescription() * expect(getByTestId('logo')).not.toHaveAccessibleDescription('Company logo') * expect(getByTestId('logo')).toHaveAccessibleDescription('The logo of Our Company') * @see * [testing-library/jest-dom#tohaveaccessibledescription](https://github.com/testing-library/jest-dom#tohaveaccessibledescription) */ toHaveAccessibleDescription(text?: string | RegExp | E): R; /** * @description * This allows you to assert that an element has the expected * [accessible error message](https://w3c.github.io/aria/#aria-errormessage). * * You can pass the exact string of the expected accessible error message. * Alternatively, you can perform a partial match by passing a regular expression * or by using either * [expect.stringContaining](https://jestjs.io/docs/en/expect.html#expectnotstringcontainingstring) * or [expect.stringMatching](https://jestjs.io/docs/en/expect.html#expectstringmatchingstring-regexp). * * @example * <input aria-label="Has Error" aria-invalid="true" aria-errormessage="error-message" /> * <div id="error-message" role="alert">This field is invalid</div> * * <input aria-label="No Error Attributes" /> * <input aria-label="Not Invalid" aria-invalid="false" aria-errormessage="error-message" /> * * // Inputs with Valid Error Messages * expect(getByRole('textbox', {name: 'Has Error'})).toHaveAccessibleErrorMessage() * expect(getByRole('textbox',
{name: 'Has Error'})).toHaveAccessibleErrorMessage('This field is invalid') * expect(getByRole('textbox', {name: 'Has Error'})).toHaveAccessibleErrorMessage(/invalid/i) * expect( * getByRole('textbox', {name: 'Has Error'}), * ).not.toHaveAccessibleErrorMessage('This field is absolutely correct!') * * // Inputs without Valid Error Messages * expect( * getByRole('textbox', {name: 'No Error Attributes'}), * ).not.toHaveAccessibleErrorMessage() * * expect( * getByRole('textbox', {name: 'Not Invalid'}), * ).not.toHaveAccessibleErrorMessage() * * @see * [testing-library/jest-dom#tohaveaccessibleerrormessage](https://github.com/testing-library/jest-dom#tohaveaccessibleerrormessage) */ toHaveAccessibleErrorMessage(text?: string | RegExp | E): R; /** * @description * This allows to assert that an element has the expected [accessible name](https://w3c.github.io/accname/). * It is useful, for instance, to assert that form elements and buttons are properly labelled. * * You can pass the exact string of the expected accessible name, or you can make a * partial match passing a regular expression, or by using either * [expect.stringContaining](https://jestjs.io/docs/en/expect.html#expectnotstringcontainingstring) * or [expect.stringMatching](https://jestjs.io/docs/en/expect.html#expectstringmatchingstring-regexp). * @example * <img data-testid="img-alt" src="" alt="Test alt" /> * <img data-testid="img-empty-alt" src="" alt="" /> * <svg data-testid="svg-title"><title>Test title</title></svg> * <button data-testid="button-img-alt"><img src="" alt="Test" /></button> * <p><img data-testid="img-paragraph" src="" alt="" /> Test content</p> * <button data-testid="svg-button"><svg><title>Test</title></svg></p> * <div><svg data-testid="svg-without-title"></svg></div> * <input data-testid="input-title" title="test" /> * * expect(getByTestId('img-alt')).toHaveAccessibleName('Test alt') * expect(getByTestId('img-empty-alt')).not.toHaveAccessibleName() * expect(getByTestId('svg-title')).toHaveAccessibleName('Test title') * expect(getByTestId('button-img-alt')).toHaveAccessibleName() * expect(getByTestId('img-paragraph')).not.toHaveAccessibleName() * expect(getByTestId('svg-button')).toHaveAccessibleName() * expect(getByTestId('svg-without-title')).not.toHaveAccessibleName() * expect(getByTestId('input-title')).toHaveAccessibleName() * @see * [testing-library/jest-dom#tohaveaccessiblename](https://github.com/testing-library/jest-dom#tohaveaccessiblename) */ toHaveAccessibleName(text?: string | RegExp | E): R; /** * @description * This allows you to check whether the given element is partially checked. * It accepts an input of type checkbox and elements with a role of checkbox * with a aria-checked="mixed", or input of type checkbox with indeterminate * set to true * * @example * <input type="checkbox" aria-checked="mixed" data-testid="aria-checkbox-mixed" /> * <input type="checkbox" checked data-testid="input-checkbox-checked" /> * <input type="checkbox" data-testid="input-checkbox-unchecked" /> * <div role="checkbox" aria-checked="true" data-testid="aria-checkbox-checked" /> * <div * role="checkbox" * aria-checked="false" * data-testid="aria-checkbox-unchecked" * /> * <input type="checkbox" data-testid="input-checkbox-indeterminate" /> * * const ariaCheckboxMixed = getByTestId('aria-checkbox-mixed') * const inputCheckboxChecke
d = getByTestId('input-checkbox-checked') * const inputCheckboxUnchecked = getByTestId('input-checkbox-unchecked') * const ariaCheckboxChecked = getByTestId('aria-checkbox-checked') * const ariaCheckboxUnchecked = getByTestId('aria-checkbox-unchecked') * const inputCheckboxIndeterminate = getByTestId('input-checkbox-indeterminate') * * expect(ariaCheckboxMixed).toBePartiallyChecked() * expect(inputCheckboxChecked).not.toBePartiallyChecked() * expect(inputCheckboxUnchecked).not.toBePartiallyChecked() * expect(ariaCheckboxChecked).not.toBePartiallyChecked() * expect(ariaCheckboxUnchecked).not.toBePartiallyChecked() * * inputCheckboxIndeterminate.indeterminate = true * expect(inputCheckboxIndeterminate).toBePartiallyChecked() * @see * [testing-library/jest-dom#tobepartiallychecked](https://github.com/testing-library/jest-dom#tobepartiallychecked) */ toBePartiallyChecked(): R; /** * @deprecated * since v5.17.0 * * @description * Check whether the given element has an [ARIA error message](https://www.w3.org/TR/wai-aria/#aria-errormessage) or not. * * Use the `aria-errormessage` attribute to reference another element that contains * custom error message text. Multiple ids is **NOT** allowed. Authors MUST use * `aria-invalid` in conjunction with `aria-errormessage`. Learn more from the * [`aria-errormessage` spec](https://www.w3.org/TR/wai-aria/#aria-errormessage). * * Whitespace is normalized. * * When a `string` argument is passed through, it will perform a whole * case-sensitive match to the error message text. * * To perform a case-insensitive match, you can use a `RegExp` with the `/i` * modifier. * * To perform a partial match, you can pass a `RegExp` or use * expect.stringContaining("partial string")`. * * @example * <label for="startTime"> Please enter a start time for the meeting: </label> * <input id="startTime" type="text" aria-errormessage="msgID" aria-invalid="true" value="11:30 PM" /> * <span id="msgID" aria-live="assertive" style="visibility:visible"> * Invalid time: the time must be between 9:00 AM and 5:00 PM" * </span> * * * const timeInput = getByLabel('startTime') * * expect(timeInput).toHaveErrorMessage( * 'Invalid time: the time must be between 9:00 AM and 5:00 PM', * ) * expect(timeInput).toHaveErrorMessage(/invalid time/i) // to partially match * expect(timeInput).toHaveErrorMessage(expect.stringContaining('Invalid time')) // to partially match * expect(timeInput).not.toHaveErrorMessage('Pikachu!') * @see * [testing-library/jest-dom#tohaveerrormessage](https://github.com/testing-library/jest-dom#tohaveerrormessage) */ toHaveErrorMessage(text?: string | RegExp | E): R; } } declare const matchers: matchers.TestingLibraryMatchers<any, void>; export = matchers;
import { Component } from "react"; import { TransitionProps } from "./Transition"; export interface CSSTransitionClassNames { appear?: string | undefined; appearActive?: string | undefined; appearDone?: string | undefined; enter?: string | undefined; enterActive?: string | undefined; enterDone?: string | undefined; exit?: string | undefined; exitActive?: string | undefined; exitDone?: string | undefined; } export type CSSTransitionProps<Ref extends undefined | HTMLElement = undefined> = TransitionProps<Ref> & { /** * The animation `classNames` applied to the component as it enters or exits. * A single name can be provided and it will be suffixed for each stage: e.g. * * `classNames="fade"` applies `fade-enter`, `fade-enter-active`, * `fade-exit`, `fade-exit-active`, `fade-appear`, and `fade-appear-active`. * * Each individual classNames can also be specified independently like: * * ```js * classNames={{ * appear: 'my-appear', * appearActive: 'my-appear-active', * appearDone: 'my-appear-done', * enter: 'my-enter', * enterActive: 'my-enter-active', * enterDone: 'my-enter-done', * exit: 'my-exit', * exitActive: 'my-exit-active', * exitDone: 'my-exit-done' * }} * ``` */ classNames?: string | CSSTransitionClassNames | undefined; }; declare class CSSTransition<Ref extends undefined | HTMLElement> extends Component<CSSTransitionProps<Ref>> {} export default CSSTransition;
export interface Config { disabled: boolean; } declare const config: Config; export default config;
export { default as config } from "./config"; export { default as CSSTransition } from "./CSSTransition"; export { default as SwitchTransition } from "./SwitchTransition"; export { default as Transition, TransitionStatus } from "./Transition"; export { default as TransitionGroup } from "./TransitionGroup";
import { Component, ReactElement } from "react"; export enum modes { out = "out-in", in = "in-out", } export interface SwitchTransitionProps { /** * Transition modes. * `out-in`: Current element transitions out first, then when complete, the new element transitions in. * `in-out`: New element transitions in first, then when complete, the current element transitions out. */ mode?: "out-in" | "in-out" | undefined; /** * Any `Transition` or `CSSTransition` component */ children: ReactElement; } /** * A transition component inspired by the [vue transition modes](https://vuejs.org/v2/guide/transitions.html#Transition-Modes). * You can use it when you want to control the render between state transitions. * Based on the selected mode and the child's key which is the `Transition` or `CSSTransition` component, the `SwitchTransition` makes a consistent transition between them. * * If the `out-in` mode is selected, the `SwitchTransition` waits until the old child leaves and then inserts a new child. * If the `in-out` mode is selected, the `SwitchTransition` inserts a new child first, waits for the new child to enter and then removes the old child * * ```jsx * function App() { * const [state, setState] = useState(false); * return ( * <SwitchTransition> * <FadeTransition key={state ? "Goodbye, world!" : "Hello, world!"} * addEndListener={(node, done) => node.addEventListener("transitionend", done, false)} * classNames='fade' > * <button onClick={() => setState(state => !state)}> * {state ? "Goodbye, world!" : "Hello, world!"} * </button> * </FadeTransition> * </SwitchTransition> * ) * } * ``` */ declare class SwitchTransition extends Component<SwitchTransitionProps> {} export default SwitchTransition;
import { Component, ReactNode } from "react"; type RefHandler< RefElement extends undefined | HTMLElement, ImplicitRefHandler extends (node: HTMLElement, ...args: any[]) => void, ExplicitRefHandler extends (...args: any[]) => void, > = { implicit: ImplicitRefHandler; explicit: ExplicitRefHandler; }[RefElement extends undefined ? "implicit" : "explicit"]; export type EndHandler<RefElement extends undefined | HTMLElement> = RefHandler< RefElement, (node: HTMLElement, done: () => void) => void, (done: () => void) => void >; export type EnterHandler<RefElement extends undefined | HTMLElement> = RefHandler< RefElement, (node: HTMLElement, isAppearing: boolean) => void, (isAppearing: boolean) => void >; export type ExitHandler<E extends undefined | HTMLElement> = RefHandler<E, (node: HTMLElement) => void, () => void>; export const UNMOUNTED = "unmounted"; export const EXITED = "exited"; export const ENTERING = "entering"; export const ENTERED = "entered"; export const EXITING = "exiting"; export interface TransitionActions { /** * Normally a component is not transitioned if it is shown when the * `<Transition>` component mounts. If you want to transition on the first * mount set appear to true, and the component will transition in as soon * as the `<Transition>` mounts. Note: there are no specific "appear" states. * appear only adds an additional enter transition. */ appear?: boolean | undefined; /** * Enable or disable enter transitions. */ enter?: boolean | undefined; /** * Enable or disable exit transitions. */ exit?: boolean | undefined; } interface BaseTransitionProps<RefElement extends undefined | HTMLElement> { /** * Show the component; triggers the enter or exit states */ in?: boolean | undefined; /** * By default the child component is mounted immediately along with the * parent Transition component. If you want to "lazy mount" the component on * the first `in={true}` you can set `mountOnEnter`. After the first enter * transition the component will stay mounted, even on "exited", unless you * also specify `unmountOnExit`. */ mountOnEnter?: boolean | undefined; /** * By default the child component stays mounted after it reaches the * 'exited' state. Set `unmountOnExit` if you'd prefer to unmount the * component after it finishes exiting. */ unmountOnExit?: boolean | undefined; /** * Callback fired before the "entering" status is applied. An extra * parameter `isAppearing` is supplied to indicate if the enter stage is * occurring on the initial mount */ onEnter?: EnterHandler<RefElement> | undefined; /** * Callback fired after the "entering" status is applied. An extra parameter * isAppearing is supplied to indicate if the enter stage is occurring on * the initial mount */ onEntering?: EnterHandler<RefElement> | undefined; /** * Callback fired after the "entered" status is applied. An extra parameter * isAppearing is supplied to indicate if the enter stage is occurring on * the initial mount */ onEntered?: EnterHandler<RefElement> | undefined; /** * Callback fired before the "exiting" status is applied. */ onExit?: ExitHandler<RefElement> | undefined; /** * Callback fired after the "exiting" status is applied. */ onExiting?: ExitHandler<RefElement> | undefined; /** * Callback fired after the "exited" status is applied. */ onExited?: ExitHandler<RefElement> | undefined; /** * A function child can be used instead of a React element. This function is * called with the current transition status ('entering', 'entered', * 'exiting', 'exited', 'unmounted'), which can be used to apply context * specific props to a component. * ```jsx * <Transit
ion in={this.state.in} timeout={150}> * {state => ( * <MyComponent className={`fade fade-${state}`} /> * )} * </Transition> * ``` */ children?: TransitionChildren | undefined; /** * A React reference to DOM element that need to transition: https://stackoverflow.com/a/51127130/4671932 * When `nodeRef` prop is used, node is not passed to callback functions (e.g. onEnter) because user already has direct access to the node. * When changing `key` prop of `Transition` in a `TransitionGroup` a new `nodeRef` need to be provided to `Transition` with changed `key` * prop (@see https://github.com/reactjs/react-transition-group/blob/master/test/Transition-test.js). */ nodeRef?: React.Ref<RefElement> | undefined; [prop: string]: any; } export type TransitionStatus = typeof ENTERING | typeof ENTERED | typeof EXITING | typeof EXITED | typeof UNMOUNTED; export type TransitionChildren = | ReactNode | ((status: TransitionStatus, childProps?: Record<string, unknown>) => ReactNode); export interface TimeoutProps<RefElement extends undefined | HTMLElement> extends BaseTransitionProps<RefElement> { /** * The duration of the transition, in milliseconds. Required unless addEndListener is provided. * * You may specify a single timeout for all transitions: * ```js * timeout={500} * ``` * or individually: * ```js * timeout={{ * appear: 500, * enter: 300, * exit: 500, * }} * ``` * - appear defaults to the value of `enter` * - enter defaults to `0` * - exit defaults to `0` */ timeout: number | { appear?: number | undefined; enter?: number | undefined; exit?: number | undefined }; /** * Add a custom transition end trigger. Called with the transitioning DOM * node and a done callback. Allows for more fine grained transition end * logic. Note: Timeouts are still used as a fallback if provided. */ addEndListener?: EndHandler<RefElement> | undefined; } export interface EndListenerProps<Ref extends undefined | HTMLElement> extends BaseTransitionProps<Ref> { /** * The duration of the transition, in milliseconds. Required unless addEndListener is provided. * * You may specify a single timeout for all transitions: * ```js * timeout={500} * ``` * or individually: * ```js * timeout={{ * appear: 500, * enter: 300, * exit: 500, * }} * ``` * - appear defaults to the value of `enter` * - enter defaults to `0` * - exit defaults to `0` */ timeout?: | number | { appear?: number | undefined; enter?: number | undefined; exit?: number | undefined } | undefined; /** * Add a custom transition end trigger. Called with the transitioning DOM * node and a done callback. Allows for more fine grained transition end * logic. Note: Timeouts are still used as a fallback if provided. */ addEndListener: EndHandler<Ref>; } export type TransitionProps<RefElement extends undefined | HTMLElement = undefined> = | TimeoutProps<RefElement> | EndListenerProps<RefElement>; /** * The Transition component lets you describe a transition from one component * state to another _over time_ with a simple declarative API. Most commonly * It's used to animate the mounting and unmounting of Component, but can also * be used to describe in-place transition states as well. * * By default the `Transition` component does not alter the behavior of the * component it renders, it only tracks "enter" and "exit" states for the components. * It's up to you to give meaning and effect to those states. For example we can * add styles to a component when it enters or exits: * * ```jsx * import Transition from 'react-transition-group/Transition'; * * const duration = 300; * * const defaultStyle = { * tr
ansition: `opacity ${duration}ms ease-in-out`, * opacity: 0, * } * * const transitionStyles = { * entering: { opacity: 1 }, * entered: { opacity: 1 }, * }; * * const Fade = ({ in: inProp }) => ( * <Transition in={inProp} timeout={duration}> * {(state) => ( * <div style={{ * ...defaultStyle, * ...transitionStyles[state] * }}> * I'm A fade Transition! * </div> * )} * </Transition> * ); * ``` */ declare class Transition<RefElement extends HTMLElement | undefined> extends Component<TransitionProps<RefElement>> {} export default Transition;
// Disable automatic exports. export {}; interface MapLike<Key, Value> { entries: () => Array<[Key, Value]>; get: (key: Key) => Value | undefined; has: (key: Key) => boolean; keys: () => Key[]; values: () => Value[]; } // index.js export type ARIARoleDefinitionKey = ARIAAbstractRole | ARIARole | ARIADPubRole; export const aria: MapLike<ARIAProperty, ARIAPropertyDefinition>; export interface DOMDefinition { reserved?: boolean | undefined; interactive?: boolean | undefined; } export const dom: MapLike<string, DOMDefinition>; export const elementRoles: MapLike<ARIARoleRelationConcept, Set<ARIARoleDefinitionKey>>; export const roles: MapLike<ARIARoleDefinitionKey, ARIARoleDefinition>; export const roleElements: MapLike<ARIARoleDefinitionKey, Set<ARIARoleRelationConcept>>; // types export type ARIAAbstractRole = | "command" | "composite" | "input" | "landmark" | "range" | "roletype" | "section" | "sectionhead" | "select" | "structure" | "widget" | "window"; export type ARIAWidgetRole = | "button" | "checkbox" | "gridcell" | "link" | "menuitem" | "menuitemcheckbox" | "menuitemradio" | "option" | "progressbar" | "radio" | "scrollbar" | "searchbox" | "slider" | "spinbutton" | "switch" | "tab" | "tabpanel" | "textbox" | "treeitem"; export type ARIACompositeWidgetRole = | "combobox" | "grid" | "listbox" | "menu" | "menubar" | "radiogroup" | "tablist" | "tree" | "treegrid"; export type ARIADocumentStructureRole = | "application" | "article" | "blockquote" | "caption" | "cell" | "columnheader" | "definition" | "deletion" | "directory" | "document" | "emphasis" | "feed" | "figure" | "generic" | "group" | "heading" | "img" | "insertion" | "list" | "listitem" | "math" | "meter" | "none" | "note" | "paragraph" | "presentation" | "row" | "rowgroup" | "rowheader" | "separator" | "strong" | "subscript" | "superscript" | "table" | "term" | "time" | "toolbar" | "tooltip"; export type ARIALandmarkRole = | "banner" | "complementary" | "contentinfo" | "form" | "main" | "navigation" | "region" | "search"; export type ARIALiveRegionRole = "alert" | "log" | "marquee" | "status" | "timer"; export type ARIAWindowRole = "alertdialog" | "dialog"; export type ARIAUncategorizedRole = "code"; export type ARIADPubRole = | "doc-abstract" | "doc-acknowledgments" | "doc-afterword" | "doc-appendix" | "doc-backlink" | "doc-biblioentry" | "doc-bibliography" | "doc-biblioref" | "doc-chapter" | "doc-colophon" | "doc-conclusion" | "doc-cover" | "doc-credit" | "doc-credits" | "doc-dedication" | "doc-endnote" | "doc-endnotes" | "doc-epigraph" | "doc-epilogue" | "doc-errata" | "doc-example" | "doc-footnote" | "doc-foreword" | "doc-glossary" | "doc-glossref" | "doc-index" | "doc-introduction" | "doc-noteref" | "doc-notice" | "doc-pagebreak" | "doc-pagelist" | "doc-part" | "doc-preface" | "doc-prologue" | "doc-pullquote" | "doc-qna" | "doc-subtitle" | "doc-tip" | "doc-toc"; export type ARIARole = | ARIAWidgetRole | ARIACompositeWidgetRole | ARIADocumentStructureRole | ARIALandmarkRole | ARIALiveRegionRole | ARIAWindowRole | ARIAUncategorizedRole; export interface ARIARoleDefinition { /* Abstract roles may not be used in HTML. */ abstract: boolean; /* The concepts in related domains that inform behavior mappings. */ baseConcepts: ARIARoleRelation[]; /* Child presentational roles strip child nodes of roles and flatten the * content to text. */ childrenPresentational: boolean; /* aria-*
properties and states disallowed on this role. */ prohibitedProps: ARIAPropertyMap; /* aria-* properties and states allowed on this role. */ props: ARIAPropertyMap; /* The concepts in related domains that inform behavior mappings. */ relatedConcepts: ARIARoleRelation[]; /* aria-* properties and states required on this role. */ requiredProps: ARIAPropertyMap; /* An array or super class "stacks." Each stack contains a LIFO list of * strings correspond to a super class in the inheritance chain of this * role. Roles may have more than one inheritance chain, which is why * this property is an array of arrays and not a single array. */ superClass: Array<Array<ARIAAbstractRole | ARIARole | ARIADPubRole>>; } export type ARIAState = | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-grabbed" | "aria-hidden" | "aria-invalid" | "aria-pressed" | "aria-selected"; export type ARIAProperty = | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-dropeffect" | "aria-errormessage" | "aria-flowto" | "aria-haspopup" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | ARIAState; export interface ARIAPropertyMap { "aria-busy"?: unknown | undefined; "aria-checked"?: unknown | undefined; "aria-disabled"?: unknown | undefined; "aria-expanded"?: unknown | undefined; "aria-grabbed"?: unknown | undefined; "aria-hidden"?: unknown | undefined; "aria-invalid"?: unknown | undefined; "aria-pressed"?: unknown | undefined; "aria-selected"?: unknown | undefined; "aria-activedescendant"?: unknown | undefined; "aria-atomic"?: unknown | undefined; "aria-autocomplete"?: unknown | undefined; "aria-colcount"?: unknown | undefined; "aria-colindex"?: unknown | undefined; "aria-colspan"?: unknown | undefined; "aria-controls"?: unknown | undefined; "aria-current"?: ARIAPropertyCurrent | null | undefined; "aria-describedat"?: unknown | undefined; "aria-describedby"?: unknown | undefined; "aria-details"?: unknown | undefined; "aria-dropeffect"?: unknown | undefined; "aria-errormessage"?: unknown | undefined; "aria-flowto"?: unknown | undefined; "aria-haspopup"?: unknown | undefined; "aria-keyshortcuts"?: unknown | undefined; "aria-label"?: unknown | undefined; "aria-labelledby"?: unknown | undefined; "aria-level"?: unknown | undefined; "aria-live"?: unknown | undefined; "aria-modal"?: unknown | undefined; "aria-multiline"?: unknown | undefined; "aria-multiselectable"?: unknown | undefined; "aria-orientation"?: unknown | undefined; "aria-owns"?: unknown | undefined; "aria-placeholder"?: unknown | undefined; "aria-posinset"?: unknown | undefined; "aria-readonly"?: unknown | undefined; "aria-relevant"?: unknown | undefined; "aria-required"?: unknown | undefined; "aria-roledescription"?: unknown | undefined; "aria-rowcount"?: unknown | undefined; "aria-rowindex"?: unknown | undefined; "aria-rowspan"?: unknown | undefined; "aria-setsize"?: unknown | undefined; "aria-sort"?: unknown | undefined; "aria-valuemax"?: unknown | undefined; "aria-valuemin"?: unknown | undefined; "aria-value
now"?: unknown | undefined; "aria-valuetext"?: unknown | undefined; } export interface ARIAPropertyDefinition { type: "string" | "id" | "idlist" | "integer" | "number" | "boolean" | "token" | "tokenlist" | "tristate"; values?: Array<string | boolean> | undefined; allowundefined?: boolean | undefined; } export type ARIAPropertyCurrent = "page" | "step" | "location" | "date" | "time" | "true" | "false" | true | false; export interface ARIARoleRelation { module?: string | undefined; concept?: ARIARoleRelationConcept | undefined; } /* The concept in a related domain that informs behavior mappings. * Related domains include: HTML, "Device Independence Delivery Unit", XForms, * and ARIA to name a few. */ export interface ARIARoleRelationConcept { name: string; attributes?: ARIARoleRelationConceptAttribute[] | undefined; // These constraints are drawn from the mapping between ARIA and HTML: // https://www.w3.org/TR/html-aria constraints?: | Array< | "direct descendant of document" | "direct descendant of ol, ul or menu" | "direct descendant of details element with the open attribute defined" | "descendant of table" > | undefined; } export interface ARIARoleRelationConceptAttribute { name: string; value?: string | number | undefined; // These constraints are drawn from the mapping between ARIA and HTML: // https://www.w3.org/TR/html-aria constraints?: Array<"unset" | ">1"> | undefined; }
declare namespace yargsParser { interface Arguments { /** Non-option arguments */ _: Array<string | number>; /** Arguments after the end-of-options flag `--` */ "--"?: Array<string | number>; /** All remaining options */ [argName: string]: any; } interface DetailedArguments { /** An object representing the parsed value of `args` */ argv: Arguments; /** Populated with an error object if an exception occurred during parsing. */ error: Error | null; /** The inferred list of aliases built by combining lists in opts.alias. */ aliases: { [alias: string]: string[] }; /** Any new aliases added via camel-case expansion. */ newAliases: { [alias: string]: boolean }; /** The configuration loaded from the yargs stanza in package.json. */ configuration: Configuration; } interface Configuration { /** Should variables prefixed with --no be treated as negations? Default is `true` */ "boolean-negation": boolean; /** Should hyphenated arguments be expanded into camel-case aliases? Default is `true` */ "camel-case-expansion": boolean; /** Should arrays be combined when provided by both command line arguments and a configuration file. Default is `false` */ "combine-arrays": boolean; /** Should keys that contain . be treated as objects? Default is `true` */ "dot-notation": boolean; /** Should arguments be coerced into an array when duplicated. Default is `true` */ "duplicate-arguments-array": boolean; /** Should array arguments be coerced into a single array when duplicated. Default is `true` */ "flatten-duplicate-arrays": boolean; /** Should arrays consume more than one positional argument following their flag. Default is `true` */ "greedy-arrays": boolean; /** Should nargs consume dash options as well as positional arguments. Default is `false` */ "nargs-eats-options": boolean; /** Should parsing stop at the first text argument? This is similar to how e.g. ssh parses its command line. Default is `false` */ "halt-at-non-option": boolean; /** The prefix to use for negated boolean variables. Default is `'no-'` */ "negation-prefix": string; /** Should keys that look like numbers be treated as such? Default is `true` */ "parse-numbers": boolean; /** Should positional keys that look like numbers be treated as such? Default is `true` */ "parse-positional-numbers": boolean; /** Should unparsed flags be stored in -- or _. Default is `false` */ "populate--": boolean; /** Should a placeholder be added for keys not set via the corresponding CLI argument? Default is `false` */ "set-placeholder-key": boolean; /** Should a group of short-options be treated as boolean flags? Default is `true` */ "short-option-groups": boolean; /** Should aliases be removed before returning results? Default is `false` */ "strip-aliased": boolean; /** Should dashed keys be removed before returning results? This option has no effect if camel-case-expansion is disabled. Default is `false` */ "strip-dashed": boolean; /** Should unknown options be treated like regular arguments? An unknown option is one that is not configured in opts. Default is `false` */ "unknown-options-as-args": boolean; } interface Options { /** An object representing the set of aliases for a key: `{ alias: { foo: ['f']} }`. */ alias?: { [key: string]: string | string[] } | undefined; /** * Indicate that keys should be parsed as an array: `{ array: ['foo', 'bar'] }`. * Indicate that keys should be parsed as an array and coerced to booleans / numbers: * { array: [ { key: 'foo', boolean: true }, {key: 'bar', number: true} ] }
`. */ array?: | string[] | Array<{ key: string; boolean?: boolean | undefined; number?: boolean | undefined }> | undefined; /** Arguments should be parsed as booleans: `{ boolean: ['x', 'y'] }`. */ boolean?: string[] | undefined; /** Indicate a key that represents a path to a configuration file (this file will be loaded and parsed). */ config?: string | string[] | { [key: string]: boolean } | undefined; /** Provide configuration options to the yargs-parser. */ configuration?: Partial<Configuration> | undefined; /** * Provide a custom synchronous function that returns a coerced value from the argument provided (or throws an error), e.g. * `{ coerce: { foo: function (arg) { return modifiedArg } } }`. */ coerce?: { [key: string]: (arg: any) => any } | undefined; /** Indicate a key that should be used as a counter, e.g., `-vvv = {v: 3}`. */ count?: string[] | undefined; /** Provide default values for keys: `{ default: { x: 33, y: 'hello world!' } }`. */ default?: { [key: string]: any } | undefined; /** Environment variables (`process.env`) with the prefix provided should be parsed. */ envPrefix?: string | undefined; /** Specify that a key requires n arguments: `{ narg: {x: 2} }`. */ narg?: { [key: string]: number } | undefined; /** `path.normalize()` will be applied to values set to this key. */ normalize?: string[] | undefined; /** Keys should be treated as strings (even if they resemble a number `-x 33`). */ string?: string[] | undefined; /** Keys should be treated as numbers. */ number?: string[] | undefined; } interface Parser { (argv: string | string[], opts?: Options): Arguments; detailed(argv: string | string[], opts?: Options): DetailedArguments; camelCase(str: string): string; decamelize(str: string, joinString?: string): string; looksLikeNumber(value: string | number | null | undefined): boolean; } } declare var yargsParser: yargsParser.Parser; export = yargsParser;
// disable automatic export export {}; /** * This type is only interesting if you're only using this module for a specifc build environment. * * With module augmentation you can declare what build of scheduler you are using by * augmenting this interface with e.g. `interface Build { type: 'development'; }` * Depending on the build some exported members have different types. * Possible values are `production`, `profiling` and `development`. * The default behavior for the types is to use a union of all possible types. */ // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface Build {} export type EnableSchedulerTracing = Build extends { type: infer BuildType } ? BuildType extends "production" | "profiling" ? false : BuildType extends "development" ? true : undefined : undefined; type TypeByBuildFlag< Flag extends boolean | undefined, WhenTrue, WhenFalse, > = Flag extends undefined ? (WhenTrue | WhenFalse) : Flag extends true ? WhenTrue : WhenFalse; type IfSchedulerTracing<WhenTrue, WhenFalse> = TypeByBuildFlag< EnableSchedulerTracing, WhenTrue, WhenFalse >; export interface Interaction { __count: number; id: number; name: string; timestamp: number; } export interface Subscriber { /** * A new interaction has been created via the trace() method. */ onInteractionTraced: (interaction: Interaction) => void; /** * All scheduled async work for an interaction has finished. */ onInteractionScheduledWorkCompleted: (interaction: Interaction) => void; /** * New async work has been scheduled for a set of interactions. * When this work is later run, onWorkStarted/onWorkStopped will be called. * A batch of async/yieldy work may be scheduled multiple times before completing. * In that case, onWorkScheduled may be called more than once before onWorkStopped. * Work is scheduled by a "thread" which is identified by a unique ID. */ onWorkScheduled: (interactions: Set<Interaction>, threadID: number) => void; /** * A batch of scheduled work has been canceled. * Work is done by a "thread" which is identified by a unique ID. */ onWorkCanceled: (interactions: Set<Interaction>, threadID: number) => void; /** * A batch of work has started for a set of interactions. * When this work is complete, onWorkStopped will be called. * Work is not always completed synchronously; yielding may occur in between. * A batch of async/yieldy work may also be re-started before completing. * In that case, onWorkStarted may be called more than once before onWorkStopped. * Work is done by a "thread" which is identified by a unique ID. */ onWorkStarted: (interactions: Set<Interaction>, threadID: number) => void; /** * A batch of work has completed for a set of interactions. * Work is done by a "thread" which is identified by a unique ID. */ onWorkStopped: (interactions: Set<Interaction>, threadID: number) => void; } export interface InteractionsRef { current: Set<Interaction>; } export interface SubscriberRef { current: Subscriber | null; } export const __interactionsRef: IfSchedulerTracing<InteractionsRef, null>; export const __subscriberRef: IfSchedulerTracing<SubscriberRef, null>; export function unstable_clear<T>(callback: () => T): T; export function unstable_getCurrent(): Set<Interaction> | null; export function unstable_getThreadID(): number; export function unstable_trace<T>( name: string, timestamp: number, callback: () => T, threadID?: number, ): T; export type WrappedFunction<T extends (...args: any[]) => any> = T & { cancel: () => void; }; /** * The callback is immediately returned if the enableSchedulerTracing is disabled. * It is unclear for which bundles this is the case. * * @param callback * @param threadID */ export function unstable_wrap<T extends (
...args: any[]) => any>( callback: T, threadID?: number, ): IfSchedulerTracing<WrappedFunction<T>, T>; export function unstable_subscribe(subscriber: Subscriber): void; export function unstable_unsubscribe(subscriber: Subscriber): void;
import { CoverageMap, CoverageSummary, FileCoverage } from "istanbul-lib-coverage"; /** * returns a reporting context for the supplied options */ export function createContext(options?: Partial<ContextOptions>): Context; /** * returns the default watermarks that would be used when not * overridden */ export function getDefaultWatermarks(): Watermarks; export class ReportBase { constructor(options?: Partial<ReportBaseOptions>); execute(context: Context): void; } export interface ReportBaseOptions { summarizer: Summarizers; } export type Summarizers = "flat" | "nested" | "pkg" | "defaultSummarizer"; export interface ContextOptions { coverageMap: CoverageMap; defaultSummarizer: Summarizers; dir: string; watermarks: Partial<Watermarks>; sourceFinder(filepath: string): string; } export interface Context { data: any; dir: string; sourceFinder(filepath: string): string; watermarks: Watermarks; writer: FileWriter; /** * returns the coverage class given a coverage * types and a percentage value. */ classForPercent(type: keyof Watermarks, value: number): string; /** * returns the source code for the specified file path or throws if * the source could not be found. */ getSource(filepath: string): string; getTree(summarizer?: Summarizers): Tree; /** * returns a full visitor given a partial one. */ getVisitor<N extends Node = Node>(visitor: Partial<Visitor<N>>): Visitor<N>; /** * returns a FileWriter implementation for reporting use. Also available * as the `writer` property on the context. */ getWriter(): FileWriter; /** * returns an XML writer for the supplied content writer */ getXmlWriter(contentWriter: ContentWriter): XmlWriter; } /** * Base class for writing content */ export class ContentWriter { /** * returns the colorized version of a string. Typically, * content writers that write to files will return the * same string and ones writing to a tty will wrap it in * appropriate escape sequences. */ colorize(str: string, clazz?: string): string; /** * writes a string appended with a newline to the destination */ println(str: string): void; /** * closes this content writer. Should be called after all writes are complete. */ close(): void; } /** * a content writer that writes to a file */ export class FileContentWriter extends ContentWriter { constructor(fileDescriptor: number); write(str: string): void; } /** * a content writer that writes to the console */ export class ConsoleWriter extends ContentWriter { write(str: string): void; } /** * utility for writing files under a specific directory */ export class FileWriter { constructor(baseDir: string); static startCapture(): void; static stopCapture(): void; static getOutput(): string; static resetOutput(): void; /** * returns a FileWriter that is rooted at the supplied subdirectory */ writeForDir(subdir: string): FileWriter; /** * copies a file from a source directory to a destination name */ copyFile(source: string, dest: string, header?: string): void; /** * returns a content writer for writing content to the supplied file. */ writeFile(file: string | null): ContentWriter; } export interface XmlWriter { indent(str: string): string; /** * writes the opening XML tag with the supplied attributes */ openTag(name: string, attrs?: any): void; /** * closes an open XML tag. */ closeTag(name: string): void; /** * writes a tag and its value opening and closing it at the same time */ inlineTag(name: string, attrs?: any, content?: string): void; /** * closes all open tags and ends the document */ closeAll(): void; } export type Watermark = [number, number]; export interface Watermarks {
statements: Watermark; functions: Watermark; branches: Watermark; lines: Watermark; } export interface Node { isRoot(): boolean; visit(visitor: Visitor, state: any): void; } export interface ReportNode extends Node { path: string; parent: ReportNode | null; fileCoverage: FileCoverage; children: ReportNode[]; addChild(child: ReportNode): void; asRelative(p: string): string; getQualifiedName(): string; getRelativeName(): string; getParent(): Node; getChildren(): Node[]; isSummary(): boolean; getFileCoverage(): FileCoverage; getCoverageSummary(filesOnly: boolean): CoverageSummary; visit(visitor: Visitor<ReportNode>, state: any): void; } export interface Visitor<N extends Node = Node> { onStart(root: N, state: any): void; onSummary(root: N, state: any): void; onDetail(root: N, state: any): void; onSummaryEnd(root: N, state: any): void; onEnd(root: N, state: any): void; } export interface Tree<N extends Node = Node> { getRoot(): N; visit(visitor: Partial<Visitor<N>>, state: any): void; }
/** * These are types for things that are present in the upcoming React 18 release. * * Once React 18 is released they can just be moved to the main index file. * * To load the types declared here in an actual project, there are three ways. The easiest one, * if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section, * is to add `"react-dom/canary"` to the `"types"` array. * * Alternatively, a specific import syntax can to be used from a typescript file. * This module does not exist in reality, which is why the {} is important: * * ```ts * import {} from 'react-dom/canary' * ``` * * It is also possible to include it through a triple-slash reference: * * ```ts * /// <reference types="react-dom/canary" /> * ``` * * Either the import or the reference only needs to appear once, anywhere in the project. */ // See https://github.com/facebook/react/blob/main/packages/react-dom/index.js to see how the exports are declared, // but confirm with published source code (e.g. https://unpkg.com/react-dom@canary) that these exports end up in the published code import React = require("react"); import ReactDOM = require("."); export {}; declare const REACT_FORM_STATE_SIGIL: unique symbol; declare module "." { function prefetchDNS(href: string): void; interface PreconnectOptions { // Don't create a helper type. // It would have to be in module scope to be inlined in TS tooltips. // But then it becomes part of the public API. // TODO: Upstream to microsoft/TypeScript-DOM-lib-generator -> w3c/webref // since the spec has a notion of a dedicated type: https://html.spec.whatwg.org/multipage/urls-and-fetching.html#cors-settings-attribute crossOrigin?: "anonymous" | "use-credentials" | "" | undefined; } function preconnect(href: string, options?: PreconnectOptions): void; type PreloadAs = | "audio" | "document" | "embed" | "fetch" | "font" | "image" | "object" | "track" | "script" | "style" | "video" | "worker"; interface PreloadOptions { as: PreloadAs; crossOrigin?: "anonymous" | "use-credentials" | "" | undefined; fetchPriority?: "high" | "low" | "auto" | undefined; // TODO: These should only be allowed with `as: 'image'` but it's not trivial to write tests against the full TS support matrix. imageSizes?: string | undefined; imageSrcSet?: string | undefined; integrity?: string | undefined; nonce?: string | undefined; referrerPolicy?: ReferrerPolicy | undefined; } function preload(href: string, options?: PreloadOptions): void; // https://html.spec.whatwg.org/multipage/links.html#link-type-modulepreload type PreloadModuleAs = RequestDestination; interface PreloadModuleOptions { /** * @default "script" */ as: PreloadModuleAs; crossOrigin?: "anonymous" | "use-credentials" | "" | undefined; integrity?: string | undefined; nonce?: string | undefined; } function preloadModule(href: string, options?: PreloadModuleOptions): void; type PreinitAs = "script" | "style"; interface PreinitOptions { as: PreinitAs; crossOrigin?: "anonymous" | "use-credentials" | "" | undefined; fetchPriority?: "high" | "low" | "auto" | undefined; precedence?: string | undefined; integrity?: string | undefined; nonce?: string | undefined; } function preinit(href: string, options?: PreinitOptions): void; // Will be expanded to include all of https://github.com/tc39/proposal-import-attributes type PreinitModuleAs = "script"; interface PreinitModuleOptions { /** * @default "script" */ as?: PreinitModuleAs; crossOrigin?: "anonymous" | "use-credentials" | "" | undefined; integrity?:
string | undefined; nonce?: string | undefined; } function preinitModule(href: string, options?: PreinitModuleOptions): void; interface FormStatusNotPending { pending: false; data: null; method: null; action: null; } interface FormStatusPending { pending: true; data: FormData; method: string; action: string | ((formData: FormData) => void | Promise<void>); } type FormStatus = FormStatusPending | FormStatusNotPending; function useFormStatus(): FormStatus; function useFormState<State>( action: (state: Awaited<State>) => State | Promise<State>, initialState: Awaited<State>, permalink?: string, ): [state: Awaited<State>, dispatch: () => void]; function useFormState<State, Payload>( action: (state: Awaited<State>, payload: Payload) => State | Promise<State>, initialState: Awaited<State>, permalink?: string, ): [state: Awaited<State>, dispatch: (payload: Payload) => void]; } declare module "./client" { interface ReactFormState { [REACT_FORM_STATE_SIGIL]: never; } interface HydrationOptions { formState?: ReactFormState | null; } }
/** * These are types for things that are present in the `experimental` builds of React but not yet * on a stable build. * * Once they are promoted to stable they can just be moved to the main index file. * * To load the types declared here in an actual project, there are three ways. The easiest one, * if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section, * is to add `"react-dom/experimental"` to the `"types"` array. * * Alternatively, a specific import syntax can to be used from a typescript file. * This module does not exist in reality, which is why the {} is important: * * ```ts * import {} from 'react-dom/experimental' * ``` * * It is also possible to include it through a triple-slash reference: * * ```ts * /// <reference types="react-dom/experimental" /> * ``` * * Either the import or the reference only needs to appear once, anywhere in the project. */ // See https://github.com/facebook/react/blob/main/packages/react-dom/index.experimental.js to see how the exports are declared, // but confirm with published source code (e.g. https://unpkg.com/react-dom@experimental) that these exports end up in the published code import React = require("react"); import ReactDOM = require("./canary"); export {}; declare module "." { }
// NOTE: Users of the `experimental` builds of React should add a reference // to 'react-dom/experimental' in their project. See experimental.d.ts's top comment // for reference and documentation on how exactly to do it. export as namespace ReactDOM; import { CElement, Component, ComponentState, DOMAttributes, DOMElement, FunctionComponentElement, ReactElement, ReactInstance, ReactNode, ReactPortal, } from "react"; export function findDOMNode(instance: ReactInstance | null | undefined): Element | null | Text; export function unmountComponentAtNode(container: Element | DocumentFragment): boolean; export function createPortal( children: ReactNode, container: Element | DocumentFragment, key?: null | string, ): ReactPortal; export const version: string; export const render: Renderer; export const hydrate: Renderer; export function flushSync<R>(fn: () => R): R; export function flushSync<A, R>(fn: (a: A) => R, a: A): R; export function unstable_batchedUpdates<A, R>(callback: (a: A) => R, a: A): R; export function unstable_batchedUpdates<R>(callback: () => R): R; export function unstable_renderSubtreeIntoContainer<T extends Element>( parentComponent: Component<any>, element: DOMElement<DOMAttributes<T>, T>, container: Element, callback?: (element: T) => any, ): T; export function unstable_renderSubtreeIntoContainer<P, T extends Component<P, ComponentState>>( parentComponent: Component<any>, element: CElement<P, T>, container: Element, callback?: (component: T) => any, ): T; export function unstable_renderSubtreeIntoContainer<P>( parentComponent: Component<any>, element: ReactElement<P>, container: Element, callback?: (component?: Component<P, ComponentState> | Element) => any, // eslint-disable-next-line @typescript-eslint/no-invalid-void-type ): Component<P, ComponentState> | Element | void; export type Container = Element | Document | DocumentFragment; export interface Renderer { // Deprecated(render): The return value is deprecated. // In future releases the render function's return type will be void. <T extends Element>( element: DOMElement<DOMAttributes<T>, T>, container: Container | null, callback?: () => void, ): T; ( element: Array<DOMElement<DOMAttributes<any>, any>>, container: Container | null, callback?: () => void, ): Element; ( element: FunctionComponentElement<any> | Array<FunctionComponentElement<any>>, container: Container | null, callback?: () => void, ): void; <P, T extends Component<P, ComponentState>>( element: CElement<P, T>, container: Container | null, callback?: () => void, ): T; ( element: Array<CElement<any, Component<any, ComponentState>>>, container: Container | null, callback?: () => void, ): Component<any, ComponentState>; <P>( element: ReactElement<P>, container: Container | null, callback?: () => void, // eslint-disable-next-line @typescript-eslint/no-invalid-void-type ): Component<P, ComponentState> | Element | void; ( element: ReactElement[], container: Container | null, callback?: () => void, // eslint-disable-next-line @typescript-eslint/no-invalid-void-type ): Component<any, ComponentState> | Element | void; }
/** * WARNING: This entrypoint is only available starting with `react-dom@18.0.0-rc.1` */ // See https://github.com/facebook/react/blob/main/packages/react-dom/client.js to see how the exports are declared, import React = require("react"); export interface HydrationOptions { /** * Prefix for `useId`. */ identifierPrefix?: string; onRecoverableError?: (error: unknown, errorInfo: ErrorInfo) => void; } export interface RootOptions { /** * Prefix for `useId`. */ identifierPrefix?: string; onRecoverableError?: (error: unknown, errorInfo: ErrorInfo) => void; } export interface ErrorInfo { digest?: string; componentStack?: string; } export interface Root { render(children: React.ReactNode): void; unmount(): void; } /** * Replaces `ReactDOM.render` when the `.render` method is called and enables Concurrent Mode. * * @see https://reactjs.org/docs/concurrent-mode-reference.html#createroot */ export function createRoot(container: Element | DocumentFragment, options?: RootOptions): Root; /** * Same as `createRoot()`, but is used to hydrate a container whose HTML contents were rendered by ReactDOMServer. * * React will attempt to attach event listeners to the existing markup. * * **Example Usage** * * ```jsx * hydrateRoot(document.querySelector('#root'), <App />) * ``` * * @see https://reactjs.org/docs/react-dom-client.html#hydrateroot */ export function hydrateRoot( container: Element | Document, initialChildren: React.ReactNode, options?: HydrationOptions, ): Root;
import { AbstractView, CElement, ClassType, Component, ComponentClass, DOMAttributes, DOMElement, FC, FunctionComponentElement, ReactElement, ReactHTMLElement, ReactInstance, } from "react"; import * as ReactTestUtils from "."; export {}; export interface OptionalEventProperties { bubbles?: boolean | undefined; cancelable?: boolean | undefined; currentTarget?: EventTarget | undefined; defaultPrevented?: boolean | undefined; eventPhase?: number | undefined; isTrusted?: boolean | undefined; nativeEvent?: Event | undefined; preventDefault?(): void; stopPropagation?(): void; target?: EventTarget | undefined; timeStamp?: Date | undefined; type?: string | undefined; } export type ModifierKey = | "Alt" | "AltGraph" | "CapsLock" | "Control" | "Fn" | "FnLock" | "Hyper" | "Meta" | "NumLock" | "ScrollLock" | "Shift" | "Super" | "Symbol" | "SymbolLock"; export interface SyntheticEventData extends OptionalEventProperties { altKey?: boolean | undefined; button?: number | undefined; buttons?: number | undefined; clientX?: number | undefined; clientY?: number | undefined; changedTouches?: TouchList | undefined; charCode?: number | undefined; clipboardData?: DataTransfer | undefined; ctrlKey?: boolean | undefined; deltaMode?: number | undefined; deltaX?: number | undefined; deltaY?: number | undefined; deltaZ?: number | undefined; detail?: number | undefined; getModifierState?(key: ModifierKey): boolean; key?: string | undefined; keyCode?: number | undefined; locale?: string | undefined; location?: number | undefined; metaKey?: boolean | undefined; pageX?: number | undefined; pageY?: number | undefined; relatedTarget?: EventTarget | undefined; repeat?: boolean | undefined; screenX?: number | undefined; screenY?: number | undefined; shiftKey?: boolean | undefined; targetTouches?: TouchList | undefined; touches?: TouchList | undefined; view?: AbstractView | undefined; which?: number | undefined; } export type EventSimulator = (element: Element | Component<any>, eventData?: SyntheticEventData) => void; export interface MockedComponentClass { new(props: any): any; } export interface ShallowRenderer { /** * After `shallowRenderer.render()` has been called, returns shallowly rendered output. */ getRenderOutput<E extends ReactElement>(): E; /** * Similar to `ReactDOM.render` but it doesn't require DOM and only renders a single level deep. */ render(element: ReactElement, context?: any): void; unmount(): void; } /** * Simulate an event dispatch on a DOM node with optional `eventData` event data. * `Simulate` has a method for every event that React understands. */ export namespace Simulate { const abort: EventSimulator; const animationEnd: EventSimulator; const animationIteration: EventSimulator; const animationStart: EventSimulator; const blur: EventSimulator; const cancel: EventSimulator; const canPlay: EventSimulator; const canPlayThrough: EventSimulator; const change: EventSimulator; const click: EventSimulator; const close: EventSimulator; const compositionEnd: EventSimulator; const compositionStart: EventSimulator; const compositionUpdate: EventSimulator; const contextMenu: EventSimulator; const copy: EventSimulator; const cut: EventSimulator; const auxClick: EventSimulator; const doubleClick: EventSimulator; const drag: EventSimulator; const dragEnd: EventSimulator; const dragEnter: EventSimulator; const dragExit: EventSimulator; const dragLeave: EventSimulator; const dragOver: EventSimulator; const dragStart: EventSimulator; const drop: EventSimulator; const durationChange: EventSimulator; const emptied:
EventSimulator; const encrypted: EventSimulator; const ended: EventSimulator; const error: EventSimulator; const focus: EventSimulator; const input: EventSimulator; const invalid: EventSimulator; const keyDown: EventSimulator; const keyPress: EventSimulator; const keyUp: EventSimulator; const load: EventSimulator; const loadStart: EventSimulator; const loadedData: EventSimulator; const loadedMetadata: EventSimulator; const mouseDown: EventSimulator; const mouseEnter: EventSimulator; const mouseLeave: EventSimulator; const mouseMove: EventSimulator; const mouseOut: EventSimulator; const mouseOver: EventSimulator; const mouseUp: EventSimulator; const paste: EventSimulator; const pause: EventSimulator; const play: EventSimulator; const playing: EventSimulator; const progress: EventSimulator; const pointerCancel: EventSimulator; const pointerDown: EventSimulator; const pointerUp: EventSimulator; const pointerMove: EventSimulator; const pointerOut: EventSimulator; const pointerOver: EventSimulator; const pointerEnter: EventSimulator; const pointerLeave: EventSimulator; const gotPointerCapture: EventSimulator; const lostPointerCapture: EventSimulator; const rateChange: EventSimulator; const reset: EventSimulator; const resize: EventSimulator; const scroll: EventSimulator; const toggle: EventSimulator; const seeked: EventSimulator; const seeking: EventSimulator; const select: EventSimulator; const beforeInput: EventSimulator; const stalled: EventSimulator; const submit: EventSimulator; const suspend: EventSimulator; const timeUpdate: EventSimulator; const touchCancel: EventSimulator; const touchEnd: EventSimulator; const touchMove: EventSimulator; const touchStart: EventSimulator; const transitionEnd: EventSimulator; const volumeChange: EventSimulator; const waiting: EventSimulator; const wheel: EventSimulator; } /** * Render a React element into a detached DOM node in the document. __This function requires a DOM__. */ export function renderIntoDocument<T extends Element>( element: DOMElement<any, T>, ): T; export function renderIntoDocument( element: FunctionComponentElement<any>, ): void; // If we replace `P` with `any` in this overload, then some tests fail because // calls to `renderIntoDocument` choose the last overload on the // subtype-relation pass and get an undesirably broad return type. Using `P` // allows this overload to match on the subtype-relation pass. export function renderIntoDocument<P, T extends Component<P>>( element: CElement<P, T>, ): T; export function renderIntoDocument<P>( element: ReactElement<P>, ): Component<P> | Element | void; /** * Pass a mocked component module to this method to augment it with useful methods that allow it to * be used as a dummy React component. Instead of rendering as usual, the component will become * a simple `<div>` (or other tag if `mockTagName` is provided) containing any provided children. */ export function mockComponent( mocked: MockedComponentClass, mockTagName?: string, ): typeof ReactTestUtils; /** * Returns `true` if `element` is any React element. */ export function isElement(element: any): boolean; /** * Returns `true` if `element` is a React element whose type is of a React `componentClass`. */ export function isElementOfType<T extends HTMLElement>( element: ReactElement, type: string, ): element is ReactHTMLElement<T>; /** * Returns `true` if `element` is a React element whose type is of a React `componentClass`. */ export function isElementOfType<P extends DOMAttributes<{}>, T extends Element>( element: ReactElement, type: string, ): element is DOMElement<P, T>; /** * Returns `true` if `element` is a React element whose type is of a React `componentClass`. */ export function isElementOfT
ype<P>( element: ReactElement, type: FC<P>, ): element is FunctionComponentElement<P>; /** * Returns `true` if `element` is a React element whose type is of a React `componentClass`. */ export function isElementOfType<P, T extends Component<P>, C extends ComponentClass<P>>( element: ReactElement, type: ClassType<P, T, C>, ): element is CElement<P, T>; /** * Returns `true` if `instance` is a DOM component (such as a `<div>` or `<span>`). */ export function isDOMComponent(instance: ReactInstance): instance is Element; /** * Returns `true` if `instance` is a user-defined component, such as a class or a function. */ export function isCompositeComponent(instance: ReactInstance): instance is Component<any>; /** * Returns `true` if `instance` is a component whose type is of a React `componentClass`. */ export function isCompositeComponentWithType<T extends Component<any>, C extends ComponentClass<any>>( instance: ReactInstance, type: ClassType<any, T, C>, ): boolean; /** * Traverse all components in `tree` and accumulate all components where * `test(component)` is `true`. This is not that useful on its own, but it's used * as a primitive for other test utils. */ export function findAllInRenderedTree( root: Component<any>, fn: (i: ReactInstance) => boolean, ): ReactInstance[]; /** * Finds all DOM elements of components in the rendered tree that are * DOM components with the class name matching `className`. */ export function scryRenderedDOMComponentsWithClass( root: Component<any>, className: string, ): Element[]; /** * Like `scryRenderedDOMComponentsWithClass()` but expects there to be one result, * and returns that one result, or throws exception if there is any other * number of matches besides one. */ export function findRenderedDOMComponentWithClass( root: Component<any>, className: string, ): Element; /** * Finds all DOM elements of components in the rendered tree that are * DOM components with the tag name matching `tagName`. */ export function scryRenderedDOMComponentsWithTag( root: Component<any>, tagName: string, ): Element[]; /** * Like `scryRenderedDOMComponentsWithTag()` but expects there to be one result, * and returns that one result, or throws exception if there is any other * number of matches besides one. */ export function findRenderedDOMComponentWithTag( root: Component<any>, tagName: string, ): Element; /** * Finds all instances of components with type equal to `componentClass`. */ export function scryRenderedComponentsWithType<T extends Component<any>, C extends ComponentClass<any>>( root: Component<any>, type: ClassType<any, T, C>, ): T[]; /** * Same as `scryRenderedComponentsWithType()` but expects there to be one result * and returns that one result, or throws exception if there is any other * number of matches besides one. */ export function findRenderedComponentWithType<T extends Component<any>, C extends ComponentClass<any>>( root: Component<any>, type: ClassType<any, T, C>, ): T; /** * Call this in your tests to create a shallow renderer. */ export function createRenderer(): ShallowRenderer; /** * Wrap any code rendering and triggering updates to your components into `act()` calls. * * Ensures that the behavior in your tests matches what happens in the browser * more closely by executing pending `useEffect`s before returning. This also * reduces the amount of re-renders done. * * @param callback A synchronous, void callback that will execute as a single, complete React commit. * * @see https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks */ // NOTES // - the order of these signatures matters - typescript will check the signatures in source order. // If the `() => VoidOrUndefinedOnly` signature is first, it'll erroneously match a Promise returning function for users with // `strictNullChecks: false`. // - VoidOrUndefinedOnly is there to forbid any non-void r
eturn values for users with `strictNullChecks: true` declare const UNDEFINED_VOID_ONLY: unique symbol; // eslint-disable-next-line @typescript-eslint/no-invalid-void-type type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never }; // While act does always return Thenable, if a void function is passed, we pretend the return value is also void to not trigger dangling Promise lint rules. export function act(callback: () => VoidOrUndefinedOnly): void; export function act<T>(callback: () => T | Promise<T>): Promise<T>; // Intentionally doesn't extend PromiseLike<never>. // Ideally this should be as hard to accidentally use as possible. export interface DebugPromiseLike { // the actual then() in here is 0-ary, but that doesn't count as a PromiseLike. then(onfulfilled: (value: never) => never, onrejected: (reason: never) => never): never; }
import Range = require("../classes/range"); import SemVer = require("../classes/semver"); import semver = require("../index"); /** * Return the lowest version that can possibly match the given range. */ declare function minVersion(range: string | Range, optionsOrLoose?: boolean | semver.Options): SemVer | null; export = minVersion;
import Range = require("../classes/range"); import SemVer = require("../classes/semver"); import semver = require("../index"); /** * Return true if the version is outside the bounds of the range in either the high or low direction. * The hilo argument must be either the string '>' or '<'. (This is the function called by gtr and ltr.) */ declare function outside( version: string | SemVer, range: string | Range, hilo: ">" | "<", optionsOrLoose?: boolean | semver.RangeOptions, ): boolean; export = outside;
import Range = require("../classes/range"); import SemVer = require("../classes/semver"); import semver = require("../index"); /** * Return the lowest version in the list that satisfies the range, or null if none of them do. */ declare function minSatisfying<T extends string | SemVer>( versions: readonly T[], range: string | Range, optionsOrLoose?: boolean | semver.RangeOptions, ): T | null; export = minSatisfying;
import Range = require("../classes/range"); import semver = require("../index"); /** * Mostly just for testing and legacy API reasons */ declare function toComparators(range: string | Range, optionsOrLoose?: boolean | semver.Options): string[][]; export = toComparators;
import Range = require("../classes/range"); import semver = require("../index"); /** * Return a "simplified" range that matches the same items in `versions` list as the range specified. * Note that it does *not* guarantee that it would match the same versions in all cases, * only for the set of versions provided. * This is useful when generating ranges by joining together multiple versions with `||` programmatically, * to provide the user with something a bit more ergonomic. * If the provided range is shorter in string-length than the generated range, then that is returned. */ declare function simplify(ranges: string[], range: string | Range, options?: semver.Options): string | Range; export = simplify;
import Range = require("../classes/range"); import SemVer = require("../classes/semver"); import semver = require("../index"); /** * Return the highest version in the list that satisfies the range, or null if none of them do. */ declare function maxSatisfying<T extends string | SemVer>( versions: readonly T[], range: string | Range, optionsOrLoose?: boolean | semver.RangeOptions, ): T | null; export = maxSatisfying;
import Range = require("../classes/range"); import SemVer = require("../classes/semver"); import semver = require("../index"); /** * Return true if version is less than all the versions possible in the range. */ declare function ltr( version: string | SemVer, range: string | Range, optionsOrLoose?: boolean | semver.RangeOptions, ): boolean; export = ltr;
import Range = require("../classes/range"); import semver = require("../index"); /** * Return the valid range or null if it's not valid */ declare function validRange( range: string | Range | null | undefined, optionsOrLoose?: boolean | semver.RangeOptions, ): string | null; export = validRange;
import Range = require("../classes/range"); import semver = require("../index"); /** * Return true if any of the ranges comparators intersect */ declare function intersects( range1: string | Range, range2: string | Range, optionsOrLoose?: boolean | semver.RangeOptions, ): boolean; export = intersects;
import Range = require("../classes/range"); import semver = require("../index"); /** * Return true if the subRange range is entirely contained by the superRange range. */ declare function subset(sub: string | Range, dom: string | Range, options?: semver.RangeOptions): boolean; export = subset;
import Range = require("../classes/range"); import SemVer = require("../classes/semver"); import semver = require("../index"); /** * Return true if version is greater than all the versions possible in the range. */ declare function gtr( version: string | SemVer, range: string | Range, optionsOrLoose?: boolean | semver.RangeOptions, ): boolean; export = gtr;
import semver = require("../index"); import SemVer = require("./semver"); declare class Comparator { constructor(comp: string | Comparator, optionsOrLoose?: boolean | semver.Options); semver: SemVer; operator: "" | "=" | "<" | ">" | "<=" | ">="; value: string; loose: boolean; options: semver.Options; parse(comp: string): void; test(version: string | SemVer): boolean; intersects(comp: Comparator, optionsOrLoose?: boolean | semver.Options): boolean; } export = Comparator;
import semver = require("../index"); import Comparator = require("./comparator"); import SemVer = require("./semver"); declare class Range { constructor(range: string | Range, optionsOrLoose?: boolean | semver.RangeOptions); range: string; raw: string; loose: boolean; options: semver.Options; includePrerelease: boolean; format(): string; inspect(): string; set: ReadonlyArray<readonly Comparator[]>; parseRange(range: string): readonly Comparator[]; test(version: string | SemVer): boolean; intersects(range: Range, optionsOrLoose?: boolean | semver.Options): boolean; } export = Range;
import semver = require("../index"); declare class SemVer { constructor(version: string | SemVer, optionsOrLoose?: boolean | semver.RangeOptions); raw: string; loose: boolean; options: semver.Options; format(): string; inspect(): string; major: number; minor: number; patch: number; version: string; build: readonly string[]; prerelease: ReadonlyArray<string | number>; /** * Compares two versions excluding build identifiers (the bit after `+` in the semantic version string). * * @return * - `0` if `this` == `other` * - `1` if `this` is greater * - `-1` if `other` is greater. */ compare(other: string | SemVer): 1 | 0 | -1; /** * Compares the release portion of two versions. * * @return * - `0` if `this` == `other` * - `1` if `this` is greater * - `-1` if `other` is greater. */ compareMain(other: string | SemVer): 1 | 0 | -1; /** * Compares the prerelease portion of two versions. * * @return * - `0` if `this` == `other` * - `1` if `this` is greater * - `-1` if `other` is greater. */ comparePre(other: string | SemVer): 1 | 0 | -1; /** * Compares the build identifier of two versions. * * @return * - `0` if `this` == `other` * - `1` if `this` is greater * - `-1` if `other` is greater. */ compareBuild(other: string | SemVer): 1 | 0 | -1; inc(release: semver.ReleaseType, identifier?: string): SemVer; toString(): string; } export = SemVer;
/** * Compares two identifiers, must be numeric strings or truthy/falsy values. * * Sorts in ascending order when passed to `Array.sort()`. */ export function compareIdentifiers(a: string | null | undefined, b: string | null | undefined): 1 | 0 | -1; /** * The reverse of compareIdentifiers. * * Sorts in descending order when passed to `Array.sort()`. */ export function rcompareIdentifiers(a: string | null | undefined, b: string | null | undefined): 1 | 0 | -1;
import semver = require("../index"); import SemVer = require("../classes/semver"); /** * Returns difference between two versions by the release type (major, premajor, minor, preminor, patch, prepatch, or prerelease), or null if the versions are the same. */ declare function diff(v1: string | SemVer, v2: string | SemVer): semver.ReleaseType | null; export = diff;
import SemVer = require("../classes/semver"); import semver = require("../index"); /** * v1 < v2 */ declare function lt(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | semver.Options): boolean; export = lt;
import semver = require("../index"); import SemVer = require("../classes/semver"); /** * Coerces a string to SemVer if possible */ declare function coerce( version: string | number | SemVer | null | undefined, options?: semver.CoerceOptions, ): SemVer | null; export = coerce;
import semver = require("../index"); import SemVer = require("../classes/semver"); /** * Pass in a comparison string, and it'll call the corresponding semver comparison function. * "===" and "!==" do simple string comparison, but are included for completeness. * Throws if an invalid comparison string is provided. */ declare function cmp( v1: string | SemVer, operator: semver.Operator, v2: string | SemVer, optionsOrLoose?: boolean | semver.Options, ): boolean; export = cmp;
import SemVer = require("../classes/semver"); import semver = require("../index"); /** * v1 == v2 This is true if they're logically equivalent, even if they're not the exact same string. You already know how to compare strings. */ declare function eq(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | semver.Options): boolean; export = eq;
import SemVer = require("../classes/semver"); import semver = require("../index"); /** * Sorts an array of semver entries in descending order using `compareBuild()`. */ declare function rsort<T extends string | SemVer>(list: T[], optionsOrLoose?: boolean | semver.Options): T[]; export = rsort;
import SemVer = require("../classes/semver"); import semver = require("../index"); /** * v1 != v2 The opposite of eq. */ declare function neq(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | semver.Options): boolean; export = neq;
import SemVer = require("../classes/semver"); import semver = require("../index"); /** * Return the minor version number. */ declare function minor(version: string | SemVer, optionsOrLoose?: boolean | semver.Options): number; export = minor;
import SemVer = require("../classes/semver"); import semver = require("../index"); /** * v1 >= v2 */ declare function gte(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | semver.Options): boolean; export = gte;
import semver = require("../index"); import SemVer = require("../classes/semver"); /** * Return the parsed version as a string, or null if it's not valid. */ declare function valid( version: string | SemVer | null | undefined, optionsOrLoose?: boolean | semver.Options, ): string | null; export = valid;
import semver = require("../index"); import SemVer = require("../classes/semver"); /** * Compares two versions including build identifiers (the bit after `+` in the semantic version string). * * Sorts in ascending order when passed to `Array.sort()`. * * @return * - `0` if `v1` == `v2` * - `1` if `v1` is greater * - `-1` if `v2` is greater. * * @since 6.1.0 */ declare function compareBuild( a: string | SemVer, b: string | SemVer, optionsOrLoose?: boolean | semver.Options, ): 1 | 0 | -1; export = compareBuild;
import Range = require("../classes/range"); import SemVer = require("../classes/semver"); import semver = require("../index"); /** * Return true if the version satisfies the range. */ declare function satisfies( version: string | SemVer, range: string | Range, optionsOrLoose?: boolean | semver.RangeOptions, ): boolean; export = satisfies;
import SemVer = require("../classes/semver"); import semver = require("../index"); /** * Returns an array of prerelease components, or null if none exist. */ declare function prerelease( version: string | SemVer, optionsOrLoose?: boolean | semver.Options, ): ReadonlyArray<string | number> | null; export = prerelease;
import SemVer = require("../classes/semver"); import semver = require("../index"); /** * v1 <= v2 */ declare function lte(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | semver.Options): boolean; export = lte;
import SemVer = require("../classes/semver"); import semver = require("../index"); /** * The reverse of compare. * * Sorts in descending order when passed to `Array.sort()`. */ declare function rcompare( v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | semver.Options, ): 1 | 0 | -1; export = rcompare;
import SemVer = require("../classes/semver"); import semver = require("../index"); /** * v1 > v2 */ declare function gt(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | semver.Options): boolean; export = gt;
import SemVer = require("../classes/semver"); declare function compareLoose(v1: string | SemVer, v2: string | SemVer): 1 | 0 | -1; export = compareLoose;
import SemVer = require("../classes/semver"); import semver = require("../index"); /** * Return the patch version number. */ declare function patch(version: string | SemVer, optionsOrLoose?: boolean | semver.Options): number; export = patch;
import semver = require("../index"); import SemVer = require("../classes/semver"); /** * Compares two versions excluding build identifiers (the bit after `+` in the semantic version string). * * Sorts in ascending order when passed to `Array.sort()`. * * @return * - `0` if `v1` == `v2` * - `1` if `v1` is greater * - `-1` if `v2` is greater. */ declare function compare( v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | semver.Options, ): 1 | 0 | -1; export = compare;
import SemVer = require("../classes/semver"); import semver = require("../index"); /** * Sorts an array of semver entries in ascending order using `compareBuild()`. */ declare function sort<T extends string | SemVer>(list: T[], optionsOrLoose?: boolean | semver.Options): T[]; export = sort;
export interface CoverageSummaryData { lines: Totals; statements: Totals; branches: Totals; functions: Totals; } export class CoverageSummary { constructor(data: CoverageSummary | CoverageSummaryData); merge(obj: CoverageSummary): CoverageSummary; toJSON(): CoverageSummaryData; isEmpty(): boolean; data: CoverageSummaryData; lines: Totals; statements: Totals; branches: Totals; functions: Totals; } export interface CoverageMapData { [key: string]: FileCoverage | FileCoverageData; } export class CoverageMap { constructor(data: CoverageMapData | CoverageMap); addFileCoverage(pathOrObject: string | FileCoverage | FileCoverageData): void; files(): string[]; fileCoverageFor(filename: string): FileCoverage; filter(callback: (key: string) => boolean): void; getCoverageSummary(): CoverageSummary; merge(data: CoverageMapData | CoverageMap): void; toJSON(): CoverageMapData; data: CoverageMapData; } export interface Location { line: number; column: number; } export interface Range { start: Location; end: Location; } export interface BranchMapping { loc: Range; type: string; locations: Range[]; line: number; } export interface FunctionMapping { name: string; decl: Range; loc: Range; line: number; } export interface FileCoverageData { path: string; statementMap: { [key: string]: Range }; fnMap: { [key: string]: FunctionMapping }; branchMap: { [key: string]: BranchMapping }; s: { [key: string]: number }; f: { [key: string]: number }; b: { [key: string]: number[] }; } export interface Totals { total: number; covered: number; skipped: number; pct: number; } export interface Coverage { covered: number; total: number; coverage: number; } export class FileCoverage implements FileCoverageData { constructor(data: string | FileCoverage | FileCoverageData); merge(other: FileCoverageData): void; getBranchCoverageByLine(): { [line: number]: Coverage }; getLineCoverage(): { [line: number]: number }; getUncoveredLines(): number[]; resetHits(): void; computeBranchTotals(): Totals; computeSimpleTotals(): Totals; toSummary(): CoverageSummary; toJSON(): object; data: FileCoverageData; path: string; statementMap: { [key: string]: Range }; fnMap: { [key: string]: FunctionMapping }; branchMap: { [key: string]: BranchMapping }; s: { [key: string]: number }; f: { [key: string]: number }; b: { [key: string]: number[] }; } export const classes: { FileCoverage: FileCoverage; }; export function createCoverageMap(data?: CoverageMap | CoverageMapData): CoverageMap; export function createCoverageSummary(obj?: CoverageSummary | CoverageSummaryData): CoverageSummary; export function createFileCoverage(pathOrObject: string | FileCoverage | FileCoverageData): FileCoverage;
import * as t from "@babel/types"; export import Node = t.Node; export import RemovePropertiesOptions = t.RemovePropertiesOptions; declare const traverse: { <S>(parent: Node, opts: TraverseOptions<S>, scope: Scope | undefined, state: S, parentPath?: NodePath): void; (parent: Node, opts?: TraverseOptions, scope?: Scope, state?: any, parentPath?: NodePath): void; visitors: typeof visitors; verify: typeof visitors.verify; explode: typeof visitors.explode; cheap: (node: Node, enter: (node: Node) => void) => void; node: ( node: Node, opts: TraverseOptions, scope?: Scope, state?: any, path?: NodePath, skipKeys?: Record<string, boolean>, ) => void; clearNode: (node: Node, opts?: RemovePropertiesOptions) => void; removeProperties: (tree: Node, opts?: RemovePropertiesOptions) => Node; hasType: (tree: Node, type: Node["type"], denylistTypes?: string[]) => boolean; cache: typeof cache; }; export namespace visitors { /** * `explode()` will take a `Visitor` object with all of the various shorthands * that we support, and validates & normalizes it into a common format, ready * to be used in traversal. * * The various shorthands are: * - `Identifier() { ... }` -> `Identifier: { enter() { ... } }` * - `"Identifier|NumericLiteral": { ... }` -> `Identifier: { ... }, NumericLiteral: { ... }` * - Aliases in `@babel/types`: e.g. `Property: { ... }` -> `ObjectProperty: { ... }, ClassProperty: { ... }` * * Other normalizations are: * - Visitors of virtual types are wrapped, so that they are only visited when their dynamic check passes * - `enter` and `exit` functions are wrapped in arrays, to ease merging of visitors */ function explode<S = unknown>( visitor: Visitor<S>, ): { [Type in Exclude<Node, t.DeprecatedAliases>["type"]]?: VisitNodeObject<S, Extract<Node, { type: Type }>>; }; function verify(visitor: Visitor): void; function merge<State>(visitors: Array<Visitor<State>>): Visitor<State>; function merge( visitors: Visitor[], states?: any[], wrapper?: ( stateKey: any, visitorKey: keyof Visitor, func: VisitNodeFunction<unknown, Node>, ) => VisitNodeFunction<unknown, Node> | null, ): Visitor; } export namespace cache { let path: WeakMap<t.Node, Map<t.Node, NodePath>>; let scope: WeakMap<t.Node, Scope>; function clear(): void; function clearPath(): void; function clearScope(): void; } export default traverse; export type TraverseOptions<S = Node> = { scope?: Scope; noScope?: boolean; denylist?: NodeType[]; /** @deprecated will be removed in Babel 8 */ blacklist?: NodeType[]; shouldSkip?: (node: NodePath) => boolean; } & Visitor<S>; export class Scope { /** * This searches the current "scope" and collects all references/bindings * within. */ constructor(path: NodePath, parentScope?: Scope); uid: number; path: NodePath; block: Node; labels: Map<string, NodePath<t.LabeledStatement>>; parentBlock: Node; parent: Scope; hub: HubInterface; bindings: { [name: string]: Binding }; references: { [name: string]: true }; globals: { [name: string]: t.Identifier | t.JSXIdentifier }; uids: { [name: string]: boolean }; data: Record<string | symbol, unknown>; crawling: boolean; static globals: string[]; /** Variables available in current context. */ static contextVariables: string[]; /** Traverse node with current scope and path. */ traverse<S>(node: Node | Node[], opts: TraverseOptions<S>, state: S): void; traverse(node: Node | Node[], opts?: TraverseOptions, state?: any): void; /** Generate a unique identifier and add it to the current scope. */ generateDeclaredUidIdentifier(name?: string): t.Identifier; /** Generate a unique i
dentifier. */ generateUidIdentifier(name?: string): t.Identifier; /** Generate a unique `_id1` binding. */ generateUid(name?: string): string; /** Generate a unique identifier based on a node. */ generateUidIdentifierBasedOnNode(parent: Node, defaultName?: string): t.Identifier; /** * Determine whether evaluating the specific input `node` is a consequenceless reference. ie. * evaluating it wont result in potentially arbitrary code from being ran. The following are * whitelisted and determined not to cause side effects: * * - `this` expressions * - `super` expressions * - Bound identifiers */ isStatic(node: Node): boolean; /** Possibly generate a memoised identifier if it is not static and has consequences. */ maybeGenerateMemoised(node: Node, dontPush?: boolean): t.Identifier; checkBlockScopedCollisions(local: Binding, kind: BindingKind, name: string, id: object): void; rename(oldName: string, newName?: string, block?: Node): void; dump(): void; toArray( node: t.Node, i?: number | boolean, arrayLikeIsIterable?: boolean, ): t.ArrayExpression | t.CallExpression | t.Identifier; hasLabel(name: string): boolean; getLabel(name: string): NodePath<t.LabeledStatement> | undefined; registerLabel(path: NodePath<t.LabeledStatement>): void; registerDeclaration(path: NodePath): void; buildUndefinedNode(): t.UnaryExpression; registerConstantViolation(path: NodePath): void; registerBinding(kind: BindingKind, path: NodePath, bindingPath?: NodePath): void; addGlobal(node: t.Identifier | t.JSXIdentifier): void; hasUid(name: string): boolean; hasGlobal(name: string): boolean; hasReference(name: string): boolean; isPure(node: Node, constantsOnly?: boolean): boolean; /** * Set some arbitrary data on the current scope. */ setData(key: string, val: any): any; /** * Recursively walk up scope tree looking for the data `key`. */ getData(key: string): any; /** * Recursively walk up scope tree looking for the data `key` and if it exists, * remove it. */ removeData(key: string): void; crawl(): void; push(opts: { id: t.LVal; init?: t.Expression; unique?: boolean; _blockHoist?: number | undefined; kind?: "var" | "let" | "const"; }): void; /** Walk up to the top of the scope tree and get the `Program`. */ getProgramParent(): Scope; /** Walk up the scope tree until we hit either a Function or return null. */ getFunctionParent(): Scope | null; /** * Walk up the scope tree until we hit either a BlockStatement/Loop/Program/Function/Switch or reach the * very top and hit Program. */ getBlockParent(): Scope; /** * Walk up from a pattern scope (function param initializer) until we hit a non-pattern scope, * then returns its block parent * @returns An ancestry scope whose path is a block parent */ getPatternParent(): Scope; /** Walks the scope tree and gathers **all** bindings. */ getAllBindings(): Record<string, Binding>; /** Walks the scope tree and gathers all declarations of `kind`. */ getAllBindingsOfKind(...kinds: string[]): Record<string, Binding>; bindingIdentifierEquals(name: string, node: Node): boolean; getBinding(name: string): Binding | undefined; getOwnBinding(name: string): Binding | undefined; getBindingIdentifier(name: string): t.Identifier; getOwnBindingIdentifier(name: string): t.Identifier; hasOwnBinding(name: string): boolean; hasBinding( name: string, optsOrNoGlobals?: | boolean | { noGlobals?: boolean; noUids?: boolean; }, ): boolean; parentHasBinding( name: string, opts?: { noGlobals?: boolean;
noUids?: boolean; }, ): boolean; /** Move a binding of `name` to another `scope`. */ moveBindingTo(name: string, scope: Scope): void; removeOwnBinding(name: string): void; removeBinding(name: string): void; } export type BindingKind = "var" | "let" | "const" | "module" | "hoisted" | "param" | "local" | "unknown"; /** * This class is responsible for a binding inside of a scope. * * It tracks the following: * * * Node path. * * Amount of times referenced by other nodes. * * Paths to nodes that reassign or modify this binding. * * The kind of binding. (Is it a parameter, declaration etc) */ export class Binding { constructor(opts: { identifier: t.Identifier; scope: Scope; path: NodePath; kind: BindingKind }); identifier: t.Identifier; scope: Scope; path: NodePath; kind: BindingKind; referenced: boolean; references: number; referencePaths: NodePath[]; constant: boolean; constantViolations: NodePath[]; hasDeoptedValue: boolean; hasValue: boolean; value: any; deopValue(): void; setValue(value: any): void; clearValue(): void; /** Register a constant violation with the provided `path`. */ reassign(path: NodePath): void; /** Increment the amount of references to this binding. */ reference(path: NodePath): void; /** Decrement the amount of references to this binding. */ dereference(): void; } export type Visitor<S = unknown> = & VisitNodeObject<S, Node> & { [Type in Node["type"]]?: VisitNode<S, Extract<Node, { type: Type }>>; } & { [K in keyof t.Aliases]?: VisitNode<S, t.Aliases[K]>; } & { [K in keyof VirtualTypeAliases]?: VisitNode<S, VirtualTypeAliases[K]>; } & { // Babel supports `NodeTypesWithoutComment | NodeTypesWithoutComment | ... ` but it is // too complex for TS. So we type it as a general visitor only if the key contains `|` // this is good enough for non-visitor traverse options e.g. `noScope` [k: `${string}|${string}`]: VisitNode<S, Node>; }; export type VisitNode<S, P extends Node> = VisitNodeFunction<S, P> | VisitNodeObject<S, P>; export type VisitNodeFunction<S, P extends Node> = (this: S, path: NodePath<P>, state: S) => void; type NodeType = Node["type"] | keyof t.Aliases; export interface VisitNodeObject<S, P extends Node> { enter?: VisitNodeFunction<S, P>; exit?: VisitNodeFunction<S, P>; } export type NodeKeyOfArrays<T extends Node> = { [P in keyof T]-?: T[P] extends Array<Node | null | undefined> ? P : never; }[keyof T]; export type NodeKeyOfNodes<T extends Node> = { [P in keyof T]-?: T[P] extends Node | null | undefined ? P : never; }[keyof T]; export type NodePaths<T extends Node | readonly Node[]> = T extends readonly Node[] ? { -readonly [K in keyof T]: NodePath<Extract<T[K], Node>> } : T extends Node ? [NodePath<T>] : never; type NodeListType<N, K extends keyof N> = N[K] extends Array<infer P> ? (P extends Node ? P : never) : never; type NodesInsertionParam<T extends Node> = T | readonly T[] | [T, ...T[]]; export class NodePath<T = Node> { constructor(hub: HubInterface, parent: Node); parent: Node; hub: Hub; data: Record<string | symbol, unknown>; context: TraversalContext; scope: Scope; contexts: TraversalContext[]; state: any; opts: any; // exploded TraverseOptions skipKeys: Record<string, boolean> | null; parentPath: T extends t.Program ? null : NodePath; container: Node | Node[] | null; listKey: string | null; key: string | number | null; node: T; type: T extends Node ? T["type"] : T extends null | undefined ? undefined : Node["type"] | undefined; shouldSkip: boolean; shouldStop: boolean; removed: boolean; inList: boolean; parentKey: string; typeAnnotation: object; static get<C extends Node, K extends keyof C>(opts: { hub?: HubInterface;
parentPath: NodePath | null; parent: Node; container: C; key: K; }): NodePath<C[K]>; static get<C extends Node, L extends NodeKeyOfArrays<C>>(opts: { hub?: HubInterface; parentPath: NodePath | null; parent: Node; container: C; listKey: L; key: number; }): C[L] extends Array<Node | null | undefined> ? NodePath<C[L][number]> : never; getScope(scope: Scope): Scope; setData(key: string | symbol, val: any): any; getData(key: string | symbol, def?: any): any; hasNode(): this is NodePath<Exclude<T, null | undefined>>; buildCodeFrameError(msg: string, Error?: ErrorConstructor): Error; traverse<T>(visitor: TraverseOptions<T>, state: T): void; traverse(visitor: TraverseOptions): void; set(key: string, node: any): void; getPathLocation(): string; // Example: https://github.com/babel/babel/blob/63204ae51e020d84a5b246312f5eeb4d981ab952/packages/babel-traverse/src/path/modification.js#L83 debug(buildMessage: () => string): void; // #region ------------------------- ancestry ------------------------- /** * Starting at the parent path of the current `NodePath` and going up the * tree, return the first `NodePath` that causes the provided `callback` * to return a truthy value, or `null` if the `callback` never returns a * truthy value. */ findParent(callback: (path: NodePath) => boolean): NodePath | null; /** * Starting at current `NodePath` and going up the tree, return the first * `NodePath` that causes the provided `callback` to return a truthy value, * or `null` if the `callback` never returns a truthy value. */ find(callback: (path: NodePath) => boolean): NodePath | null; /** Get the parent function of the current path. */ getFunctionParent(): NodePath<t.Function> | null; /** Walk up the tree until we hit a parent node path in a list. */ getStatementParent(): NodePath<t.Statement> | null; /** * Get the deepest common ancestor and then from it, get the earliest relationship path * to that ancestor. * * Earliest is defined as being "before" all the other nodes in terms of list container * position and visiting key. */ getEarliestCommonAncestorFrom(paths: NodePath[]): NodePath; /** Get the earliest path in the tree where the provided `paths` intersect. */ getDeepestCommonAncestorFrom( paths: NodePath[], filter?: (deepest: Node, i: number, ancestries: NodePath[][]) => NodePath, ): NodePath; /** * Build an array of node paths containing the entire ancestry of the current node path. * * NOTE: The current node path is included in this. */ getAncestry(): [this, ...NodePath[]]; /** * A helper to find if `this` path is an ancestor of `maybeDescendant` */ isAncestor(maybeDescendant: NodePath): boolean; /** * A helper to find if `this` path is a descendant of `maybeAncestor` */ isDescendant(maybeAncestor: NodePath): boolean; inType(...candidateTypes: string[]): boolean; // #endregion // #region ------------------------- inference ------------------------- /** Infer the type of the current `NodePath`. */ getTypeAnnotation(): t.FlowType | t.TSType; isBaseType(baseName: string, soft?: boolean): boolean; couldBeBaseType(name: string): boolean; baseTypeStrictlyMatches(rightArg: NodePath): boolean; isGenericType(genericName: string): boolean; // #endregion // #region ------------------------- replacement ------------------------- /** * Replace a node with an array of multiple. This method performs the following steps: * * - Inherit the comments of first provided node with that of the current node. * - Insert the provided nodes after the current node. * - Remove the current node. */ replaceWithMultiple<Nodes exten
ds Node | readonly Node[] | [Node, ...Node[]]>(nodes: Nodes): NodePaths<Nodes>; /** * Parse a string as an expression and replace the current node with the result. * * NOTE: This is typically not a good idea to use. Building source strings when * transforming ASTs is an antipattern and SHOULD NOT be encouraged. Even if it's * easier to use, your transforms will be extremely brittle. */ replaceWithSourceString(replacement: string): [NodePath]; /** Replace the current node with another. */ replaceWith<R extends Node>(replacementPath: R | NodePath<R>): [NodePath<R>]; replaceWith<R extends NodePath>(replacementPath: R): [R]; /** * This method takes an array of statements nodes and then explodes it * into expressions. This method retains completion records which is * extremely important to retain original semantics. */ replaceExpressionWithStatements(nodes: t.Statement[]): NodePaths<t.Expression | t.Statement>; replaceInline<Nodes extends Node | readonly Node[] | [Node, ...Node[]]>(nodes: Nodes): NodePaths<Nodes>; // #endregion // #region ------------------------- evaluation ------------------------- /** * Walk the input `node` and statically evaluate if it's truthy. * * Returning `true` when we're sure that the expression will evaluate to a * truthy value, `false` if we're sure that it will evaluate to a falsy * value and `undefined` if we aren't sure. Because of this please do not * rely on coercion when using this method and check with === if it's false. */ evaluateTruthy(): boolean | undefined; /** * Walk the input `node` and statically evaluate it. * * Returns an object in the form `{ confident, value, deopt }`. `confident` * indicates whether or not we had to drop out of evaluating the expression * because of hitting an unknown node that we couldn't confidently find the * value of, in which case `deopt` is the path of said node. * * Example: * * t.evaluate(parse("5 + 5")) // { confident: true, value: 10 } * t.evaluate(parse("!true")) // { confident: true, value: false } * t.evaluate(parse("foo + foo")) // { confident: false, value: undefined, deopt: NodePath } */ evaluate(): { confident: boolean; value: any; deopt?: NodePath; }; // #endregion // #region ------------------------- introspection ------------------------- /** * Match the current node if it matches the provided `pattern`. * * For example, given the match `React.createClass` it would match the * parsed nodes of `React.createClass` and `React["createClass"]`. */ matchesPattern(pattern: string, allowPartial?: boolean): boolean; /** * Check whether we have the input `key`. If the `key` references an array then we check * if the array has any items, otherwise we just check if it's falsy. */ has(key: string): boolean; // has(key: keyof T): boolean; isStatic(): boolean; /** Alias of `has`. */ is(key: string): boolean; // is(key: keyof T): boolean; /** Opposite of `has`. */ isnt(key: string): boolean; // isnt(key: keyof T): boolean; /** Check whether the path node `key` strict equals `value`. */ equals(key: string, value: any): boolean; // equals(key: keyof T, value: any): boolean; /** * Check the type against our stored internal type of the node. This is handy when a node has * been removed yet we still internally know the type and need it to calculate node replacement. */ isNodeType(type: string): boolean; /** * This checks whether or not we're in one of the following positions: * * for (KEY in right); * for (KEY;;); * * This is because these spots allow VariableDeclarations AND normal expressions so we need * to tell the path replacement that it's o
k to replace this with an expression. */ canHaveVariableDeclarationOrExpression(): boolean; /** * This checks whether we are swapping an arrow function's body between an * expression and a block statement (or vice versa). * * This is because arrow functions may implicitly return an expression, which * is the same as containing a block statement. */ canSwapBetweenExpressionAndStatement(replacement: Node): boolean; /** Check whether the current path references a completion record */ isCompletionRecord(allowInsideFunction?: boolean): boolean; /** * Check whether or not the current `key` allows either a single statement or block statement * so we can explode it if necessary. */ isStatementOrBlock(): boolean; /** Check if the currently assigned path references the `importName` of `moduleSource`. */ referencesImport(moduleSource: string, importName: string): boolean; /** Get the source code associated with this node. */ getSource(): string; /** Check if the current path will maybe execute before another path */ willIMaybeExecuteBefore(target: NodePath): boolean; resolve(dangerous?: boolean, resolved?: NodePath[]): NodePath; isConstantExpression(): boolean; isInStrictMode(): boolean; // #endregion // #region ------------------------- context ------------------------- call(key: string): boolean; isDenylisted(): boolean; /** @deprecated will be removed in Babel 8 */ isBlacklisted(): boolean; visit(): boolean; skip(): void; skipKey(key: string): void; stop(): void; setScope(): void; setContext(context?: TraversalContext): this; /** * Here we resync the node paths `key` and `container`. If they've changed according * to what we have stored internally then we attempt to resync by crawling and looking * for the new values. */ resync(): void; popContext(): void; pushContext(context: TraversalContext): void; requeue(pathToQueue?: NodePath): void; // #endregion // #region ------------------------- removal ------------------------- remove(): void; // #endregion // #region ------------------------- conversion ------------------------- toComputedKey(): t.PrivateName | t.Expression; /** @deprecated Use `arrowFunctionToExpression` */ arrowFunctionToShadowed(): void; /** * Given an arbitrary function, process its content as if it were an arrow function, moving references * to "this", "arguments", "super", and such into the function's parent scope. This method is useful if * you have wrapped some set of items in an IIFE or other function, but want "this", "arguments", and super" * to continue behaving as expected. */ unwrapFunctionEnvironment(): void; /** * Convert a given arrow function into a normal ES5 function expression. */ arrowFunctionToExpression({ allowInsertArrow, allowInsertArrowWithRest, /** @deprecated Use `noNewArrows` instead */ specCompliant, noNewArrows, }?: { allowInsertArrow?: boolean; allowInsertArrowWithRest?: boolean; specCompliant?: boolean; noNewArrows?: boolean; }): NodePath<Exclude<t.Function, t.Method | t.ArrowFunctionExpression> | t.CallExpression>; ensureBlock( this: NodePath<t.Loop | t.WithStatement | t.Function | t.LabeledStatement | t.CatchClause>, ): asserts this is NodePath< T & { body: t.BlockStatement; } >; // #endregion // #region ------------------------- modification ------------------------- /** Insert the provided nodes before the current one. */ insertBefore<Nodes extends NodesInsertionParam<Node>>(nodes: Nodes): NodePaths<Nodes>; /** * Insert the provided nodes after the current one. When inserting nodes after an * expression, ensure that the
completion record is correct by pushing the current node. */ insertAfter<Nodes extends NodesInsertionParam<Node>>(nodes: Nodes): NodePaths<Nodes>; /** Update all sibling node paths after `fromIndex` by `incrementBy`. */ updateSiblingKeys(fromIndex: number, incrementBy: number): void; /** * Insert child nodes at the start of the current node. * @param listKey - The key at which the child nodes are stored (usually body). * @param nodes - the nodes to insert. */ unshiftContainer< T extends Node, K extends NodeKeyOfArrays<T>, Nodes extends NodesInsertionParam<NodeListType<T, K>>, >(this: NodePath<T>, listKey: K, nodes: Nodes): NodePaths<Nodes>; /** * Insert child nodes at the end of the current node. * @param listKey - The key at which the child nodes are stored (usually body). * @param nodes - the nodes to insert. */ pushContainer<T extends Node, K extends NodeKeyOfArrays<T>, Nodes extends NodesInsertionParam<NodeListType<T, K>>>( this: NodePath<T>, listKey: K, nodes: Nodes, ): NodePaths<Nodes>; /** Hoist the current node to the highest scope possible and return a UID referencing it. */ hoist(scope: Scope): void; // #endregion // #region ------------------------- family ------------------------- getOpposite(): NodePath | null; getCompletionRecords(): NodePath[]; getSibling(key: string | number): NodePath; getPrevSibling(): NodePath; getNextSibling(): NodePath; getAllPrevSiblings(): NodePath[]; getAllNextSiblings(): NodePath[]; get<K extends keyof T>(key: K, context?: boolean | TraversalContext): NodePathResult<T[K]>; get(key: string, context?: boolean | TraversalContext): NodePath | NodePath[]; getBindingIdentifiers(duplicates: true): Record<string, t.Identifier[]>; getBindingIdentifiers(duplicates?: false): Record<string, t.Identifier>; getBindingIdentifiers(duplicates?: boolean): Record<string, t.Identifier | t.Identifier[]>; getOuterBindingIdentifiers(duplicates: true): Record<string, t.Identifier[]>; getOuterBindingIdentifiers(duplicates?: false): Record<string, t.Identifier>; getOuterBindingIdentifiers(duplicates?: boolean): Record<string, t.Identifier | t.Identifier[]>; getBindingIdentifierPaths(duplicates: true, outerOnly?: boolean): Record<string, Array<NodePath<t.Identifier>>>; getBindingIdentifierPaths(duplicates?: false, outerOnly?: boolean): Record<string, NodePath<t.Identifier>>; getBindingIdentifierPaths( duplicates?: boolean, outerOnly?: boolean, ): Record<string, NodePath<t.Identifier> | Array<NodePath<t.Identifier>>>; getOuterBindingIdentifierPaths(duplicates: true): Record<string, Array<NodePath<t.Identifier>>>; getOuterBindingIdentifierPaths(duplicates?: false): Record<string, NodePath<t.Identifier>>; getOuterBindingIdentifierPaths( duplicates?: boolean, outerOnly?: boolean, ): Record<string, NodePath<t.Identifier> | Array<NodePath<t.Identifier>>>; // #endregion // #region ------------------------- comments ------------------------- /** Share comments amongst siblings. */ shareCommentsWithSiblings(): void; addComment(type: t.CommentTypeShorthand, content: string, line?: boolean): void; /** Give node `comments` of the specified `type`. */ addComments(type: t.CommentTypeShorthand, comments: t.Comment[]): void; // #endregion // #region ------------------------- isXXX ------------------------- isAccessor(opts?: object): this is NodePath<t.Accessor>; isAnyTypeAnnotation(opts?: object): this is NodePath<t.AnyTypeAnnotation>; isArgumentPlaceholder(opts?: object): this is NodePath<t.ArgumentPlaceholder>; isArrayExpression(opts?: object): this is NodePath<t.ArrayExpression>; isArrayPattern(opts?: object): this is NodePath<t.ArrayPattern>; isArrayTypeAnnotation(opts?: object): this
is NodePath<t.ArrayTypeAnnotation>; isArrowFunctionExpression(opts?: object): this is NodePath<t.ArrowFunctionExpression>; isAssignmentExpression(opts?: object): this is NodePath<t.AssignmentExpression>; isAssignmentPattern(opts?: object): this is NodePath<t.AssignmentPattern>; isAwaitExpression(opts?: object): this is NodePath<t.AwaitExpression>; isBigIntLiteral(opts?: object): this is NodePath<t.BigIntLiteral>; isBinary(opts?: object): this is NodePath<t.Binary>; isBinaryExpression(opts?: object): this is NodePath<t.BinaryExpression>; isBindExpression(opts?: object): this is NodePath<t.BindExpression>; isBlock(opts?: object): this is NodePath<t.Block>; isBlockParent(opts?: object): this is NodePath<t.BlockParent>; isBlockStatement(opts?: object): this is NodePath<t.BlockStatement>; isBooleanLiteral(opts?: object): this is NodePath<t.BooleanLiteral>; isBooleanLiteralTypeAnnotation(opts?: object): this is NodePath<t.BooleanLiteralTypeAnnotation>; isBooleanTypeAnnotation(opts?: object): this is NodePath<t.BooleanTypeAnnotation>; isBreakStatement(opts?: object): this is NodePath<t.BreakStatement>; isCallExpression(opts?: object): this is NodePath<t.CallExpression>; isCatchClause(opts?: object): this is NodePath<t.CatchClause>; isClass(opts?: object): this is NodePath<t.Class>; isClassAccessorProperty(opts?: object): this is NodePath<t.ClassAccessorProperty>; isClassBody(opts?: object): this is NodePath<t.ClassBody>; isClassDeclaration(opts?: object): this is NodePath<t.ClassDeclaration>; isClassExpression(opts?: object): this is NodePath<t.ClassExpression>; isClassImplements(opts?: object): this is NodePath<t.ClassImplements>; isClassMethod(opts?: object): this is NodePath<t.ClassMethod>; isClassPrivateMethod(opts?: object): this is NodePath<t.ClassPrivateMethod>; isClassPrivateProperty(opts?: object): this is NodePath<t.ClassPrivateProperty>; isClassProperty(opts?: object): this is NodePath<t.ClassProperty>; isCompletionStatement(opts?: object): this is NodePath<t.CompletionStatement>; isConditional(opts?: object): this is NodePath<t.Conditional>; isConditionalExpression(opts?: object): this is NodePath<t.ConditionalExpression>; isContinueStatement(opts?: object): this is NodePath<t.ContinueStatement>; isDebuggerStatement(opts?: object): this is NodePath<t.DebuggerStatement>; isDecimalLiteral(opts?: object): this is NodePath<t.DecimalLiteral>; isDeclaration(opts?: object): this is NodePath<t.Declaration>; isDeclareClass(opts?: object): this is NodePath<t.DeclareClass>; isDeclareExportAllDeclaration(opts?: object): this is NodePath<t.DeclareExportAllDeclaration>; isDeclareExportDeclaration(opts?: object): this is NodePath<t.DeclareExportDeclaration>; isDeclareFunction(opts?: object): this is NodePath<t.DeclareFunction>; isDeclareInterface(opts?: object): this is NodePath<t.DeclareInterface>; isDeclareModule(opts?: object): this is NodePath<t.DeclareModule>; isDeclareModuleExports(opts?: object): this is NodePath<t.DeclareModuleExports>; isDeclareOpaqueType(opts?: object): this is NodePath<t.DeclareOpaqueType>; isDeclareTypeAlias(opts?: object): this is NodePath<t.DeclareTypeAlias>; isDeclareVariable(opts?: object): this is NodePath<t.DeclareVariable>; isDeclaredPredicate(opts?: object): this is NodePath<t.DeclaredPredicate>; isDecorator(opts?: object): this is NodePath<t.Decorator>; isDirective(opts?: object): this is NodePath<t.Directive>; isDirectiveLiteral(opts?: object): this is NodePath<t.DirectiveLiteral>; isDoExpression(opts?: object): this is NodePath<t.DoExpression>; isDoWhileStatement(opts?: object): this is NodePath<t.DoWhileStatement>; isEmptyStatement(opts?: object): this is NodePath<t.EmptyStatement>; isEmptyTypeAnnotation(opts?: object): this is NodePath<t.EmptyTypeAnnotation>; isEnumBody(opts?: object): t
his is NodePath<t.EnumBody>; isEnumBooleanBody(opts?: object): this is NodePath<t.EnumBooleanBody>; isEnumBooleanMember(opts?: object): this is NodePath<t.EnumBooleanMember>; isEnumDeclaration(opts?: object): this is NodePath<t.EnumDeclaration>; isEnumDefaultedMember(opts?: object): this is NodePath<t.EnumDefaultedMember>; isEnumMember(opts?: object): this is NodePath<t.EnumMember>; isEnumNumberBody(opts?: object): this is NodePath<t.EnumNumberBody>; isEnumNumberMember(opts?: object): this is NodePath<t.EnumNumberMember>; isEnumStringBody(opts?: object): this is NodePath<t.EnumStringBody>; isEnumStringMember(opts?: object): this is NodePath<t.EnumStringMember>; isEnumSymbolBody(opts?: object): this is NodePath<t.EnumSymbolBody>; isExistsTypeAnnotation(opts?: object): this is NodePath<t.ExistsTypeAnnotation>; isExportAllDeclaration(opts?: object): this is NodePath<t.ExportAllDeclaration>; isExportDeclaration(opts?: object): this is NodePath<t.ExportDeclaration>; isExportDefaultDeclaration(opts?: object): this is NodePath<t.ExportDefaultDeclaration>; isExportDefaultSpecifier(opts?: object): this is NodePath<t.ExportDefaultSpecifier>; isExportNamedDeclaration(opts?: object): this is NodePath<t.ExportNamedDeclaration>; isExportNamespaceSpecifier(opts?: object): this is NodePath<t.ExportNamespaceSpecifier>; isExportSpecifier(opts?: object): this is NodePath<t.ExportSpecifier>; isExpression(opts?: object): this is NodePath<t.Expression>; isExpressionStatement(opts?: object): this is NodePath<t.ExpressionStatement>; isExpressionWrapper(opts?: object): this is NodePath<t.ExpressionWrapper>; isFile(opts?: object): this is NodePath<t.File>; isFlow(opts?: object): this is NodePath<t.Flow>; isFlowBaseAnnotation(opts?: object): this is NodePath<t.FlowBaseAnnotation>; isFlowDeclaration(opts?: object): this is NodePath<t.FlowDeclaration>; isFlowPredicate(opts?: object): this is NodePath<t.FlowPredicate>; isFlowType(opts?: object): this is NodePath<t.FlowType>; isFor(opts?: object): this is NodePath<t.For>; isForInStatement(opts?: object): this is NodePath<t.ForInStatement>; isForOfStatement(opts?: object): this is NodePath<t.ForOfStatement>; isForStatement(opts?: object): this is NodePath<t.ForStatement>; isForXStatement(opts?: object): this is NodePath<t.ForXStatement>; isFunction(opts?: object): this is NodePath<t.Function>; isFunctionDeclaration(opts?: object): this is NodePath<t.FunctionDeclaration>; isFunctionExpression(opts?: object): this is NodePath<t.FunctionExpression>; isFunctionParent(opts?: object): this is NodePath<t.FunctionParent>; isFunctionTypeAnnotation(opts?: object): this is NodePath<t.FunctionTypeAnnotation>; isFunctionTypeParam(opts?: object): this is NodePath<t.FunctionTypeParam>; isGenericTypeAnnotation(opts?: object): this is NodePath<t.GenericTypeAnnotation>; isIdentifier(opts?: object): this is NodePath<t.Identifier>; isIfStatement(opts?: object): this is NodePath<t.IfStatement>; isImmutable(opts?: object): this is NodePath<t.Immutable>; isImport(opts?: object): this is NodePath<t.Import>; isImportAttribute(opts?: object): this is NodePath<t.ImportAttribute>; isImportDeclaration(opts?: object): this is NodePath<t.ImportDeclaration>; isImportDefaultSpecifier(opts?: object): this is NodePath<t.ImportDefaultSpecifier>; isImportNamespaceSpecifier(opts?: object): this is NodePath<t.ImportNamespaceSpecifier>; isImportSpecifier(opts?: object): this is NodePath<t.ImportSpecifier>; isIndexedAccessType(opts?: object): this is NodePath<t.IndexedAccessType>; isInferredPredicate(opts?: object): this is NodePath<t.InferredPredicate>; isInterfaceDeclaration(opts?: object): this is NodePath<t.InterfaceDeclaration>; isInterfaceExtends(opts?: object): this is NodePath<t.InterfaceExtends>; isInterfaceTypeAnnotation(opts?: ob
ject): this is NodePath<t.InterfaceTypeAnnotation>; isInterpreterDirective(opts?: object): this is NodePath<t.InterpreterDirective>; isIntersectionTypeAnnotation(opts?: object): this is NodePath<t.IntersectionTypeAnnotation>; isJSX(opts?: object): this is NodePath<t.JSX>; isJSXAttribute(opts?: object): this is NodePath<t.JSXAttribute>; isJSXClosingElement(opts?: object): this is NodePath<t.JSXClosingElement>; isJSXClosingFragment(opts?: object): this is NodePath<t.JSXClosingFragment>; isJSXElement(opts?: object): this is NodePath<t.JSXElement>; isJSXEmptyExpression(opts?: object): this is NodePath<t.JSXEmptyExpression>; isJSXExpressionContainer(opts?: object): this is NodePath<t.JSXExpressionContainer>; isJSXFragment(opts?: object): this is NodePath<t.JSXFragment>; isJSXIdentifier(opts?: object): this is NodePath<t.JSXIdentifier>; isJSXMemberExpression(opts?: object): this is NodePath<t.JSXMemberExpression>; isJSXNamespacedName(opts?: object): this is NodePath<t.JSXNamespacedName>; isJSXOpeningElement(opts?: object): this is NodePath<t.JSXOpeningElement>; isJSXOpeningFragment(opts?: object): this is NodePath<t.JSXOpeningFragment>; isJSXSpreadAttribute(opts?: object): this is NodePath<t.JSXSpreadAttribute>; isJSXSpreadChild(opts?: object): this is NodePath<t.JSXSpreadChild>; isJSXText(opts?: object): this is NodePath<t.JSXText>; isLVal(opts?: object): this is NodePath<t.LVal>; isLabeledStatement(opts?: object): this is NodePath<t.LabeledStatement>; isLiteral(opts?: object): this is NodePath<t.Literal>; isLogicalExpression(opts?: object): this is NodePath<t.LogicalExpression>; isLoop(opts?: object): this is NodePath<t.Loop>; isMemberExpression(opts?: object): this is NodePath<t.MemberExpression>; isMetaProperty(opts?: object): this is NodePath<t.MetaProperty>; isMethod(opts?: object): this is NodePath<t.Method>; isMiscellaneous(opts?: object): this is NodePath<t.Miscellaneous>; isMixedTypeAnnotation(opts?: object): this is NodePath<t.MixedTypeAnnotation>; isModuleDeclaration(opts?: object): this is NodePath<t.ModuleDeclaration>; isModuleExpression(opts?: object): this is NodePath<t.ModuleExpression>; isModuleSpecifier(opts?: object): this is NodePath<t.ModuleSpecifier>; isNewExpression(opts?: object): this is NodePath<t.NewExpression>; isNoop(opts?: object): this is NodePath<t.Noop>; isNullLiteral(opts?: object): this is NodePath<t.NullLiteral>; isNullLiteralTypeAnnotation(opts?: object): this is NodePath<t.NullLiteralTypeAnnotation>; isNullableTypeAnnotation(opts?: object): this is NodePath<t.NullableTypeAnnotation>; /** @deprecated Use `isNumericLiteral` */ isNumberLiteral(opts?: object): this is NodePath<t.NumberLiteral>; isNumberLiteralTypeAnnotation(opts?: object): this is NodePath<t.NumberLiteralTypeAnnotation>; isNumberTypeAnnotation(opts?: object): this is NodePath<t.NumberTypeAnnotation>; isNumericLiteral(opts?: object): this is NodePath<t.NumericLiteral>; isObjectExpression(opts?: object): this is NodePath<t.ObjectExpression>; isObjectMember(opts?: object): this is NodePath<t.ObjectMember>; isObjectMethod(opts?: object): this is NodePath<t.ObjectMethod>; isObjectPattern(opts?: object): this is NodePath<t.ObjectPattern>; isObjectProperty(opts?: object): this is NodePath<t.ObjectProperty>; isObjectTypeAnnotation(opts?: object): this is NodePath<t.ObjectTypeAnnotation>; isObjectTypeCallProperty(opts?: object): this is NodePath<t.ObjectTypeCallProperty>; isObjectTypeIndexer(opts?: object): this is NodePath<t.ObjectTypeIndexer>; isObjectTypeInternalSlot(opts?: object): this is NodePath<t.ObjectTypeInternalSlot>; isObjectTypeProperty(opts?: object): this is NodePath<t.ObjectTypeProperty>; isObjectTypeSpreadProperty(opts?: object): this is NodePath<t.ObjectTypeSpreadProperty>; isOpaqueType(opts?: object): this is Nod
ePath<t.OpaqueType>; isOptionalCallExpression(opts?: object): this is NodePath<t.OptionalCallExpression>; isOptionalIndexedAccessType(opts?: object): this is NodePath<t.OptionalIndexedAccessType>; isOptionalMemberExpression(opts?: object): this is NodePath<t.OptionalMemberExpression>; isParenthesizedExpression(opts?: object): this is NodePath<t.ParenthesizedExpression>; isPattern(opts?: object): this is NodePath<t.Pattern>; isPatternLike(opts?: object): this is NodePath<t.PatternLike>; isPipelineBareFunction(opts?: object): this is NodePath<t.PipelineBareFunction>; isPipelinePrimaryTopicReference(opts?: object): this is NodePath<t.PipelinePrimaryTopicReference>; isPipelineTopicExpression(opts?: object): this is NodePath<t.PipelineTopicExpression>; isPlaceholder(opts?: object): this is NodePath<t.Placeholder>; isPrivate(opts?: object): this is NodePath<t.Private>; isPrivateName(opts?: object): this is NodePath<t.PrivateName>; isProgram(opts?: object): this is NodePath<t.Program>; isProperty(opts?: object): this is NodePath<t.Property>; isPureish(opts?: object): this is NodePath<t.Pureish>; isQualifiedTypeIdentifier(opts?: object): this is NodePath<t.QualifiedTypeIdentifier>; isRecordExpression(opts?: object): this is NodePath<t.RecordExpression>; isRegExpLiteral(opts?: object): this is NodePath<t.RegExpLiteral>; /** @deprecated Use `isRegExpLiteral` */ isRegexLiteral(opts?: object): this is NodePath<t.RegexLiteral>; isRestElement(opts?: object): this is NodePath<t.RestElement>; /** @deprecated Use `isRestElement` */ isRestProperty(opts?: object): this is NodePath<t.RestProperty>; isReturnStatement(opts?: object): this is NodePath<t.ReturnStatement>; isScopable(opts?: object): this is NodePath<t.Scopable>; isSequenceExpression(opts?: object): this is NodePath<t.SequenceExpression>; isSpreadElement(opts?: object): this is NodePath<t.SpreadElement>; /** @deprecated Use `isSpreadElement` */ isSpreadProperty(opts?: object): this is NodePath<t.SpreadProperty>; isStandardized(opts?: object): this is NodePath<t.Standardized>; isStatement(opts?: object): this is NodePath<t.Statement>; isStaticBlock(opts?: object): this is NodePath<t.StaticBlock>; isStringLiteral(opts?: object): this is NodePath<t.StringLiteral>; isStringLiteralTypeAnnotation(opts?: object): this is NodePath<t.StringLiteralTypeAnnotation>; isStringTypeAnnotation(opts?: object): this is NodePath<t.StringTypeAnnotation>; isSuper(opts?: object): this is NodePath<t.Super>; isSwitchCase(opts?: object): this is NodePath<t.SwitchCase>; isSwitchStatement(opts?: object): this is NodePath<t.SwitchStatement>; isSymbolTypeAnnotation(opts?: object): this is NodePath<t.SymbolTypeAnnotation>; isTSAnyKeyword(opts?: object): this is NodePath<t.TSAnyKeyword>; isTSArrayType(opts?: object): this is NodePath<t.TSArrayType>; isTSAsExpression(opts?: object): this is NodePath<t.TSAsExpression>; isTSBaseType(opts?: object): this is NodePath<t.TSBaseType>; isTSBigIntKeyword(opts?: object): this is NodePath<t.TSBigIntKeyword>; isTSBooleanKeyword(opts?: object): this is NodePath<t.TSBooleanKeyword>; isTSCallSignatureDeclaration(opts?: object): this is NodePath<t.TSCallSignatureDeclaration>; isTSConditionalType(opts?: object): this is NodePath<t.TSConditionalType>; isTSConstructSignatureDeclaration(opts?: object): this is NodePath<t.TSConstructSignatureDeclaration>; isTSConstructorType(opts?: object): this is NodePath<t.TSConstructorType>; isTSDeclareFunction(opts?: object): this is NodePath<t.TSDeclareFunction>; isTSDeclareMethod(opts?: object): this is NodePath<t.TSDeclareMethod>; isTSEntityName(opts?: object): this is NodePath<t.TSEntityName>; isTSEnumDeclaration(opts?: object): this is NodePath<t.TSEnumDeclaration>; isTSEnumMember(opts?: object): this is NodePath<t.TSEnumMember>;
isTSExportAssignment(opts?: object): this is NodePath<t.TSExportAssignment>; isTSExpressionWithTypeArguments(opts?: object): this is NodePath<t.TSExpressionWithTypeArguments>; isTSExternalModuleReference(opts?: object): this is NodePath<t.TSExternalModuleReference>; isTSFunctionType(opts?: object): this is NodePath<t.TSFunctionType>; isTSImportEqualsDeclaration(opts?: object): this is NodePath<t.TSImportEqualsDeclaration>; isTSImportType(opts?: object): this is NodePath<t.TSImportType>; isTSIndexSignature(opts?: object): this is NodePath<t.TSIndexSignature>; isTSIndexedAccessType(opts?: object): this is NodePath<t.TSIndexedAccessType>; isTSInferType(opts?: object): this is NodePath<t.TSInferType>; isTSInstantiationExpression(opts?: object): this is NodePath<t.TSInstantiationExpression>; isTSInterfaceBody(opts?: object): this is NodePath<t.TSInterfaceBody>; isTSInterfaceDeclaration(opts?: object): this is NodePath<t.TSInterfaceDeclaration>; isTSIntersectionType(opts?: object): this is NodePath<t.TSIntersectionType>; isTSIntrinsicKeyword(opts?: object): this is NodePath<t.TSIntrinsicKeyword>; isTSLiteralType(opts?: object): this is NodePath<t.TSLiteralType>; isTSMappedType(opts?: object): this is NodePath<t.TSMappedType>; isTSMethodSignature(opts?: object): this is NodePath<t.TSMethodSignature>; isTSModuleBlock(opts?: object): this is NodePath<t.TSModuleBlock>; isTSModuleDeclaration(opts?: object): this is NodePath<t.TSModuleDeclaration>; isTSNamedTupleMember(opts?: object): this is NodePath<t.TSNamedTupleMember>; isTSNamespaceExportDeclaration(opts?: object): this is NodePath<t.TSNamespaceExportDeclaration>; isTSNeverKeyword(opts?: object): this is NodePath<t.TSNeverKeyword>; isTSNonNullExpression(opts?: object): this is NodePath<t.TSNonNullExpression>; isTSNullKeyword(opts?: object): this is NodePath<t.TSNullKeyword>; isTSNumberKeyword(opts?: object): this is NodePath<t.TSNumberKeyword>; isTSObjectKeyword(opts?: object): this is NodePath<t.TSObjectKeyword>; isTSOptionalType(opts?: object): this is NodePath<t.TSOptionalType>; isTSParameterProperty(opts?: object): this is NodePath<t.TSParameterProperty>; isTSParenthesizedType(opts?: object): this is NodePath<t.TSParenthesizedType>; isTSPropertySignature(opts?: object): this is NodePath<t.TSPropertySignature>; isTSQualifiedName(opts?: object): this is NodePath<t.TSQualifiedName>; isTSRestType(opts?: object): this is NodePath<t.TSRestType>; isTSSatisfiesExpression(opts?: object): this is NodePath<t.TSSatisfiesExpression>; isTSStringKeyword(opts?: object): this is NodePath<t.TSStringKeyword>; isTSSymbolKeyword(opts?: object): this is NodePath<t.TSSymbolKeyword>; isTSThisType(opts?: object): this is NodePath<t.TSThisType>; isTSTupleType(opts?: object): this is NodePath<t.TSTupleType>; isTSType(opts?: object): this is NodePath<t.TSType>; isTSTypeAliasDeclaration(opts?: object): this is NodePath<t.TSTypeAliasDeclaration>; isTSTypeAnnotation(opts?: object): this is NodePath<t.TSTypeAnnotation>; isTSTypeAssertion(opts?: object): this is NodePath<t.TSTypeAssertion>; isTSTypeElement(opts?: object): this is NodePath<t.TSTypeElement>; isTSTypeLiteral(opts?: object): this is NodePath<t.TSTypeLiteral>; isTSTypeOperator(opts?: object): this is NodePath<t.TSTypeOperator>; isTSTypeParameter(opts?: object): this is NodePath<t.TSTypeParameter>; isTSTypeParameterDeclaration(opts?: object): this is NodePath<t.TSTypeParameterDeclaration>; isTSTypeParameterInstantiation(opts?: object): this is NodePath<t.TSTypeParameterInstantiation>; isTSTypePredicate(opts?: object): this is NodePath<t.TSTypePredicate>; isTSTypeQuery(opts?: object): this is NodePath<t.TSTypeQuery>; isTSTypeReference(opts?: object): this is NodePath<t.TSTypeReference>; isTSUndefinedKeyword(opts?: object): this is NodePath<t.TSUndefine
dKeyword>; isTSUnionType(opts?: object): this is NodePath<t.TSUnionType>; isTSUnknownKeyword(opts?: object): this is NodePath<t.TSUnknownKeyword>; isTSVoidKeyword(opts?: object): this is NodePath<t.TSVoidKeyword>; isTaggedTemplateExpression(opts?: object): this is NodePath<t.TaggedTemplateExpression>; isTemplateElement(opts?: object): this is NodePath<t.TemplateElement>; isTemplateLiteral(opts?: object): this is NodePath<t.TemplateLiteral>; isTerminatorless(opts?: object): this is NodePath<t.Terminatorless>; isThisExpression(opts?: object): this is NodePath<t.ThisExpression>; isThisTypeAnnotation(opts?: object): this is NodePath<t.ThisTypeAnnotation>; isThrowStatement(opts?: object): this is NodePath<t.ThrowStatement>; isTopicReference(opts?: object): this is NodePath<t.TopicReference>; isTryStatement(opts?: object): this is NodePath<t.TryStatement>; isTupleExpression(opts?: object): this is NodePath<t.TupleExpression>; isTupleTypeAnnotation(opts?: object): this is NodePath<t.TupleTypeAnnotation>; isTypeAlias(opts?: object): this is NodePath<t.TypeAlias>; isTypeAnnotation(opts?: object): this is NodePath<t.TypeAnnotation>; isTypeCastExpression(opts?: object): this is NodePath<t.TypeCastExpression>; isTypeParameter(opts?: object): this is NodePath<t.TypeParameter>; isTypeParameterDeclaration(opts?: object): this is NodePath<t.TypeParameterDeclaration>; isTypeParameterInstantiation(opts?: object): this is NodePath<t.TypeParameterInstantiation>; isTypeScript(opts?: object): this is NodePath<t.TypeScript>; isTypeofTypeAnnotation(opts?: object): this is NodePath<t.TypeofTypeAnnotation>; isUnaryExpression(opts?: object): this is NodePath<t.UnaryExpression>; isUnaryLike(opts?: object): this is NodePath<t.UnaryLike>; isUnionTypeAnnotation(opts?: object): this is NodePath<t.UnionTypeAnnotation>; isUpdateExpression(opts?: object): this is NodePath<t.UpdateExpression>; isUserWhitespacable(opts?: object): this is NodePath<t.UserWhitespacable>; isV8IntrinsicIdentifier(opts?: object): this is NodePath<t.V8IntrinsicIdentifier>; isVariableDeclaration(opts?: object): this is NodePath<t.VariableDeclaration>; isVariableDeclarator(opts?: object): this is NodePath<t.VariableDeclarator>; isVariance(opts?: object): this is NodePath<t.Variance>; isVoidTypeAnnotation(opts?: object): this is NodePath<t.VoidTypeAnnotation>; isWhile(opts?: object): this is NodePath<t.While>; isWhileStatement(opts?: object): this is NodePath<t.WhileStatement>; isWithStatement(opts?: object): this is NodePath<t.WithStatement>; isYieldExpression(opts?: object): this is NodePath<t.YieldExpression>; isBindingIdentifier(opts?: object): this is NodePath<VirtualTypeAliases["BindingIdentifier"]>; isBlockScoped(opts?: object): this is NodePath<t.FunctionDeclaration | t.ClassDeclaration | t.VariableDeclaration>; /** @deprecated */ isExistentialTypeParam(opts?: object): this is NodePath<VirtualTypeAliases["ExistentialTypeParam"]>; isForAwaitStatement(opts?: object): this is NodePath<VirtualTypeAliases["ForAwaitStatement"]>; isGenerated(opts?: object): boolean; /** @deprecated */ isNumericLiteralTypeAnnotation(opts?: object): void; isPure(opts?: object): boolean; isReferenced(opts?: object): boolean; isReferencedIdentifier(opts?: object): this is NodePath<VirtualTypeAliases["ReferencedIdentifier"]>; isReferencedMemberExpression(opts?: object): this is NodePath<VirtualTypeAliases["ReferencedMemberExpression"]>; isScope(opts?: object): this is NodePath<VirtualTypeAliases["Scope"]>; isUser(opts?: object): boolean; isVar(opts?: object): this is NodePath<VirtualTypeAliases["Var"]>; // #endregion // #region ------------------------- assertXXX ------------------------- assertAccessor(opts?: object): asserts this is NodePath<t.Accessor>; assertAnyTypeAnnotation(opts?: obj
ect): asserts this is NodePath<t.AnyTypeAnnotation>; assertArgumentPlaceholder(opts?: object): asserts this is NodePath<t.ArgumentPlaceholder>; assertArrayExpression(opts?: object): asserts this is NodePath<t.ArrayExpression>; assertArrayPattern(opts?: object): asserts this is NodePath<t.ArrayPattern>; assertArrayTypeAnnotation(opts?: object): asserts this is NodePath<t.ArrayTypeAnnotation>; assertArrowFunctionExpression(opts?: object): asserts this is NodePath<t.ArrowFunctionExpression>; assertAssignmentExpression(opts?: object): asserts this is NodePath<t.AssignmentExpression>; assertAssignmentPattern(opts?: object): asserts this is NodePath<t.AssignmentPattern>; assertAwaitExpression(opts?: object): asserts this is NodePath<t.AwaitExpression>; assertBigIntLiteral(opts?: object): asserts this is NodePath<t.BigIntLiteral>; assertBinary(opts?: object): asserts this is NodePath<t.Binary>; assertBinaryExpression(opts?: object): asserts this is NodePath<t.BinaryExpression>; assertBindExpression(opts?: object): asserts this is NodePath<t.BindExpression>; assertBlock(opts?: object): asserts this is NodePath<t.Block>; assertBlockParent(opts?: object): asserts this is NodePath<t.BlockParent>; assertBlockStatement(opts?: object): asserts this is NodePath<t.BlockStatement>; assertBooleanLiteral(opts?: object): asserts this is NodePath<t.BooleanLiteral>; assertBooleanLiteralTypeAnnotation(opts?: object): asserts this is NodePath<t.BooleanLiteralTypeAnnotation>; assertBooleanTypeAnnotation(opts?: object): asserts this is NodePath<t.BooleanTypeAnnotation>; assertBreakStatement(opts?: object): asserts this is NodePath<t.BreakStatement>; assertCallExpression(opts?: object): asserts this is NodePath<t.CallExpression>; assertCatchClause(opts?: object): asserts this is NodePath<t.CatchClause>; assertClass(opts?: object): asserts this is NodePath<t.Class>; assertClassAccessorProperty(opts?: object): asserts this is NodePath<t.ClassAccessorProperty>; assertClassBody(opts?: object): asserts this is NodePath<t.ClassBody>; assertClassDeclaration(opts?: object): asserts this is NodePath<t.ClassDeclaration>; assertClassExpression(opts?: object): asserts this is NodePath<t.ClassExpression>; assertClassImplements(opts?: object): asserts this is NodePath<t.ClassImplements>; assertClassMethod(opts?: object): asserts this is NodePath<t.ClassMethod>; assertClassPrivateMethod(opts?: object): asserts this is NodePath<t.ClassPrivateMethod>; assertClassPrivateProperty(opts?: object): asserts this is NodePath<t.ClassPrivateProperty>; assertClassProperty(opts?: object): asserts this is NodePath<t.ClassProperty>; assertCompletionStatement(opts?: object): asserts this is NodePath<t.CompletionStatement>; assertConditional(opts?: object): asserts this is NodePath<t.Conditional>; assertConditionalExpression(opts?: object): asserts this is NodePath<t.ConditionalExpression>; assertContinueStatement(opts?: object): asserts this is NodePath<t.ContinueStatement>; assertDebuggerStatement(opts?: object): asserts this is NodePath<t.DebuggerStatement>; assertDecimalLiteral(opts?: object): asserts this is NodePath<t.DecimalLiteral>; assertDeclaration(opts?: object): asserts this is NodePath<t.Declaration>; assertDeclareClass(opts?: object): asserts this is NodePath<t.DeclareClass>; assertDeclareExportAllDeclaration(opts?: object): asserts this is NodePath<t.DeclareExportAllDeclaration>; assertDeclareExportDeclaration(opts?: object): asserts this is NodePath<t.DeclareExportDeclaration>; assertDeclareFunction(opts?: object): asserts this is NodePath<t.DeclareFunction>; assertDeclareInterface(opts?: object): asserts this is NodePath<t.DeclareInterface>; assertDeclareModule(opts?: object): asserts this is NodePath<t.DeclareModule>; assertDeclareModuleExports(opts?: object): asserts this is NodePath<t.Dec
lareModuleExports>; assertDeclareOpaqueType(opts?: object): asserts this is NodePath<t.DeclareOpaqueType>; assertDeclareTypeAlias(opts?: object): asserts this is NodePath<t.DeclareTypeAlias>; assertDeclareVariable(opts?: object): asserts this is NodePath<t.DeclareVariable>; assertDeclaredPredicate(opts?: object): asserts this is NodePath<t.DeclaredPredicate>; assertDecorator(opts?: object): asserts this is NodePath<t.Decorator>; assertDirective(opts?: object): asserts this is NodePath<t.Directive>; assertDirectiveLiteral(opts?: object): asserts this is NodePath<t.DirectiveLiteral>; assertDoExpression(opts?: object): asserts this is NodePath<t.DoExpression>; assertDoWhileStatement(opts?: object): asserts this is NodePath<t.DoWhileStatement>; assertEmptyStatement(opts?: object): asserts this is NodePath<t.EmptyStatement>; assertEmptyTypeAnnotation(opts?: object): asserts this is NodePath<t.EmptyTypeAnnotation>; assertEnumBody(opts?: object): asserts this is NodePath<t.EnumBody>; assertEnumBooleanBody(opts?: object): asserts this is NodePath<t.EnumBooleanBody>; assertEnumBooleanMember(opts?: object): asserts this is NodePath<t.EnumBooleanMember>; assertEnumDeclaration(opts?: object): asserts this is NodePath<t.EnumDeclaration>; assertEnumDefaultedMember(opts?: object): asserts this is NodePath<t.EnumDefaultedMember>; assertEnumMember(opts?: object): asserts this is NodePath<t.EnumMember>; assertEnumNumberBody(opts?: object): asserts this is NodePath<t.EnumNumberBody>; assertEnumNumberMember(opts?: object): asserts this is NodePath<t.EnumNumberMember>; assertEnumStringBody(opts?: object): asserts this is NodePath<t.EnumStringBody>; assertEnumStringMember(opts?: object): asserts this is NodePath<t.EnumStringMember>; assertEnumSymbolBody(opts?: object): asserts this is NodePath<t.EnumSymbolBody>; assertExistsTypeAnnotation(opts?: object): asserts this is NodePath<t.ExistsTypeAnnotation>; assertExportAllDeclaration(opts?: object): asserts this is NodePath<t.ExportAllDeclaration>; assertExportDeclaration(opts?: object): asserts this is NodePath<t.ExportDeclaration>; assertExportDefaultDeclaration(opts?: object): asserts this is NodePath<t.ExportDefaultDeclaration>; assertExportDefaultSpecifier(opts?: object): asserts this is NodePath<t.ExportDefaultSpecifier>; assertExportNamedDeclaration(opts?: object): asserts this is NodePath<t.ExportNamedDeclaration>; assertExportNamespaceSpecifier(opts?: object): asserts this is NodePath<t.ExportNamespaceSpecifier>; assertExportSpecifier(opts?: object): asserts this is NodePath<t.ExportSpecifier>; assertExpression(opts?: object): asserts this is NodePath<t.Expression>; assertExpressionStatement(opts?: object): asserts this is NodePath<t.ExpressionStatement>; assertExpressionWrapper(opts?: object): asserts this is NodePath<t.ExpressionWrapper>; assertFile(opts?: object): asserts this is NodePath<t.File>; assertFlow(opts?: object): asserts this is NodePath<t.Flow>; assertFlowBaseAnnotation(opts?: object): asserts this is NodePath<t.FlowBaseAnnotation>; assertFlowDeclaration(opts?: object): asserts this is NodePath<t.FlowDeclaration>; assertFlowPredicate(opts?: object): asserts this is NodePath<t.FlowPredicate>; assertFlowType(opts?: object): asserts this is NodePath<t.FlowType>; assertFor(opts?: object): asserts this is NodePath<t.For>; assertForInStatement(opts?: object): asserts this is NodePath<t.ForInStatement>; assertForOfStatement(opts?: object): asserts this is NodePath<t.ForOfStatement>; assertForStatement(opts?: object): asserts this is NodePath<t.ForStatement>; assertForXStatement(opts?: object): asserts this is NodePath<t.ForXStatement>; assertFunction(opts?: object): asserts this is NodePath<t.Function>; assertFunctionDeclaration(opts?: object): asserts this is NodePath<t.FunctionDeclaration>; assertFu
README.md exists but content is empty. Use the Edit dataset card button to edit it.
Downloads last month
32
Edit dataset card