diff --git a/flow-typed/npm/@testing-library/jest-dom_v5.5.x.js b/flow-typed/npm/@testing-library/jest-dom_v5.5.x.js new file mode 100644 index 0000000000..5b389f866a --- /dev/null +++ b/flow-typed/npm/@testing-library/jest-dom_v5.5.x.js @@ -0,0 +1,46 @@ +// flow-typed signature: 0c9447942a6ffdb5f79f218bfe8e58d9 +// flow-typed version: fe9fda6713/@testing-library/jest-dom_v5.5.x/flow_>=v0.104.x + +declare module '@testing-library/jest-dom' { + declare type JestMatcherResult = { + message?: string | (() => string), + pass: boolean, + ... + }; + + declare type Result = JestMatcherResult | Promise; + + declare module.exports: {| + /** + * @deprecated + */ + toBeInTheDOM(container?: HTMLElement): Result, + + toBeInTheDocument(): Result, + toBeVisible(): Result, + toBeEmpty(): Result, + toBeDisabled(): Result, + toBeEnabled(): Result, + toBeInvalid(): Result, + toBeRequired(): Result, + toBeValid(): Result, + toContainElement(element: HTMLElement | null): Result, + toContainHTML(htmlText: string): Result, + toHaveAttribute(attr: string, value?: any): Result, + toHaveClass(...classNames: string[]): Result, + toHaveFocus(): Result, + toHaveFormValues(expectedValues: { [name: string]: any, ... }): Result, + toHaveStyle(css: string | { [name: string]: any, ... }): Result, + toHaveTextContent( + text: string | RegExp, + options?: {| normalizeWhitespace: boolean |} + ): Result, + toHaveValue(value?: string | string[] | number): Result, + toHaveDisplayValue(value: string | string[]): Result, + toBeChecked(): Result, + |}; +} + +declare module '@testing-library/jest-dom/extend-expect' { + declare module.exports: any; +} diff --git a/flow-typed/npm/@testing-library/react-hooks_v3.x.x.js b/flow-typed/npm/@testing-library/react-hooks_v3.x.x.js new file mode 100644 index 0000000000..da861656b5 --- /dev/null +++ b/flow-typed/npm/@testing-library/react-hooks_v3.x.x.js @@ -0,0 +1,73 @@ +// flow-typed signature: d2327256a96d87ce8dfe5ef5ec7149e4 +// flow-typed version: ec99079dbb/@testing-library/react-hooks_v3.x.x/flow_>=v0.104.x + +// @flow +// Initially adapted from: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/testing-library__react-hooks. + +declare module '@testing-library/react-hooks' { + declare export type RenderHookOptions

= {| + +initialProps?: P, + +wrapper?: React$ComponentType<{| + ...P, + +children: React$Node, + |}>, + |}; + + declare export type WaitOptions = {| + +interval?: number, + +timeout?: number, + +suppressErrors?: boolean, + |}; + + declare type HookResult = {| + +current: R, + +error?: Error, + |}; + + declare type RenderHookResult = {| + +result: HookResult, + +waitForNextUpdate: ( + options?: $Diff> + ) => Promise, + +waitForValueToChange: ( + selector: () => any, + options?: WaitOptions + ) => Promise, + +waitFor: ( + callback: () => boolean | void, + options?: WaitOptions + ) => Promise, + +unmount: () => boolean, + +rerender: (newProps?: P) => void, + |}; + + // From `react-test-renderer`. + // See: https://github.com/flow-typed/flow-typed/blob/master/definitions/npm/react-test-renderer_v16.x.x/. + + declare type Thenable = { + then(resolve: () => mixed, reject?: () => mixed): mixed, + ... + }; + + /** + * To prepare a component for assertions, wrap the code rendering it and + * performing updates inside an act() call. This makes your test run closer to + * how React works in the browser. + */ + declare export function act(callback: () => void | Promise): Thenable; + + /** + * Renders a test component that will call the provided `callback`, including + * any hooks it calls, every time it renders. + */ + declare export function renderHook( + callback: (props: P) => R, + options?: RenderHookOptions

+ ): RenderHookResult; + + /** + * Unmounts any rendered hooks rendered with `renderHook`, ensuring all + * effects have been flushed. + */ + declare export function cleanup(): Promise; +} diff --git a/flow-typed/npm/@testing-library/react_v11.x.x.js b/flow-typed/npm/@testing-library/react_v11.x.x.js index 7cdea93323..c6506ae868 100644 --- a/flow-typed/npm/@testing-library/react_v11.x.x.js +++ b/flow-typed/npm/@testing-library/react_v11.x.x.js @@ -1,7 +1,172 @@ -// flow-typed signature: d3455ace7aba63a5fb162172c5a1e27f -// flow-typed version: 88c6d45a60/@testing-library/react_v11.x.x/flow_>=v0.104.x +// flow-typed signature: 6f8a40accb2445e1ba35aa962ded3dfe +// flow-typed version: 12efeb009c/@testing-library/react_v11.x.x/flow_>=v0.104.x + +/** + * A local copy from: + * https://github.com/A11yance/aria-query/blob/2e6a3011a0d8987655f3a14853934fe3df38a8d8/flow/aria.js + */ +declare module '@@aria-query' { + declare export type ARIAAbstractRole = + | 'command' + | 'composite' + | 'input' + | 'landmark' + | 'range' + | 'roletype' + | 'section' + | 'sectionhead' + | 'select' + | 'structure' + | 'widget' + | 'window'; + + declare export type ARIAWidgetRole = + | 'button' + | 'checkbox' + | 'gridcell' + | 'link' + | 'menuitem' + | 'menuitemcheckbox' + | 'menuitemradio' + | 'option' + | 'progressbar' + | 'radio' + | 'scrollbar' + | 'searchbox' + | 'slider' + | 'spinbutton' + | 'switch' + | 'tab' + | 'tabpanel' + | 'textbox' + | 'treeitem'; + + declare export type ARIACompositeWidgetRole = + | 'combobox' + | 'grid' + | 'listbox' + | 'menu' + | 'menubar' + | 'radiogroup' + | 'tablist' + | 'tree' + | 'treegrid'; + + declare 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'; + + declare export type ARIALandmarkRole = + | 'banner' + | 'complementary' + | 'contentinfo' + | 'form' + | 'main' + | 'navigation' + | 'region' + | 'search'; + + declare export type ARIALiveRegionRole = + | 'alert' + | 'log' + | 'marquee' + | 'status' + | 'timer'; + + declare export type ARIAWindowRole = 'alertdialog' | 'dialog'; + + declare export type ARIAUncategorizedRole = 'code'; + + declare 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'; + + declare export type ARIARole = + | ARIAWidgetRole + | ARIACompositeWidgetRole + | ARIADocumentStructureRole + | ARIALandmarkRole + | ARIALiveRegionRole + | ARIAWindowRole + | ARIAUncategorizedRole; +} declare module '@testing-library/react' { + import type { ARIARole } from '@@aria-query'; + // This type comes from // https://github.com/facebook/flow/blob/v0.104.0/lib/react-dom.js#L64 declare type ReactDOMTestUtilsThenable = { @@ -14,85 +179,38 @@ declare module '@testing-library/react' { callback: () => void | ReactDOMTestUtilsThenable ) => ReactDOMTestUtilsThenable; - declare type WaitForElementOptions = {| + declare type WaitForOptions = {| container?: HTMLElement, timeout?: number, + interval?: number, + onTimeout?: (error: Error) => Error, mutationObserverOptions?: MutationObserverInit, |}; - declare type TextMatch = - | string - | RegExp - | ((content: string, element: HTMLElement) => boolean); - - declare type TextMatchOptions = { - exact?: boolean, - trim?: boolean, - collapseWhitespace?: boolean, - normalizer?: (text: string) => string, - ... - }; - - declare type SelectorMatchOptions = { - selector?: string, - ... - } & TextMatchOptions; - - declare type QueryByBoundAttribute = ( - text: TextMatch, - options?: TextMatchOptions - ) => ?HTMLElement; - - declare type AllByBoundAttribute = ( - text: TextMatch, - options?: TextMatchOptions - ) => Array; - - declare type FindAllByBoundAttribute = ( - text: TextMatch, - options?: TextMatchOptions, - waitForElementOptions?: WaitForElementOptions - ) => Promise; - - declare type GetByBoundAttribute = ( - text: TextMatch, - options?: TextMatchOptions - ) => HTMLElement; - - declare type FindByBoundAttribute = ( - text: TextMatch, - options?: TextMatchOptions, - waitForElementOptions?: WaitForElementOptions - ) => Promise; - - declare type QueryByText = ( - text: TextMatch, - options?: SelectorMatchOptions - ) => ?HTMLElement; + declare type MatcherFunction = ( + content: string, + element: ?Element + ) => boolean; - declare type AllByText = ( - text: TextMatch, - options?: SelectorMatchOptions - ) => Array; + declare type Matcher = MatcherFunction | RegExp | string | number; - declare type FindAllByText = ( - text: TextMatch, - options?: SelectorMatchOptions, - waitForElementOptions?: WaitForElementOptions - ) => Promise; + declare type ByRoleMatcher = ARIARole | MatcherFunction; - declare type GetByText = ( - text: TextMatch, - options?: SelectorMatchOptions - ) => HTMLElement; + declare type NormalizerFn = (text: string) => string; - declare type FindByText = ( - text: TextMatch, - options?: SelectorMatchOptions, - waitForElementOptions?: WaitForElementOptions - ) => Promise; + declare type MatcherOptions = {| + exact?: boolean, + /** Use normalizer with getDefaultNormalizer instead */ + trim?: boolean, + /** Use normalizer with getDefaultNormalizer instead */ + collapseWhitespace?: boolean, + normalizer?: NormalizerFn, + /** suppress suggestions for a specific query */ + suggest?: boolean, + |}; - declare type ByRoleOptions = { + declare type ByRoleOptions = {| + ...MatcherOptions, /** * If true includes elements in the query set that are usually excluded from * the accessibility tree. `role="none"` or `role="presentation"` are included @@ -114,6 +232,11 @@ declare module '@testing-library/react' { * pressed in the accessibility tree, i.e., `aria-pressed="true"` */ pressed?: boolean, + /** + * If true only includes elements in the query set that are marked as + * expanded in the accessibility tree, i.e., `aria-expanded="true"` + */ + expanded?: boolean, /** * Includes elements with the `"heading"` role matching the indicated level, * either by the semantic HTML heading elements `

-

` or matching @@ -132,34 +255,92 @@ declare module '@testing-library/react' { | string | RegExp | ((accessibleName: string, element: Element) => boolean), - ... - } & TextMatchOptions; + |}; + + declare type SelectorMatcherOptions = {| + ...MatcherOptions, + selector?: string, + |}; + + declare type QueryByBoundAttribute = ( + text: Matcher, + options?: MatcherOptions + ) => ?HTMLElement; + + declare type AllByBoundAttribute = ( + text: Matcher, + options?: MatcherOptions + ) => Array; + + declare type FindAllByBoundAttribute = ( + text: Matcher, + options?: MatcherOptions, + waitForElementOptions?: WaitForOptions + ) => Promise; + + declare type GetByBoundAttribute = ( + text: Matcher, + options?: MatcherOptions + ) => HTMLElement; + + declare type FindByBoundAttribute = ( + text: Matcher, + options?: MatcherOptions, + waitForElementOptions?: WaitForOptions + ) => Promise; + + declare type QueryByText = ( + text: Matcher, + options?: SelectorMatcherOptions + ) => ?HTMLElement; + + declare type AllByText = ( + text: Matcher, + options?: SelectorMatcherOptions + ) => Array; + + declare type FindAllByText = ( + text: Matcher, + options?: SelectorMatcherOptions, + waitForElementOptions?: WaitForOptions + ) => Promise; + + declare type GetByText = ( + text: Matcher, + options?: SelectorMatcherOptions + ) => HTMLElement; + + declare type FindByText = ( + text: Matcher, + options?: SelectorMatcherOptions, + waitForElementOptions?: WaitForOptions + ) => Promise; declare type AllByRole = ( - role: TextMatch, + role: ByRoleMatcher, options?: ByRoleOptions ) => HTMLElement[]; declare type GetByRole = ( - role: TextMatch, + role: ByRoleMatcher, options?: ByRoleOptions ) => HTMLElement; declare type QueryByRole = ( - role: TextMatch, + role: ByRoleMatcher, options?: ByRoleOptions ) => HTMLElement | null; declare type FindByRole = ( - role: TextMatch, + role: ByRoleMatcher, options?: ByRoleOptions, - waitForElementOptions?: WaitForElementOptions + waitForElementOptions?: WaitForOptions ) => Promise; declare type FindAllByRole = ( - role: any, + role: ByRoleMatcher, options?: ByRoleOptions, - waitForElementOptions?: WaitForElementOptions + waitForElementOptions?: WaitForOptions ) => Promise; declare type GetsAndQueries = {| @@ -282,13 +463,13 @@ declare module '@testing-library/react' { |}; declare export function render( - ui: React$Node, + ui: React$Element, options?: RenderOptionsWithoutCustomQueries ): RenderResult<>; declare export function render< CustomQueries: { [string]: (...args: Array) => any, ... } >( - ui: React$Node, + ui: React$Element, options: RenderOptionsWithCustomQueries ): RenderResult; @@ -436,53 +617,53 @@ declare module '@testing-library/react' { // dom-testing-library re-declares declare export function queryByTestId( container: HTMLElement, - id: TextMatch, - options?: TextMatchOptions + id: Matcher, + options?: MatcherOptions ): ?HTMLElement; declare export function getByTestId( container: HTMLElement, - id: TextMatch, - options?: TextMatchOptions + id: Matcher, + options?: MatcherOptions ): HTMLElement; declare export function queryByText( container: HTMLElement, - text: TextMatch, - options?: TextMatchOptions + text: Matcher, + options?: MatcherOptions ): ?HTMLElement; declare export function getByText( container: HTMLElement, - text: TextMatch, - options?: { selector?: string, ... } & TextMatchOptions + text: Matcher, + options?: { selector?: string, ... } & MatcherOptions ): HTMLElement; declare export function queryByPlaceholderText( container: HTMLElement, - text: TextMatch, - options?: TextMatchOptions + text: Matcher, + options?: MatcherOptions ): ?HTMLElement; declare export function getByPlaceholderText( container: HTMLElement, - text: TextMatch, - options?: TextMatchOptions + text: Matcher, + options?: MatcherOptions ): HTMLElement; declare export function queryByLabelText( container: HTMLElement, - text: TextMatch, - options?: TextMatchOptions + text: Matcher, + options?: MatcherOptions ): ?HTMLElement; declare export function getByLabelText( container: HTMLElement, - text: TextMatch, - options?: { selector?: string, ... } & TextMatchOptions + text: Matcher, + options?: { selector?: string, ... } & MatcherOptions ): HTMLElement; declare export function queryByAltText( container: HTMLElement, - text: TextMatch, - options?: TextMatchOptions + text: Matcher, + options?: MatcherOptions ): ?HTMLElement; declare export function getByAltText( container: HTMLElement, - text: TextMatch, - options?: TextMatchOptions + text: Matcher, + options?: MatcherOptions ): HTMLElement; declare export function getNodeText(node: HTMLElement): string; declare export var screen: Screen<>; diff --git a/flow-typed/npm/chalk_v2.x.x.js b/flow-typed/npm/chalk_v2.x.x.js deleted file mode 100644 index 0fa58c2591..0000000000 --- a/flow-typed/npm/chalk_v2.x.x.js +++ /dev/null @@ -1,100 +0,0 @@ -// @flow - -// flow-typed signature: 8af4d93597d645140f12c00de2a323bc -// flow-typed version: c6154227d1/chalk_v2.x.x/flow_>=v0.104.x - -// From: https://github.com/chalk/chalk/blob/master/index.js.flow - -declare module 'chalk' { - declare type TemplateStringsArray = $ReadOnlyArray; - - declare type Level = $Values<{ - None: 0, - Basic: 1, - Ansi256: 2, - TrueColor: 3, - ... - }>; - - declare type ChalkOptions = {| - level?: Level, - |}; - - declare type ColorSupport = {| - level: Level, - hasBasic: boolean, - has256: boolean, - has16m: boolean, - |}; - - declare interface Chalk { - (...text: string[]): string; - (text: TemplateStringsArray, ...placeholders: string[]): string; - Instance(options?: ChalkOptions): Chalk; - enabled: boolean; - level: Level; - rgb(r: number, g: number, b: number): Chalk; - hsl(h: number, s: number, l: number): Chalk; - hsv(h: number, s: number, v: number): Chalk; - hwb(h: number, w: number, b: number): Chalk; - bgHex(color: string): Chalk; - bgKeyword(color: string): Chalk; - bgRgb(r: number, g: number, b: number): Chalk; - bgHsl(h: number, s: number, l: number): Chalk; - bgHsv(h: number, s: number, v: number): Chalk; - bgHwb(h: number, w: number, b: number): Chalk; - hex(color: string): Chalk; - keyword(color: string): Chalk; - - +reset: Chalk; - +bold: Chalk; - +dim: Chalk; - +italic: Chalk; - +underline: Chalk; - +inverse: Chalk; - +hidden: Chalk; - +strikethrough: Chalk; - - +visible: Chalk; - - +black: Chalk; - +red: Chalk; - +green: Chalk; - +yellow: Chalk; - +blue: Chalk; - +magenta: Chalk; - +cyan: Chalk; - +white: Chalk; - +gray: Chalk; - +grey: Chalk; - +blackBright: Chalk; - +redBright: Chalk; - +greenBright: Chalk; - +yellowBright: Chalk; - +blueBright: Chalk; - +magentaBright: Chalk; - +cyanBright: Chalk; - +whiteBright: Chalk; - - +bgBlack: Chalk; - +bgRed: Chalk; - +bgGreen: Chalk; - +bgYellow: Chalk; - +bgBlue: Chalk; - +bgMagenta: Chalk; - +bgCyan: Chalk; - +bgWhite: Chalk; - +bgBlackBright: Chalk; - +bgRedBright: Chalk; - +bgGreenBright: Chalk; - +bgYellowBright: Chalk; - +bgBlueBright: Chalk; - +bgMagentaBright: Chalk; - +bgCyanBright: Chalk; - +bgWhiteBrigh: Chalk; - - supportsColor: ColorSupport; - } - - declare module.exports: Chalk; -} diff --git a/flow-typed/npm/chalk_v4.x.x.js b/flow-typed/npm/chalk_v4.x.x.js new file mode 100644 index 0000000000..147f4b4091 --- /dev/null +++ b/flow-typed/npm/chalk_v4.x.x.js @@ -0,0 +1,97 @@ +// flow-typed signature: 5096c316b7092ffc5ddc487d26c0d6a4 +// flow-typed version: f2e3dcf9e8/chalk_v4.x.x/flow_>=v0.104.x + +// From: https://github.com/chalk/chalk/blob/master/index.d.ts + +declare module "chalk" { + declare type TemplateStringsArray = $ReadOnlyArray; + + declare type Level = $Values<{ + None: 0, + Basic: 1, + Ansi256: 2, + TrueColor: 3, + ... + }>; + + declare type ChalkOptions = {| + level?: Level + |}; + + declare type ColorSupport = {| + level: Level, + hasBasic: boolean, + has256: boolean, + has16m: boolean + |}; + + declare interface Chalk { + (...text: string[]): string, + (text: TemplateStringsArray, ...placeholders: string[]): string, + Instance(options?: ChalkOptions): Chalk, + level: Level, + rgb(r: number, g: number, b: number): Chalk, + hsl(h: number, s: number, l: number): Chalk, + hsv(h: number, s: number, v: number): Chalk, + hwb(h: number, w: number, b: number): Chalk, + bgHex(color: string): Chalk, + bgKeyword(color: string): Chalk, + bgRgb(r: number, g: number, b: number): Chalk, + bgHsl(h: number, s: number, l: number): Chalk, + bgHsv(h: number, s: number, v: number): Chalk, + bgHwb(h: number, w: number, b: number): Chalk, + hex(color: string): Chalk, + keyword(color: string): Chalk, + + +reset: Chalk, + +bold: Chalk, + +dim: Chalk, + +italic: Chalk, + +underline: Chalk, + +inverse: Chalk, + +hidden: Chalk, + +strikethrough: Chalk, + + +visible: Chalk, + + +black: Chalk, + +red: Chalk, + +green: Chalk, + +yellow: Chalk, + +blue: Chalk, + +magenta: Chalk, + +cyan: Chalk, + +white: Chalk, + +gray: Chalk, + +grey: Chalk, + +blackBright: Chalk, + +redBright: Chalk, + +greenBright: Chalk, + +yellowBright: Chalk, + +blueBright: Chalk, + +magentaBright: Chalk, + +cyanBright: Chalk, + +whiteBright: Chalk, + + +bgBlack: Chalk, + +bgRed: Chalk, + +bgGreen: Chalk, + +bgYellow: Chalk, + +bgBlue: Chalk, + +bgMagenta: Chalk, + +bgCyan: Chalk, + +bgWhite: Chalk, + +bgBlackBright: Chalk, + +bgRedBright: Chalk, + +bgGreenBright: Chalk, + +bgYellowBright: Chalk, + +bgBlueBright: Chalk, + +bgMagentaBright: Chalk, + +bgCyanBright: Chalk, + +bgWhiteBrigh: Chalk, + + supportsColor: ColorSupport + } + + declare module.exports: Chalk; +} diff --git a/flow-typed/npm/next_v9.x.x.js b/flow-typed/npm/next_v9.x.x.js index 409ebfd45e..ac3d40385a 100644 --- a/flow-typed/npm/next_v9.x.x.js +++ b/flow-typed/npm/next_v9.x.x.js @@ -1,5 +1,5 @@ -// flow-typed signature: 53ed6733e03743ec40738c247e2ad74b -// flow-typed version: 3be12a0b70/next_v9.x.x/flow_>=v0.104.x +// flow-typed signature: 514646ec2cd38bf48c399f8b3ac0ea8c +// flow-typed version: 071a03ea49/next_v9.x.x/flow_>=v0.104.x declare module "next" { declare type RequestHandler = ( @@ -61,7 +61,7 @@ declare module "next" { declare export type Page = { ...React$Component, - getInitialProps: (ctx: Context) => Promise<*>, + getInitialProps: (ctx: Context) => Promise, ... }; @@ -164,17 +164,17 @@ declare module "next/router" { as: ?(string | URLObject), options?: EventChangeOptions ): Promise, - prefetch(url: string): Promise<*>, + prefetch(url: string): Promise, beforePopState(cb: BeforePopStateCallback): void, ... }; - declare export function useRouter(): Router; - declare export function withRouter( Component: React$ComponentType ): Class>; + declare export function useRouter(): Router; + declare export default Router; } @@ -198,7 +198,7 @@ declare module "next/document" { declare export var Main: Class>; declare export var NextScript: Class>; declare export default Class> & { - getInitialProps: (ctx: DocumentContext) => Promise<*>, + getInitialProps: (ctx: DocumentContext) => Promise, renderPage(cb: Function): void, ... }; @@ -217,7 +217,7 @@ declare module "next/app" { ... }; - declare export default Class> & { getInitialProps: (appInitialProps: AppInitialProps) => Promise<*>, ... }; + declare export default Class> & { getInitialProps: (appInitialProps: AppInitialProps) => Promise, ... }; } declare module "next/dynamic" { diff --git a/flow-typed/npm/ramda_v0.26.x.js b/flow-typed/npm/ramda_v0.26.x.js deleted file mode 100644 index aaeb78ed17..0000000000 --- a/flow-typed/npm/ramda_v0.26.x.js +++ /dev/null @@ -1,2164 +0,0 @@ -// flow-typed signature: ecd12ba08d83e1cf0131093c2f432f73 -// flow-typed version: 313c0f9ce8/ramda_v0.26.x/flow_>=v0.104.x - -/* eslint-disable no-unused-vars, no-redeclare */ - -type Transformer = { - "@@transducer/step": (r: A, a: *) => R, - "@@transducer/init": () => A, - "@@transducer/result": (result: *) => B, - ... -}; - -declare type $npm$ramda$Placeholder = { "@@functional/placeholder": true, ... }; - -declare opaque type $npm$ramda$Reduced; - -declare module ramda { - declare type FunctorObj = { map: ((A => B) => FunctorObj), ... } - declare type FunctorFantasyLand = { 'fantasy-land/map': ((A => B) => FunctorFantasyLand), ... } - declare type UnaryFn = (a: A) => R; - declare type UnaryPromiseFn = UnaryFn>; - declare type BinaryFn = ((a: A, b: B) => R) & - ((a: A) => (b: B) => R); - declare type UnarySameTypeFn = UnaryFn; - declare type BinarySameTypeFn = BinaryFn; - declare type NestedObject = { [k: string]: T | NestedObject, ... }; - declare type UnaryPredicateFn = (x: T) => boolean; - declare type MapUnaryPredicateFn = (V) => V => boolean; - declare type BinaryPredicateFn = (x: T, y: T) => boolean; - declare type BinaryPredicateFn2 = (x: T, y: S) => boolean; - - declare interface ObjPredicate { - (value: any, key: string): boolean; - } - - declare type __CurriedFunction1 = (...r: [AA]) => R; - declare type CurriedFunction1 = __CurriedFunction1; - - declare type __CurriedFunction2 = ( - ((...r: [AA]) => CurriedFunction1) & - ((...r: [$npm$ramda$Placeholder, BB]) => CurriedFunction1) & - ((...r: [AA, BB]) => R) - ); - declare type CurriedFunction2 = __CurriedFunction2; - - declare type __CurriedFunction3 = ( - ((...r: [AA]) => CurriedFunction2) & - ((...r: [$npm$ramda$Placeholder, BB]) => CurriedFunction2) & - ((...r: [AA, BB]) => CurriedFunction1) & - ((...r: [$npm$ramda$Placeholder, BB, CC]) => CurriedFunction1) & - ((...r: [AA, $npm$ramda$Placeholder, CC]) => CurriedFunction1) & - ((...r: [AA, BB, CC]) => R) - ); - declare type CurriedFunction3 = __CurriedFunction3< - A, - B, - C, - R, - *, - *, - * - >; - - declare type __CurriedFunction4< - A, - B, - C, - D, - R, - AA: A, - BB: B, - CC: C, - DD: D - > = ((...r: [AA]) => CurriedFunction3) & - ((...r: [$npm$ramda$Placeholder, BB]) => CurriedFunction3) & - ((...r: [AA, BB]) => CurriedFunction2) & - ((...r: [$npm$ramda$Placeholder, BB, CC]) => CurriedFunction2) & - ((...r: [BB, $npm$ramda$Placeholder, CC]) => CurriedFunction2) & - ((...r: [AA, BB, CC]) => CurriedFunction1) & - ((...r: [$npm$ramda$Placeholder, BB, CC, DD]) => CurriedFunction1) & - ((...r: [AA, $npm$ramda$Placeholder, CC, DD]) => CurriedFunction1) & - ((...r: [AA, BB, $npm$ramda$Placeholder, DD]) => CurriedFunction1) & - ((...r: [AA, BB, CC, DD]) => R); - declare type CurriedFunction4 = __CurriedFunction4< - A, - B, - C, - D, - R, - *, - *, - *, - * - >; - - declare type __CurriedFunction5< - A, - B, - C, - D, - E, - R, - AA: A, - BB: B, - CC: C, - DD: D, - EE: E - > = ((...r: [AA]) => CurriedFunction4) & - ((...r: [$npm$ramda$Placeholder, BB]) => CurriedFunction4) & - ((...r: [AA, BB]) => CurriedFunction3) & - ((...r: [$npm$ramda$Placeholder, BB, CC]) => CurriedFunction3) & - ((...r: [AA, $npm$ramda$Placeholder, CC]) => CurriedFunction3) & - ((...r: [AA, BB, CC]) => CurriedFunction2) & - ((...r: [$npm$ramda$Placeholder, BB, CC, DD]) => CurriedFunction2) & - ((...r: [AA, $npm$ramda$Placeholder, CC, DD]) => CurriedFunction2) & - ((...r: [AA, BB, $npm$ramda$Placeholder, DD]) => CurriedFunction2) & - ((...r: [AA, BB, CC, DD]) => CurriedFunction1) & - ((...r: [$npm$ramda$Placeholder, BB, CC, DD, EE]) => CurriedFunction1) & - ((...r: [AA, $npm$ramda$Placeholder, CC, DD, EE]) => CurriedFunction1) & - ((...r: [AA, BB, $npm$ramda$Placeholder, DD, EE]) => CurriedFunction1) & - ((...r: [AA, BB, CC, $npm$ramda$Placeholder, EE]) => CurriedFunction1) & - ((...r: [AA, BB, CC, DD, EE]) => R); - declare type CurriedFunction5 = __CurriedFunction5< - A, - B, - C, - D, - E, - R, - *, - *, - *, - *, - * - >; - - declare type __CurriedFunction6< - A, - B, - C, - D, - E, - F, - R, - AA: A, - BB: B, - CC: C, - DD: D, - EE: E, - FF: F - > = ((...r: [AA]) => CurriedFunction5) & - ((...r: [$npm$ramda$Placeholder, BB]) => CurriedFunction5) & - ((...r: [AA, BB]) => CurriedFunction4) & - ((...r: [$npm$ramda$Placeholder, BB, CC]) => CurriedFunction4) & - ((...r: [AA, $npm$ramda$Placeholder, CC]) => CurriedFunction4) & - ((...r: [AA, BB, CC]) => CurriedFunction3) & - ((...r: [$npm$ramda$Placeholder, BB, CC, DD]) => CurriedFunction3) & - ((...r: [AA, $npm$ramda$Placeholder, CC, DD]) => CurriedFunction3) & - ((...r: [AA, BB, $npm$ramda$Placeholder, DD]) => CurriedFunction3) & - ((...r: [AA, BB, CC, DD]) => CurriedFunction2) & - ((...r: [$npm$ramda$Placeholder, BB, CC, DD, EE]) => CurriedFunction2) & - ((...r: [AA, $npm$ramda$Placeholder, CC, DD, EE]) => CurriedFunction2) & - ((...r: [AA, BB, $npm$ramda$Placeholder, DD, EE]) => CurriedFunction2) & - ((...r: [AA, BB, CC, $npm$ramda$Placeholder, EE]) => CurriedFunction2) & - ((...r: [AA, BB, CC, DD, EE]) => CurriedFunction1) & - ((...r: [$npm$ramda$Placeholder, BB, CC, DD, EE, FF]) => CurriedFunction1) & - ((...r: [AA, $npm$ramda$Placeholder, CC, DD, EE, FF]) => CurriedFunction1) & - ((...r: [AA, BB, $npm$ramda$Placeholder, DD, EE, FF]) => CurriedFunction1) & - ((...r: [AA, BB, CC, $npm$ramda$Placeholder, EE, FF]) => CurriedFunction1) & - ((...r: [AA, BB, CC, DD, $npm$ramda$Placeholder, FF]) => CurriedFunction1) & - ((...r: [AA, BB, CC, DD, EE, FF]) => R); - declare type CurriedFunction6 = __CurriedFunction6< - A, - B, - C, - D, - E, - F, - R, - *, - *, - *, - *, - *, - * - >; - - declare type Curry = (((...r: [A]) => R) => CurriedFunction1) & - (((...r: [A, B]) => R) => CurriedFunction2) & - (((...r: [A, B, C]) => R) => CurriedFunction3) & - (( - (...r: [A, B, C, D]) => R - ) => CurriedFunction4) & - (( - (...r: [A, B, C, D, E]) => R - ) => CurriedFunction5) & - (( - (...r: [A, B, C, D, E, F]) => R - ) => CurriedFunction6); - - declare type Partial = (((...r: [A]) => R, args: [A]) => () => R) & - (((...r: [A, B]) => R, args: [A]) => B => R) & - (((...r: [A, B]) => R, args: [A, B]) => () => R) & - (((...r: [A, B, C]) => R, args: [A]) => (B, C) => R) & - (((...r: [A, B, C]) => R, args: [A, B]) => C => R) & - (((...r: [A, B, C]) => R, args: [A, B, C]) => () => R) & - (((...r: [A, B, C, D]) => R, args: [A]) => (B, C, D) => R) & - (((...r: [A, B, C, D]) => R, args: [A, B]) => (C, D) => R) & - (((...r: [A, B, C, D]) => R, args: [A, B, C]) => D => R) & - (( - (...r: [A, B, C, D]) => R, - args: [A, B, C, D] - ) => () => R) & - (( - (...r: [A, B, C, D, E]) => R, - args: [A] - ) => (B, C, D, E) => R) & - (( - (...r: [A, B, C, D, E]) => R, - args: [A, B] - ) => (C, D, E) => R) & - (( - (...r: [A, B, C, D, E]) => R, - args: [A, B, C] - ) => (D, E) => R) & - (( - (...r: [A, B, C, D, E]) => R, - args: [A, B, C, D] - ) => E => R) & - (( - (...r: [A, B, C, D, E]) => R, - args: [A, B, C, D, E] - ) => () => R) & - (( - (...r: [A, B, C, D, E, F]) => R, - args: [A] - ) => (B, C, D, E, F) => R) & - (( - (...r: [A, B, C, D, E, F]) => R, - args: [A, B] - ) => (C, D, E, F) => R) & - (( - (...r: [A, B, C, D, E, F]) => R, - args: [A, B, C] - ) => (D, E, F) => R) & - (( - (...r: [A, B, C, D, E, F]) => R, - args: [A, B, C, D] - ) => (E, F) => R) & - (( - (...r: [A, B, C, D, E, F]) => R, - args: [A, B, C, D, E] - ) => F => R) & - (( - (...r: [A, B, C, D, E, F]) => R, - args: [A, B, C, D, E, F] - ) => () => R) & - (( - (...r: [A, B, C, D, E, F, G]) => R, - args: [A] - ) => (B, C, D, E, F, G) => R) & - (( - (...r: [A, B, C, D, E, F, G]) => R, - args: [A, B] - ) => (C, D, E, F, G) => R) & - (( - (...r: [A, B, C, D, E, F, G]) => R, - args: [A, B, C] - ) => (D, E, F, G) => R) & - (( - (...r: [A, B, C, D, E, F, G]) => R, - args: [A, B, C, D] - ) => (E, F, G) => R) & - (( - (...r: [A, B, C, D, E, F, G]) => R, - args: [A, B, C, D, E] - ) => (F, G) => R) & - (( - (...r: [A, B, C, D, E, F, G]) => R, - args: [A, B, C, D, E, F] - ) => G => R) & - (( - (...r: [A, B, C, D, E, F, G]) => R, - args: [A, B, C, D, E, F, G] - ) => () => R) & - (( - (...r: [A, B, C, D, E, F, G, H]) => R, - args: [A] - ) => (B, C, D, E, F, G, H) => R) & - (( - (...r: [A, B, C, D, E, F, G, H]) => R, - args: [A, B] - ) => (C, D, E, F, G, H) => R) & - (( - (...r: [A, B, C, D, E, F, G, H]) => R, - args: [A, B, C] - ) => (D, E, F, G, H) => R) & - (( - (...r: [A, B, C, D, E, F, G, H]) => R, - args: [A, B, C, D] - ) => (E, F, G, H) => R) & - (( - (...r: [A, B, C, D, E, F, G, H]) => R, - args: [A, B, C, D, E] - ) => (F, G, H) => R) & - (( - (...r: [A, B, C, D, E, F, G, H]) => R, - args: [A, B, C, D, E, F] - ) => (G, H) => R) & - (( - (...r: [A, B, C, D, E, F, G, H]) => R, - args: [A, B, C, D, E, F, G] - ) => H => R) & - (( - (...r: [A, B, C, D, E, F, G, H]) => R, - args: [A, B, C, D, E, F, G, H] - ) => () => R) & - (( - (...r: [A, B, C, D, E, F, G, H, I]) => R, - args: [A] - ) => (B, C, D, E, F, G, H, I) => R) & - (( - (...r: [A, B, C, D, E, F, G, H, I]) => R, - args: [A, B] - ) => (C, D, E, F, G, H, I) => R) & - (( - (...r: [A, B, C, D, E, F, G, H, I]) => R, - args: [A, B, C] - ) => (D, E, F, G, H, I) => R) & - (( - (...r: [A, B, C, D, E, F, G, H, I]) => R, - args: [A, B, C, D] - ) => (E, F, G, H, I) => R) & - (( - (...r: [A, B, C, D, E, F, G, H, I]) => R, - args: [A, B, C, D, E] - ) => (F, G, H, I) => R) & - (( - (...r: [A, B, C, D, E, F, G, H, I]) => R, - args: [A, B, C, D, E, F] - ) => (G, H, I) => R) & - (( - (...r: [A, B, C, D, E, F, G, H, I]) => R, - args: [A, B, C, D, E, F, G] - ) => (H, I) => R) & - (( - (...r: [A, B, C, D, E, F, G, H, I]) => R, - args: [A, B, C, D, E, F, G, H] - ) => I => R) & - (( - (...r: [A, B, C, D, E, F, G, H, I]) => R, - args: [A, B, C, D, E, F, G, H, I] - ) => () => R); - - declare var pipe: { - ( - ab: (...a: Args) => B, - bc: UnaryFn, - cd: UnaryFn, - de: UnaryFn, - ef: UnaryFn, - fg: UnaryFn, - ): (...a: Args) => Return, - ( - ab: (...a: Args) => B, - bc: UnaryFn, - cd: UnaryFn, - de: UnaryFn, - ef: UnaryFn, - ): (...a: Args) => Return, - ( - ab: (...a: Args) => B, - bc: UnaryFn, - cd: UnaryFn, - de: UnaryFn, - ): (...a: Args) => Return, - ( - ab: (...a: Args) => B, - bc: UnaryFn, - cd: UnaryFn, - ): (...a: Args) => Return, - ( - ab: (...a: Args) => B, - bc: UnaryFn, - ): (...a: Args) => Return, - (ab: UnaryFn): UnaryFn, - ... - }; - - declare type Pipe = typeof pipe; - - declare type PipeP = (( - ab: UnaryPromiseFn, - bc: UnaryPromiseFn, - cd: UnaryPromiseFn, - de: UnaryPromiseFn, - ef: UnaryPromiseFn, - fg: UnaryPromiseFn, - ) => UnaryPromiseFn) & - (( - ab: UnaryPromiseFn, - bc: UnaryPromiseFn, - cd: UnaryPromiseFn, - de: UnaryPromiseFn, - ef: UnaryPromiseFn, - ) => UnaryPromiseFn) & - (( - ab: UnaryPromiseFn, - bc: UnaryPromiseFn, - cd: UnaryPromiseFn, - de: UnaryPromiseFn, - ) => UnaryPromiseFn) & - (( - ab: UnaryPromiseFn, - bc: UnaryPromiseFn, - cd: UnaryPromiseFn, - ) => UnaryPromiseFn) & - (( - ab: UnaryPromiseFn, - bc: UnaryPromiseFn, - ) => UnaryPromiseFn) & - (( - ab: UnaryPromiseFn, - ) => UnaryPromiseFn); - - declare type Compose = (( - jk: UnaryFn, - ij: UnaryFn, - hi: UnaryFn, - gh: UnaryFn, - fg: UnaryFn, - ef: UnaryFn, - de: UnaryFn, - cd: UnaryFn, - bc: UnaryFn, - ab: UnaryFn - ) => UnaryFn) & - (( - ij: UnaryFn, - hi: UnaryFn, - gh: UnaryFn, - fg: UnaryFn, - ef: UnaryFn, - de: UnaryFn, - cd: UnaryFn, - bc: UnaryFn, - ab: UnaryFn - ) => UnaryFn) & - (( - hi: UnaryFn, - gh: UnaryFn, - fg: UnaryFn, - ef: UnaryFn, - de: UnaryFn, - cd: UnaryFn, - bc: UnaryFn, - ab: UnaryFn - ) => UnaryFn) & - (( - gh: UnaryFn, - fg: UnaryFn, - ef: UnaryFn, - de: UnaryFn, - cd: UnaryFn, - bc: UnaryFn, - ab: UnaryFn - ) => UnaryFn) & - (( - fg: UnaryFn, - ef: UnaryFn, - de: UnaryFn, - cd: UnaryFn, - bc: UnaryFn, - ab: UnaryFn - ) => UnaryFn) & - (( - ef: UnaryFn, - de: UnaryFn, - cd: UnaryFn, - bc: UnaryFn, - ab: UnaryFn, - ) => UnaryFn) & - (( - de: UnaryFn, - cd: UnaryFn, - bc: UnaryFn, - ab: UnaryFn, - ) => UnaryFn) & - (( - cd: UnaryFn, - bc: UnaryFn, - ab: UnaryFn, - ) => UnaryFn) & - (( - bc: UnaryFn, - ab: UnaryFn, - ) => UnaryFn) & - ((ab: UnaryFn) => UnaryFn); - - // This kind of filter allows us to do type refinement on the result, but we - // still need Filter so that non-refining predicates still pass a type check. - declare type RefineFilter = - & (, T: Array | $ReadOnlyArray> (fn: P, xs: T) => Array<$Refine>) - & (, T: Array | $ReadOnlyArray> (fn: P) => (xs: T) => Array<$Refine>); - - declare type Filter = - & ( | { +[key: K]: V, ... }> (fn: UnaryPredicateFn, xs: T) => T) - & (> (fn: UnaryPredicateFn, xs: T) => T) - - & ( | { +[key: K]: V, ... }> (fn: UnaryPredicateFn) =>(xs: T) => T) - & ( | { [key: K]: V, ... }> (fn: UnaryPredicateFn) =>(xs: T) => T) - - declare interface Monad { - chain(f: A => Monad): Monad; - } - - declare class Semigroup {} - - declare class Chain { - chain | Array>(fn: (a: T) => V, x: V): V; - chain | Array>(fn: (a: T) => V): (x: V) => V; - } - - declare class GenericContructor { - constructor(x: T): GenericContructor; - } - - declare class GenericContructorMulti { - constructor(...args: Array): GenericContructor; - } - - /** - * DONE: - * Function* - * List* - * Logic - * Math - * Object* - * Relation - * String - * Type - */ - - declare var compose: Compose; - declare var pipeK: PipeK; - declare var pipeP: PipeP; - declare function then(onSuccess: UnaryFn | UnaryPromiseFn): CurriedFunction1, Promise> - declare function then(onSuccess: UnaryFn | UnaryPromiseFn, p: Promise): Promise; - declare var curry: Curry; - declare function curryN( - length: number, - fn: (...args: Array) => any - ): Function; - - // *Math - declare var add: CurriedFunction2; - declare var inc: UnaryFn; - declare var dec: UnaryFn; - declare var mean: UnaryFn, number>; - declare var divide: CurriedFunction2; - declare var mathMod: CurriedFunction2; - declare var median: UnaryFn, number>; - declare var modulo: CurriedFunction2; - declare var multiply: CurriedFunction2; - declare var negate: UnaryFn; - declare var product: UnaryFn, number>; - declare var subtract: - & CurriedFunction2 - & CurriedFunction2 - & CurriedFunction2 - & CurriedFunction2; - declare var sum: UnaryFn, number>; - - // Filter - // To refine with filter, be sure to import the RefineFilter type, and cast - // filter to a RefineFilter. - // ex: - // import { type RefineFilter, filter } from 'ramda' - // const notNull = (x): bool %checks => x != null - // const ns: Array = (filter: RefineFilter)(notNull, [1, 2, null]) - declare var filter: RefineFilter & Filter; - // reject doesn't get RefineFilter since it performs the opposite work of - // filter, and we don't have a kind of $NotPred type. - declare var reject: Filter; - - // *String - declare var match: CurriedFunction2>; - declare type ReplacementFn = (substring: string, ...args: Array) => string; - declare function replace(A): CurriedFunction2; - declare function replace(A, B): CurriedFunction1; - declare function replace(A, B, string): string; - declare var split: CurriedFunction2>; - declare var test: CurriedFunction2; - // startsWith and endsWith use the same signature: - declare type EdgeWith = - & ( - & ((Array) => (Array) => boolean) - & (Array, Array) => boolean - ) - & ( - & ((string) => (string) => boolean) - & (string, string) => boolean - ) - ; - declare var startsWith: EdgeWith<*>; - declare var endsWith: EdgeWith<*>; - declare function toLower(a: string): string; - declare function toString(x: any): string; - declare function toUpper(a: string): string; - declare function trim(a: string): string; - - // *Type - declare function is(t: T): (v: any) => boolean; - declare function is(t: T, v: any): boolean; - declare var propIs: CurriedFunction3; - declare function type(x: ?any): string; - - declare function isNil(x: mixed): boolean %checks(x === undefined || - x === null); - - // *List - declare function adjust( - index: number, - ): (fn: (a: T) => T) => (src: Array) => Array; - declare function adjust( - index: number, - fn: (a: T) => T, - ): (src: Array) => Array; - declare function adjust( - index: number, - fn: (a: T) => T, - src: Array - ): Array; - - declare function all(fn: UnaryPredicateFn, xs: Array): boolean; - declare function all( - fn: UnaryPredicateFn, - ): (xs: Array) => boolean; - - declare function any(fn: UnaryPredicateFn, xs: Array): boolean; - declare function any( - fn: UnaryPredicateFn, - ): (xs: Array) => boolean; - - declare function aperture(n: number, xs: Array): Array>; - declare function aperture( - n: number, - ): (xs: Array) => Array>; - - declare function append(A, $ReadOnlyArray): Array; - declare function append(A): CurriedFunction1<$ReadOnlyArray, Array>; - - declare function prepend(x: E, xs: Array): Array; - declare function prepend( - x: E, - ): (xs: Array) => Array; - - declare function chain(f: (x: A) => B[], xs: A[]): B[] - declare function chain(f: (x: A) => B[]): (xs: A[]) => B[] - - declare function concat(x: $ReadOnlyArray, y: $ReadOnlyArray): Array; - declare function concat(x: $ReadOnlyArray): CurriedFunction1<$ReadOnlyArray, Array>; - - declare function concat(x: string, y: string): string; - declare function concat(x: string): CurriedFunction1; - - declare type Includes = - & ((string, string) => boolean) - & ((string) => ((string => boolean))) - & ( | Array>(a: A) => (b: T) => boolean) - & ( | Array>(a: A, b: T) => boolean) - - // Contains is deprecated, and is a synonym for includes. - declare var contains: Includes; - declare var includes: Includes; - - declare function drop | string>( - n: number, - ): (xs: T) => T; - declare function drop | string>(n: number, xs: T): T; - - declare function dropLast | string>( - n: number, - ): (xs: T) => T; - declare function dropLast | string>(n: number, xs: T): T; - - declare function dropLastWhile>( - fn: UnaryPredicateFn, - ): (xs: T) => T; - declare function dropLastWhile>( - fn: UnaryPredicateFn, - xs: T - ): T; - - declare function dropWhile>( - fn: UnaryPredicateFn, - ): (xs: T) => T; - declare function dropWhile>(fn: UnaryPredicateFn, xs: T): T; - - declare function dropRepeats>(xs: T): T; - - declare function dropRepeatsWith>( - fn: BinaryPredicateFn, - ): (xs: T) => T; - declare function dropRepeatsWith>( - fn: BinaryPredicateFn, - xs: T - ): T; - - declare function groupBy(fn: (x: T) => string, xs: $ReadOnlyArray): { [key: string]: Array, ... }; - declare function groupBy(fn: (x: T) => string): CurriedFunction1<$ReadOnlyArray, { [string]: Array, ... }>; - - declare function groupWith | string>( - fn: BinaryPredicateFn, - xs: V - ): Array; - declare function groupWith | string>( - fn: BinaryPredicateFn, - ): (xs: V) => Array; - - declare function head>(xs: V): $ElementType; - declare function head(xs: V): V; - - declare function into, R: Array<*> | string | Object>( - accum: R, - xf: (a: A) => I, - input: A - ): R; - declare function into, R>( - accum: Transformer, - xf: (a: A) => R, - input: A - ): R; - - declare function indexOf(x: ?E, xs: Array): number; - declare function indexOf( - x: ?E, - ): (xs: Array) => number; - - declare function indexBy( - fn: (x: T) => string, - ): (xs: Array) => { [key: string]: T, ... }; - declare function indexBy( - fn: (x: T) => string, - xs: Array - ): { [key: string]: T, ... }; - - declare function insert( - index: number, - ): (elem: T) => (src: Array) => Array; - declare function insert( - index: number, - elem: T, - ): (src: Array) => Array; - declare function insert(index: number, elem: T, src: Array): Array; - - declare function insertAll( - index: number, - ): (elem: Array) => (src: Array) => Array; - declare function insertAll( - index: number, - elems: Array, - ): (src: Array) => Array; - declare function insertAll( - index: number, - elems: Array, - src: Array - ): Array; - - declare function join(x: string, xs: Array): string; - declare function join( - x: string, - ): (xs: Array) => string; - - declare function last>(xs: V): ?T; - declare function last(xs: V): V; - - declare function none(fn: UnaryPredicateFn, xs: Array): boolean; - declare function none( - fn: UnaryPredicateFn, - ): (xs: Array) => boolean; - - declare function nth>(i: number, xs: T): ?V; - declare function nth | string>( - i: number, - ): ((xs: string) => string) & ((xs: T) => ?V); - declare function nth(i: number, xs: T): T; - - declare type Find = (>( - fn: UnaryPredicateFn - ) => (xs: T) => ?V) & - (>(fn: UnaryPredicateFn, xs: T) => ?V); - - declare var find: Find; - - declare function findLast | O>( - fn: UnaryPredicateFn, - ): (xs: T | O) => ?V | O; - declare function findLast | O>( - fn: UnaryPredicateFn, - xs: T | O - ): ?V | O; - - declare function findIndex | { [key: K]: V, ... }>( - fn: UnaryPredicateFn, - ): (xs: T) => number; - declare function findIndex | { [key: K]: V, ... }>( - fn: UnaryPredicateFn, - xs: T - ): number; - declare function findLastIndex | { [key: K]: V, ... }>( - fn: UnaryPredicateFn, - ): (xs: T) => number; - declare function findLastIndex | { [key: K]: V, ... }>( - fn: UnaryPredicateFn, - xs: T - ): number; - - declare function forEach(fn: (x: T) => ?V, xs: Array): Array; - declare function forEach( - fn: (x: T) => ?V, - ): (xs: Array) => Array; - - declare function forEachObjIndexed( - fn: (val: A, key: string, o: O) => B, - o: { [key: string]: A, ... } - ): O; - - declare function forEachObjIndexed( - fn: (val: A, key: string, o: O) => B, - ...args: Array - ): (o: { [key: string]: A, ... }) => O; - - declare function lastIndexOf(x: E, xs: Array): number; - declare function lastIndexOf( - x: E, - ): (xs: Array) => number; - - declare var map: { - R, SR, S: { +map: FN => SR, ... }>(fn: FN, xs: S): SR, - R>(fn: FN): - ( SR, ... }>(xs: S) => SR) & - ((xs: { [key: string]: T, ... }) => { [key: string]: R, ... }) & - ((xs: { +[key: string]: T, ... }) => { +[key: string]: R, ... }) & - ((xs: Array) => Array) & - ((xs: $ReadOnlyArray) => $ReadOnlyArray), - (fn: (x: T) => R, xs: Array): Array, - (fn: (x: T) => R, xs: $ReadOnlyArray): $ReadOnlyArray, - (fn: (x: T) => R, xs: { [key: string]: T, ... }): { [key: string]: R, ... }, - (fn: (x: T) => R, xs: { +[key: string]: T, ... }): { +[key: string]: R, ... }, - ... - }; - - - declare type AccumIterator = (acc: R, x: A) => [R, B]; - declare function mapAccum( - fn: AccumIterator, - acc: R, - xs: Array - ): [R, Array]; - declare function mapAccum( - fn: AccumIterator, - ): (acc: R, xs: Array) => [R, Array]; - - declare function mapAccumRight( - fn: AccumIterator, - acc: R, - xs: Array - ): [R, Array]; - declare function mapAccumRight( - fn: AccumIterator, - ): (acc: R, xs: Array) => [R, Array]; - - declare function intersperse(x: E, xs: Array): Array; - declare function intersperse( - x: E, - ): (xs: Array) => Array; - - declare function pair(a: A, b: B): [A, B]; - declare function pair(a: A): (b: B) => [A, B]; - - declare function partition | { [key: K]: V, ... }>( - fn: UnaryPredicateFn, - xs: T - ): [T, T]; - declare function partition | { [key: K]: V, ... }>( - fn: UnaryPredicateFn, - ): (xs: T) => [T, T]; - - declare function pluck< - V, - K: $Keys, - >(key: K, list: V[]): Array<$ElementType>; - declare function pluck< - V, - K: $Keys, - >(key: K): (list: V[]) => Array<$ElementType>; - declare function pluck< - T, - V: T[], - >(key: number, list: V[]): Array<$ElementType>; - declare function pluck< - T, - V: T[], - >(key: number): (list: V[]) => Array<$ElementType>; - - declare var range: CurriedFunction2>; - - declare function reduced(x: T | $npm$ramda$Reduced): $npm$ramda$Reduced; - - declare function remove( - from: number, - ): ((to: number) => (src: Array) => Array) & - ((to: number, src: Array) => Array); - declare function remove( - from: number, - to: number, - ): (src: Array) => Array; - declare function remove(from: number, to: number, src: Array): Array; - - declare function repeat(x: T, times: number): Array; - declare function repeat(x: T): (times: number) => Array; - - declare function slice | string>( - from: number, - ): ((to: number) => (src: T) => T) & - ((to: number, src: T) => T); - declare function slice | string>( - from: number, - to: number, - ): (src: T) => T; - declare function slice | string>( - from: number, - to: number, - src: T - ): T; - - declare function sort>(fn: (a: V, b: V) => number, xs: T): T; - declare function sort>( - fn: (a: V, b: V) => number, - ): (xs: T) => T; - - declare function sortWith>( - fns: Array<(a: V, b: V) => number>, - xs: T - ): T; - declare function sortWith>( - fns: Array<(a: V, b: V) => number>, - ): (xs: T) => T; - - /** - * In the examples for ascend and descend, its result is plugged into sort. - * In order for this to function properly ascend and descend need to yield a - * function that can take two arguments. In our case we'll declare the result - * function as curried, which matches the ramda behavior. - */ - declare type MakeComparator = (A => B) => CurriedFunction2 - - declare var descend: MakeComparator - declare var ascend: MakeComparator - - declare function times(fn: (i: number) => T, n: number): Array; - declare function times( - fn: (i: number) => T, - ): (n: number) => Array; - - declare function take | string>(n: number, xs: T): T; - declare function take | string>(n: number): (xs: T) => T; - - declare function takeLast | string>(n: number, xs: T): T; - declare function takeLast | string>(n: number): (xs: T) => T; - - declare function takeLastWhile>( - fn: UnaryPredicateFn, - xs: T - ): T; - declare function takeLastWhile>( - fn: UnaryPredicateFn - ): (xs: T) => T; - - declare function takeWhile>(fn: UnaryPredicateFn, xs: T): T; - declare function takeWhile>( - fn: UnaryPredicateFn - ): (xs: T) => T; - - declare function unfold( - fn: (seed: T) => [R, T] | boolean, - ): (seed: T) => Array; - declare function unfold( - fn: (seed: T) => [R, T] | boolean, - seed: T - ): Array; - - declare function uniqBy( - fn: (x: T) => V, - ): (xs: Array) => Array; - declare function uniqBy(fn: (x: T) => V, xs: Array): Array; - - declare function uniqWith( - fn: BinaryPredicateFn, - ): (xs: Array) => Array; - declare function uniqWith( - fn: BinaryPredicateFn, - xs: Array - ): Array; - - declare function update( - index: number, - ): ((elem: T) => (src: Array) => Array) & - ((elem: T, src: Array) => Array); - declare function update( - index: number, - elem: T, - ): (src: Array) => Array; - declare function update(index: number, elem: T, src: Array): Array; - - // TODO `without` as a transducer - declare function without($ReadOnlyArray, $ReadOnlyArray): Array; - declare function without($ReadOnlyArray): CurriedFunction1<$ReadOnlyArray, Array>; - - declare function xprod(xs: Array, ys: Array): Array<[T, S]>; - declare function xprod( - xs: Array, - ): (ys: Array) => Array<[T, S]>; - - declare function zip(xs: Array, ys: Array): Array<[T, S]>; - declare function zip( - xs: Array, - ): (ys: Array) => Array<[T, S]>; - - declare function zipObj( - xs: Array, - ys: Array - ): { [key: T]: S, ... }; - declare function zipObj( - xs: Array, - ): (ys: Array) => { [key: T]: S, ... }; - - declare type NestedArray = Array>; - declare function flatten(xs: NestedArray): Array; - - declare function fromPairs(pair: Array<[T, V]>): { [key: string]: V, ... }; - - declare function init | string>(xs: V): V; - - declare function length(xs: Array | string | { length: number, ... }): number; - - declare function reverse | string>(xs: V): V; - - declare type Reduce = (( - fn: (acc: A, elm: B) => $npm$ramda$Reduced | A - ) => ((init: A) => (xs: Array | $ReadOnlyArray) => A) & - ((init: A, xs: Array | $ReadOnlyArray) => A)) & - (( - fn: (acc: A, elm: B) => $npm$ramda$Reduced | A, - init: A - ) => (xs: Array | $ReadOnlyArray) => A) & - (( - fn: (acc: A, elm: B) => $npm$ramda$Reduced | A, - init: A, - xs: Array | $ReadOnlyArray - ) => A); - - declare var reduce: Reduce; - - declare function reduceBy( - fn: (acc: B, elem: A) => B, - ): ((acc: B) => (( - keyFn: (elem: A) => string, - ) => (xs: Array) => { [key: string]: B, ... }) & - ((keyFn: (elem: A) => string, xs: Array) => { [key: string]: B, ... })) & - (( - acc: B, - keyFn: (elem: A) => string, - ) => (xs: Array) => { [key: string]: B, ... }) & - (( - acc: B, - keyFn: (elem: A) => string, - xs: Array - ) => { [key: string]: B, ... }); - declare function reduceBy( - fn: (acc: B, elem: A) => B, - acc: B, - ): (( - keyFn: (elem: A) => string, - ) => (xs: Array) => { [key: string]: B, ... }) & - ((keyFn: (elem: A) => string, xs: Array) => { [key: string]: B, ... }); - declare function reduceBy( - fn: (acc: B, elem: A) => B, - acc: B, - keyFn: (elem: A) => string - ): (xs: Array) => { [key: string]: B, ... }; - declare function reduceBy( - fn: (acc: B, elem: A) => B, - acc: B, - keyFn: (elem: A) => string, - xs: Array - ): { [key: string]: B, ... }; - - declare function reduceRight( - fn: (elem: B, acc: A) => A, - ): ((init: A, xs: Array) => A) & - ((init: A) => (xs: Array) => A); - declare function reduceRight( - fn: (elem: B, acc: A) => A, - init: A, - ): (xs: Array) => A; - declare function reduceRight( - fn: (elem: B, acc: A) => A, - init: A, - xs: Array - ): A; - - declare function reduceWhile(pred: (acc: A, curr: B) => boolean): (( - fn: (a: A, b: B) => A, - ) => (init: A) => ( - xs: Array - ) => A & - (( - fn: (a: A, b: B) => A, - ) => (init: A, xs: Array) => A)) & - (( - fn: (a: A, b: B) => A, - init: A, - ) => (xs: Array) => A) & - ((fn: (a: A, b: B) => A, init: A, xs: Array) => A); - - declare function reduceWhile( - pred: (acc: A, curr: B) => boolean, - fn: (a: A, b: B) => A, - ): ((init: A) => (xs: Array) => A) & - ((init: A, xs: Array) => A); - - declare function reduceWhile( - fn: (acc: A, curr: B) => boolean, - fn: (a: A, b: B) => A, - init: A, - xs: Array - ): A; - - declare function scan( - fn: (acc: A, elem: B) => A, - ): ((init: A, xs: Array) => Array) & - ((init: A) => (xs: Array) => Array); - declare function scan( - fn: (acc: A, elem: B) => A, - init: A, - ): (xs: Array) => Array; - declare function scan( - fn: (acc: A, elem: B) => A, - init: A, - xs: Array - ): Array; - - declare function splitAt | string>(i: number, xs: T): [T, T]; - declare function splitAt | string>( - i: number - ): (xs: T) => [T, T]; - declare function splitEvery | string>( - i: number, - xs: T - ): Array; - declare function splitEvery | string>( - i: number - ): (xs: T) => Array; - declare function splitWhen>( - fn: UnaryPredicateFn, - xs: T - ): [T, T]; - declare function splitWhen>( - fn: UnaryPredicateFn - ): (xs: T) => [T, T]; - - declare function tail | string>(xs: V): V; - - declare function transpose(xs: Array>): Array>; - - declare function uniq(xs: Array): Array; - - declare function unnest(xs: NestedArray): NestedArray; - - declare function zipWith( - fn: (a: T, b: S) => R, - ): ((xs: Array, ys: Array) => Array) & - ((xs: Array) => (ys: Array) => Array); - declare function zipWith( - fn: (a: T, b: S) => R, - xs: Array, - ): (ys: Array) => Array; - declare function zipWith( - fn: (a: T, b: S) => R, - xs: Array, - ys: Array - ): Array; - - // *Relation - declare function equals(x: T): (y: T) => boolean; - declare function equals(x: T, y: T): boolean; - - declare function eqBy( - fn: (x: A) => B, - ): ((x: A, y: A) => boolean) & - ((x: A) => (y: A) => boolean); - declare function eqBy( - fn: (x: A) => B, - x: A, - ): (y: A) => boolean; - declare function eqBy(fn: (x: A) => B, x: A, y: A): boolean; - - // Flow cares about the order in which these appear. Generally function - // siguatures should go from smallest arity to largest arity. - declare type PropEq = (( - prop: $Keys - ) => ((val: mixed) => (obj: T) => boolean) & - ((val: mixed, obj: T) => boolean)) & - ((prop: $Keys, val: mixed) => (obj: T) => boolean) & - ((prop: $Keys, val: mixed, obj: T) => boolean) & - // Array variants. - (( - prop: number - ) => ((val: mixed) => (obj: Array<*>) => boolean) & - ((val: mixed, obj: Array<*>) => boolean)) & - ((prop: number, val: mixed) => (obj: Array<*>) => boolean) & - ((prop: number, val: mixed, obj: Array<*>) => boolean); - declare var propEq: PropEq; - - declare function pathEq( - path: Array, - ): ((val: mixed) => (o: Object) => boolean) & - ((val: mixed, o: Object) => boolean); - declare function pathEq( - path: Array, - val: mixed, - ): (o: Object) => boolean; - declare function pathEq(path: Array, val: mixed, o: Object): boolean; - - declare function clamp( - min: T, - ): ((max: T) => (v: T) => T) & ((max: T, v: T) => T); - declare function clamp( - min: T, - max: T, - ): (v: T) => T; - declare function clamp(min: T, max: T, v: T): T; - - declare function countBy( - fn: (x: T) => string, - ): (list: Array) => { [key: string]: number, ... }; - declare function countBy( - fn: (x: T) => string, - list: Array - ): { [key: string]: number, ... }; - - declare function difference( - xs1: Array, - ): (xs2: Array) => Array; - declare function difference(xs1: Array, xs2: Array): Array; - - declare function differenceWith( - fn: BinaryPredicateFn, - ): ((xs1: Array) => (xs2: Array) => Array) & - ((xs1: Array, xs2: Array) => Array); - declare function differenceWith( - fn: BinaryPredicateFn, - xs1: Array, - ): (xs2: Array) => Array; - declare function differenceWith( - fn: BinaryPredicateFn, - xs1: Array, - xs2: Array - ): Array; - - declare function eqBy(fn: (x: T) => T, x: T, y: T): boolean; - declare function eqBy(fn: (x: T) => T): (x: T, y: T) => boolean; - declare function eqBy(fn: (x: T) => T, x: T): (y: T) => boolean; - declare function eqBy(fn: (x: T) => T): (x: T) => (y: T) => boolean; - - declare type RelationCompare = - & ((x: number) => (y: number) => bool) - & ((x: number, y: number) => bool) - & ((x: string) => (y: string) => bool) - & ((x: string, y: string) => bool) - - declare var gt: RelationCompare - declare var gte: RelationCompare - declare var lt: RelationCompare - declare var lte: RelationCompare - - declare function identical(x: T): (y: T) => boolean; - declare function identical(x: T, y: T): boolean; - - declare function innerJoin( - pred: (a: A, b: B) => boolean, - ): ( - a: Array, - ) => (b: Array) => Array & ((a: Array, b: Array) => Array); - declare function innerJoin( - pred: (a: A, b: B) => boolean, - a: Array, - ): (b: Array) => Array; - declare function innerJoin( - pred: (a: A, b: B) => boolean, - a: Array, - b: Array - ): Array; - - declare function intersection(x: Array, y: Array): Array; - declare function intersection(x: Array): (y: Array) => Array; - - declare function max(x: T): (y: T) => T; - declare function max(x: T, y: T): T; - - declare function maxBy( - fn: (x: T) => V, - ): ((x: T, y: T) => T) & ((x: T) => (y: T) => T); - declare function maxBy( - fn: (x: T) => V, - x: T, - ): (y: T) => T; - declare function maxBy(fn: (x: T) => V, x: T, y: T): T; - - declare function min(x: T): (y: T) => T; - declare function min(x: T, y: T): T; - - declare function minBy( - fn: (x: T) => V, - ): ((x: T, y: T) => T) & ((x: T) => (y: T) => T); - declare function minBy(fn: (x: T) => V, x: T): (y: T) => T; - declare function minBy(fn: (x: T) => V, x: T, y: T): T; - - declare function sortBy( - fn: (x: T) => V, - ): (x: Array) => Array; - declare function sortBy(fn: (x: T) => V, x: Array): Array; - - declare function symmetricDifference( - x: Array, - ): (y: Array) => Array; - declare function symmetricDifference(x: Array, y: Array): Array; - - declare function symmetricDifferenceWith( - fn: BinaryPredicateFn, - ): ((x: Array) => (y: Array) => Array) & - ((x: Array, y: Array) => Array); - declare function symmetricDifferenceWith( - fn: BinaryPredicateFn, - x: Array, - ): (y: Array) => Array; - declare function symmetricDifferenceWith( - fn: BinaryPredicateFn, - x: Array, - y: Array - ): Array; - - declare function union( - x: Array, - ): (y: Array) => Array; - declare function union(x: Array, y: Array): Array; - - declare function unionWith( - fn: BinaryPredicateFn, - ): ((x: Array) => (y: Array) => Array) & - ((x: Array, y: Array) => Array); - declare function unionWith( - fn: BinaryPredicateFn, - x: Array, - ): (y: Array) => Array; - declare function unionWith( - fn: BinaryPredicateFn, - x: Array, - y: Array - ): Array; - - // *Object - declare var assoc: { - ( - key: string, - ...args: Array - ): - & ((val: T) => (src: S) => ({ [k: string]: T, ... })) - & ((val: T, src: S) => ({ [k: string]: T, ... } & S)), - ( - key: string, - val: T, - ...args: Array - ): (src: S) => ({ [k: string]: T, ... } & S), - > (key: K, val: T, src: S): ({ [k: string]: T, ... } & S), - (key: string, val: T, src: S): ({ - [k: string]: T, - ...$Exact, - ... - }), - ... - }; - - declare function assocPath( - key: Array, - ...args: Array - ): ((val: V) => (src: S) => { [k: string]: V, ... }) & - ((val: V) => (src: S) => { [k: string]: V, ... } & S); - declare function assocPath( - key: Array, - val: V, - ...args: Array - ): (src: S) => { [k: string]: V, ... } & S; - declare function assocPath( - key: Array, - val: V, - src: S - ): { [k: string]: V, ... } & S; - - declare function clone(src: T): $Shape; - - declare function dissoc( - key: string, - ...args: Array - ): (src: { [k: string]: T, ... }) => { [k: string]: T, ... }; - declare function dissoc( - key: string, - src: { [k: string]: T, ... } - ): { [k: string]: T, ... }; - - declare function dissocPath( - key: Array, - ...args: Array - ): (src: { [k: string]: U, ... }) => { [k: string]: U, ... }; - declare function dissocPath( - key: Array, - src: { [k: string]: U, ... } - ): { [k: string]: U, ... }; - - declare function evolve(NestedObject): A => A; - declare function evolve(NestedObject, A): A; - - declare function eqProps( - key: string, - ...args: Array - ): ((o1: Object) => (o2: Object) => boolean) & - ((o1: Object, o2: Object) => boolean); - declare function eqProps( - key: string, - o1: Object, - ...args: Array - ): (o2: Object) => boolean; - declare function eqProps(key: string, o1: Object, o2: Object): boolean; - - declare function has(key: string): (o: Object) => boolean; - declare function has(key: string, o: Object): boolean; - - declare function hasPath(path: Array): (o: Object) => boolean; - declare function hasPath(path: Array, o: Object): boolean; - - declare function hasIn(key: string, o: Object): boolean; - declare function hasIn(key: string): (o: Object) => boolean; - - declare function invert(o: Object): { [k: string]: Array, ... }; - declare function invertObj(o: Object): { [k: string]: string, ... }; - - declare function keys(o: ?Object): Array; - - declare type Lens, Fb: Functor> = (A => Fb) => Fb; - /** - * Because it is difficult to treat objects as if they are Functors, let's - * just have a lens type that works with objects, since Ramda supports objects - * as Functors in this context. - */ - declare type LensObj = (A => O) => O; - - declare var lens: - & (( - getter: (f: Fa) => A) => ( - setter: (b: B, f: Fa) => Fb - ) => LensObj) - & (( - getter: (f: Fa) => A, - setter: (b: B, f: Fa) => Fb - ) => LensObj) - & (, Fb: Functor>( - getter: (f: Fa) => A) => ( - setter: (b: B, f: Fa) => Fb - ) => Lens) - & (, Fb: Functor>( - getter: (f: Fa) => A, - setter: (b: B, f: Fa) => Fb - ) => Lens) - - declare function lensIndex, Fb: Functor, N: number, V: $ElementType>(N): Lens; - - /** - * lensPath requires a tuple rather than an Array for its parameter. This - * allows us to make rested $ElementType uses in order to walk down the object - * hierarchy. This remains something TODO. - */ - declare function lensPath>(p: [K]): LensObj, O>; - declare function lensPath< - O, F, - K0: $Keys, E0: $ElementType, - K1: $Keys - >(p: [K0, K1]): LensObj, O>; - declare function lensPath< - O, F, - K0: $Keys, E0: $ElementType, - K1: $Keys, E1: $ElementType, - K2: $Keys - >(p: [K0, K1, K2]): LensObj, O>; - declare function lensPath< - O, F, - K0: $Keys, E0: $ElementType, - K1: $Keys, E1: $ElementType, - K2: $Keys, E2: $ElementType, - K3: $Keys - >(p: [K0, K1, K2, K3]): LensObj, O>; - declare function lensPath< - O, F, - K0: $Keys, E0: $ElementType, - K1: $Keys, E1: $ElementType, - K2: $Keys, E2: $ElementType, - K3: $Keys, E3: $ElementType, - K4: $Keys - >(p: [K0, K1, K2, K3, K4]): LensObj, O>; - - // declare function lensProp(str: string): Lens; - declare function lensProp>(K): LensObj, O>; - - declare function mapObjIndexed( - fn: (val: A, key: string, o: Object) => B, - o: { [key: string]: A, ... } - ): { [key: string]: B, ... }; - declare function mapObjIndexed( - fn: (val: A, key: string, o: Object) => B, - ...args: Array - ): (o: { [key: string]: A, ... }) => { [key: string]: B, ... }; - - declare type Merge = - ((a: A) => (b: B) => A & B) & - ((a: A, b: B) => A & B); - - declare var merge: Merge; - declare var mergeLeft: Merge; - declare var mergeDeepLeft: Merge; - declare var mergeRight: Merge; - - declare function mergeAll( - os: Array<{ [k: string]: T, ... }> - ): { [k: string]: T, ... }; - - declare var mergeDeepRight: ((a: A, b: B) => B & A) & - ((a: A) => (b: B) => B & A); - - declare type MergeWith = ( & $Values>( - fn: (a: T, b: T) => T, - a: A, - b: B - ) => A & B) & - (( - fn: (a: T, b: T) => T, - ) => (a: A) => (b: B) => A & B) & - (( - fn: (a: T, b: T) => T, - ) => (a: A, b: B) => A & B) & - (( - fn: (a: T, b: T) => T, - a: A, - ) => (b: B) => A & B); - - declare type MergeWithKey = (< - A, - B, - S: $Keys & $Keys, - T: $ElementType> & $ElementType>, - >( - fn: (s: S, a: T, b: T) => T, - a: A, - b: B - ) => A & B) & - (( - fn: (s: S, a: T, b: T) => T, - ) => (a: A, b: B) => A & B) & - (( - fn: (s: S, a: T, b: T) => T, - ) => (a: A) => (b: B) => A & B) & - (( - fn: (s: S, a: T, b: T) => T, - a: A, - ) => (b: B) => A & B); - - declare var mergeDeepWith: MergeWith; - - declare var mergeDeepWithKey: MergeWithKey; - - declare var mergeWith: MergeWith; - - declare var mergeWithKey: MergeWithKey; - - declare function objOf( - key: string, - ): (val: T) => { [key: string]: T, ... }; - declare function objOf(key: string, val: T): { [key: string]: T, ... }; - - declare function omit( - keys: Array, - ): (val: T) => Object; - declare function omit(keys: Array, val: T): Object; - - declare type Functor = - | { @@iterator(): Iterator, ... } - | FunctorObj - | FunctorFantasyLand - | Array - | $ReadOnlyArray - - declare var over: - & ((lens: LensObj) => CurriedFunction2 B, Oa, Ob>) - & ((lens: LensObj, A => B) => CurriedFunction1) - & ((lens: LensObj, A => B, Oa) => Ob) - & (, Fb: Functor>(lens: Lens) => CurriedFunction2 B, Fa, Fb>) - & (, Fb: Functor>(lens: Lens, A => B) => CurriedFunction1) - & (, Fb: Functor>(lens: Lens, A => B, Fa) => Fb) - - declare function path( - p: Array, - ): (o: NestedObject) => V; - declare function path( - p: Array, - ): (o: null | void) => void; - declare function path( - p: Array, - ): (o: mixed) => ?V; - declare function path>(p: Array, o: A): V; - declare function path(p: Array, o: A): void; - declare function path(p: Array, o: A): ?V; - - declare function path( - p: Array, - ): (o: NestedObject) => V; - declare function path( - p: Array, - ): (o: null | void) => void; - declare function path( - p: Array, - ): (o: mixed) => ?V; - declare function path>(p: Array, o: A): V; - declare function path(p: Array, o: A): void; - declare function path(p: Array, o: A): ?V; - - declare function pathOr>( - or: T, - ): ((p: Array) => (o: ?A) => V | T) & - ((p: Array, o: ?A) => V | T); - declare function pathOr>( - or: T, - p: Array, - ): (o: ?A) => V | T; - declare function pathOr>( - or: T, - p: Array, - o: ?A - ): V | T; - - declare function pick>>( - keys: K, - ): (val: O) => O; - declare function pick>>( - keys: K, - val: O - ): O; - - declare function pickAll( - keys: Array, - ): (val: { [key: string]: A, ... }) => { [key: string]: ?A, ... }; - declare function pickAll( - keys: Array, - val: { [key: string]: A, ... } - ): { [key: string]: ?A, ... }; - - declare function pickBy( - fn: BinaryPredicateFn2, - ): (val: { [key: string]: A, ... }) => { [key: string]: A, ... }; - declare function pickBy( - fn: BinaryPredicateFn2, - val: { [key: string]: A, ... } - ): { [key: string]: A, ... }; - - declare function project( - keys: Array, - ): (val: Array<{ [key: string]: T, ... }>) => Array<{ [key: string]: T, ... }>; - declare function project( - keys: Array, - val: Array<{ [key: string]: T, ... }> - ): Array<{ [key: string]: T, ... }>; - - declare function prop( - key: T, - ): (o: O) => $ElementType; - declare function prop( - __: $npm$ramda$Placeholder, - o: O - ): (key: T) => $ElementType; - declare function prop(key: T, o: O): $ElementType; - - declare function propOr( - or: T, - ): ((p: string) => (o: A) => V | T) & - ((p: string, o: A) => V | T); - declare function propOr( - or: T, - p: string, - ): (o: A) => V | T; - declare function propOr( - or: T, - p: string, - o: A - ): V | T; - - declare function keysIn(o: Object): Array; - - declare function props( - keys: Array, - ): (o: O) => Array<$ElementType>; - declare function props( - keys: Array, - o: O - ): Array<$ElementType>; - - declare var set: - & ((lens: LensObj) => ( - & (B => Oa => Ob) - & ((B, Oa) => Ob) - )) - & ((lens: LensObj, B, Oa) => Ob) - // NOTE: Other functor types might need to be directly supported here. - & (>(lens: Lens>) => ( - & (B => Fa => Array) - & ((B, Fa) => Array) - )) - & (>(lens: Lens>, B, Fa) => Array) - & (, Fb: Functor>(lens: Lens) => ( - & (B => Fa => Fb) - & ((B, Fa) => Fb) - )) - & (, Fb: Functor>(lens: Lens, B, Fa) => Fb) - - declare function toPairs( - o: O - ): Array<[$Keys, T]>; - - declare function toPairsIn( - o: O - ): Array<[string, T]>; - - declare function values(o: T): Array<$Values>; - - declare function valuesIn(o: O): Array; - - declare function where( - predObj: $ObjMap, - o: O - ): boolean; - declare function where( - predObj: $ObjMap - ): O => boolean; - - declare function whereEq( - predObj: O, - ): (o: $Shape) => boolean; - declare function whereEq( - predObj: O, - o: $Shape - ): boolean; - - declare var view: - & ((LensObj) => Oa => A) - & ((LensObj, Oa) => A) - & (, Fb: Functor>(Lens) => Fa => A) - & (, Fb: Functor>(Lens, Fa) => A) - - // *Function - declare var __: $npm$ramda$Placeholder; - - declare var T: (_: any) => true; - declare var F: (_: any) => false; - - declare function addIndex( - iterFn: (fn: (x: A) => B, xs: Array) => Array - ): (fn: (x: A, idx: number, xs: Array) => B, xs: Array) => Array; - - declare function always(x: T): (x: any) => T; - - declare function ap( - fns: Array<(x: T) => V>, - ): (xs: Array) => Array; - declare function ap(fns: Array<(x: T) => V>, xs: Array): Array; - - declare function apply( - fn: (...args: Array) => V, - ): (xs: Array) => V; - declare function apply(fn: (...args: Array) => V, xs: Array): V; - - declare function applySpec< - V, - S, - A: Array, - T: NestedObject<(...args: A) => S> - >( - spec: T - ): (...args: A) => NestedObject; - - declare function applyTo(a: A): (fn: (x: A) => B) => B; - declare function applyTo(a: A, fn: (x: A) => B): B; - - declare function binary( - fn: (...args: Array) => T - ): (x: any, y: any) => T; - - declare function bind( - fn: (...args: Array) => any, - thisObj: T - ): (...args: Array) => any; - - declare function call( - fn: (...args: Array) => T, - ...args: Array - ): T; - - declare function comparator( - fn: BinaryPredicateFn - ): (x: T, y: T) => number; - - // TODO add tests - declare function construct( - ctor: Class> - ): (x: T) => GenericContructor; - - // TODO add tests - declare function constructN( - n: number, - ctor: Class> - ): (...args: any) => GenericContructorMulti; - - // TODO make less generic - declare function converge(after: Function, fns: Array): Function; - - declare function empty(x: T): T; - - declare function flip( - fn: (arg0: A, arg1: B) => TResult - ): CurriedFunction2; - declare function flip( - fn: (arg0: A, arg1: B, arg2: C) => TResult - ): ((arg0: B, arg1: A) => (arg2: C) => TResult) & - ((arg0: B, arg1: A, arg2: C) => TResult); - declare function flip( - fn: (arg0: A, arg1: B, arg2: C, arg3: D) => TResult - ): (( - arg1: B, - arg0: A, - ) => (arg2: C, arg3: D) => TResult) & - ((arg1: B, arg0: A, arg2: C, arg3: D) => TResult); - declare function flip( - fn: (arg0: A, arg1: B, arg2: C, arg3: D, arg4: E) => TResult - ): (( - arg1: B, - arg0: A, - ) => (arg2: C, arg3: D, arg4: E) => TResult) & - ((arg1: B, arg0: A, arg2: C, arg3: D, arg4: E) => TResult); - - declare function identity(x: T): T; - - declare function invoker( - arity: number, - name: $Keys - ): CurriedFunction2 & - CurriedFunction3 & - CurriedFunction4; - - declare function juxt( - fns: Array<(...args: Array) => T> - ): (...args: Array) => Array; - - // TODO lift - - // TODO liftN - - declare function memoizeWith( - keyFn: (...args: Array) => C - ): (...args: Array) => (...args: Array) => B; - declare function memoizeWith( - keyFn: (...args: Array) => C, - fn: (...args: Array) => B - ): (...args: Array) => B; - - declare function nAry( - arity: number, - fn: (...args: Array) => T - ): (...args: Array) => T; - - declare function nthArg(n: number): (...args: Array) => T; - - declare var o: (( - fn1: (b: B) => C, - ...rest: void[] - ) => ((fn2: (a: A) => B, ...rest: void[]) => (x: A) => C) & - ((fn2: (a: A) => B, x: A) => C)) & - (( - fn1: (b: B) => C, - fn2: (a: A) => B, - ...rest: void[] - ) => (x: A) => C) & - ((fn1: (b: B) => C, fn2: (a: A) => B, x: A) => C); - - declare function of(x: T): Array; - - declare function once) => B>(fn: T): T; - - declare var partial: Partial; - // TODO partialRight - - declare type UnaryMonadFn = UnaryFn>; - declare type PipeK = (>( - ab: UnaryMonadFn, - bc: UnaryMonadFn, - cd: UnaryMonadFn, - de: UnaryMonadFn, - ef: UnaryMonadFn, - fg: UnaryMonadFn, - gh: UnaryMonadFn, - hi: UnaryMonadFn, - ij: UnaryMonadFn, - jk: J => L, - ) => A => L) & - (>( - ab: UnaryMonadFn, - bc: UnaryMonadFn, - cd: UnaryMonadFn, - de: UnaryMonadFn, - ef: UnaryMonadFn, - fg: UnaryMonadFn, - gh: UnaryMonadFn, - hi: UnaryMonadFn, - ij: I => K, - ) => A => K) & - (>( - ab: UnaryMonadFn, - bc: UnaryMonadFn, - cd: UnaryMonadFn, - de: UnaryMonadFn, - ef: UnaryMonadFn, - fg: UnaryMonadFn, - gh: UnaryMonadFn, - hi: H => J, - ) => A => J) & - (>( - ab: UnaryMonadFn, - bc: UnaryMonadFn, - cd: UnaryMonadFn, - de: UnaryMonadFn, - ef: UnaryMonadFn, - fg: UnaryMonadFn, - gh: G => I, - ) => A => I) & - (>( - ab: UnaryMonadFn, - bc: UnaryMonadFn, - cd: UnaryMonadFn, - de: UnaryMonadFn, - ef: UnaryMonadFn, - fg: F => H, - ) => A => H) & - (>( - ab: UnaryMonadFn, - bc: UnaryMonadFn, - cd: UnaryMonadFn, - de: UnaryMonadFn, - ef: E => G, - ) => A => G) & - (>( - ab: UnaryMonadFn, - bc: UnaryMonadFn, - cd: UnaryMonadFn, - de: D => F, - ) => A => F) & - (>( - ab: UnaryMonadFn, - bc: UnaryMonadFn, - cd: C => E, - ) => A => E) & - (>( - ab: UnaryMonadFn, - bc: B => D, - ) => A => D) & - (>( - ab: A => C - ) => A => C); - - declare function tap(fn: (x: T) => any): (x: T) => T; - declare function tap(fn: (x: T) => any, x: T): T; - - declare function tryCatch( - tryer: (a: A) => B - ): ((catcher: (e: E, a: A) => B) => (a: A) => B) & - ((catcher: (e: E, a: A) => B, a: A) => B); - declare function tryCatch( - tryer: (a: A) => B, - catcher: (e: E, a: A) => B - ): (a: A) => B; - declare function tryCatch( - tryer: (a: A) => B, - catcher: (e: E, a: A) => B, - a: A - ): B; - - declare function unapply( - fn: (xs: Array) => V - ): (...args: Array) => V; - - declare function unary(fn: (...args: Array) => T): (x: any) => T; - - declare var uncurryN: ((2, (A) => B => C) => (A, B) => C) & - ((3, (A) => B => C => D) => (A, B, C) => D) & - ((4, (A) => B => C => D => E) => (A, B, C, D) => E) & - (( - 5, - (A) => B => C => D => E => F - ) => (A, B, C, D, E) => F) & - (( - 6, - (A) => B => C => D => E => F => G - ) => (A, B, C, D, E, F) => G) & - (( - 7, - (A) => B => C => D => E => F => G => H - ) => (A, B, C, D, E, F, G) => H) & - (( - 8, - (A) => B => C => D => E => F => G => H => I - ) => (A, B, C, D, E, F, G, H) => I); - - //TODO useWith - - // *Logic - - declare function allPass( - fns: Array<(...args: Array) => boolean> - ): (...args: Array) => boolean; - - declare function and(x: X): (y: Y) => X | Y; - declare function and(x: X, y: Y): X | Y; - - declare function anyPass( - fns: Array<(...args: Array) => boolean> - ): (...args: Array) => boolean; - - declare function both( - x: (...args: Array) => boolean, - ): (y: (...args: Array) => boolean) => (...args: Array) => boolean; - declare function both( - x: (...args: Array) => boolean, - y: (...args: Array) => boolean - ): (...args: Array) => boolean; - - declare function complement( - x: (...args: Array) => boolean - ): (...args: Array) => boolean; - - declare function cond( - fns: Array<[(...args: Array) => boolean, (...args: Array) => B]> - ): (...args: Array) => B; - - declare function defaultTo(d: T): (x: ?V) => V | T; - declare function defaultTo(d: T, x: ?V): V | T; - - declare function either( - x: (...args: Array) => *, - ): (y: (...args: Array) => *) => (...args: Array) => *; - declare function either( - x: (...args: Array) => *, - y: (...args: Array) => * - ): (...args: Array) => *; - - declare function ifElse( - cond: (...args: Args) => boolean - ): (( - f1: (...args: Args) => B - ) => (f2: (...args: Args) => C) => (...args: Args) => B | C) & - (( - f1: (...args: Args) => B, - f2: (...args: Args) => C - ) => (...args: Args) => B | C); - declare function ifElse( - cond: (...args: Args) => boolean, - f1: (...args: Args) => B, - f2: (...args: Args) => C - ): (...args: Args) => B | C; - - declare function isEmpty(x: ?Array | Object | string): boolean; - - declare function not(x: boolean): boolean; - - declare function or(x: X): (y: Y) => X | Y; - declare function or(x: X, y: Y): X | Y; - - declare var pathSatisfies: CurriedFunction3< - UnaryPredicateFn, - Array, - Object, - boolean - >; - - declare function propSatisfies( - cond: (x: $ElementType) => boolean, - prop: K, - o: T - ): boolean; - declare function propSatisfies( - cond: (x: $ElementType) => boolean, - prop: K, - ): (o: T) => boolean; - declare function propSatisfies( - cond: (x: $ElementType) => boolean, - ): ((prop: K) => (o: T) => boolean) & - ((prop: K, o: T) => boolean); - - declare function unless( - pred: UnaryPredicateFn, - ): ((fn: (x: S) => V) => (x: T | S) => T | V) & - ((fn: (x: S) => V, x: T | S) => T | V); - declare function unless( - pred: UnaryPredicateFn, - fn: (x: S) => V, - ): (x: T | S) => V | T; - declare function unless( - pred: UnaryPredicateFn, - fn: (x: S) => V, - x: T | S - ): T | V; - - declare function until( - pred: UnaryPredicateFn, - ): ((fn: (x: T) => T) => (x: T) => T) & - ((fn: (x: T) => T, x: T) => T); - declare function until( - pred: UnaryPredicateFn, - fn: (x: T) => T, - ): (x: T) => T; - declare function until( - pred: UnaryPredicateFn, - fn: (x: T) => T, - x: T - ): T; - - declare function when( - pred: UnaryPredicateFn, - ): ((fn: (x: S) => V) => (x: T | S) => T | V) & - ((fn: (x: S) => V, x: T | S) => T | V); - declare function when( - pred: UnaryPredicateFn, - fn: (x: S) => V, - ): (x: T | S) => V | T; - declare function when( - pred: UnaryPredicateFn, - fn: (x: S) => V, - x: T | S - ): T | V; -} diff --git a/flow-typed/npm/react-dom_v16.x.x.js b/flow-typed/npm/react-dom_v17.x.x.js similarity index 72% rename from flow-typed/npm/react-dom_v16.x.x.js rename to flow-typed/npm/react-dom_v17.x.x.js index 889928b996..00eddf3d24 100644 --- a/flow-typed/npm/react-dom_v16.x.x.js +++ b/flow-typed/npm/react-dom_v17.x.x.js @@ -1,30 +1,31 @@ -// flow-typed signature: a333d1cdbb5a4103d0be63a412070e22 -// flow-typed version: b2693c1879/react-dom_v16.x.x/flow_>=v0.117.x +// flow-typed signature: 883d1ffd89c1dd19944fb3d4876938c0 +// flow-typed version: 302d4b65e2/react-dom_v17.x.x/flow_>=v0.127.x declare module 'react-dom' { + declare var version: string; + declare function findDOMNode( - componentOrElement: Element | ?React$Component, + componentOrElement: Element | ?React$Component ): null | Element | Text; declare function render( element: React$Element, container: Element, - callback?: () => void, + callback?: () => void ): React$ElementRef; declare function hydrate( element: React$Element, container: Element, - callback?: () => void, + callback?: () => void ): React$ElementRef; declare function createPortal( node: React$Node, - container: Element, + container: Element ): React$Portal; declare function unmountComponentAtNode(container: any): boolean; - declare var version: string; declare function unstable_batchedUpdates( callback: (a: A, b: B, c: C, d: D, e: E) => mixed, @@ -32,79 +33,108 @@ declare module 'react-dom' { b: B, c: C, d: D, - e: E, + e: E ): void; + declare function unstable_renderSubtreeIntoContainer< - ElementType: React$ElementType, + ElementType: React$ElementType >( parentComponent: React$Component, nextElement: React$Element, container: any, - callback?: () => void, + callback?: () => void ): React$ElementRef; } declare module 'react-dom/server' { + declare var version: string; + declare function renderToString(element: React$Node): string; + declare function renderToStaticMarkup(element: React$Node): string; + declare function renderToNodeStream(element: React$Node): stream$Readable; + declare function renderToStaticNodeStream( - element: React$Node, + element: React$Node ): stream$Readable; - declare var version: string; } -type Thenable = { then(resolve: () => mixed, reject?: () => mixed): mixed, ... }; - declare module 'react-dom/test-utils' { - declare var Simulate: { [eventName: string]: (element: Element, eventData?: Object) => void, ... }; + declare type Thenable = { + then(resolve: () => mixed, reject?: () => mixed): mixed, + ... + }; + + declare var Simulate: { + [eventName: string]: ( + element: Element, + eventData?: { [key: string]: mixed, ... } + ) => void, + ... + }; + declare function renderIntoDocument( - instance: React$Element, + instance: React$Element ): React$Component; + declare function mockComponent( componentClass: React$ElementType, - mockTagName?: string, - ): Object; + mockTagName?: string + ): { [key: string]: mixed, ... }; + declare function isElement(element: React$Element): boolean; + declare function isElementOfType( element: React$Element, - componentClass: React$ElementType, + componentClass: React$ElementType ): boolean; + declare function isDOMComponent(instance: any): boolean; + declare function isCompositeComponent( - instance: React$Component, + instance: React$Component ): boolean; + declare function isCompositeComponentWithType( instance: React$Component, - componentClass: React$ElementType, + componentClass: React$ElementType ): boolean; + declare function findAllInRenderedTree( tree: React$Component, - test: (child: React$Component) => boolean, + test: (child: React$Component) => boolean ): Array>; + declare function scryRenderedDOMComponentsWithClass( tree: React$Component, - className: string, + className: string ): Array; + declare function findRenderedDOMComponentWithClass( tree: React$Component, - className: string, + className: string ): ?Element; + declare function scryRenderedDOMComponentsWithTag( tree: React$Component, - tagName: string, + tagName: string ): Array; + declare function findRenderedDOMComponentWithTag( tree: React$Component, - tagName: string, + tagName: string ): ?Element; + declare function scryRenderedComponentsWithType( tree: React$Component, - componentClass: React$ElementType, + componentClass: React$ElementType ): Array>; + declare function findRenderedComponentWithType( tree: React$Component, - componentClass: React$ElementType, + componentClass: React$ElementType ): ?React$Component; + declare function act(callback: () => void | Thenable): Thenable; }