From 34b42dbf696847ce0dd1282f5dc3d872cb0f79a0 Mon Sep 17 00:00:00 2001 From: Craig Kovatch Date: Fri, 29 Dec 2017 17:44:19 -0800 Subject: [PATCH 001/109] Add WAI-ARIA 1.1 attributes to React typings --- types/react/index.d.ts | 136 +++++++++++++++++++++++++++++++++++++ types/react/v15/index.d.ts | 136 +++++++++++++++++++++++++++++++++++++ 2 files changed, 272 insertions(+) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index c5c1c76d17..a4784caa41 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -2498,6 +2498,142 @@ declare namespace React { unselectable?: boolean; } + // All the WAI-ARIA 1.1 attributes + // https://www.w3.org/TR/wai-aria-1.1/ + interface HTMLAttributes extends DOMAttributes { + /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */ + 'aria-activedescendant'?: string; + /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change + * notifications defined by the aria-relevant attribute. */ + 'aria-atomic'?: boolean; + /** Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for + * an input and specifies how predictions would be presented if they are made. */ + 'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both'; + /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are + * complete before exposing them to the user. */ + 'aria-busy'?: boolean; + /** Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. + * @see aria-pressed @see aria-selected. */ + 'aria-checked'?: boolean | 'false' | 'mixed' | 'true'; + /** Defines the total number of columns in a table, grid, or treegrid. + * @see aria-colindex. */ + 'aria-colcount'?: number; + /** Defines an element's column index or position with respect to the total number of columns within a table, grid, or + * treegrid. + * @see aria-colcount @see aria-colspan. */ + 'aria-colindex'?: number; + /** Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid. + * @see aria-colindex @see aria-rowspan. */ + 'aria-colspan'?: number; + /** Indicates the element that represents the current item within a container or set of related elements. */ + 'aria-current'?: boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time'; + /** Identifies the element (or elements) that describes the object. + * @see aria-labelledby */ + 'aria-describedby'?: string; + /** Identifies the element that provides a detailed, extended description for the object. + * @see aria-describedby. */ + 'aria-details'?: string; + /** Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. + * @see aria-hidden @see aria-readonly. */ + 'aria-disabled'?: boolean; + /** Indicates what functions can be performed when a dragged object is released on the drop target. + * @deprecated in ARIA 1.1 */ + 'aria-dropeffect'?: 'none' | 'copy' | 'execute' | 'link' | 'move' | 'popup'; + /** Identifies the element that provides an error message for the object. + * @see aria-invalid @see aria-describedby. */ + 'aria-errormessage'?: string; + /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */ + 'aria-expanded'?: boolean; + /** Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, + * allows assistive technology to override the general default of reading in document source order. */ + 'aria-flowto'?: string; + /** Indicates an element's "grabbed" state in a drag-and-drop operation. + * @deprecated in ARIA 1.1 */ + 'aria-grabbed'?: boolean; + /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an + * element. */ + 'aria-haspopup'?: boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'; + /** Indicates whether the element is exposed to an accessibility API. + * @see aria-disabled. */ + 'aria-hidden'?: boolean; + /** Indicates the entered value does not conform to the format expected by the application. + * @see aria-errormessage. */ + 'aria-invalid'?: boolean | 'false' | 'true' | 'grammar' | 'spelling'; + /** Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. */ + 'aria-keyshortcuts'?: string; + /** Defines a string value that labels the current element. + * @see aria-labelledby. */ + 'aria-label'?: string; + /** Identifies the element (or elements) that labels the current element. + * @see aria-describedby. */ + 'aria-labelledby'?: string; + /** Defines the hierarchical level of an element within a structure. */ + 'aria-level'?: number; + /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, + * and user can expect from the live region. */ + 'aria-live'?: 'off' | 'assertive' | 'polite'; + /** Indicates whether an element is modal when displayed. */ + 'aria-modal'?: boolean; + /** Indicates whether a text box accepts multiple lines of input or only a single line. */ + 'aria-multiline'?: boolean; + /** Indicates that the user may select more than one item from the current selectable descendants. */ + 'aria-multiselectable'?: boolean; + /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */ + 'aria-orientation'?: 'undefined' | 'horizontal' | 'vertical'; + /** Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship + * between DOM + * elements where the DOM hierarchy cannot be used to represent the relationship. + * @see aria-controls. */ + 'aria-owns'?: string; + /** Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. + * A hint could be a sample value or a brief description of the expected format. */ + 'aria-placeholder'?: string; + /** Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in + * the set are present in the DOM. + * @see aria-setsize. */ + 'aria-posinset'?: number; + /** Indicates the current "pressed" state of toggle buttons. + * @see aria-checked @see aria-selected. */ + 'aria-pressed'?: boolean | 'undefined' | 'false' | 'mixed' | 'true'; + /** Indicates that the element is not editable, but is otherwise operable. + * @see aria-disabled. */ + 'aria-readonly'?: boolean; + /** Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. + * @see aria-atomic. */ + 'aria-relevant'?: 'additions' | 'additions text' | 'all' | 'removals' | 'text'; + /** Indicates that user input is required on the element before a form may be submitted. */ + 'aria-required'?: boolean; + /** Defines a human-readable, author-localized description for the role of an element. */ + 'aria-roledescription'?: string; + /** Defines the total number of rows in a table, grid, or treegrid. + * @see aria-rowindex. */ + 'aria-rowcount'?: number; + /** Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid. + * @see aria-rowcount @see aria-rowspan. */ + 'aria-rowindex'?: number; + /** Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid. + * @see aria-rowindex @see aria-colspan. */ + 'aria-rowspan'?: number; + /** Indicates the current "selected" state of various widgets. + * @see aria-checked @see aria-pressed. */ + 'aria-selected'?: boolean | 'undefined' | 'false' | 'true'; + /** Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are + * present in the DOM. + * @see aria-posinset. */ + 'aria-setsize'?: number; + /** Indicates if items in a table or grid are sorted in ascending or descending order. */ + 'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other'; + /** Defines the maximum allowed value for a range widget. */ + 'aria-valuemax'?: number; + /** Defines the minimum allowed value for a range widget. */ + 'aria-valuemin'?: number; + /** Defines the current value for a range widget. + * @see aria-valuetext. */ + 'aria-valuenow'?: number; + /** Defines the human readable text alternative of aria-valuenow for a range widget. */ + 'aria-valuetext'?: string; + } + interface AllHTMLAttributes extends HTMLAttributes { // Standard HTML Attributes accept?: string; diff --git a/types/react/v15/index.d.ts b/types/react/v15/index.d.ts index 12b25439aa..72a14d9abb 100644 --- a/types/react/v15/index.d.ts +++ b/types/react/v15/index.d.ts @@ -2428,6 +2428,142 @@ declare namespace React { unselectable?: boolean; } + // All the WAI-ARIA 1.1 attributes + // https://www.w3.org/TR/wai-aria-1.1/ + interface HTMLAttributes extends DOMAttributes { + /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */ + 'aria-activedescendant'?: string; + /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change + * notifications defined by the aria-relevant attribute. */ + 'aria-atomic'?: boolean; + /** Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for + * an input and specifies how predictions would be presented if they are made. */ + 'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both'; + /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are + * complete before exposing them to the user. */ + 'aria-busy'?: boolean; + /** Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. + * @see aria-pressed @see aria-selected. */ + 'aria-checked'?: boolean | 'false' | 'mixed' | 'true'; + /** Defines the total number of columns in a table, grid, or treegrid. + * @see aria-colindex. */ + 'aria-colcount'?: number; + /** Defines an element's column index or position with respect to the total number of columns within a table, grid, or + * treegrid. + * @see aria-colcount @see aria-colspan. */ + 'aria-colindex'?: number; + /** Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid. + * @see aria-colindex @see aria-rowspan. */ + 'aria-colspan'?: number; + /** Indicates the element that represents the current item within a container or set of related elements. */ + 'aria-current'?: boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time'; + /** Identifies the element (or elements) that describes the object. + * @see aria-labelledby */ + 'aria-describedby'?: string; + /** Identifies the element that provides a detailed, extended description for the object. + * @see aria-describedby. */ + 'aria-details'?: string; + /** Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. + * @see aria-hidden @see aria-readonly. */ + 'aria-disabled'?: boolean; + /** Indicates what functions can be performed when a dragged object is released on the drop target. + * @deprecated in ARIA 1.1 */ + 'aria-dropeffect'?: 'none' | 'copy' | 'execute' | 'link' | 'move' | 'popup'; + /** Identifies the element that provides an error message for the object. + * @see aria-invalid @see aria-describedby. */ + 'aria-errormessage'?: string; + /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */ + 'aria-expanded'?: boolean; + /** Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, + * allows assistive technology to override the general default of reading in document source order. */ + 'aria-flowto'?: string; + /** Indicates an element's "grabbed" state in a drag-and-drop operation. + * @deprecated in ARIA 1.1 */ + 'aria-grabbed'?: boolean; + /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an + * element. */ + 'aria-haspopup'?: boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'; + /** Indicates whether the element is exposed to an accessibility API. + * @see aria-disabled. */ + 'aria-hidden'?: boolean; + /** Indicates the entered value does not conform to the format expected by the application. + * @see aria-errormessage. */ + 'aria-invalid'?: boolean | 'false' | 'true' | 'grammar' | 'spelling'; + /** Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. */ + 'aria-keyshortcuts'?: string; + /** Defines a string value that labels the current element. + * @see aria-labelledby. */ + 'aria-label'?: string; + /** Identifies the element (or elements) that labels the current element. + * @see aria-describedby. */ + 'aria-labelledby'?: string; + /** Defines the hierarchical level of an element within a structure. */ + 'aria-level'?: number; + /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, + * and user can expect from the live region. */ + 'aria-live'?: 'off' | 'assertive' | 'polite'; + /** Indicates whether an element is modal when displayed. */ + 'aria-modal'?: boolean; + /** Indicates whether a text box accepts multiple lines of input or only a single line. */ + 'aria-multiline'?: boolean; + /** Indicates that the user may select more than one item from the current selectable descendants. */ + 'aria-multiselectable'?: boolean; + /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */ + 'aria-orientation'?: 'undefined' | 'horizontal' | 'vertical'; + /** Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship + * between DOM + * elements where the DOM hierarchy cannot be used to represent the relationship. + * @see aria-controls. */ + 'aria-owns'?: string; + /** Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. + * A hint could be a sample value or a brief description of the expected format. */ + 'aria-placeholder'?: string; + /** Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in + * the set are present in the DOM. + * @see aria-setsize. */ + 'aria-posinset'?: number; + /** Indicates the current "pressed" state of toggle buttons. + * @see aria-checked @see aria-selected. */ + 'aria-pressed'?: boolean | 'undefined' | 'false' | 'mixed' | 'true'; + /** Indicates that the element is not editable, but is otherwise operable. + * @see aria-disabled. */ + 'aria-readonly'?: boolean; + /** Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. + * @see aria-atomic. */ + 'aria-relevant'?: 'additions' | 'additions text' | 'all' | 'removals' | 'text'; + /** Indicates that user input is required on the element before a form may be submitted. */ + 'aria-required'?: boolean; + /** Defines a human-readable, author-localized description for the role of an element. */ + 'aria-roledescription'?: string; + /** Defines the total number of rows in a table, grid, or treegrid. + * @see aria-rowindex. */ + 'aria-rowcount'?: number; + /** Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid. + * @see aria-rowcount @see aria-rowspan. */ + 'aria-rowindex'?: number; + /** Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid. + * @see aria-rowindex @see aria-colspan. */ + 'aria-rowspan'?: number; + /** Indicates the current "selected" state of various widgets. + * @see aria-checked @see aria-pressed. */ + 'aria-selected'?: boolean | 'undefined' | 'false' | 'true'; + /** Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are + * present in the DOM. + * @see aria-posinset. */ + 'aria-setsize'?: number; + /** Indicates if items in a table or grid are sorted in ascending or descending order. */ + 'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other'; + /** Defines the maximum allowed value for a range widget. */ + 'aria-valuemax'?: number; + /** Defines the minimum allowed value for a range widget. */ + 'aria-valuemin'?: number; + /** Defines the current value for a range widget. + * @see aria-valuetext. */ + 'aria-valuenow'?: number; + /** Defines the human readable text alternative of aria-valuenow for a range widget. */ + 'aria-valuetext'?: string; + } + interface AllHTMLAttributes extends HTMLAttributes { // Standard HTML Attributes accept?: string; From 8ffe91a4d8eb3f647c6548a7c91ed0f180f37225 Mon Sep 17 00:00:00 2001 From: Craig Kovatch Date: Fri, 29 Dec 2017 18:05:53 -0800 Subject: [PATCH 002/109] Fix linting errors --- types/react/index.d.ts | 191 +++++++++++++--------- types/react/v15/index.d.ts | 313 +++++++++++++++++++++---------------- 2 files changed, 299 insertions(+), 205 deletions(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index a4784caa41..e3c3f53bb8 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -2498,79 +2498,105 @@ declare namespace React { unselectable?: boolean; } - // All the WAI-ARIA 1.1 attributes - // https://www.w3.org/TR/wai-aria-1.1/ + // All the WAI-ARIA 1.1 attributes from https://www.w3.org/TR/wai-aria-1.1/ interface HTMLAttributes extends DOMAttributes { - /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */ + /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */ 'aria-activedescendant'?: string; - /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change - * notifications defined by the aria-relevant attribute. */ + /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute. */ 'aria-atomic'?: boolean; - /** Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for - * an input and specifies how predictions would be presented if they are made. */ + /** + * Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be + * presented if they are made. + */ 'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both'; - /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are - * complete before exposing them to the user. */ + /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user. */ 'aria-busy'?: boolean; - /** Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. - * @see aria-pressed @see aria-selected. */ + /** + * Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. + * @see aria-pressed @see aria-selected. + */ 'aria-checked'?: boolean | 'false' | 'mixed' | 'true'; - /** Defines the total number of columns in a table, grid, or treegrid. - * @see aria-colindex. */ + /** + * Defines the total number of columns in a table, grid, or treegrid. + * @see aria-colindex. + */ 'aria-colcount'?: number; - /** Defines an element's column index or position with respect to the total number of columns within a table, grid, or - * treegrid. - * @see aria-colcount @see aria-colspan. */ + /** + * Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid. + * @see aria-colcount @see aria-colspan. + */ 'aria-colindex'?: number; - /** Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid. - * @see aria-colindex @see aria-rowspan. */ + /** + * Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid. + * @see aria-colindex @see aria-rowspan. + */ 'aria-colspan'?: number; /** Indicates the element that represents the current item within a container or set of related elements. */ 'aria-current'?: boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time'; - /** Identifies the element (or elements) that describes the object. - * @see aria-labelledby */ + /** + * Identifies the element (or elements) that describes the object. + * @see aria-labelledby + */ 'aria-describedby'?: string; - /** Identifies the element that provides a detailed, extended description for the object. - * @see aria-describedby. */ + /** + * Identifies the element that provides a detailed, extended description for the object. + * @see aria-describedby. + */ 'aria-details'?: string; - /** Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. - * @see aria-hidden @see aria-readonly. */ + /** + * Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. + * @see aria-hidden @see aria-readonly. + */ 'aria-disabled'?: boolean; - /** Indicates what functions can be performed when a dragged object is released on the drop target. - * @deprecated in ARIA 1.1 */ + /** + * Indicates what functions can be performed when a dragged object is released on the drop target. + * @deprecated in ARIA 1.1 + */ 'aria-dropeffect'?: 'none' | 'copy' | 'execute' | 'link' | 'move' | 'popup'; - /** Identifies the element that provides an error message for the object. - * @see aria-invalid @see aria-describedby. */ + /** + * Identifies the element that provides an error message for the object. + * @see aria-invalid @see aria-describedby. + */ 'aria-errormessage'?: string; /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */ 'aria-expanded'?: boolean; - /** Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, - * allows assistive technology to override the general default of reading in document source order. */ + /** + * Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, + * allows assistive technology to override the general default of reading in document source order. + */ 'aria-flowto'?: string; - /** Indicates an element's "grabbed" state in a drag-and-drop operation. - * @deprecated in ARIA 1.1 */ + /** + * Indicates an element's "grabbed" state in a drag-and-drop operation. + * @deprecated in ARIA 1.1 + */ 'aria-grabbed'?: boolean; - /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an - * element. */ + /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. */ 'aria-haspopup'?: boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'; - /** Indicates whether the element is exposed to an accessibility API. - * @see aria-disabled. */ + /** + * Indicates whether the element is exposed to an accessibility API. + * @see aria-disabled. + */ 'aria-hidden'?: boolean; - /** Indicates the entered value does not conform to the format expected by the application. - * @see aria-errormessage. */ + /** + * Indicates the entered value does not conform to the format expected by the application. + * @see aria-errormessage. + */ 'aria-invalid'?: boolean | 'false' | 'true' | 'grammar' | 'spelling'; /** Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. */ 'aria-keyshortcuts'?: string; - /** Defines a string value that labels the current element. - * @see aria-labelledby. */ + /** + * Defines a string value that labels the current element. + * @see aria-labelledby. + */ 'aria-label'?: string; - /** Identifies the element (or elements) that labels the current element. - * @see aria-describedby. */ + /** + * Identifies the element (or elements) that labels the current element. + * @see aria-describedby. + */ 'aria-labelledby'?: string; /** Defines the hierarchical level of an element within a structure. */ 'aria-level'?: number; - /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, - * and user can expect from the live region. */ + /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region. */ 'aria-live'?: 'off' | 'assertive' | 'polite'; /** Indicates whether an element is modal when displayed. */ 'aria-modal'?: boolean; @@ -2580,46 +2606,65 @@ declare namespace React { 'aria-multiselectable'?: boolean; /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */ 'aria-orientation'?: 'undefined' | 'horizontal' | 'vertical'; - /** Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship - * between DOM - * elements where the DOM hierarchy cannot be used to represent the relationship. - * @see aria-controls. */ + /** + * Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship + * between DOM elements where the DOM hierarchy cannot be used to represent the relationship. + * @see aria-controls. + */ 'aria-owns'?: string; - /** Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. - * A hint could be a sample value or a brief description of the expected format. */ + /** + * Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. + * A hint could be a sample value or a brief description of the expected format. + */ 'aria-placeholder'?: string; - /** Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in - * the set are present in the DOM. - * @see aria-setsize. */ + /** + * Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. + * @see aria-setsize. + */ 'aria-posinset'?: number; - /** Indicates the current "pressed" state of toggle buttons. - * @see aria-checked @see aria-selected. */ + /** + * Indicates the current "pressed" state of toggle buttons. + * @see aria-checked @see aria-selected. + */ 'aria-pressed'?: boolean | 'undefined' | 'false' | 'mixed' | 'true'; - /** Indicates that the element is not editable, but is otherwise operable. - * @see aria-disabled. */ + /** + * Indicates that the element is not editable, but is otherwise operable. + * @see aria-disabled. + */ 'aria-readonly'?: boolean; - /** Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. - * @see aria-atomic. */ + /** + * Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. + * @see aria-atomic. + */ 'aria-relevant'?: 'additions' | 'additions text' | 'all' | 'removals' | 'text'; /** Indicates that user input is required on the element before a form may be submitted. */ 'aria-required'?: boolean; /** Defines a human-readable, author-localized description for the role of an element. */ 'aria-roledescription'?: string; - /** Defines the total number of rows in a table, grid, or treegrid. - * @see aria-rowindex. */ + /** + * Defines the total number of rows in a table, grid, or treegrid. + * @see aria-rowindex. + */ 'aria-rowcount'?: number; - /** Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid. - * @see aria-rowcount @see aria-rowspan. */ + /** + * Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid. + * @see aria-rowcount @see aria-rowspan. + */ 'aria-rowindex'?: number; - /** Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid. - * @see aria-rowindex @see aria-colspan. */ + /** + * Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid. + * @see aria-rowindex @see aria-colspan. + */ 'aria-rowspan'?: number; - /** Indicates the current "selected" state of various widgets. - * @see aria-checked @see aria-pressed. */ + /** + * Indicates the current "selected" state of various widgets. + * @see aria-checked @see aria-pressed. + */ 'aria-selected'?: boolean | 'undefined' | 'false' | 'true'; - /** Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are - * present in the DOM. - * @see aria-posinset. */ + /** + * Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. + * @see aria-posinset. + */ 'aria-setsize'?: number; /** Indicates if items in a table or grid are sorted in ascending or descending order. */ 'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other'; @@ -2627,8 +2672,10 @@ declare namespace React { 'aria-valuemax'?: number; /** Defines the minimum allowed value for a range widget. */ 'aria-valuemin'?: number; - /** Defines the current value for a range widget. - * @see aria-valuetext. */ + /** + * Defines the current value for a range widget. + * @see aria-valuetext. + */ 'aria-valuenow'?: number; /** Defines the human readable text alternative of aria-valuenow for a range widget. */ 'aria-valuetext'?: string; diff --git a/types/react/v15/index.d.ts b/types/react/v15/index.d.ts index 72a14d9abb..5169c8d2e8 100644 --- a/types/react/v15/index.d.ts +++ b/types/react/v15/index.d.ts @@ -2428,141 +2428,188 @@ declare namespace React { unselectable?: boolean; } - // All the WAI-ARIA 1.1 attributes - // https://www.w3.org/TR/wai-aria-1.1/ + // All the WAI-ARIA 1.1 attributes from https://www.w3.org/TR/wai-aria-1.1/ interface HTMLAttributes extends DOMAttributes { /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */ - 'aria-activedescendant'?: string; - /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change - * notifications defined by the aria-relevant attribute. */ - 'aria-atomic'?: boolean; - /** Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for - * an input and specifies how predictions would be presented if they are made. */ - 'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both'; - /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are - * complete before exposing them to the user. */ - 'aria-busy'?: boolean; - /** Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. - * @see aria-pressed @see aria-selected. */ - 'aria-checked'?: boolean | 'false' | 'mixed' | 'true'; - /** Defines the total number of columns in a table, grid, or treegrid. - * @see aria-colindex. */ - 'aria-colcount'?: number; - /** Defines an element's column index or position with respect to the total number of columns within a table, grid, or - * treegrid. - * @see aria-colcount @see aria-colspan. */ - 'aria-colindex'?: number; - /** Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid. - * @see aria-colindex @see aria-rowspan. */ - 'aria-colspan'?: number; - /** Indicates the element that represents the current item within a container or set of related elements. */ - 'aria-current'?: boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time'; - /** Identifies the element (or elements) that describes the object. - * @see aria-labelledby */ - 'aria-describedby'?: string; - /** Identifies the element that provides a detailed, extended description for the object. - * @see aria-describedby. */ - 'aria-details'?: string; - /** Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. - * @see aria-hidden @see aria-readonly. */ - 'aria-disabled'?: boolean; - /** Indicates what functions can be performed when a dragged object is released on the drop target. - * @deprecated in ARIA 1.1 */ - 'aria-dropeffect'?: 'none' | 'copy' | 'execute' | 'link' | 'move' | 'popup'; - /** Identifies the element that provides an error message for the object. - * @see aria-invalid @see aria-describedby. */ - 'aria-errormessage'?: string; - /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */ - 'aria-expanded'?: boolean; - /** Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, - * allows assistive technology to override the general default of reading in document source order. */ - 'aria-flowto'?: string; - /** Indicates an element's "grabbed" state in a drag-and-drop operation. - * @deprecated in ARIA 1.1 */ - 'aria-grabbed'?: boolean; - /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an - * element. */ - 'aria-haspopup'?: boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'; - /** Indicates whether the element is exposed to an accessibility API. - * @see aria-disabled. */ - 'aria-hidden'?: boolean; - /** Indicates the entered value does not conform to the format expected by the application. - * @see aria-errormessage. */ - 'aria-invalid'?: boolean | 'false' | 'true' | 'grammar' | 'spelling'; - /** Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. */ - 'aria-keyshortcuts'?: string; - /** Defines a string value that labels the current element. - * @see aria-labelledby. */ - 'aria-label'?: string; - /** Identifies the element (or elements) that labels the current element. - * @see aria-describedby. */ - 'aria-labelledby'?: string; - /** Defines the hierarchical level of an element within a structure. */ - 'aria-level'?: number; - /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, - * and user can expect from the live region. */ - 'aria-live'?: 'off' | 'assertive' | 'polite'; - /** Indicates whether an element is modal when displayed. */ - 'aria-modal'?: boolean; - /** Indicates whether a text box accepts multiple lines of input or only a single line. */ - 'aria-multiline'?: boolean; - /** Indicates that the user may select more than one item from the current selectable descendants. */ - 'aria-multiselectable'?: boolean; - /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */ - 'aria-orientation'?: 'undefined' | 'horizontal' | 'vertical'; - /** Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship - * between DOM - * elements where the DOM hierarchy cannot be used to represent the relationship. - * @see aria-controls. */ - 'aria-owns'?: string; - /** Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. - * A hint could be a sample value or a brief description of the expected format. */ - 'aria-placeholder'?: string; - /** Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in - * the set are present in the DOM. - * @see aria-setsize. */ - 'aria-posinset'?: number; - /** Indicates the current "pressed" state of toggle buttons. - * @see aria-checked @see aria-selected. */ - 'aria-pressed'?: boolean | 'undefined' | 'false' | 'mixed' | 'true'; - /** Indicates that the element is not editable, but is otherwise operable. - * @see aria-disabled. */ - 'aria-readonly'?: boolean; - /** Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. - * @see aria-atomic. */ - 'aria-relevant'?: 'additions' | 'additions text' | 'all' | 'removals' | 'text'; - /** Indicates that user input is required on the element before a form may be submitted. */ - 'aria-required'?: boolean; - /** Defines a human-readable, author-localized description for the role of an element. */ - 'aria-roledescription'?: string; - /** Defines the total number of rows in a table, grid, or treegrid. - * @see aria-rowindex. */ - 'aria-rowcount'?: number; - /** Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid. - * @see aria-rowcount @see aria-rowspan. */ - 'aria-rowindex'?: number; - /** Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid. - * @see aria-rowindex @see aria-colspan. */ - 'aria-rowspan'?: number; - /** Indicates the current "selected" state of various widgets. - * @see aria-checked @see aria-pressed. */ - 'aria-selected'?: boolean | 'undefined' | 'false' | 'true'; - /** Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are - * present in the DOM. - * @see aria-posinset. */ - 'aria-setsize'?: number; - /** Indicates if items in a table or grid are sorted in ascending or descending order. */ - 'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other'; - /** Defines the maximum allowed value for a range widget. */ - 'aria-valuemax'?: number; - /** Defines the minimum allowed value for a range widget. */ - 'aria-valuemin'?: number; - /** Defines the current value for a range widget. - * @see aria-valuetext. */ - 'aria-valuenow'?: number; - /** Defines the human readable text alternative of aria-valuenow for a range widget. */ - 'aria-valuetext'?: string; - } + 'aria-activedescendant'?: string; + /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute. */ + 'aria-atomic'?: boolean; + /** + * Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be + * presented if they are made. + */ + 'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both'; + /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user. */ + 'aria-busy'?: boolean; + /** + * Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. + * @see aria-pressed @see aria-selected. + */ + 'aria-checked'?: boolean | 'false' | 'mixed' | 'true'; + /** + * Defines the total number of columns in a table, grid, or treegrid. + * @see aria-colindex. + */ + 'aria-colcount'?: number; + /** + * Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid. + * @see aria-colcount @see aria-colspan. + */ + 'aria-colindex'?: number; + /** + * Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid. + * @see aria-colindex @see aria-rowspan. + */ + 'aria-colspan'?: number; + /** Indicates the element that represents the current item within a container or set of related elements. */ + 'aria-current'?: boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time'; + /** + * Identifies the element (or elements) that describes the object. + * @see aria-labelledby + */ + 'aria-describedby'?: string; + /** + * Identifies the element that provides a detailed, extended description for the object. + * @see aria-describedby. + */ + 'aria-details'?: string; + /** + * Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. + * @see aria-hidden @see aria-readonly. + */ + 'aria-disabled'?: boolean; + /** + * Indicates what functions can be performed when a dragged object is released on the drop target. + * @deprecated in ARIA 1.1 + */ + 'aria-dropeffect'?: 'none' | 'copy' | 'execute' | 'link' | 'move' | 'popup'; + /** + * Identifies the element that provides an error message for the object. + * @see aria-invalid @see aria-describedby. + */ + 'aria-errormessage'?: string; + /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */ + 'aria-expanded'?: boolean; + /** + * Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, + * allows assistive technology to override the general default of reading in document source order. + */ + 'aria-flowto'?: string; + /** + * Indicates an element's "grabbed" state in a drag-and-drop operation. + * @deprecated in ARIA 1.1 + */ + 'aria-grabbed'?: boolean; + /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. */ + 'aria-haspopup'?: boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'; + /** + * Indicates whether the element is exposed to an accessibility API. + * @see aria-disabled. + */ + 'aria-hidden'?: boolean; + /** + * Indicates the entered value does not conform to the format expected by the application. + * @see aria-errormessage. + */ + 'aria-invalid'?: boolean | 'false' | 'true' | 'grammar' | 'spelling'; + /** Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. */ + 'aria-keyshortcuts'?: string; + /** + * Defines a string value that labels the current element. + * @see aria-labelledby. + */ + 'aria-label'?: string; + /** + * Identifies the element (or elements) that labels the current element. + * @see aria-describedby. + */ + 'aria-labelledby'?: string; + /** Defines the hierarchical level of an element within a structure. */ + 'aria-level'?: number; + /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region. */ + 'aria-live'?: 'off' | 'assertive' | 'polite'; + /** Indicates whether an element is modal when displayed. */ + 'aria-modal'?: boolean; + /** Indicates whether a text box accepts multiple lines of input or only a single line. */ + 'aria-multiline'?: boolean; + /** Indicates that the user may select more than one item from the current selectable descendants. */ + 'aria-multiselectable'?: boolean; + /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */ + 'aria-orientation'?: 'undefined' | 'horizontal' | 'vertical'; + /** + * Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship + * between DOM elements where the DOM hierarchy cannot be used to represent the relationship. + * @see aria-controls. + */ + 'aria-owns'?: string; + /** + * Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. + * A hint could be a sample value or a brief description of the expected format. + */ + 'aria-placeholder'?: string; + /** + * Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. + * @see aria-setsize. + */ + 'aria-posinset'?: number; + /** + * Indicates the current "pressed" state of toggle buttons. + * @see aria-checked @see aria-selected. + */ + 'aria-pressed'?: boolean | 'undefined' | 'false' | 'mixed' | 'true'; + /** + * Indicates that the element is not editable, but is otherwise operable. + * @see aria-disabled. + */ + 'aria-readonly'?: boolean; + /** + * Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. + * @see aria-atomic. + */ + 'aria-relevant'?: 'additions' | 'additions text' | 'all' | 'removals' | 'text'; + /** Indicates that user input is required on the element before a form may be submitted. */ + 'aria-required'?: boolean; + /** Defines a human-readable, author-localized description for the role of an element. */ + 'aria-roledescription'?: string; + /** + * Defines the total number of rows in a table, grid, or treegrid. + * @see aria-rowindex. + */ + 'aria-rowcount'?: number; + /** + * Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid. + * @see aria-rowcount @see aria-rowspan. + */ + 'aria-rowindex'?: number; + /** + * Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid. + * @see aria-rowindex @see aria-colspan. + */ + 'aria-rowspan'?: number; + /** + * Indicates the current "selected" state of various widgets. + * @see aria-checked @see aria-pressed. + */ + 'aria-selected'?: boolean | 'undefined' | 'false' | 'true'; + /** + * Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. + * @see aria-posinset. + */ + 'aria-setsize'?: number; + /** Indicates if items in a table or grid are sorted in ascending or descending order. */ + 'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other'; + /** Defines the maximum allowed value for a range widget. */ + 'aria-valuemax'?: number; + /** Defines the minimum allowed value for a range widget. */ + 'aria-valuemin'?: number; + /** + * Defines the current value for a range widget. + * @see aria-valuetext. + */ + 'aria-valuenow'?: number; + /** Defines the human readable text alternative of aria-valuenow for a range widget. */ + 'aria-valuetext'?: string; + } interface AllHTMLAttributes extends HTMLAttributes { // Standard HTML Attributes From eebfcef80eec96a3c823b0e73e32f297050241bf Mon Sep 17 00:00:00 2001 From: Craig Kovatch Date: Thu, 4 Jan 2018 14:23:28 -0800 Subject: [PATCH 003/109] Add 'true' and 'false' options to boolean attributes, remove incorrect 'undefined' options --- types/react/index.d.ts | 28 ++++++++++++++-------------- types/react/v15/index.d.ts | 28 ++++++++++++++-------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index e3c3f53bb8..9277ed2986 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -2503,14 +2503,14 @@ declare namespace React { /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */ 'aria-activedescendant'?: string; /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute. */ - 'aria-atomic'?: boolean; + 'aria-atomic'?: boolean | 'false' | 'true'; /** * Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be * presented if they are made. */ 'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both'; /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user. */ - 'aria-busy'?: boolean; + 'aria-busy'?: boolean | 'false' | 'true'; /** * Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. * @see aria-pressed @see aria-selected. @@ -2547,7 +2547,7 @@ declare namespace React { * Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. * @see aria-hidden @see aria-readonly. */ - 'aria-disabled'?: boolean; + 'aria-disabled'?: boolean | 'false' | 'true'; /** * Indicates what functions can be performed when a dragged object is released on the drop target. * @deprecated in ARIA 1.1 @@ -2559,7 +2559,7 @@ declare namespace React { */ 'aria-errormessage'?: string; /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */ - 'aria-expanded'?: boolean; + 'aria-expanded'?: boolean | 'false' | 'true'; /** * Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, * allows assistive technology to override the general default of reading in document source order. @@ -2569,14 +2569,14 @@ declare namespace React { * Indicates an element's "grabbed" state in a drag-and-drop operation. * @deprecated in ARIA 1.1 */ - 'aria-grabbed'?: boolean; + 'aria-grabbed'?: boolean | 'false' | 'true'; /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. */ 'aria-haspopup'?: boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'; /** * Indicates whether the element is exposed to an accessibility API. * @see aria-disabled. */ - 'aria-hidden'?: boolean; + 'aria-hidden'?: boolean | 'false' | 'true'; /** * Indicates the entered value does not conform to the format expected by the application. * @see aria-errormessage. @@ -2599,13 +2599,13 @@ declare namespace React { /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region. */ 'aria-live'?: 'off' | 'assertive' | 'polite'; /** Indicates whether an element is modal when displayed. */ - 'aria-modal'?: boolean; + 'aria-modal'?: boolean | 'false' | 'true'; /** Indicates whether a text box accepts multiple lines of input or only a single line. */ - 'aria-multiline'?: boolean; + 'aria-multiline'?: boolean | 'false' | 'true'; /** Indicates that the user may select more than one item from the current selectable descendants. */ - 'aria-multiselectable'?: boolean; + 'aria-multiselectable'?: boolean | 'false' | 'true'; /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */ - 'aria-orientation'?: 'undefined' | 'horizontal' | 'vertical'; + 'aria-orientation'?: 'horizontal' | 'vertical'; /** * Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship * between DOM elements where the DOM hierarchy cannot be used to represent the relationship. @@ -2626,19 +2626,19 @@ declare namespace React { * Indicates the current "pressed" state of toggle buttons. * @see aria-checked @see aria-selected. */ - 'aria-pressed'?: boolean | 'undefined' | 'false' | 'mixed' | 'true'; + 'aria-pressed'?: boolean | 'false' | 'mixed' | 'true'; /** * Indicates that the element is not editable, but is otherwise operable. * @see aria-disabled. */ - 'aria-readonly'?: boolean; + 'aria-readonly'?: boolean | 'false' | 'true'; /** * Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. * @see aria-atomic. */ 'aria-relevant'?: 'additions' | 'additions text' | 'all' | 'removals' | 'text'; /** Indicates that user input is required on the element before a form may be submitted. */ - 'aria-required'?: boolean; + 'aria-required'?: boolean | 'false' | 'true'; /** Defines a human-readable, author-localized description for the role of an element. */ 'aria-roledescription'?: string; /** @@ -2660,7 +2660,7 @@ declare namespace React { * Indicates the current "selected" state of various widgets. * @see aria-checked @see aria-pressed. */ - 'aria-selected'?: boolean | 'undefined' | 'false' | 'true'; + 'aria-selected'?: boolean | 'false' | 'true'; /** * Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. * @see aria-posinset. diff --git a/types/react/v15/index.d.ts b/types/react/v15/index.d.ts index 5169c8d2e8..797d21f0d8 100644 --- a/types/react/v15/index.d.ts +++ b/types/react/v15/index.d.ts @@ -2433,14 +2433,14 @@ declare namespace React { /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */ 'aria-activedescendant'?: string; /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute. */ - 'aria-atomic'?: boolean; + 'aria-atomic'?: boolean | 'false' | 'true'; /** * Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be * presented if they are made. */ 'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both'; /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user. */ - 'aria-busy'?: boolean; + 'aria-busy'?: boolean | 'false' | 'true'; /** * Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. * @see aria-pressed @see aria-selected. @@ -2477,7 +2477,7 @@ declare namespace React { * Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. * @see aria-hidden @see aria-readonly. */ - 'aria-disabled'?: boolean; + 'aria-disabled'?: boolean | 'false' | 'true'; /** * Indicates what functions can be performed when a dragged object is released on the drop target. * @deprecated in ARIA 1.1 @@ -2489,7 +2489,7 @@ declare namespace React { */ 'aria-errormessage'?: string; /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */ - 'aria-expanded'?: boolean; + 'aria-expanded'?: boolean | 'false' | 'true'; /** * Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, * allows assistive technology to override the general default of reading in document source order. @@ -2499,14 +2499,14 @@ declare namespace React { * Indicates an element's "grabbed" state in a drag-and-drop operation. * @deprecated in ARIA 1.1 */ - 'aria-grabbed'?: boolean; + 'aria-grabbed'?: boolean | 'false' | 'true'; /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. */ 'aria-haspopup'?: boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'; /** * Indicates whether the element is exposed to an accessibility API. * @see aria-disabled. */ - 'aria-hidden'?: boolean; + 'aria-hidden'?: boolean | 'false' | 'true'; /** * Indicates the entered value does not conform to the format expected by the application. * @see aria-errormessage. @@ -2529,13 +2529,13 @@ declare namespace React { /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region. */ 'aria-live'?: 'off' | 'assertive' | 'polite'; /** Indicates whether an element is modal when displayed. */ - 'aria-modal'?: boolean; + 'aria-modal'?: boolean | 'false' | 'true'; /** Indicates whether a text box accepts multiple lines of input or only a single line. */ - 'aria-multiline'?: boolean; + 'aria-multiline'?: boolean | 'false' | 'true'; /** Indicates that the user may select more than one item from the current selectable descendants. */ - 'aria-multiselectable'?: boolean; + 'aria-multiselectable'?: boolean | 'false' | 'true'; /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */ - 'aria-orientation'?: 'undefined' | 'horizontal' | 'vertical'; + 'aria-orientation'?: 'horizontal' | 'vertical'; /** * Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship * between DOM elements where the DOM hierarchy cannot be used to represent the relationship. @@ -2556,19 +2556,19 @@ declare namespace React { * Indicates the current "pressed" state of toggle buttons. * @see aria-checked @see aria-selected. */ - 'aria-pressed'?: boolean | 'undefined' | 'false' | 'mixed' | 'true'; + 'aria-pressed'?: boolean | 'false' | 'mixed' | 'true'; /** * Indicates that the element is not editable, but is otherwise operable. * @see aria-disabled. */ - 'aria-readonly'?: boolean; + 'aria-readonly'?: boolean | 'false' | 'true'; /** * Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. * @see aria-atomic. */ 'aria-relevant'?: 'additions' | 'additions text' | 'all' | 'removals' | 'text'; /** Indicates that user input is required on the element before a form may be submitted. */ - 'aria-required'?: boolean; + 'aria-required'?: boolean | 'false' | 'true'; /** Defines a human-readable, author-localized description for the role of an element. */ 'aria-roledescription'?: string; /** @@ -2590,7 +2590,7 @@ declare namespace React { * Indicates the current "selected" state of various widgets. * @see aria-checked @see aria-pressed. */ - 'aria-selected'?: boolean | 'undefined' | 'false' | 'true'; + 'aria-selected'?: boolean | 'false' | 'true'; /** * Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. * @see aria-posinset. From 0565f573b66721dd76b625ed3696ecc561d8b95d Mon Sep 17 00:00:00 2001 From: Craig Kovatch Date: Sat, 6 Jan 2018 11:11:44 -0800 Subject: [PATCH 004/109] Add tests --- types/react/test/index.ts | 6 +++++- types/react/test/tsx.tsx | 11 +++++++++++ types/react/v15/test/index.ts | 6 +++++- types/react/v15/test/tsx.tsx | 11 +++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/types/react/test/index.ts b/types/react/test/index.ts index e8aabfa35c..06a72c2bcb 100644 --- a/types/react/test/index.ts +++ b/types/react/test/index.ts @@ -307,7 +307,11 @@ const htmlAttr: React.HTMLProps = { }, dangerouslySetInnerHTML: { __html: "STRONG" - } + }, + 'aria-atomic': false, + 'aria-checked': 'true', + 'aria-colcount': 7, + 'aria-label': 'test' }; DOM.div(htmlAttr); DOM.span(htmlAttr); diff --git a/types/react/test/tsx.tsx b/types/react/test/tsx.tsx index 38d902c387..26c2ff9d41 100644 --- a/types/react/test/tsx.tsx +++ b/types/react/test/tsx.tsx @@ -41,6 +41,17 @@ StatelessComponent2.defaultProps = { foo ; +// WAI-ARIA 1.1 Attributes +
+ bar +
; + interface Props { hello: string; } diff --git a/types/react/v15/test/index.ts b/types/react/v15/test/index.ts index 340ea94ec2..e4b324916d 100644 --- a/types/react/v15/test/index.ts +++ b/types/react/v15/test/index.ts @@ -346,7 +346,11 @@ const htmlAttr: React.HTMLProps = { }, dangerouslySetInnerHTML: { __html: "STRONG" - } + }, + 'aria-atomic': false, + 'aria-checked': 'true', + 'aria-colcount': 7, + 'aria-label': 'test' }; React.DOM.div(htmlAttr); React.DOM.span(htmlAttr); diff --git a/types/react/v15/test/tsx.tsx b/types/react/v15/test/tsx.tsx index 8afb75d9a8..7f781cb8fc 100644 --- a/types/react/v15/test/tsx.tsx +++ b/types/react/v15/test/tsx.tsx @@ -41,6 +41,17 @@ StatelessComponent2.defaultProps = { foo ; +// WAI-ARIA 1.1 Attributes +
+ bar +
; + interface Props { hello: string; } From b540b2e9e0f95ebb59798bbf4dff5d8c36dd5041 Mon Sep 17 00:00:00 2001 From: Craig Kovatch Date: Sat, 6 Jan 2018 11:13:19 -0800 Subject: [PATCH 005/109] Revert incorrect use of $ExpectError --- types/react/test/tsx.tsx | 1 - types/react/v15/test/tsx.tsx | 1 - 2 files changed, 2 deletions(-) diff --git a/types/react/test/tsx.tsx b/types/react/test/tsx.tsx index 26c2ff9d41..bc48add9a4 100644 --- a/types/react/test/tsx.tsx +++ b/types/react/test/tsx.tsx @@ -47,7 +47,6 @@ StatelessComponent2.defaultProps = { aria-checked='true' aria-colcount={7} aria-label='test' - ariaExpanded='false' // $ExpectError > bar ; diff --git a/types/react/v15/test/tsx.tsx b/types/react/v15/test/tsx.tsx index 7f781cb8fc..289a912a3f 100644 --- a/types/react/v15/test/tsx.tsx +++ b/types/react/v15/test/tsx.tsx @@ -47,7 +47,6 @@ StatelessComponent2.defaultProps = { aria-checked='true' aria-colcount={7} aria-label='test' - ariaExpanded='false' // $ExpectError > bar ; From 2f72593265c0202f6c46d1cc47cdfb778c74b369 Mon Sep 17 00:00:00 2001 From: baobabx Date: Wed, 17 Jan 2018 16:39:49 +0900 Subject: [PATCH 006/109] Adding definition for Database#configure --- types/sqlite3/index.d.ts | 2 ++ types/sqlite3/sqlite3-tests.ts | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/types/sqlite3/index.d.ts b/types/sqlite3/index.d.ts index 921845e5a0..26f69d526d 100644 --- a/types/sqlite3/index.d.ts +++ b/types/sqlite3/index.d.ts @@ -83,6 +83,8 @@ export class Database extends events.EventEmitter { on(event: "error", listener: (err: Error) => void): this; on(event: "open" | "close", listener: () => void): this; on(event: string, listener: (...args: any[]) => void): this; + + configure(option: "busyTimeout", value: number): void; } export function verbose(): void; diff --git a/types/sqlite3/sqlite3-tests.ts b/types/sqlite3/sqlite3-tests.ts index 4ddfa0a502..ee5e4b17d7 100644 --- a/types/sqlite3/sqlite3-tests.ts +++ b/types/sqlite3/sqlite3-tests.ts @@ -5,7 +5,8 @@ let db: sqlite3.Database = new sqlite3.Database('chain.sqlite3', () => {}); function createDb() { console.log("createDb chain"); - db = new sqlite3.Database('chain.sqlite3', createTable); + db = new sqlite3.Database('chain.sqlite3', createTable); + db.configure("busyTimeout", 1000); } function createTable() { From 1621caf0dfdceac25e5ecc5748184c9edcefb079 Mon Sep 17 00:00:00 2001 From: Mathieu Masy Date: Mon, 5 Feb 2018 16:57:56 -0500 Subject: [PATCH 007/109] [react-form] Updated typings --- types/react-form/index.d.ts | 9 ++++-- types/react-form/react-form-tests.tsx | 44 +++++++++++++++++++++++++++ types/react-form/tsconfig.json | 2 +- 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/types/react-form/index.d.ts b/types/react-form/index.d.ts index 965f55e7e7..debc89488c 100644 --- a/types/react-form/index.d.ts +++ b/types/react-form/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for react-form 2.12 +// Type definitions for react-form 2.16 // Project: https://github.com/tannerlinsley/react-form#readme // Definitions by: Cameron McAteer +// Mathieu Masy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -18,7 +19,7 @@ export interface FormErrors { [key: string]: FormError; } export type NestedErrors = Nested; -export type RenderReturn = JSX.Element | false | null; +export type RenderReturn = JSX.Element | false | null | never[]; export interface FormState { values: FormValues; @@ -29,7 +30,10 @@ export interface FormState { } export interface FormProps { + component?: React.ReactType<{ formApi: FormApi }>; + render?: (formApi: FormApi) => RenderReturn; dontValidateOnMount?: boolean; + validateOnSubmit?: boolean; defaultValues?: FormValues; onSubmit?(values: FormValues, submissionEvent: React.SyntheticEvent, formApi: FormApi): void; preSubmit?(values: FormValues, formApi: FormApi): FormValues; @@ -43,6 +47,7 @@ export interface FormProps { [field: string]: (value: FormValue) => Promise }; dontPreventDefault?: boolean; + getApi?: (formApi: FormApi) => void; } export interface FormApi { diff --git a/types/react-form/react-form-tests.tsx b/types/react-form/react-form-tests.tsx index 2d08cc4b8a..36aa86db94 100644 --- a/types/react-form/react-form-tests.tsx +++ b/types/react-form/react-form-tests.tsx @@ -21,6 +21,50 @@ import { FormApi } from 'react-form'; +// Form Api +class FormApiMethods extends React.Component { + constructor(props: {}) { + super(props); + this.state = {}; + } + + render() { + const FormContent = (props: { formApi?: FormApi }) => ( +
{}}> + + + + ); + + return ( +
+
+ { formApi => ( + + + + + )} + + +
( + + + + + )}> + + +
+ + + +
+
+ ); + } +} + // Basic Form Example const statusOptions = [ { diff --git a/types/react-form/tsconfig.json b/types/react-form/tsconfig.json index cc5dcb26ba..43d05d6dc6 100644 --- a/types/react-form/tsconfig.json +++ b/types/react-form/tsconfig.json @@ -23,4 +23,4 @@ "index.d.ts", "react-form-tests.tsx" ] -} \ No newline at end of file +} From 3eb8d0c31adb111d48011296ae2ddaec327143fa Mon Sep 17 00:00:00 2001 From: Mathieu Masy Date: Wed, 7 Feb 2018 14:20:16 -0500 Subject: [PATCH 008/109] [react-form] Added placeholder prop on Select component --- types/react-form/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-form/index.d.ts b/types/react-form/index.d.ts index debc89488c..4dc7e4b1b2 100644 --- a/types/react-form/index.d.ts +++ b/types/react-form/index.d.ts @@ -142,6 +142,7 @@ export type SelectOptions = Array<{ export interface SelectProps extends FieldProps, React.SelectHTMLAttributes { options: SelectOptions; + placeholder: string; } export const Select: React.StatelessComponent; From d4d064b7c57f3feddfe25a417bed0cdf70ea214f Mon Sep 17 00:00:00 2001 From: orblazer Date: Sun, 11 Mar 2018 14:32:47 +0100 Subject: [PATCH 009/109] Fix "this" context on "on" functions --- types/ws/index.d.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/types/ws/index.d.ts b/types/ws/index.d.ts index 303dcc3875..fbfc3713c3 100644 --- a/types/ws/index.d.ts +++ b/types/ws/index.d.ts @@ -67,14 +67,14 @@ declare class WebSocket extends events.EventEmitter { removeEventListener(method: string, listener?: () => void): void; // Events - on(event: 'close', listener: (code: number, reason: string) => void): this; - on(event: 'error', listener: (err: Error) => void): this; - on(event: 'upgrade', listener: (request: http.IncomingMessage) => void): this; - on(event: 'message', listener: (data: WebSocket.Data) => void): this; - on(event: 'open' , listener: () => void): this; - on(event: 'ping' | 'pong', listener: (data: Buffer) => void): this; - on(event: 'unexpected-response', listener: (request: http.ClientRequest, response: http.IncomingMessage) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; + on(event: 'close', listener: (this: WebSocket, code: number, reason: string) => void): this; + on(event: 'error', listener: (this: WebSocket, err: Error) => void): this; + on(event: 'upgrade', listener: (this: WebSocket, request: http.IncomingMessage) => void): this; + on(event: 'message', listener: (this: WebSocket, data: WebSocket.Data) => void): this; + on(event: 'open' , listener: (this: WebSocket) => void): this; + on(event: 'ping' | 'pong', listener: (this: WebSocket, data: Buffer) => void): this; + on(event: 'unexpected-response', listener: (this: WebSocket, request: http.ClientRequest, response: http.IncomingMessage) => void): this; + on(event: string | symbol, listener: (this: WebSocket, ...args: any[]) => void): this; addListener(event: 'close', listener: (code: number, message: string) => void): this; addListener(event: 'error', listener: (err: Error) => void): this; @@ -181,11 +181,11 @@ declare namespace WebSocket { shouldHandle(request: http.IncomingMessage): boolean; // Events - on(event: 'connection', cb: (socket: WebSocket, request: http.IncomingMessage) => void): this; - on(event: 'error', cb: (error: Error) => void): this; - on(event: 'headers', cb: (headers: string[], request: http.IncomingMessage) => void): this; - on(event: 'listening', cb: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; + on(event: 'connection', cb: (this: WebSocket, socket: WebSocket, request: http.IncomingMessage) => void): this; + on(event: 'error', cb: (this: WebSocket, error: Error) => void): this; + on(event: 'headers', cb: (this: WebSocket, headers: string[], request: http.IncomingMessage) => void): this; + on(event: 'listening', cb: (this: WebSocket) => void): this; + on(event: string | symbol, listener: (this: WebSocket, ...args: any[]) => void): this; addListener(event: 'connection', cb: (client: WebSocket) => void): this; addListener(event: 'error', cb: (err: Error) => void): this; From 15412bfd248a0efdafd8aa6641c74128d6eb5406 Mon Sep 17 00:00:00 2001 From: orblazer Date: Sun, 11 Mar 2018 14:36:07 +0100 Subject: [PATCH 010/109] Add missing contribution --- types/ws/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/ws/index.d.ts b/types/ws/index.d.ts index fbfc3713c3..7848bf3992 100644 --- a/types/ws/index.d.ts +++ b/types/ws/index.d.ts @@ -4,6 +4,7 @@ // Matt Silverlock // Margus Lamp // Philippe D'Alva +// Orblazer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// From dbd9ce2952c633fe63ebe9a1a03103ce1a218742 Mon Sep 17 00:00:00 2001 From: Behind The Math Date: Sun, 11 Mar 2018 13:19:15 -0400 Subject: [PATCH 011/109] [sqlite3] Add return type for .verbose() --- types/sqlite3/index.d.ts | 17 +++++++++++++++-- types/sqlite3/sqlite3-tests.ts | 4 ++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/types/sqlite3/index.d.ts b/types/sqlite3/index.d.ts index 921845e5a0..1116cc6388 100644 --- a/types/sqlite3/index.d.ts +++ b/types/sqlite3/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for sqlite3 3.1 +// Type definitions for sqlite3 3.1.13 // Project: https://github.com/mapbox/node-sqlite3 // Definitions by: Nick Malaguti // Sumant Manne +// Behind The Math // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -85,4 +86,16 @@ export class Database extends events.EventEmitter { on(event: string, listener: (...args: any[]) => void): this; } -export function verbose(): void; +export function verbose(): sqlite3; + +// tslint:disable-next-line:strict-export-declare-modifiers +interface sqlite3 { + OPEN_READONLY: number; + OPEN_READWRITE: number; + OPEN_CREATE: number; + cached: typeof cached; + RunResult: RunResult; + Statement: typeof Statement; + Database: typeof Database; + verbose(): this; +} diff --git a/types/sqlite3/sqlite3-tests.ts b/types/sqlite3/sqlite3-tests.ts index 4ddfa0a502..cc2ace853c 100644 --- a/types/sqlite3/sqlite3-tests.ts +++ b/types/sqlite3/sqlite3-tests.ts @@ -1,5 +1,5 @@ -import sqlite3 = require('sqlite3'); -sqlite3.verbose(); +import * as sqlite from 'sqlite3'; +const sqlite3 = sqlite.verbose(); let db: sqlite3.Database = new sqlite3.Database('chain.sqlite3', () => {}); From 6d7596886844c498730bf91e34287d62a1459689 Mon Sep 17 00:00:00 2001 From: Behind The Math Date: Sun, 11 Mar 2018 16:10:12 -0400 Subject: [PATCH 012/109] Bug fixes --- types/sqlite3/index.d.ts | 2 +- types/sqlite3/sqlite3-tests.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/sqlite3/index.d.ts b/types/sqlite3/index.d.ts index 1116cc6388..7461cf82b7 100644 --- a/types/sqlite3/index.d.ts +++ b/types/sqlite3/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for sqlite3 3.1.13 +// Type definitions for sqlite3 3.1 // Project: https://github.com/mapbox/node-sqlite3 // Definitions by: Nick Malaguti // Sumant Manne diff --git a/types/sqlite3/sqlite3-tests.ts b/types/sqlite3/sqlite3-tests.ts index cc2ace853c..fe897f73ec 100644 --- a/types/sqlite3/sqlite3-tests.ts +++ b/types/sqlite3/sqlite3-tests.ts @@ -1,7 +1,7 @@ import * as sqlite from 'sqlite3'; const sqlite3 = sqlite.verbose(); -let db: sqlite3.Database = new sqlite3.Database('chain.sqlite3', () => {}); +let db: sqlite.Database = new sqlite3.Database('chain.sqlite3', () => {}); function createDb() { console.log("createDb chain"); From 46673df4bb096c17b876f83f771127b585131663 Mon Sep 17 00:00:00 2001 From: Calum MacRae Date: Mon, 12 Mar 2018 15:41:33 +0000 Subject: [PATCH 013/109] Return date --- types/twix/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/twix/index.d.ts b/types/twix/index.d.ts index 8ca402e8e6..5b37054eb9 100644 --- a/types/twix/index.d.ts +++ b/types/twix/index.d.ts @@ -80,6 +80,7 @@ export interface Twix { asDuration(period: string): Duration; isValid(): boolean; + toDate(): Date; } export interface TwixStatic { From b31ffd962e2563b73599a721b2cd9ab0f35ceb41 Mon Sep 17 00:00:00 2001 From: stephentuso Date: Wed, 14 Mar 2018 16:17:27 -0400 Subject: [PATCH 014/109] [dynogels] Fix return type for Item#get --- types/dynogels/dynogels-tests.ts | 6 ++++-- types/dynogels/index.d.ts | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/types/dynogels/dynogels-tests.ts b/types/dynogels/dynogels-tests.ts index ca16707256..a7634548e7 100644 --- a/types/dynogels/dynogels-tests.ts +++ b/types/dynogels/dynogels-tests.ts @@ -148,12 +148,14 @@ dynogels.dynamoDriver(dynamodb); // Saving Models To DynamoDB Account.create({ email: 'foo@example.com', name: 'Foo Bar', age: 21 }, (err, acc) => { - acc.get('email'); + const email = acc.get('email') as string; + console.log(`Created account ${email}`); }); const acc = new Account({ email: 'test@example.com', name: 'Test Example' }); acc.save((err) => { - acc.get('email'); + const email = acc.get('email') as string; + console.log(`Created account ${email}`); }); BlogPost.create({ diff --git a/types/dynogels/index.d.ts b/types/dynogels/index.d.ts index 2e4c5acbf4..ea82c74609 100644 --- a/types/dynogels/index.d.ts +++ b/types/dynogels/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for dynogels 8.0 +// Type definitions for dynogels 9.0 // Project: https://github.com/clarkie/dynogels#readme // Definitions by: Spartan Labs +// Stephen Tuso // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -152,7 +153,8 @@ export interface ModelConfig { // Dynogels Item export interface Item { - get(key?: string): { [key: string]: any }; + get(): { [key: string]: any }; + get(key: string): any; set(params: {}): Item; save(callback?: DynogelsItemCallback): void; update(options: UpdateItemOptions, callback?: DynogelsItemCallback): void; From c3545db618098defce0d82cb5ebe742c23b1bfe2 Mon Sep 17 00:00:00 2001 From: Mykolas Kairys Date: Thu, 15 Mar 2018 14:21:40 +0200 Subject: [PATCH 015/109] react-router-redux typings update for createMatchSelector function --- types/react-router-redux/index.d.ts | 4 ++++ types/react-router-redux/react-router-redux-tests.tsx | 6 +++++- types/react-router-redux/tslint.json | 5 ++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/types/react-router-redux/index.d.ts b/types/react-router-redux/index.d.ts index 0ce965b397..89ef136014 100644 --- a/types/react-router-redux/index.d.ts +++ b/types/react-router-redux/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/ReactTraining/react-router/tree/master/packages/react-router-redux // Definitions by: Huy Nguyen // Shoya Tanaka +// Mykolas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -19,6 +20,7 @@ import { LocationDescriptor } from 'history'; import * as React from 'react'; +import { match } from 'react-router'; export interface ConnectedRouterProps { store?: Store; @@ -77,3 +79,5 @@ export interface LocationChangeAction { } export function routerMiddleware(history: History): Middleware; + +export function createMatchSelector(path: string): (state: State) => match | null; diff --git a/types/react-router-redux/react-router-redux-tests.tsx b/types/react-router-redux/react-router-redux-tests.tsx index b6927fb7bf..bf2575ae26 100644 --- a/types/react-router-redux/react-router-redux-tests.tsx +++ b/types/react-router-redux/react-router-redux-tests.tsx @@ -7,7 +7,7 @@ import { Provider } from 'react-redux'; import createHistory from 'history/createBrowserHistory'; import { Route } from 'react-router'; -import { ConnectedRouter, routerReducer, routerMiddleware, push, RouterState } from 'react-router-redux'; +import { ConnectedRouter, routerReducer, routerMiddleware, push, RouterState, createMatchSelector } from 'react-router-redux'; // Create a history of your choosing (we're using a browser history in this case) const history = createHistory(); @@ -44,3 +44,7 @@ ReactDOM.render( // Now you can dispatch navigation actions from anywhere! store.dispatch(push('/foo')); + +// And match location path using createMatchSelector +const matchSelector = createMatchSelector('/:foo'); +const match = matchSelector(store.getState()); diff --git a/types/react-router-redux/tslint.json b/types/react-router-redux/tslint.json index f93cf8562a..71ee04c4e1 100644 --- a/types/react-router-redux/tslint.json +++ b/types/react-router-redux/tslint.json @@ -1,3 +1,6 @@ { - "extends": "dtslint/dt.json" + "extends": "dtslint/dt.json", + "rules": { + "no-unnecessary-generics": false + } } From b13cd56680d5ff64393bd8d6098337f8e239e9f4 Mon Sep 17 00:00:00 2001 From: nevace Date: Thu, 15 Mar 2018 12:54:04 +0000 Subject: [PATCH 016/109] change Response type to 'any' --- types/twit/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/twit/index.d.ts b/types/twit/index.d.ts index 3fbd57283a..79106ce66e 100644 --- a/types/twit/index.d.ts +++ b/types/twit/index.d.ts @@ -224,7 +224,7 @@ declare module 'twit' { } } - export type Response = object + export type Response = any interface MediaParam { file_path: string From 08928fb325a5c19b139cf811c6df7d002660833a Mon Sep 17 00:00:00 2001 From: Mathieu Masy Date: Thu, 15 Mar 2018 10:23:12 -0400 Subject: [PATCH 017/109] [react-form] SelectProps' placeholder is not required --- types/react-form/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-form/index.d.ts b/types/react-form/index.d.ts index 4dc7e4b1b2..4114f3b7ee 100644 --- a/types/react-form/index.d.ts +++ b/types/react-form/index.d.ts @@ -142,7 +142,7 @@ export type SelectOptions = Array<{ export interface SelectProps extends FieldProps, React.SelectHTMLAttributes { options: SelectOptions; - placeholder: string; + placeholder?: string; } export const Select: React.StatelessComponent; From a7c606fea92885f8c23eea56761db388c165da40 Mon Sep 17 00:00:00 2001 From: nevace Date: Thu, 15 Mar 2018 14:23:54 +0000 Subject: [PATCH 018/109] added cursor param --- types/twit/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/twit/index.d.ts b/types/twit/index.d.ts index 79106ce66e..4100f95349 100644 --- a/types/twit/index.d.ts +++ b/types/twit/index.d.ts @@ -260,6 +260,7 @@ declare module 'twit' { long?: number, follow?: boolean, include_email?: boolean, + cursor?: number } export interface PromiseResponse { data: Response, From 89a712404fcb22541cbee4d661445a6734d89b48 Mon Sep 17 00:00:00 2001 From: nevace Date: Thu, 15 Mar 2018 14:25:59 +0000 Subject: [PATCH 019/109] remove previous change --- types/twit/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/twit/index.d.ts b/types/twit/index.d.ts index 4100f95349..27f33ad97d 100644 --- a/types/twit/index.d.ts +++ b/types/twit/index.d.ts @@ -224,7 +224,7 @@ declare module 'twit' { } } - export type Response = any + export type Response = object interface MediaParam { file_path: string From 2fe747bc0fadb216d1ef359eef870c8a4fa848d3 Mon Sep 17 00:00:00 2001 From: nevace Date: Thu, 15 Mar 2018 14:28:56 +0000 Subject: [PATCH 020/109] remove right change --- types/twit/index.d.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/types/twit/index.d.ts b/types/twit/index.d.ts index 27f33ad97d..30baf8c5d8 100644 --- a/types/twit/index.d.ts +++ b/types/twit/index.d.ts @@ -224,7 +224,7 @@ declare module 'twit' { } } - export type Response = object + export type Response = any interface MediaParam { file_path: string @@ -259,8 +259,7 @@ declare module 'twit' { lat?: number, long?: number, follow?: boolean, - include_email?: boolean, - cursor?: number + include_email?: boolean } export interface PromiseResponse { data: Response, From 4026a2cc259d6d2e9a7b9e5050bb190b0d4d177a Mon Sep 17 00:00:00 2001 From: nevace Date: Thu, 15 Mar 2018 14:29:45 +0000 Subject: [PATCH 021/109] comma --- types/twit/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/twit/index.d.ts b/types/twit/index.d.ts index 30baf8c5d8..79106ce66e 100644 --- a/types/twit/index.d.ts +++ b/types/twit/index.d.ts @@ -259,7 +259,7 @@ declare module 'twit' { lat?: number, long?: number, follow?: boolean, - include_email?: boolean + include_email?: boolean, } export interface PromiseResponse { data: Response, From 8b910ced688d7a90c338c2bb833185e0353deed7 Mon Sep 17 00:00:00 2001 From: nevace Date: Thu, 15 Mar 2018 14:31:33 +0000 Subject: [PATCH 022/109] add cursor param --- types/twit/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/twit/index.d.ts b/types/twit/index.d.ts index 79106ce66e..ce6a1327f1 100644 --- a/types/twit/index.d.ts +++ b/types/twit/index.d.ts @@ -260,6 +260,7 @@ declare module 'twit' { long?: number, follow?: boolean, include_email?: boolean, + cursor?: number, } export interface PromiseResponse { data: Response, From f61789e131db99d372f98fb64d45ae402d7be404 Mon Sep 17 00:00:00 2001 From: nevace Date: Thu, 15 Mar 2018 14:37:47 +0000 Subject: [PATCH 023/109] remove previous change --- types/twit/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/twit/index.d.ts b/types/twit/index.d.ts index ce6a1327f1..6b82dd6b65 100644 --- a/types/twit/index.d.ts +++ b/types/twit/index.d.ts @@ -224,7 +224,7 @@ declare module 'twit' { } } - export type Response = any + export type Response = object interface MediaParam { file_path: string From 4ae235a416378c87087274d69d3c18d59855fea7 Mon Sep 17 00:00:00 2001 From: Craig Kovatch Date: Thu, 15 Mar 2018 12:12:39 -0700 Subject: [PATCH 024/109] Add missing 'aria-controls' attribute to React WAI-ARIA typings --- types/react/index.d.ts | 5 +++++ types/react/v15/index.d.ts | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index d56d9571e1..df7716f8a9 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -2533,6 +2533,11 @@ declare namespace React { * @see aria-colindex @see aria-rowspan. */ 'aria-colspan'?: number; + /** + * Identifies the element (or elements) whose contents or presence are controlled by the current element. + * @see aria-owns. + */ + 'aria-controls'?: string; /** Indicates the element that represents the current item within a container or set of related elements. */ 'aria-current'?: boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time'; /** diff --git a/types/react/v15/index.d.ts b/types/react/v15/index.d.ts index 534d92de29..2111008d0d 100644 --- a/types/react/v15/index.d.ts +++ b/types/react/v15/index.d.ts @@ -2481,6 +2481,11 @@ declare namespace React { * @see aria-colindex @see aria-rowspan. */ 'aria-colspan'?: number; + /** + * Identifies the element (or elements) whose contents or presence are controlled by the current element. + * @see aria-owns. + */ + 'aria-controls'?: string; /** Indicates the element that represents the current item within a container or set of related elements. */ 'aria-current'?: boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time'; /** From b9369a91f4d64121b1d36b70de37354a3e8b4e81 Mon Sep 17 00:00:00 2001 From: naughton Date: Thu, 15 Mar 2018 13:14:44 -0700 Subject: [PATCH 025/109] fix signatures for listQueues and listTopics fix Subscription and Topic CountDetails property add ServiceBusClient between ServicebusServiceClient and EventEmitter ...to expose host, port and protocol. --- types/azure-sb/azure-sb-tests.ts | 4 ++-- types/azure-sb/index.d.ts | 24 ++++++++----------- types/azure-sb/lib/servicebusservice.d.ts | 8 +++++-- .../azure-sb/lib/servicebusserviceclient.d.ts | 7 +++--- types/azure-sb/lib/serviceclient.d.ts | 8 +++++++ types/azure-sb/tsconfig.json | 3 ++- 6 files changed, 31 insertions(+), 23 deletions(-) create mode 100644 types/azure-sb/lib/serviceclient.d.ts diff --git a/types/azure-sb/azure-sb-tests.ts b/types/azure-sb/azure-sb-tests.ts index 411862a3b2..14d2ba9054 100644 --- a/types/azure-sb/azure-sb-tests.ts +++ b/types/azure-sb/azure-sb-tests.ts @@ -14,14 +14,14 @@ function ResponseCallback(err: Error | null, response: Azure.ServiceBus.Response const ServiceBus = AzureSB.createServiceBusService('connectionstring'); // Queues -ServiceBus.listQueues('', createResultCallback()); +ServiceBus.listQueues(createResultCallback()); ServiceBus.createQueue('test', createResultCallback()); ServiceBus.createQueueIfNotExists('test', createResultCallback()); ServiceBus.getQueue('test', createResultCallback()); ServiceBus.deleteQueue('test', ResponseCallback); // Topics -ServiceBus.listTopics('', createResultCallback()); +ServiceBus.listTopics(createResultCallback()); ServiceBus.createTopic('test', createResultCallback()); ServiceBus.createTopicIfNotExists('test', createResultCallback()); ServiceBus.getTopic('test', createResultCallback()); diff --git a/types/azure-sb/index.d.ts b/types/azure-sb/index.d.ts index ba92395c0f..9f9d07d3dc 100644 --- a/types/azure-sb/index.d.ts +++ b/types/azure-sb/index.d.ts @@ -214,15 +214,15 @@ export namespace Azure.ServiceBus { // [x: string]: string | Dictionary; // } + export const ActiveMessageCount = 'd2p1:ActiveMessageCount'; + export const DeadLetterMessageCount = 'd2p1:DeadLetterMessageCount'; + export const ScheduledMessageCount = 'd2p1:ScheduledMessageCount'; + export const TransferMessageCount = 'd2p1:TransferMessageCount'; + export const TransferDeadLetterMessageCount = 'd2p1:TransferDeadLetterMessageCount'; + export interface Topic extends ExtendedBase { AccessedAt: DateString; - CountDetails: { - 'd2p1:ActiveMessageCount': string; - 'd2p1:DeadLetterMessageCount': string; - 'd2p1:ScheduledMessageCount': string; - 'd2p1:TransferMessageCount': string; - 'd2p1:TransferDeadLetterMessageCount': string; - }; + CountDetails: { [key: string]: string }; EnableSubscriptionPartitioning: string; FilteringMessagesBeforePublishing: string; IsExpress: string; @@ -242,13 +242,7 @@ export namespace Azure.ServiceBus { } export interface Subscription extends ExtendedBase { - CountDetails: { - 'd3p1:ActiveMessageCount': string; - 'd3p1:DeadLetterMessageCount': string; - 'd3p1:ScheduledMessageCount': string; - 'd3p1:TransferMessageCount': string; - 'd3p1:TransferDeadLetterMessageCount': string; - }; + CountDetails: { [key: string]: string }; DeadLetteringOnFilterEvaluationExceptions: string; DeadLetteringOnMessageExpiration: string; LockDuration: string; @@ -315,6 +309,8 @@ export namespace Azure.ServiceBus { export type CreateSubscriptionOptions = Partial; export type ListSubscriptionsOptions = Partial; export type ListRulesOptions = Partial; + export type ListTopicsOptions = Partial; + export type ListQueuesOptions = Partial; export type CreateRuleOptions = Partial; export type CreateNotificationHubOptions = Partial; export type ListNotificationHubsOptions = Partial; diff --git a/types/azure-sb/lib/servicebusservice.d.ts b/types/azure-sb/lib/servicebusservice.d.ts index 44f2b2c522..45600a1661 100644 --- a/types/azure-sb/lib/servicebusservice.d.ts +++ b/types/azure-sb/lib/servicebusservice.d.ts @@ -11,6 +11,8 @@ import CreateTopicOptions = Azure.ServiceBus.CreateTopicOptions; import ListNotificationHubsOptions = Azure.ServiceBus.ListNotificationHubsOptions; import ListRulesOptions = Azure.ServiceBus.ListRulesOptions; import ListSubscriptionsOptions = Azure.ServiceBus.ListSubscriptionsOptions; +import ListTopicsOptions = Azure.ServiceBus.ListTopicsOptions; +import ListQueuesOptions = Azure.ServiceBus.ListQueuesOptions; import MessageOrName = Azure.ServiceBus.MessageOrName; import Queue = Azure.ServiceBus.Results.Models.Queue; import ReceiveQueueMessageOptions = Azure.ServiceBus.ReceiveQueueMessageOptions; @@ -88,7 +90,8 @@ declare class ServiceBusService extends ServiceBusServiceBase { public getQueue(queuePath: string, callback: TypedResultAndResponseCallback): void; - public listQueues(queuePath: string, + public listQueues(callback: TypedResultAndResponseCallback): void; + public listQueues(options: ListQueuesOptions, callback: TypedResultAndResponseCallback): void; /* @@ -115,7 +118,8 @@ declare class ServiceBusService extends ServiceBusServiceBase { public getTopic(topicPath: string, callback: TypedResultAndResponseCallback): void; - public listTopics(topicPath: string, + public listTopics(callback: TypedResultAndResponseCallback): void; + public listTopics(options: ListTopicsOptions, callback: TypedResultAndResponseCallback): void; /* diff --git a/types/azure-sb/lib/servicebusserviceclient.d.ts b/types/azure-sb/lib/servicebusserviceclient.d.ts index c97b1e3107..1730b642c3 100644 --- a/types/azure-sb/lib/servicebusserviceclient.d.ts +++ b/types/azure-sb/lib/servicebusserviceclient.d.ts @@ -1,14 +1,13 @@ -/// -import EventEmitter = NodeJS.EventEmitter; +import ServiceClient = require('azure-sb/lib/serviceclient'); -declare class ServiceBusServiceClient extends EventEmitter { +declare class ServiceBusServiceClient extends ServiceClient { constructor(accessKey?: string, issuer?: string, sharedAccessKeyName?: string, sharedAccessKeyValue?: string, host?: string, acsHost?: string, - authenticationProvider?: object); + authenticationProvider?: object); } export = ServiceBusServiceClient; diff --git a/types/azure-sb/lib/serviceclient.d.ts b/types/azure-sb/lib/serviceclient.d.ts new file mode 100644 index 0000000000..3e39052235 --- /dev/null +++ b/types/azure-sb/lib/serviceclient.d.ts @@ -0,0 +1,8 @@ +/// +import EventEmitter = NodeJS.EventEmitter; +declare class ServiceClient extends EventEmitter { + public host: string; + public port: number; + public protocol: string; +} +export = ServiceClient; diff --git a/types/azure-sb/tsconfig.json b/types/azure-sb/tsconfig.json index 6e015480dc..61e37ac754 100644 --- a/types/azure-sb/tsconfig.json +++ b/types/azure-sb/tsconfig.json @@ -30,6 +30,7 @@ "lib/models/subscriptionresult.d.ts", "lib/models/notificationhubresult.d.ts", "lib/models/resourceresult.d.ts", + "lib/serviceclient.d.ts", "lib/servicebusserviceclient.d.ts", "lib/gcmservice.d.ts", "lib/wnsservice.d.ts", @@ -38,4 +39,4 @@ "azure-sb-tests.ts", "index.d.ts" ] -} \ No newline at end of file +} From b470489bc1825274193db2734b59b95e7add857a Mon Sep 17 00:00:00 2001 From: Ethan Resnick Date: Thu, 15 Mar 2018 16:23:40 -0400 Subject: [PATCH 026/109] ramda: support providing partially-applied prop(s) return type upfront --- types/ramda/index.d.ts | 2 ++ types/ramda/ramda-tests.ts | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 9b4ebf5a24..eb4b4569c6 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1481,6 +1481,7 @@ declare namespace R { */ prop

(p: P, obj: T): T[P]; prop

(p: P): (obj: Record) => T; + prop

(p: P): (obj: Record) => T; /** * Determines whether the given property of an object has a specific @@ -1519,6 +1520,7 @@ declare namespace R { */ props

(ps: ReadonlyArray

, obj: Record): T[]; props

(ps: ReadonlyArray

): (obj: Record) => T[]; + props

(ps: ReadonlyArray

): (obj: Record) => T[]; /** * Returns true if the specified object property satisfies the given predicate; false otherwise. diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 933b468f09..dbb697e658 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -724,7 +724,9 @@ interface Obj { const list: Book[] = [{id: "xyz", title: "A"}, {id: "abc", title: "B"}]; const a1 = R.indexBy(R.prop("id"), list); const a2 = R.indexBy(R.prop("id"))(list); - const a3 = R.indexBy<{ id: string }>(R.prop("id"))(list); + const a3 = R.indexBy<{ id: string }>(R.prop("id"))(list); + const a4 = R.indexBy(R.prop<"id", string>("id"))(list); + const a5 = R.indexBy<{ id: string }>(R.prop<"id", string>("id"))(list); const titlesIndexedByTitles: { [k: string]: string } = R.pipe( R.map((x: Book) => x.title), @@ -1161,7 +1163,8 @@ type Pair = KeyValuePair; () => { const x = R.prop("x"); - const a: boolean = R.tryCatch(R.prop("x"), R.F)({x: true}); // => true + const a: boolean = R.tryCatch(R.prop("x"), R.F)({x: true}); // => true + const a1: boolean = R.tryCatch(R.prop<"x", true>("x"), R.F)({x: true}); // => true const b: boolean = R.tryCatch(R.prop("x"), R.F)(null); // => false const c: boolean = R.tryCatch(R.and, R.F)(true, true); // => true }; @@ -1754,7 +1757,7 @@ class Rectangle { const format = R.converge( R.call, [ - R.pipe<{}, number, (s: string) => string>(R.prop("indent"), indentN), + R.pipe(R.prop<"indent", number>("indent"), indentN), R.prop("value") ] ); From 07098e8640e36f41b2fcda505423f5806c6000f6 Mon Sep 17 00:00:00 2001 From: Peter Tribe Date: Thu, 15 Mar 2018 23:23:30 -0700 Subject: [PATCH 027/109] Fixed: added VRFrameData declare so you can now do the required 'new VRFrameData()' --- types/webvr-api/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/webvr-api/index.d.ts b/types/webvr-api/index.d.ts index afebeda0a9..72fea2097b 100644 --- a/types/webvr-api/index.d.ts +++ b/types/webvr-api/index.d.ts @@ -162,6 +162,11 @@ interface VRFrameData { readonly timestamp: number; } +declare var VRFrameData: { + prototype: VRFrameData + new(): VRFrameData +} + interface VRPose { readonly angularAcceleration: Float32Array | null; readonly angularVelocity: Float32Array | null; From e6406805ec9569e9820b4624df5c386ce99a526b Mon Sep 17 00:00:00 2001 From: Oblosys Date: Thu, 15 Mar 2018 11:50:12 +0100 Subject: [PATCH 028/109] [react] Add supressHydrationWarning to React.HTMLAttributes interface Added in 16.1.0 (https://github.com/facebook/react/releases/tag/v16.1.0) Docs: https://reactjs.org/docs/dom-elements.html#suppresshydrationwarning --- types/react/index.d.ts | 1 + types/react/test/tsx.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index d56d9571e1..e685f78d07 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -2450,6 +2450,7 @@ declare namespace React { defaultChecked?: boolean; defaultValue?: string | string[]; suppressContentEditableWarning?: boolean; + suppressHydrationWarning?: boolean; // Standard HTML Attributes accessKey?: string; diff --git a/types/react/test/tsx.tsx b/types/react/test/tsx.tsx index 4ad5a3e2c8..7fa151fd29 100644 --- a/types/react/test/tsx.tsx +++ b/types/react/test/tsx.tsx @@ -37,6 +37,7 @@ StatelessComponent2.defaultProps = { defaultValue="some value" contentEditable suppressContentEditableWarning + suppressHydrationWarning > foo ; From a8dfe1e8c0650aa5b8658e93a2e90fcfa29941c2 Mon Sep 17 00:00:00 2001 From: Oblosys Date: Thu, 15 Mar 2018 12:19:10 +0100 Subject: [PATCH 029/109] [react] Bump minor version: 16.0 ~> 16.1 --- types/react/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index e685f78d07..513a5cd2ce 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for React 16.0 +// Type definitions for React 16.1 // Project: http://facebook.github.io/react/ // Definitions by: Asana // AssureSign From b9596736b01e6d583fee5fff16bac43d8342c998 Mon Sep 17 00:00:00 2001 From: Behind The Math Date: Sat, 17 Mar 2018 21:53:04 -0400 Subject: [PATCH 030/109] Fix indentation --- types/sqlite3/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/sqlite3/index.d.ts b/types/sqlite3/index.d.ts index 7461cf82b7..d4fb7c9599 100644 --- a/types/sqlite3/index.d.ts +++ b/types/sqlite3/index.d.ts @@ -90,12 +90,12 @@ export function verbose(): sqlite3; // tslint:disable-next-line:strict-export-declare-modifiers interface sqlite3 { - OPEN_READONLY: number; - OPEN_READWRITE: number; - OPEN_CREATE: number; + OPEN_READONLY: number; + OPEN_READWRITE: number; + OPEN_CREATE: number; cached: typeof cached; RunResult: RunResult; Statement: typeof Statement; Database: typeof Database; - verbose(): this; + verbose(): this; } From 9ef7415615c0feb97a6ec5fbe85e4544273fd352 Mon Sep 17 00:00:00 2001 From: Mike Cook Date: Mon, 19 Mar 2018 09:52:05 +0000 Subject: [PATCH 031/109] Add typings for nodecredstash --- types/nodecredstash/index.d.ts | 45 +++++++++++++++++ types/nodecredstash/nodecredstash-tests.ts | 59 ++++++++++++++++++++++ types/nodecredstash/tsconfig.json | 22 ++++++++ types/nodecredstash/tslint.json | 1 + 4 files changed, 127 insertions(+) create mode 100644 types/nodecredstash/index.d.ts create mode 100644 types/nodecredstash/nodecredstash-tests.ts create mode 100644 types/nodecredstash/tsconfig.json create mode 100644 types/nodecredstash/tslint.json diff --git a/types/nodecredstash/index.d.ts b/types/nodecredstash/index.d.ts new file mode 100644 index 0000000000..d2489178a4 --- /dev/null +++ b/types/nodecredstash/index.d.ts @@ -0,0 +1,45 @@ +// Type definitions for nodecredstash 2.0 +// Project: https://github.com/DavidTanner/nodecredstash#readme +// Definitions by: Mike Cook +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +import * as AWS from 'aws-sdk'; + +interface ICredstashConfig { + table?: string; + awsOpts?: AWS.KMS.ClientConfiguration; + dynamoOpts?: AWS.DynamoDB.ClientConfiguration; + kmsKey?: string; + kmsOpts?: AWS.KMS.ClientConfiguration; +} + +interface ICredstashContext { + [key: string]: string; +} + +interface IPutSecretOptions { + name: string; + secret: string; + context: ICredstashContext; + digest?: string; + version?: number; +} + +interface ICredstash { + getHighestVersion: (options: { name: string }) => Promise; + incrementVersion: (options: { name: string }) => Promise; + putSecret: (options: IPutSecretOptions) => Promise; + decryptStash: (stash: { key: string; }, context?: ICredstashContext) => Promise; + getAllVersions: (options: { name: string, context?: ICredstashContext, limit?: number }) => Promise>; + getSecret: (options: { name: string, context?: ICredstashContext, version?: number }) => Promise; + deleteSecrets: (options: { name: string }) => Promise>; + deleteSecret: (options: { name: string, version: number }) => Promise; + listSecrets: () => Promise; + getAllSecrets: (options: { version?: number, context?: ICredstashContext, startsWith?: string }) => Promise<{ [key: string]: string }>; + createDdbTable: () => Promise; +} + +declare function Credstash(config: ICredstashConfig): ICredstash; + +export = Credstash; diff --git a/types/nodecredstash/nodecredstash-tests.ts b/types/nodecredstash/nodecredstash-tests.ts new file mode 100644 index 0000000000..f3788adc55 --- /dev/null +++ b/types/nodecredstash/nodecredstash-tests.ts @@ -0,0 +1,59 @@ +import Credstash = require('nodecredstash'); + +const credstash = Credstash({ + awsOpts: { region: 'us-east-1' }, + dynamoOpts: { accessKeyId: 'foo' }, + kmsKey: 'bar', + kmsOpts: { accessKeyId: 'baz' }, + table: 'something' +}); + +credstash.decryptStash({ key: 'foo' }).then((result) => { + return { + id: result.KeyId, + text: result.Plaintext + }; +}); + +credstash.deleteSecret({ name: 'foo', version: 1 }).then((result) => { + if (result.Attributes) return result.Attributes['blah']; + if (result.ConsumedCapacity) return result.ConsumedCapacity.TableName; + if (result.ItemCollectionMetrics) return result.ItemCollectionMetrics.ItemCollectionKey; +}); + +credstash.deleteSecrets({ name: 'foo' }).then((results) => { + const result = results[0]; + if (result.Attributes) return result.Attributes['blah'].toUpperCase(); + if (result.ConsumedCapacity) return result.ConsumedCapacity.TableName; + if (result.ItemCollectionMetrics) return result.ItemCollectionMetrics.ItemCollectionKey; +}); + +credstash.getAllSecrets({ version: 1 }).then((result) => { + return result['foo'].toUpperCase(); +}); + +credstash.getAllVersions({ name: 'foo', context: { bar: 'baz' }, limit: 1 }).then((result) => { + return result[0].secret.toUpperCase() + result[0].version.toUpperCase(); +}); + +credstash.getHighestVersion({ name: 'foo' }).then((result) => { + return result['foo'].S; +}); + +credstash.getSecret({ name: 'foo', version: 1, context: { bar: 'baz' } }).then((result) => { + return result.toUpperCase(); +}); + +credstash.incrementVersion({ name: 'foo' }).then((result) => { + return result.toUpperCase(); +}); + +credstash.listSecrets().then((result) => { + return result.map((str) => str.toUpperCase()); +}); + +credstash.putSecret({ name: 'foo', secret: 'bar', context: { baz: 'qux' }, digest: 'quux', version: 1 }).then((result) => { + if (result.Attributes) return result.Attributes['foo']; + if (result.ConsumedCapacity) return result.ConsumedCapacity.TableName; + if (result.ItemCollectionMetrics) return result.ItemCollectionMetrics.ItemCollectionKey; +}); diff --git a/types/nodecredstash/tsconfig.json b/types/nodecredstash/tsconfig.json new file mode 100644 index 0000000000..da430c0182 --- /dev/null +++ b/types/nodecredstash/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "nodecredstash-tests.ts" + ] +} diff --git a/types/nodecredstash/tslint.json b/types/nodecredstash/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/nodecredstash/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From a626af102fb70b84e03389a55edb3db026700e4b Mon Sep 17 00:00:00 2001 From: Mike Cook Date: Mon, 19 Mar 2018 10:02:26 +0000 Subject: [PATCH 032/109] Dependencies and linting updates --- types/nodecredstash/index.d.ts | 24 ++++++++++++------------ types/nodecredstash/package.json | 6 ++++++ types/nodecredstash/tsconfig.json | 1 + 3 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 types/nodecredstash/package.json diff --git a/types/nodecredstash/index.d.ts b/types/nodecredstash/index.d.ts index d2489178a4..76375aac21 100644 --- a/types/nodecredstash/index.d.ts +++ b/types/nodecredstash/index.d.ts @@ -6,7 +6,7 @@ /// import * as AWS from 'aws-sdk'; -interface ICredstashConfig { +interface CredstashConfig { table?: string; awsOpts?: AWS.KMS.ClientConfiguration; dynamoOpts?: AWS.DynamoDB.ClientConfiguration; @@ -14,32 +14,32 @@ interface ICredstashConfig { kmsOpts?: AWS.KMS.ClientConfiguration; } -interface ICredstashContext { +interface CredstashContext { [key: string]: string; } -interface IPutSecretOptions { +interface PutSecretOptions { name: string; secret: string; - context: ICredstashContext; + context: CredstashContext; digest?: string; version?: number; } -interface ICredstash { +interface Credstash { getHighestVersion: (options: { name: string }) => Promise; incrementVersion: (options: { name: string }) => Promise; - putSecret: (options: IPutSecretOptions) => Promise; - decryptStash: (stash: { key: string; }, context?: ICredstashContext) => Promise; - getAllVersions: (options: { name: string, context?: ICredstashContext, limit?: number }) => Promise>; - getSecret: (options: { name: string, context?: ICredstashContext, version?: number }) => Promise; - deleteSecrets: (options: { name: string }) => Promise>; + putSecret: (options: PutSecretOptions) => Promise; + decryptStash: (stash: { key: string; }, context?: CredstashContext) => Promise; + getAllVersions: (options: { name: string, context?: CredstashContext, limit?: number }) => Promise>; + getSecret: (options: { name: string, context?: CredstashContext, version?: number }) => Promise; + deleteSecrets: (options: { name: string }) => Promise; deleteSecret: (options: { name: string, version: number }) => Promise; listSecrets: () => Promise; - getAllSecrets: (options: { version?: number, context?: ICredstashContext, startsWith?: string }) => Promise<{ [key: string]: string }>; + getAllSecrets: (options: { version?: number, context?: CredstashContext, startsWith?: string }) => Promise<{ [key: string]: string }>; createDdbTable: () => Promise; } -declare function Credstash(config: ICredstashConfig): ICredstash; +declare function Credstash(config: CredstashConfig): Credstash; export = Credstash; diff --git a/types/nodecredstash/package.json b/types/nodecredstash/package.json new file mode 100644 index 0000000000..0347abc684 --- /dev/null +++ b/types/nodecredstash/package.json @@ -0,0 +1,6 @@ +{ + "dependencies": { + "aws-sdk": "^2.211.0" + }, + "private": true +} diff --git a/types/nodecredstash/tsconfig.json b/types/nodecredstash/tsconfig.json index da430c0182..ec4305243c 100644 --- a/types/nodecredstash/tsconfig.json +++ b/types/nodecredstash/tsconfig.json @@ -7,6 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From 4b26c77b3ccd58041802c624b1b6f10c9ecacb1e Mon Sep 17 00:00:00 2001 From: Matthew Zartman Date: Mon, 19 Mar 2018 11:55:53 -0400 Subject: [PATCH 033/109] Adds new module to fit Meteor suggested styling --- types/meteor-roles/index.d.ts | 254 ++++++++++++++++++++++++++++++++++ 1 file changed, 254 insertions(+) diff --git a/types/meteor-roles/index.d.ts b/types/meteor-roles/index.d.ts index 80a4b02c90..ed91f96ab5 100644 --- a/types/meteor-roles/index.d.ts +++ b/types/meteor-roles/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for Meteor Roles 1.2.14 // Project: https://github.com/alanning/meteor-roles/ // Definitions by: Robbie Van Gorkom +// Matthew Zartman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -262,3 +263,256 @@ declare namespace Roles { declare namespace Meteor { var roles : Mongo.Collection; } + + +/* Declaring in the format prescribed by Meteor */ +declare module "meteor/alanning:roles" { + namespace Roles { + /** + * Constant used to reference the special 'global' group that + * can be used to apply blanket permissions across all groups. + * + * @example + * Roles.addUsersToRoles(user, 'admin', Roles.GLOBAL_GROUP) + * Roles.userIsInRole(user, 'admin') // => true + * + * Roles.setUserRoles(user, 'support-staff', Roles.GLOBAL_GROUP) + * Roles.userIsInRole(user, 'support-staff') // => true + * Roles.userIsInRole(user, 'admin') // => false + * + * @property GLOBAL_GROUP + * @type String + * @static + * @final + */ + var GLOBAL_GROUP : string; + + /** + * Subscription handle for the currently logged in user's permissions. + * + * NOTE: The corresponding publish function, `_roles`, depends on + * `this.userId` so it will automatically re-run when the currently + * logged-in user changes. + * + * @example + * + * `Roles.subscription.ready()` // => `true` if user roles have been loaded + * + * @property subscription + * @type Object + * @for Roles + */ + var subscription : Subscription; + + /** + * Add users to roles. Will create roles as needed. + * + * NOTE: Mixing grouped and non-grouped roles for the same user + * is not supported and will throw an error. + * + * Makes 2 calls to database: + * 1. retrieve list of all existing roles + * 2. update users' roles + * + * @example + * Roles.addUsersToRoles(userId, 'admin') + * Roles.addUsersToRoles(userId, ['view-secrets'], 'example.com') + * Roles.addUsersToRoles([user1, user2], ['user','editor']) + * Roles.addUsersToRoles([user1, user2], ['glorious-admin', 'perform-action'], 'example.org') + * Roles.addUsersToRoles(userId, 'admin', Roles.GLOBAL_GROUP) + * + * @method addUsersToRoles + * @param {Array|String} users User id(s) or object(s) with an _id field + * @param {Array|String} roles Name(s) of roles/permissions to add users to + * @param {String} [group] Optional group name. If supplied, roles will be + * specific to that group. + * Group names can not start with '$' or numbers. + * Periods in names '.' are automatically converted + * to underscores. + * The special group Roles.GLOBAL_GROUP provides + * a convenient way to assign blanket roles/permissions + * across all groups. The roles/permissions in the + * Roles.GLOBAL_GROUP group will be automatically + * included in checks for any group. + */ + function addUsersToRoles( + user : string|string[]|Object|Object[], + roles : string|string[], + group? : string + ) : void; + + /** + * Create a new role. Whitespace will be trimmed. + * + * @method createRole + * @param {String} role Name of role + * @return {String} id of new role + */ + function createRole(role : string) : string; + + /** + * Delete an existing role. Will throw "Role in use" error if any users + * are currently assigned to the target role. + * + * @method deleteRole + * @param {String} role Name of role + */ + function deleteRole (role : string) : void; + + /** + * Retrieve set of all existing roles + * + * @method getAllRoles + * @return {Cursor} cursor of existing roles + */ + function getAllRoles() : Mongo.Cursor; + + /** + * Retrieve users groups, if any + * + * @method getGroupsForUser + * @param {String|Object} user User Id or actual user object + * @param {String} [role] Optional name of roles to restrict groups to. + * + * @return {Array} Array of user's groups, unsorted. Roles.GLOBAL_GROUP will be omitted + */ + function getGroupsForUser( + user : string|Object, + role? : string + ) : string[]; + + /** + * Retrieve users roles + * + * @method getRolesForUser + * @param {String|Object} user User Id or actual user object + * @param {String} [group] Optional name of group to restrict roles to. + * User's Roles.GLOBAL_GROUP will also be included. + * @return {Array} Array of user's roles, unsorted. + */ + function getRolesForUser( + user : string|Object, + group? : string + ) : string[]; + + /** + * Retrieve all users who are in target role. + * + * NOTE: This is an expensive query; it performs a full collection scan + * on the users collection since there is no index set on the 'roles' field. + * This is by design as most queries will specify an _id so the _id index is + * used automatically. + * + * @method getUsersInRole + * @param {Array|String} role Name of role/permission. If array, users + * returned will have at least one of the roles + * specified but need not have _all_ roles. + * @param {String} [group] Optional name of group to restrict roles to. + * User's Roles.GLOBAL_GROUP will also be checked. + * @param {Object} [options] Optional options which are passed directly + * through to `Meteor.users.find(query, options)` + * @return {Cursor} cursor of users in role + */ + function getUsersInRole( + role : string|string[], + group? : string, + options? : { + sort?: Mongo.SortSpecifier; + skip?: number; + limit?: number; + fields?: Mongo.FieldSpecifier; + reactive?: boolean; + transform?: Function; + }) : Mongo.Cursor; + + /** + * Remove users from roles + * + * @example + * Roles.removeUsersFromRoles(users.bob, 'admin') + * Roles.removeUsersFromRoles([users.bob, users.joe], ['editor']) + * Roles.removeUsersFromRoles([users.bob, users.joe], ['editor', 'user']) + * Roles.removeUsersFromRoles(users.eve, ['user'], 'group1') + * + * @method removeUsersFromRoles + * @param {Array|String} users User id(s) or object(s) with an _id field + * @param {Array|String} roles Name(s) of roles to add users to + * @param {String} [group] Optional. Group name. If supplied, only that + * group will have roles removed. + */ + function removeUsersFromRoles( + user : string|string[]|Object|Object[], + roles? : string[], + group? : string + ) : void; + + /** + * Set a users roles/permissions. + * + * @example + * Roles.setUserRoles(userId, 'admin') + * Roles.setUserRoles(userId, ['view-secrets'], 'example.com') + * Roles.setUserRoles([user1, user2], ['user','editor']) + * Roles.setUserRoles([user1, user2], ['glorious-admin', 'perform-action'], 'example.org') + * Roles.setUserRoles(userId, 'admin', Roles.GLOBAL_GROUP) + * + * @method setUserRoles + * @param {Array|String} users User id(s) or object(s) with an _id field + * @param {Array|String} roles Name(s) of roles/permissions to add users to + * @param {String} [group] Optional group name. If supplied, roles will be + * specific to that group. + * Group names can not start with '$'. + * Periods in names '.' are automatically converted + * to underscores. + * The special group Roles.GLOBAL_GROUP provides + * a convenient way to assign blanket roles/permissions + * across all groups. The roles/permissions in the + * Roles.GLOBAL_GROUP group will be automatically + * included in checks for any group. + */ + function setUserRoles ( + user : string|string[]|Object|Object[], + roles : string|string[], + group? : string + ) : void; + + /** + * Check if user has specified permissions/roles + * + * @example + * // non-group usage + * Roles.userIsInRole(user, 'admin') + * Roles.userIsInRole(user, ['admin','editor']) + * Roles.userIsInRole(userId, 'admin') + * Roles.userIsInRole(userId, ['admin','editor']) + * + * // per-group usage + * Roles.userIsInRole(user, ['admin','editor'], 'group1') + * Roles.userIsInRole(userId, ['admin','editor'], 'group1') + * Roles.userIsInRole(userId, ['admin','editor'], Roles.GLOBAL_GROUP) + * + * // this format can also be used as short-hand for Roles.GLOBAL_GROUP + * Roles.userIsInRole(user, 'admin') + * + * @method userIsInRole + * @param {String|Object} user User Id or actual user object + * @param {String|Array} roles Name of role/permission or Array of + * roles/permissions to check against. If array, + * will return true if user is in _any_ role. + * @param {String} [group] Optional. Name of group. If supplied, limits check + * to just that group. + * The user's Roles.GLOBAL_GROUP will always be checked + * whether group is specified or not. + * @return {Boolean} true if user is in _any_ of the target roles + */ + function userIsInRole( + user : string|string[]|Object|Object[], + roles : string|string[], + group? : string + ) : boolean; + + interface Role { + name : string; + } + } +} From 984170a6915ba81296258d947593afc24607968a Mon Sep 17 00:00:00 2001 From: Justin Rockwood Date: Mon, 19 Mar 2018 17:57:09 -0700 Subject: [PATCH 034/109] fix(inquirer): allow promises in some Question options #18105 According to the docs at at https://github.com/SBoudrias/Inquirer.js/#objects, the following should allow functions that return promises: default, choices, validate, filter, and when. --- types/inquirer/index.d.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/types/inquirer/index.d.ts b/types/inquirer/index.d.ts index 4fc2ca4ce0..17ae8092df 100644 --- a/types/inquirer/index.d.ts +++ b/types/inquirer/index.d.ts @@ -5,6 +5,7 @@ // Jouderian // Qibang // Jason Dreyzehner +// Justin Rockwood // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -90,7 +91,7 @@ declare namespace inquirer { * Default value(s) to use if nothing is entered, or a function that returns the default value(s). * If defined as a function, the first parameter will be the current inquirer session answers. */ - default?: any | ((answers: T) => any); + default?: any | ((answers: T) => any) | ((answers: T) => Promise); /** * Choices array or a function returning a choices array. If defined as a function, * the first parameter will be the current inquirer session answers. @@ -99,22 +100,23 @@ declare namespace inquirer { */ choices?: | ReadonlyArray - | ((answers: T) => ReadonlyArray); + | ((answers: T) => ReadonlyArray) + | ((answers: T) => Promise>); /** * Receive the user input and should return true if the value is valid, and an error message (String) * otherwise. If false is returned, a default error message is provided. */ - validate?(input: string, answers?: T): boolean | string; + validate?(input: string, answers?: T): boolean | string | Promise; /** * Receive the user input and return the filtered value to be used inside the program. * The value returned will be added to the Answers hash. */ - filter?(input: string): string; + filter?(input: string): string | Promise; /** * Receive the current user answers hash and should return true or false depending on whether or * not this question should be asked. The value can also be a simple boolean. */ - when?: boolean | ((answers: T) => boolean); + when?: boolean | ((answers: T) => boolean) | ((answers: T) => Promise); paginated?: boolean; /** * Change the number of lines that will be rendered when using list, rawList, expand or checkbox. From b3888abd05465d4f8464490b5852e71d6a276886 Mon Sep 17 00:00:00 2001 From: Justin Rockwood Date: Mon, 19 Mar 2018 18:00:02 -0700 Subject: [PATCH 035/109] fix(inquirer): allow 'any' for ChoiceOption according to docs #17368 --- types/inquirer/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/inquirer/index.d.ts b/types/inquirer/index.d.ts index 17ae8092df..c0aba80f23 100644 --- a/types/inquirer/index.d.ts +++ b/types/inquirer/index.d.ts @@ -242,7 +242,7 @@ declare namespace inquirer { interface ChoiceOption { name?: string; - value?: string; + value?: any; type?: string; extra?: any; key?: string; From bacb3f54af840f2585caf4b2fa457157a7699d5a Mon Sep 17 00:00:00 2001 From: Justin Rockwood Date: Mon, 19 Mar 2018 20:00:59 -0700 Subject: [PATCH 036/109] fix(inquirer): add missing transformer function --- types/inquirer/index.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/inquirer/index.d.ts b/types/inquirer/index.d.ts index c0aba80f23..804f96411f 100644 --- a/types/inquirer/index.d.ts +++ b/types/inquirer/index.d.ts @@ -112,6 +112,12 @@ declare namespace inquirer { * The value returned will be added to the Answers hash. */ filter?(input: string): string | Promise; + /** + * Receive the user input and return the transformed value to be displayed to the user. The + * transformation only impacts what is shown while editing. It does not impact the answers + * hash. + */ + transformer?(input: string): string; /** * Receive the current user answers hash and should return true or false depending on whether or * not this question should be asked. The value can also be a simple boolean. From 054f23c54d01e69681daa8e18cb138fd051f3e1b Mon Sep 17 00:00:00 2001 From: Justin Rockwood Date: Mon, 19 Mar 2018 20:01:27 -0700 Subject: [PATCH 037/109] test(inquirer): add tests for added functionality --- types/inquirer/inquirer-tests.ts | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/types/inquirer/inquirer-tests.ts b/types/inquirer/inquirer-tests.ts index 7cc0fddd2a..aa545adae0 100644 --- a/types/inquirer/inquirer-tests.ts +++ b/types/inquirer/inquirer-tests.ts @@ -584,3 +584,45 @@ inquirer.prompt( console.log(JSON.stringify(answers, null, ' ')); } ); + +// +// Other tests not covered in the examples provided with inquirer +// + +// Tests promises from default, choices, validate, filter, and when + +interface AsyncAnswers { + choice: 'ONE' | 'TWO' | 'THREE'; + choseTwo: boolean; + confirmation: string; +} + +async function testAsyncPrompt(): Promise { + const answers: AsyncAnswers = await inquirer.prompt([ + { + type: 'list', + name: 'choice', + message: 'How many do you want?', + default: () => Promise.resolve('two'), + choices: () => Promise.resolve(['one', 'two', 'three']), + filter: (input: string) => Promise.resolve(input.toUpperCase()), + }, + { + type: 'confirm', + name: 'choseTwo', + message: 'Are you sure you want two?', + when: (choices: AsyncAnswers) => Promise.resolve(choices.choice === 'TWO'), + }, + { + type: 'input', + name: 'confirmation', + message: 'Type YES if you really, really want it', + validate: (input: string) => Promise.resolve(input.toUpperCase() === 'YES' ? true : 'Enter YES'), + transformer: (input: string) => input.toUpperCase(), + }, + ]); + + console.log(JSON.stringify(answers, null, ' ')); +} + +testAsyncPrompt(); From a08dc13b212d796cc3747ae30d0915cb858ef566 Mon Sep 17 00:00:00 2001 From: TristonJ Date: Tue, 20 Mar 2018 10:33:26 -0700 Subject: [PATCH 038/109] [stellar-sdk] changeTrust limit should be optional --- types/stellar-sdk/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/stellar-sdk/index.d.ts b/types/stellar-sdk/index.d.ts index 955360d3f0..b098ea0896 100644 --- a/types/stellar-sdk/index.d.ts +++ b/types/stellar-sdk/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for stellar-sdk 0.8 // Project: https://github.com/stellar/js-stellar-sdk // Definitions by: Carl Foster +// Triston Jones // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -596,7 +597,7 @@ export namespace Operation { } interface ChangeTrustOptions { asset: Asset; - limit: string; + limit?: string; source?: string; } function changeTrust(options: ChangeTrustOptions): xdr.Operation; From f2d6f88dc636fe2f68b913a717a578418f354d38 Mon Sep 17 00:00:00 2001 From: Abdulsattar Mohammed Date: Wed, 21 Mar 2018 11:48:50 +0530 Subject: [PATCH 039/109] Make renderTarget in setRenderTarget optional RenderTarget can be null in `WebGLRenderer` which can be used to unbind the frame buffer. It is actually used by `WebGLRenderer#render` which accepts a `null` `renderTarget` to and calls `setRenderTarget` with that null value. --- types/three/three-core.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 31c8cbebe0..57b060c597 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -5417,7 +5417,7 @@ export class WebGLRenderer implements Renderer { * @deprecated Use {@link WebGLRenderer#getRenderTarget .getRenderTarget()} instead. */ getCurrentRenderTarget(): RenderTarget; - setRenderTarget(renderTarget: RenderTarget): void; + setRenderTarget(renderTarget?: RenderTarget): void; readRenderTargetPixels( renderTarget: RenderTarget, x: number, y: number, width: number, height: number, buffer: any ): void; /** From 9456c18a19a0b6087e9369fa43feb7e63bf4ec56 Mon Sep 17 00:00:00 2001 From: Aaron Reisman Date: Thu, 22 Mar 2018 20:00:02 +0700 Subject: [PATCH 040/109] Update index.d.ts --- types/i18next-express-middleware/index.d.ts | 192 +++++++++++--------- 1 file changed, 109 insertions(+), 83 deletions(-) diff --git a/types/i18next-express-middleware/index.d.ts b/types/i18next-express-middleware/index.d.ts index f9877b2659..d28a334429 100644 --- a/types/i18next-express-middleware/index.d.ts +++ b/types/i18next-express-middleware/index.d.ts @@ -5,104 +5,130 @@ // TypeScript Version: 2.3 declare namespace I18next { - interface I18nextOptions extends i18nextExpressMiddleware.I18nextOptions { } + interface I18nextOptions extends i18nextExpressMiddleware.I18nextOptions {} } declare namespace i18nextExpressMiddleware { - /** - * @summary Interface for Language detector options. - * @interface - */ - interface LanguageDetectorOptions { - caches?: Array|boolean; - cookieDomain?: string; - cookieExpirationDate?: Date; - lookupCookie?: string; - lookupFromPathIndex?: number; - lookupQuerystring?: string; - lookupSession?: string; - order?: Array; - } + /** + * @summary Interface for Language detector options. + * @interface + */ + interface LanguageDetectorOptions { + caches?: Array | boolean + cookieDomain?: string + cookieExpirationDate?: Date + lookupCookie?: string + lookupFromPathIndex?: number + lookupQuerystring?: string + lookupSession?: string + order?: Array + } - /** - * @summary i18next options. - * @interface - */ - interface I18nextOptions { - detection?: LanguageDetectorOptions; - } + /** + * @summary i18next options. + * @interface + */ + interface I18nextOptions { + detection?: LanguageDetectorOptions + } } -declare module "i18next-express-middleware" { - import express = require("express"); - import i18next = require("i18next"); +declare module 'i18next-express-middleware' { + import express = require('express') + import i18next = require('i18next') + + /** + * @summary Interface for middleware to use i18next in express.js. + * @interface + */ + export interface i18nextExpressMiddleware { + LanguageDetector(): express.Handler + missingKeyHandler(): express.Handler + } + + /** + * @summary Interface for own detection functionality. + */ + export interface i18nextCustomDetection { + name: string + lookup: ( + req: express.Request, + res: express.Response, + options?: Object + ) => void + cacheUserLanguage: ( + req: express.Request, + res: express.Response, + lng?: any, + options?: Object + ) => void + } + + /** + * @summary Detects user language from current request. + * @class + */ + export class LanguageDetector { + /** + * @summary Constructor. + * @constructor + * @param {any} services The services. + * @param {Object} options The options. + * @param {Object} allOptions The all options. + */ + constructor(services?: any, options?: Object, allOptions?: Object) /** - * @summary Interface for middleware to use i18next in express.js. - * @interface + * @summary Adds detector. + * @param {i18nextCustomDetection} detector The detector to add. */ - export interface i18nextExpressMiddleware { - LanguageDetector(): express.Handler; - missingKeyHandler(): express.Handler; - } + addDetector(detector: i18nextCustomDetection): void + + // NOTE: add documentation + cacheUserLanguage( + req: express.Request, + res: express.Response, + detectionOrder: any + ): void /** - * @summary Interface for own detection functionality. + * @summary Detects the language. + * @param {Request} req The HTTP request. + * @param {Response} res The HTTP response. + * @param {detectionOrder} detectionOrder The detection order. */ - export interface i18nextCustomDetection { - name: string; - lookup: (req: express.Request, res: express.Response, options?: Object) => void; - cacheUserLanguage: (req: express.Request, res: express.Response, lng?: any, options?: Object) => void; - } + detect( + req: express.Request, + res: express.Response, + detectionOrder: any + ): void /** - * @summary Detects user language from current request. - * @class + * @summary Initializes class. + * @param {any} services The services. + * @param {Object} options The options. + * @param {Object} allOptions The all options. */ - export class LanguageDetector { - /** - * @summary Constructor. - * @constructor - * @param {any} services The services. - * @param {Object} options The options. - * @param {Object} allOptions The all options. - */ - constructor(services?: any, options?: Object, allOptions?: Object); + init(services: any, options?: Object, allOptions?: Object): void + } - /** - * @summary Adds detector. - * @param {i18nextCustomDetection} detector The detector to add. - */ - addDetector(detector: i18nextCustomDetection): void; + export function getResourcesHandler( + i18next: i18next.i18n, + options: Object + ): express.Handler + export function handle( + i18next: i18next.i18n, + options?: Object + ): express.Handler - // NOTE: add documentation - cacheUserLanguage(req: express.Request, res: express.Response, detectionOrder: any): void; - - /** - * @summary Detects the language. - * @param {Request} req The HTTP request. - * @param {Response} res The HTTP response. - * @param {detectionOrder} detectionOrder The detection order. - */ - detect(req: express.Request, res: express.Response, detectionOrder: any): void; - - /** - * @summary Initializes class. - * @param {any} services The services. - * @param {Object} options The options. - * @param {Object} allOptions The all options. - */ - init(services: any, options?: Object, allOptions?: Object): void; - } - - export function getResourcesHandler(i18next: i18next.i18n, options: Object): express.Handler; - export function handle(i18next: i18next.i18n, options?: Object): express.Handler; - - /** - * @summary Gets handler for missing key. - * @param {I18nextStatic} i18next The i18next. - * @param {Object} options The options. - * @return {express.Handler} The express handler. - */ - export function missingKeyHandler(i18next: i18next.i18n, options: Object): express.Handler; + /** + * @summary Gets handler for missing key. + * @param {I18nextStatic} i18next The i18next. + * @param {Object} options The options. + * @return {express.Handler} The express handler. + */ + export function missingKeyHandler( + i18next: i18next.i18n, + options?: Object + ): express.Handler } From 1e7e3727777e6e95cf289dc47038a0474a5ba989 Mon Sep 17 00:00:00 2001 From: Valentin Sundermann Date: Thu, 22 Mar 2018 15:56:40 +0100 Subject: [PATCH 041/109] Change return type of valueOf to bigi --- types/bigi/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/bigi/index.d.ts b/types/bigi/index.d.ts index c991b13fac..7b44ff75e4 100644 --- a/types/bigi/index.d.ts +++ b/types/bigi/index.d.ts @@ -87,7 +87,7 @@ declare class bigi { static fromDERInteger(byteArray?: any): number; static fromHex(hex: string): bigi; static isBigInteger(obj: any, check_ver: any): obj is bigi; - static valueOf(i: any): number; + static valueOf(i: any): bigi; } declare namespace bigi { interface Constants { From 0eb9a227403ee4430624fbb7fe16b13941e4586e Mon Sep 17 00:00:00 2001 From: Valentin Sundermann Date: Thu, 22 Mar 2018 15:57:25 +0100 Subject: [PATCH 042/109] Expand tests to cover the previous change --- types/bigi/bigi-tests.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/types/bigi/bigi-tests.ts b/types/bigi/bigi-tests.ts index ef9d7421d3..0e4822aeb6 100644 --- a/types/bigi/bigi-tests.ts +++ b/types/bigi/bigi-tests.ts @@ -7,3 +7,10 @@ const b3 = b1.multiply(b2); console.log(b3.toHex()); // => ae499bfe762edfb416d0ce71447af67ff33d1760cbebd70874be1d7a5564b0439a59808cb1856a91974f7023f72132 + +const b4 = BigInteger.valueOf(42); +const b5 = BigInteger.valueOf(10); +const b6 = b4.multiply(b5); + +console.log(b6); +// => BigInteger { '0': 420, '1': 0, t: 1, s: 0 } From 2efa8936a13d2f8273b04d626658e31f06930780 Mon Sep 17 00:00:00 2001 From: Behind The Math Date: Thu, 22 Mar 2018 15:53:25 -0400 Subject: [PATCH 043/109] Remove the need for lint exception --- types/sqlite3/index.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/sqlite3/index.d.ts b/types/sqlite3/index.d.ts index d4fb7c9599..8b988b5b22 100644 --- a/types/sqlite3/index.d.ts +++ b/types/sqlite3/index.d.ts @@ -88,8 +88,7 @@ export class Database extends events.EventEmitter { export function verbose(): sqlite3; -// tslint:disable-next-line:strict-export-declare-modifiers -interface sqlite3 { +export interface sqlite3 { OPEN_READONLY: number; OPEN_READWRITE: number; OPEN_CREATE: number; From dbb40c14f8a9901796e293d64adcad9c1fe9b789 Mon Sep 17 00:00:00 2001 From: Michael Zabka Date: Thu, 22 Mar 2018 21:17:22 +0100 Subject: [PATCH 044/109] Allow omit second key argument in crypto-js Hash functions * Fixes DefinitelyTyped/DefinitelyTyped#24425 --- types/crypto-js/crypto-js-tests.ts | 2 ++ types/crypto-js/index.d.ts | 52 +++++++++++++++++++----------- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/types/crypto-js/crypto-js-tests.ts b/types/crypto-js/crypto-js-tests.ts index 9b5dd1be6f..59f1d684ed 100644 --- a/types/crypto-js/crypto-js-tests.ts +++ b/types/crypto-js/crypto-js-tests.ts @@ -4,9 +4,11 @@ import CryptoJS = require('crypto-js'); var wordArray: CryptoJS.WordArray; wordArray = CryptoJS.MD5('some message'); wordArray = CryptoJS.MD5('some message', 'some key'); +wordArray = CryptoJS.MD5('some message', { any: true }); wordArray = CryptoJS.SHA1('some message'); wordArray = CryptoJS.SHA1('some message', 'some key', { any: true }); +wordArray = CryptoJS.SHA1('some message', { any: true }); wordArray = CryptoJS.format.OpenSSL('some message'); wordArray = CryptoJS.format.OpenSSL('some message', 'some key'); diff --git a/types/crypto-js/index.d.ts b/types/crypto-js/index.d.ts index c066204df2..db9ed6c30e 100644 --- a/types/crypto-js/index.d.ts +++ b/types/crypto-js/index.d.ts @@ -8,7 +8,6 @@ export as namespace CryptoJS; declare var CryptoJS: CryptoJS.Hashes; declare namespace CryptoJS { - type Hash = (message: string | LibWordArray, key?: string | WordArray, ...options: any[]) => WordArray; interface Cipher { encrypt(message: string, secretPassphrase: string | WordArray, option?: CipherOption): WordArray; decrypt(encryptedMessage: string | WordArray, secretPassphrase: string | WordArray, option?: CipherOption): DecryptedMessage; @@ -54,23 +53,40 @@ declare namespace CryptoJS { interface Padding {} export interface Hashes { - MD5: Hash; - SHA1: Hash; - SHA256: Hash; - SHA224: Hash; - SHA512: Hash; - SHA384: Hash; - SHA3: Hash; - RIPEMD160: Hash; - HmacMD5: Hash; - HmacSHA1: Hash; - HmacSHA256: Hash; - HmacSHA224: Hash; - HmacSHA512: Hash; - HmacSHA384: Hash; - HmacSHA3: Hash; - HmacRIPEMD160: Hash; - PBKDF2: Hash; + MD5(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray; + MD5(message: string | LibWordArray, ...options: any[]): WordArray; + SHA1(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray; + SHA1(message: string | LibWordArray, ...options: any[]): WordArray; + SHA256(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray; + SHA256(message: string | LibWordArray, ...options: any[]): WordArray; + SHA224(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray; + SHA224(message: string | LibWordArray, ...options: any[]): WordArray; + SHA512(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray; + SHA512(message: string | LibWordArray, ...options: any[]): WordArray; + SHA384(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray; + SHA384(message: string | LibWordArray, ...options: any[]): WordArray; + SHA3(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray; + SHA3(message: string | LibWordArray, ...options: any[]): WordArray; + RIPEMD160(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray; + RIPEMD160(message: string | LibWordArray, ...options: any[]): WordArray; + HmacMD5(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray; + HmacMD5(message: string | LibWordArray, ...options: any[]): WordArray; + HmacSHA1(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray; + HmacSHA1(message: string | LibWordArray, ...options: any[]): WordArray; + HmacSHA256(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray; + HmacSHA256(message: string | LibWordArray, ...options: any[]): WordArray; + HmacSHA224(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray; + HmacSHA224(message: string | LibWordArray, ...options: any[]): WordArray; + HmacSHA512(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray; + HmacSHA512(message: string | LibWordArray, ...options: any[]): WordArray; + HmacSHA384(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray; + HmacSHA384(message: string | LibWordArray, ...options: any[]): WordArray; + HmacSHA3(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray; + HmacSHA3(message: string | LibWordArray, ...options: any[]): WordArray; + HmacRIPEMD160(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray; + HmacRIPEMD160(message: string | LibWordArray, ...options: any[]): WordArray; + PBKDF2(message: string | LibWordArray, key?: string | WordArray, ...options: any[]): WordArray; + PBKDF2(message: string | LibWordArray, ...options: any[]): WordArray; AES: Cipher; DES: Cipher; TripleDES: Cipher; From e1806c890eadd0e83c4af8512feee44621b13ac1 Mon Sep 17 00:00:00 2001 From: Alvis HT Tang Date: Thu, 22 Mar 2018 23:48:26 +0000 Subject: [PATCH 045/109] highland: add the definition for the new isNil() for type guarding This commit add the definition for the a very simple, and yet essential, isNil function for type checking. This function is particularly useful in a consume handler. Example: ``` source.consume(function (err, x, push, next) { if (err) { // pass errors along the stream and consume next value push(err); next(); } else if (_.isNil(x)) { // type guard is only possible with this function // pass nil (end event) along the stream push(null, x); } else { // pass on the value only if the value passes the predicate if (f(x)) { push(null, x); } next(); } }); ``` See https://github.com/caolan/highland/pull/645 --- types/highland/index.d.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/types/highland/index.d.ts b/types/highland/index.d.ts index eff8fb2769..473e93880a 100644 --- a/types/highland/index.d.ts +++ b/types/highland/index.d.ts @@ -89,6 +89,17 @@ interface HighlandStatic { // UTILS // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + /** + * Returns true if `x` is the end of stream marker. + * + * @id isNil + * @section Streams + * @name _.isNil(x) + * @param x - the object to test + * @api public + */ + isNil(x: R | Highland.Nil): x is Highland.Nil; + /** * Returns true if `x` is a Highland Stream. * From a16cd3ea3211250b557fff6eb614a1d490e7d454 Mon Sep 17 00:00:00 2001 From: Alvis HT Tang Date: Thu, 22 Mar 2018 23:54:08 +0000 Subject: [PATCH 046/109] highland: add a test for the new isNil() --- types/highland/highland-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/highland/highland-tests.ts b/types/highland/highland-tests.ts index 5f1c734395..a1c48c944b 100644 --- a/types/highland/highland-tests.ts +++ b/types/highland/highland-tests.ts @@ -337,6 +337,8 @@ fooStream.toCallback((err: Error) => {}); // UTILS // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +bool = _.isNil(x); + bool = _.isStream(x); bool = _.isStream(fooStream); From d6c651c1b3a98c9ca5a7464bff678605b5e77c04 Mon Sep 17 00:00:00 2001 From: Tim Wang Date: Fri, 23 Mar 2018 13:16:51 +0800 Subject: [PATCH 047/109] Add back params generic and remove remain action generic. Add support for stateless screen. --- types/react-navigation/index.d.ts | 65 ++++++++++--------- .../react-navigation-tests.tsx | 31 +++++++-- 2 files changed, 62 insertions(+), 34 deletions(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 0e6bb2d94c..47304a1856 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-navigation 1.2 +// Type definitions for react-navigation 1.5 // Project: https://github.com/react-navigation/react-navigation // Definitions by: Huhuanming // mhcgrq @@ -45,7 +45,6 @@ export interface HeaderProps extends NavigationSceneRendererProps { mode: HeaderMode; router: NavigationRouter< NavigationState, - NavigationAction, NavigationStackScreenOptions >; getScreenDetails: (navigationScene: NavigationScene) => NavigationScreenDetails< @@ -75,9 +74,9 @@ export interface NavigationState { routes: any[]; } -export type NavigationRoute = NavigationLeafRoute | NavigationStateRoute; +export type NavigationRoute = NavigationLeafRoute | NavigationStateRoute; -export interface NavigationLeafRoute { +export interface NavigationLeafRoute { /** * React's key used by some navigators. No need to specify these manually, * they will be defined by the router. @@ -96,23 +95,23 @@ export interface NavigationLeafRoute { * Params passed to this route when navigating to it, * e.g. `{ car_id: 123 }` in a route that displays a car. */ - params?: NavigationParams; + params?: Params; } -export type NavigationStateRoute = NavigationLeafRoute & NavigationState; +export type NavigationStateRoute = NavigationLeafRoute & NavigationState; export type NavigationScreenOptionsGetter = ( - navigation: NavigationScreenProp, + navigation: NavigationScreenProp>, screenProps?: { [key: string]: any } ) => Options; -export interface NavigationRouter { +export interface NavigationRouter { /** * The reducer that outputs the new navigation state for a given action, with * an optional previous state. When the action is considered handled but the * state is unchanged, the output state is null. */ - getStateForAction: (action: Action, lastState?: State) => (State | null); + getStateForAction: (action: NavigationAction, lastState?: State) => (State | null); /** * Maps a URI-like string to an action. This can be mapped to a state @@ -121,7 +120,7 @@ export interface NavigationRouter { getActionForPathAndParams: ( path: string, params?: NavigationParams - ) => (Action | null); + ) => (NavigationAction | null); getPathAndParamsForState: ( state: State @@ -175,16 +174,24 @@ export type NavigationScreenConfig = export type NavigationComponent = NavigationScreenComponent - | NavigationNavigator; + | NavigationNavigator + | any; -export interface NavigationScreenComponent extends React.ComponentClass { - navigationOptions?: NavigationScreenConfig; -} +export type NavigationScreenComponent< + Options = {}, + Props = {} +> = React.ComponentType & Props> & +({} | { navigationOptions: NavigationScreenConfig }); -export interface NavigationNavigator extends React.ComponentClass { - router?: NavigationRouter; - navigationOptions?: NavigationScreenConfig; -} + +export type NavigationNavigator< + State = NavigationState, + Options = {}, + Props = {} +> = React.ComponentType & Props> & { + router: NavigationRouter, + navigationOptions?: NavigationScreenConfig | any, +}; export interface NavigationParams { [key: string]: any; @@ -452,10 +459,10 @@ export interface NavigationScreenProp { popToTop: (params?: { immediate?: boolean }) => boolean; } -export interface NavigationNavigatorProps { +export interface NavigationNavigatorProps { navigation?: NavigationProp; screenProps?: { [key: string]: any }; - navigationOptions?: any; + navigationOptions?: O; } /** @@ -587,7 +594,7 @@ export interface NavigationContainerProps { export interface NavigationContainer extends React.ComponentClass< NavigationContainerProps & NavigationNavigatorProps > { - router: NavigationRouter; + router: NavigationRouter; screenProps: { [key: string]: any }; navigationOptions: any; state: { nav: NavigationState | null }; @@ -810,7 +817,7 @@ export class Transitioner extends React.Component< export function TabRouter( routeConfigs: NavigationRouteConfigMap, config: NavigationTabRouterConfig -): NavigationRouter; +): NavigationRouter; /** * Stack Router @@ -820,19 +827,19 @@ export function TabRouter( export function StackRouter( routeConfigs: NavigationRouteConfigMap, config: NavigationTabRouterConfig -): NavigationRouter; +): NavigationRouter; /** * Create Navigator * * @see https://github.com/react-navigation/react-navigation/blob/master/src/navigators/createNavigator.js */ -export function createNavigator( - router: NavigationRouter, +export function createNavigator( + router: NavigationRouter, routeConfigs?: NavigationRouteConfigMap, navigatorConfig?: {} | null, navigatorType?: NavigatorType -): (NavigationView: React.ComponentClass) => NavigationNavigator; +): (NavigationView: React.ComponentClass) => NavigationNavigator; /** * Create an HOC that injects the navigation and manages the navigation state @@ -843,7 +850,7 @@ export function createNavigator( * @see https://github.com/react-navigation/react-navigation/blob/master/src/createNavigationContainer.js */ export function createNavigationContainer( - Component: NavigationNavigator + Component: NavigationNavigator ): NavigationContainer; /** * END MANUAL DEFINITIONS OUTSIDE OF TYPEDEFINITION.JS @@ -853,8 +860,8 @@ export function createNavigationContainer( * BEGIN CUSTOM CONVENIENCE INTERFACES */ -export interface NavigationScreenProps { - navigation: NavigationScreenProp; +export interface NavigationScreenProps { + navigation: NavigationScreenProp>; screenProps?: { [key: string]: any }; navigationOptions?: NavigationScreenConfig; } diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index d0e65dfc8e..4c8ff5dd99 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -36,6 +36,7 @@ import { NavigationParams, NavigationPopAction, NavigationPopToTopAction, + NavigationScreenComponent, } from 'react-navigation'; // Constants @@ -48,14 +49,19 @@ const viewStyle: ViewStyle = { const ROUTE_NAME_START_SCREEN = "StartScreen"; +interface StartScreenNavigationParams { + id: number; + s: string; +} + /** * @desc Simple screen component class with typed component props that should * receive the navigation prop from the AppNavigator. */ -class StartScreen extends React.Component { +class StartScreen extends React.Component> { render() { // Implicit type checks. - const navigationStateParams = this.props.navigation.state.params; + const navigationStateParams: StartScreenNavigationParams | void = this.props.navigation.state.params; const id = this.props.navigation.state.params && this.props.navigation.state.params.id; const s = this.props.navigation.state.params && this.props.navigation.state.params.s; @@ -84,10 +90,15 @@ class StartScreen extends React.Component { const ROUTE_NAME_NEXT_SCREEN = "NextScreen"; -class NextScreen extends React.Component { +interface NextScreenNavigationParams { + id: number; + name: string; +} + +class NextScreen extends React.Component> { render() { // Implicit type checks. - const navigationStateParams = this.props.navigation.state.params; + const navigationStateParams: NextScreenNavigationParams | void = this.props.navigation.state.params; const id = this.props.navigation.state.params && this.props.navigation.state.params.id; const name = this.props.navigation.state.params && this.props.navigation.state.params.name; @@ -100,7 +111,7 @@ class NextScreen extends React.Component { const navigationOptions = { headerBackTitle: null, }; -const initialRouteParams: NavigationParams = { +const initialRouteParams: StartScreenNavigationParams = { id: 1, s: "Start", }; @@ -123,6 +134,16 @@ export const AppNavigator = StackNavigator( }, ); +const StatelessScreen: NavigationScreenComponent<{}, {}> = () => ; + +const SimpleStackNavigator = StackNavigator( + { + simple: { + screen: StatelessScreen, + }, + } +) + /** * Router. */ From 8731027ec5db8ba1465e0b82492ee55ed63beaa5 Mon Sep 17 00:00:00 2001 From: Tim Wang Date: Fri, 23 Mar 2018 13:29:00 +0800 Subject: [PATCH 048/109] Fix CI --- types/react-navigation/index.d.ts | 1 - types/react-navigation/react-navigation-tests.tsx | 8 ++++---- types/react-navigation/tslint.json | 7 ++++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 47304a1856..3c6bffe130 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -183,7 +183,6 @@ export type NavigationScreenComponent< > = React.ComponentType & Props> & ({} | { navigationOptions: NavigationScreenConfig }); - export type NavigationNavigator< State = NavigationState, Options = {}, diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index 4c8ff5dd99..5c03253d35 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -61,7 +61,7 @@ interface StartScreenNavigationParams { class StartScreen extends React.Component> { render() { // Implicit type checks. - const navigationStateParams: StartScreenNavigationParams | void = this.props.navigation.state.params; + const navigationStateParams: StartScreenNavigationParams | undefined = this.props.navigation.state.params; const id = this.props.navigation.state.params && this.props.navigation.state.params.id; const s = this.props.navigation.state.params && this.props.navigation.state.params.s; @@ -98,7 +98,7 @@ interface NextScreenNavigationParams { class NextScreen extends React.Component> { render() { // Implicit type checks. - const navigationStateParams: NextScreenNavigationParams | void = this.props.navigation.state.params; + const navigationStateParams: NextScreenNavigationParams | undefined = this.props.navigation.state.params; const id = this.props.navigation.state.params && this.props.navigation.state.params.id; const name = this.props.navigation.state.params && this.props.navigation.state.params.name; @@ -134,7 +134,7 @@ export const AppNavigator = StackNavigator( }, ); -const StatelessScreen: NavigationScreenComponent<{}, {}> = () => ; +const StatelessScreen: NavigationScreenComponent = () => ; const SimpleStackNavigator = StackNavigator( { @@ -142,7 +142,7 @@ const SimpleStackNavigator = StackNavigator( screen: StatelessScreen, }, } -) +); /** * Router. diff --git a/types/react-navigation/tslint.json b/types/react-navigation/tslint.json index 3db14f85ea..d9d49e375e 100644 --- a/types/react-navigation/tslint.json +++ b/types/react-navigation/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-any-union": false + } +} From f3b3166bb0713c90d2c37298f056b56863c3ab39 Mon Sep 17 00:00:00 2001 From: hisorange Date: Fri, 23 Mar 2018 10:16:38 +0100 Subject: [PATCH 049/109] Add missing 'bclient' type --- types/bull/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/bull/index.d.ts b/types/bull/index.d.ts index 97cb7a23df..296009c4bd 100644 --- a/types/bull/index.d.ts +++ b/types/bull/index.d.ts @@ -41,7 +41,7 @@ declare namespace Bull { * When specified, the `Queue` will use this function to create new `ioredis` client connections. * This is useful if you want to re-use connections. */ - createClient?(type: 'client' | 'subscriber', redisOpts?: Redis.RedisOptions): Redis.Redis; + createClient?(type: 'client' | 'subscriber' | 'bclient', redisOpts?: Redis.RedisOptions): Redis.Redis; /** * Prefix to use for all redis keys From 93a7241b1e82e749fcceac58e2abe8e05760f178 Mon Sep 17 00:00:00 2001 From: Justin Chew Date: Fri, 23 Mar 2018 13:04:32 +0000 Subject: [PATCH 050/109] Correct casing for modernizr --- types/modernizr/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/modernizr/index.d.ts b/types/modernizr/index.d.ts index ff88e9f523..a9cfb92f54 100644 --- a/types/modernizr/index.d.ts +++ b/types/modernizr/index.d.ts @@ -448,6 +448,6 @@ interface ModernizrAPI { interface ModernizrStatic extends ModernizrAPI, FeatureDetects { } declare var Modernizr: ModernizrStatic; -declare module "Modernizr" { +declare module "modernizr" { export = Modernizr; } From 54b3965d34e7bdfb63b130fe1fe20bf26837b5bb Mon Sep 17 00:00:00 2001 From: Albert Yu Date: Fri, 23 Mar 2018 21:20:46 +0800 Subject: [PATCH 051/109] [@types/ember-qunit] add missing definition for `setupApplicationTest` --- types/ember-qunit/index.d.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/types/ember-qunit/index.d.ts b/types/ember-qunit/index.d.ts index a669b977e1..ea129ec3ec 100644 --- a/types/ember-qunit/index.d.ts +++ b/types/ember-qunit/index.d.ts @@ -44,6 +44,20 @@ declare module 'ember-qunit' { */ export function setResolver(resolver: Ember.Resolver): void; + /** + * Sets up acceptance tests. + * + * The `setupApplicationTest` function is used for all acceptance tests. It + * is invoked in the callback scope of a QUnit module (aka "nested module"). + * + * Once invoked, all subsequent hooks.beforeEach and test invocations will + * have access to the following: + * * `this.owner` - the owner object that been set on the test context. + * * `this.pauseTest` and `this.resumeTest` - allow easy pausing/resuming of tests. + * * `this.element` which returns the DOM element representing the application's root element. + */ + export function setupApplicationTest(hooks: NestedHooks): void; + /** * Sets up tests that need to render snippets of templates. * @@ -80,7 +94,7 @@ declare module 'ember-qunit' { */ export function setupTest(hooks: NestedHooks): void; - export class QUnitAdapter extends Ember.Test.Adapter {} + export class QUnitAdapter extends Ember.Test.Adapter { } export { module, test, skip, only, todo } from 'qunit'; } From 9526aa700f36ebea5c10c592e16506ff72b63061 Mon Sep 17 00:00:00 2001 From: Albert Yu Date: Fri, 23 Mar 2018 21:21:37 +0800 Subject: [PATCH 052/109] [@types/ember-qunit] improve `skip` definition to align with others --- types/ember-qunit/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/ember-qunit/index.d.ts b/types/ember-qunit/index.d.ts index ea129ec3ec..ad12f43ffc 100644 --- a/types/ember-qunit/index.d.ts +++ b/types/ember-qunit/index.d.ts @@ -161,9 +161,10 @@ declare module 'qunit' { * ignoring the callback argument and the respective global and module's * hooks. * - * @param Title of unit being tested + * @param name Title of unit being tested + * @param callback Function to close over assertions */ - export const skip: typeof QUnit.skip; + export function skip(name: string, callback: (this: TestContext, assert: Assert) => void): void; export default QUnit; } From 371c3bad16e85ae06a2b8bd5b0ec240d02f1119f Mon Sep 17 00:00:00 2001 From: Lenny Date: Fri, 23 Mar 2018 08:39:11 -0500 Subject: [PATCH 053/109] @types\mapbox-gl Change RasterSource URL to optional. --- types/mapbox-gl/index.d.ts | 2 +- types/mapbox-gl/mapbox-gl-tests.ts | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/types/mapbox-gl/index.d.ts b/types/mapbox-gl/index.d.ts index a51172daec..24dca985e4 100644 --- a/types/mapbox-gl/index.d.ts +++ b/types/mapbox-gl/index.d.ts @@ -610,7 +610,7 @@ declare namespace mapboxgl { interface RasterSource extends Source { type: 'raster'; - url: string; + url?: string; tiles?: string[]; minzoom?: number; maxzoom?: number; diff --git a/types/mapbox-gl/mapbox-gl-tests.ts b/types/mapbox-gl/mapbox-gl-tests.ts index 422cb3913d..ce10a26564 100644 --- a/types/mapbox-gl/mapbox-gl-tests.ts +++ b/types/mapbox-gl/mapbox-gl-tests.ts @@ -205,6 +205,22 @@ var videoSourceObj = new mapboxgl.VideoSource({ map.addSource('some id', videoSourceObj); // add map.removeSource('some id'); // remove +/** + * Add Raster Source /// made URL optional to allow only tiles. + */ +map.addSource('radar', { + type: 'raster', + tiles: ['https://nowcoast.noaa.gov/arcgis/services/nowcoast/radar_meteo_imagery_nexrad_time/MapServer/WmsServer?bbox={bbox-epsg-3857}&service=WMS&request=GetMap&version=1.3.0&layers=1&styles=&format=image/png&transparent=true&height=256&width=256&crs=EPSG:3857'], + tileSize: 256 +}) + +map.addLayer({ + id: 'radar', + type: 'raster', + source: 'radar', + paint: {} +}) + /** * Popup */ From e4edb35bf5f59e24129021c27ea6a2347e582ef8 Mon Sep 17 00:00:00 2001 From: Albert Yu Date: Fri, 23 Mar 2018 21:39:33 +0800 Subject: [PATCH 054/109] fix: let callback be optional to pass the test case --- types/ember-qunit/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/ember-qunit/index.d.ts b/types/ember-qunit/index.d.ts index ad12f43ffc..9dc93b980b 100644 --- a/types/ember-qunit/index.d.ts +++ b/types/ember-qunit/index.d.ts @@ -164,7 +164,7 @@ declare module 'qunit' { * @param name Title of unit being tested * @param callback Function to close over assertions */ - export function skip(name: string, callback: (this: TestContext, assert: Assert) => void): void; + export function skip(name: string, callback?: (this: TestContext, assert: Assert) => void): void; export default QUnit; } From ec2685287a29cdbcd146db59b460391d49487596 Mon Sep 17 00:00:00 2001 From: Justin Chew Date: Fri, 23 Mar 2018 14:14:15 +0000 Subject: [PATCH 055/109] Remove module declaration --- types/modernizr/index.d.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/types/modernizr/index.d.ts b/types/modernizr/index.d.ts index a9cfb92f54..ca5e6753f9 100644 --- a/types/modernizr/index.d.ts +++ b/types/modernizr/index.d.ts @@ -448,6 +448,4 @@ interface ModernizrAPI { interface ModernizrStatic extends ModernizrAPI, FeatureDetects { } declare var Modernizr: ModernizrStatic; -declare module "modernizr" { - export = Modernizr; -} +export = Modernizr; From 48662ad8dc57000bfa968fc021f54346615fb122 Mon Sep 17 00:00:00 2001 From: Justin Chew Date: Fri, 23 Mar 2018 14:48:12 +0000 Subject: [PATCH 056/109] Reverse commit --- types/modernizr/index.d.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/types/modernizr/index.d.ts b/types/modernizr/index.d.ts index ca5e6753f9..71046d3840 100644 --- a/types/modernizr/index.d.ts +++ b/types/modernizr/index.d.ts @@ -447,5 +447,7 @@ interface ModernizrAPI { interface ModernizrStatic extends ModernizrAPI, FeatureDetects { } -declare var Modernizr: ModernizrStatic; -export = Modernizr; +declare var Modernizr: ModernizrStatic;declare module "Modernizr" { +declare module "Modernizr" { + export = Modernizr; +} From ff63f28d065ff53dc50e86c9191cc33222850e57 Mon Sep 17 00:00:00 2001 From: Justin Chew Date: Fri, 23 Mar 2018 14:55:47 +0000 Subject: [PATCH 057/109] Fix duplicate --- types/modernizr/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/modernizr/index.d.ts b/types/modernizr/index.d.ts index 71046d3840..a9cfb92f54 100644 --- a/types/modernizr/index.d.ts +++ b/types/modernizr/index.d.ts @@ -447,7 +447,7 @@ interface ModernizrAPI { interface ModernizrStatic extends ModernizrAPI, FeatureDetects { } -declare var Modernizr: ModernizrStatic;declare module "Modernizr" { -declare module "Modernizr" { +declare var Modernizr: ModernizrStatic; +declare module "modernizr" { export = Modernizr; } From 22d2e5efbb99c765d59d661f145209eaceb1b12e Mon Sep 17 00:00:00 2001 From: Justin Chew Date: Fri, 23 Mar 2018 14:57:11 +0000 Subject: [PATCH 058/109] Set declare-module tslint to true --- types/modernizr/tslint.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/modernizr/tslint.json b/types/modernizr/tslint.json index 2279635eb4..bd2b0c4334 100644 --- a/types/modernizr/tslint.json +++ b/types/modernizr/tslint.json @@ -1,7 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { - "no-single-declare-module": false, + "no-single-declare-module": true, "no-empty-interface": false } } From 768b5c94e563c1fccaa9d8a72576e0b8f54cd320 Mon Sep 17 00:00:00 2001 From: Justin Chew Date: Fri, 23 Mar 2018 15:05:33 +0000 Subject: [PATCH 059/109] Fix tslint --- types/modernizr/tslint.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/modernizr/tslint.json b/types/modernizr/tslint.json index bd2b0c4334..9edbcd99ab 100644 --- a/types/modernizr/tslint.json +++ b/types/modernizr/tslint.json @@ -1,7 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { - "no-single-declare-module": true, - "no-empty-interface": false + "no-single-declare-module": false, + "no-empty-interface": false, + "no-declare-current-package": false } } From ebf695c819b0126efb0f91c9197a85335d0bac1f Mon Sep 17 00:00:00 2001 From: Tim Wang Date: Mon, 26 Mar 2018 10:41:58 +0800 Subject: [PATCH 060/109] Remove any union type --- types/react-navigation/index.d.ts | 3 +-- types/react-navigation/tslint.json | 7 +------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 3c6bffe130..cb27a40d71 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -175,7 +175,6 @@ export type NavigationScreenConfig = export type NavigationComponent = NavigationScreenComponent | NavigationNavigator - | any; export type NavigationScreenComponent< Options = {}, @@ -189,7 +188,7 @@ export type NavigationNavigator< Props = {} > = React.ComponentType & Props> & { router: NavigationRouter, - navigationOptions?: NavigationScreenConfig | any, + navigationOptions?: NavigationScreenConfig, }; export interface NavigationParams { diff --git a/types/react-navigation/tslint.json b/types/react-navigation/tslint.json index d9d49e375e..3db14f85ea 100644 --- a/types/react-navigation/tslint.json +++ b/types/react-navigation/tslint.json @@ -1,6 +1 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "no-any-union": false - } -} +{ "extends": "dtslint/dt.json" } From 40f7502a236e5de5d0242e891f274a697bf37ad4 Mon Sep 17 00:00:00 2001 From: Tim Wang Date: Mon, 26 Mar 2018 10:50:07 +0800 Subject: [PATCH 061/109] Fix linter issues --- types/react-navigation/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index cb27a40d71..9ec404a6fb 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -174,7 +174,7 @@ export type NavigationScreenConfig = export type NavigationComponent = NavigationScreenComponent - | NavigationNavigator + | NavigationNavigator; export type NavigationScreenComponent< Options = {}, From 26ff8e3b857cbe1e26699d527ae467f4de739348 Mon Sep 17 00:00:00 2001 From: Remko Date: Mon, 26 Mar 2018 11:54:43 +0200 Subject: [PATCH 062/109] updates c3 to use d3 v4 --- types/c3/index.d.ts | 71 +++++++++++++++++++++++++----------------- types/c3/tsconfig.json | 20 +++--------- 2 files changed, 47 insertions(+), 44 deletions(-) diff --git a/types/c3/index.d.ts b/types/c3/index.d.ts index 28f301237c..6b3968eeec 100644 --- a/types/c3/index.d.ts +++ b/types/c3/index.d.ts @@ -28,7 +28,7 @@ export interface ChartConfiguration { * Note: When chart is not binded, c3 starts observing if chart.element is binded by MutationObserver. In this case, polyfill is required in IE9 and IE10 becuase they do not support * MutationObserver. On the other hand, if chart always will be binded, polyfill will not be required because MutationObserver will never be called. */ - bindto?: string | HTMLElement | d3.Selection | null; + bindto?: string | HTMLElement | d3.Selection | null; size?: { /** * The desired width of the chart element. @@ -172,16 +172,18 @@ export interface ChartConfiguration { /** * Change the width of bar chart. If ratio is specified, change the width of bar chart by ratio. */ - width?: number | { - /** - * Set the width of each bar by ratio - */ - ratio: number, - /** - * Set max width of each bar - */ - max?: number - }; + width?: + | number + | { + /** + * Set the width of each bar by ratio + */ + ratio: number; + /** + * Set max width of each bar + */ + max?: number; + }; /** * Set if min or max value will be 0 on bar chart. */ @@ -205,7 +207,7 @@ export interface ChartConfiguration { /** * Set threshold to show/hide labels. */ - threshold?: number + threshold?: number; }; /** * Enable or disable expanding pie pieces. @@ -226,7 +228,7 @@ export interface ChartConfiguration { /** * Set threshold to show/hide labels. */ - threshold?: number + threshold?: number; }; /** * Enable or disable expanding pie pieces. @@ -280,7 +282,17 @@ export interface ChartConfiguration { /** * Set custom spline interpolation */ - type?: 'linear' | 'linear-closed' | 'basis' | 'basis-open' | 'basis-closed' | 'bundle' | 'cardinal' | 'cardinal-open' | 'cardinal-closed' | 'monotone'; + type?: + | "linear" + | "linear-closed" + | "basis" + | "basis-open" + | "basis-closed" + | "bundle" + | "cardinal" + | "cardinal-open" + | "cardinal-closed" + | "monotone"; }; }; } @@ -309,7 +321,7 @@ export interface Data { /** * Choose which JSON object keys correspond to desired data. */ - keys?: { x?: string; value: string[]; }; + keys?: { x?: string; value: string[] }; /** * Specify the key of x values in the data. * We can show the data with non-index x values by this option. This option is required when the type of x axis is timeseries. If this option is set on category axis, the values of the data @@ -365,9 +377,7 @@ export interface Data { * - j is the sub index of the data point where the label is shown. * Formatter function can be defined for each data by specifying as an object and D3 formatter function can be set (e.g. d3.format('$')) */ - labels?: boolean | - { format: FormatFunction } | - { format: { [key: string]: FormatFunction } }; + labels?: boolean | { format: FormatFunction } | { format: { [key: string]: FormatFunction } }; /** * Define the order of the data. * This option changes the order of stacking the data and pieces of pie/donut. If null specified, it will be the order the data loaded. If function specified, it will be used to sort the data @@ -387,11 +397,11 @@ export interface Data { * This option should a function and the specified function receives color (e.g. '#ff0000') and d that has data parameters like id, value, index, etc. And it must return a string that * represents color (e.g. '#00ff00'). */ - color?(color: string, d: any): string | d3.Rgb; + color?(color: string, d: any): string | d3.RGBColor; /** * Set color for each data. */ - colors?: { [key: string]: string | d3.Rgb | ((d: any) => string | d3.Rgb) }; + colors?: { [key: string]: string | d3.RGBColor | ((d: any) => string | d3.RGBColor) }; /** * Hide each data when the chart appears. * If true specified, all of data will be hidden. If multiple ids specified as an array, those will be hidden. @@ -813,7 +823,7 @@ export interface PointOptions { /** * The radius size of each point on focus. */ - r?: number + r?: number; }; }; @@ -877,7 +887,7 @@ export interface ChartAPI { load(args: { url?: string; json?: {}; - keys?: { x?: string; value: string[]; } + keys?: { x?: string; value: string[] }; rows?: PrimitiveArray[]; columns?: PrimitiveArray[]; xs?: { [key: string]: string }; @@ -885,7 +895,7 @@ export interface ChartAPI { classes?: { [key: string]: string }; categories?: string[]; axes?: { [key: string]: string }; - colors?: { [key: string]: string | d3.Rgb }; + colors?: { [key: string]: string | d3.RGBColor }; type?: string; types?: { [key: string]: string }; unload?: boolean | ArrayOrString; @@ -911,7 +921,7 @@ export interface ChartAPI { */ flow(args: { json?: {}; - keys?: { x?: string; value: string[]; } + keys?: { x?: string; value: string[] }; rows?: PrimitiveArray[]; columns?: PrimitiveArray[]; to?: any; @@ -997,7 +1007,7 @@ export interface ChartAPI { * Get and set colors of the data loaded in the chart. * @param colors If this argument is given, the colors of data will be updated. If not given, the current colors will be returned. The format of this argument is the same as data.colors. */ - colors(colors?: { [key: string]: string | d3.Rgb }): { [key: string]: string }; + colors(colors?: { [key: string]: string | d3.RGBColor }): { [key: string]: string }; /** * Get and set axes of the data loaded in the chart. * @param axes If this argument is given, the axes of data will be updated. If not given, the current axes will be returned. The format of this argument is the same as data.axes. @@ -1040,22 +1050,25 @@ export interface ChartAPI { * Get and set axis labels. * @param labels If labels is given, specified axis' label will be updated. */ - labels(labels?: { [key: string]: string }): { [key: string]: string } + labels(labels?: { [key: string]: string }): { [key: string]: string }; /** * Get and set axis min value. * @param min If min is given, specified axis' min value will be updated. If no argument is given, the current min values for each axis will be returned. */ - min(min?: number | { [key: string]: number }): number | { [key: string]: number } + min(min?: number | { [key: string]: number }): number | { [key: string]: number }; /** * Get and set axis max value. * @param max If max is given, specified axis' max value will be updated. If no argument is given, the current max values for each axis will be returned. */ - max(max?: number | { [key: string]: number }): number | { [key: string]: number } + max(max?: number | { [key: string]: number }): number | { [key: string]: number }; /** * Get and set axis min and max value. * @param range If range is given, specified axis' min and max value will be updated. If no argument is given, the current min and max values for each axis will be returned. */ - range(range?: { min?: number | { [key: string]: number }; max?: number | { [key: string]: number } }): { min: number | { [key: string]: number }; max: number | { [key: string]: number } } + range(range?: { + min?: number | { [key: string]: number }; + max?: number | { [key: string]: number }; + }): { min: number | { [key: string]: number }; max: number | { [key: string]: number } }; }; legend: { diff --git a/types/c3/tsconfig.json b/types/c3/tsconfig.json index fe3b00c503..6576ec1ed6 100644 --- a/types/c3/tsconfig.json +++ b/types/c3/tsconfig.json @@ -1,29 +1,19 @@ { "compilerOptions": { "module": "commonjs", - "lib": [ - "es6", - "dom" - ], + "lib": ["es6", "dom"], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, "strictFunctionTypes": false, "baseUrl": "../", - "typeRoots": [ - "../" - ], + "typeRoots": ["../"], "types": [], "paths": { - "d3": [ - "d3/v3" - ] + "d3": ["d3/v4"] }, "noEmit": true, "forceConsistentCasingInFileNames": true }, - "files": [ - "index.d.ts", - "c3-tests.ts" - ] -} \ No newline at end of file + "files": ["index.d.ts", "c3-tests.ts"] +} From f4b0597fd67f8c404ab1c40d2ef9b2c2fb625687 Mon Sep 17 00:00:00 2001 From: Remko Date: Mon, 26 Mar 2018 12:02:14 +0200 Subject: [PATCH 063/109] updates dependencies --- types/c3/index.d.ts | 4 ++-- types/c3/tsconfig.json | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/types/c3/index.d.ts b/types/c3/index.d.ts index 6b3968eeec..a1dfaaf8f0 100644 --- a/types/c3/index.d.ts +++ b/types/c3/index.d.ts @@ -1,11 +1,11 @@ -// Type definitions for C3js 0.4 +// Type definitions for C3js 0.5 // Project: http://c3js.org/ // Definitions by: Marc Climent // Gerin Jacob // Bernd Hacker // Dzmitry Shyndzin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 +// TypeScript Version: 2.3 import * as d3 from "d3"; diff --git a/types/c3/tsconfig.json b/types/c3/tsconfig.json index 6576ec1ed6..aa923e91c0 100644 --- a/types/c3/tsconfig.json +++ b/types/c3/tsconfig.json @@ -10,6 +10,7 @@ "typeRoots": ["../"], "types": [], "paths": { + "d3-scale": ["d3-scale/v1"], "d3": ["d3/v4"] }, "noEmit": true, From 68c613f2f5ec4c105c66199ab340f72bcd9c36c0 Mon Sep 17 00:00:00 2001 From: Pedro Antonio Souza Viegas Date: Mon, 26 Mar 2018 14:12:24 -0300 Subject: [PATCH 064/109] Adding Payments Lite Dialog params Hi! I am adding the dialog params for payments lite as it is different from normal payment ui params. --- types/facebook-js-sdk/index.d.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/types/facebook-js-sdk/index.d.ts b/types/facebook-js-sdk/index.d.ts index c380ee004d..4676cbf0fc 100644 --- a/types/facebook-js-sdk/index.d.ts +++ b/types/facebook-js-sdk/index.d.ts @@ -66,6 +66,11 @@ declare namespace facebook { */ ui(params: PayDialogParams, callback: (response: PayDialogResponse) => void): void; + /** + * @see https://developers.facebook.com/docs/games_payments/payments_lite + */ + ui(params: PaymentsLiteDialogParams, callback: (response: PaymentsLiteDialogResponse) => void): void; + /** * @see https://developers.facebook.com/docs/videos/live-video/exploring-live */ @@ -154,6 +159,14 @@ declare namespace facebook { request_id?: string; test_currency?: string; } + + interface PaymentsLiteDialogParams extends DialogParams { + method: 'pay'; + action: 'purchaseiap'; + product_id: string; + developer_payload?: string; + quantity?: number; + } interface LiveDialogParams extends DialogParams { method: 'live_broadcast'; @@ -199,6 +212,17 @@ declare namespace facebook { signed_request: string; } + interface PaymentsLiteDialogResponse { + developer_payload?: string; + payment_id: number; + product_id?: string; + purchase_time?: number; + purchase_token?: string; + signed_request?: string; + error_code?: number; + error_message?: string; + } + interface LiveDialogResponse { id: string; stream_url: string; From 5177c3bf93bf60ce3df9e6534b2e265dc50bee71 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Mon, 26 Mar 2018 11:16:08 -0700 Subject: [PATCH 065/109] Add `fn` to `is` --- types/is/index.d.ts | 21 ++++++++++++++++++--- types/is/is-tests.ts | 6 ++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/types/is/index.d.ts b/types/is/index.d.ts index b61bd6deee..3b70472d65 100644 --- a/types/is/index.d.ts +++ b/types/is/index.d.ts @@ -32,6 +32,11 @@ interface IsStatic { */ error(value: any): boolean; + /** + * Checks if the given value type is function. + */ + fn(value: any): boolean; + /** * Checks if the given value type is function. */ @@ -587,7 +592,7 @@ interface IsStaticApi { * Checks if the given value type is arguments. */ arguments(...value: any[]): boolean; - + /** * Checks if the given value type is arguments. */ @@ -633,6 +638,16 @@ interface IsStaticApi { */ error(value: any[]): boolean; + /** + * Checks if the given value type is function. + */ + fn(...value: any[]): boolean; + + /** + * Checks if the given value type is function. + */ + fn(value: any[]): boolean; + /** * Checks if the given value type is function. */ @@ -1234,12 +1249,12 @@ interface Is extends IsStatic { * Override RegExps if you think they suck. */ setRegexp(value: RegExp, regexp: 'url'): boolean; - + /** * Override RegExps if you think they suck. */ setRegexp(value: RegExp, regexp: 'email'): boolean; - + /** * Override RegExps if you think they suck. */ diff --git a/types/is/is-tests.ts b/types/is/is-tests.ts index 674d5ff761..0084de8990 100644 --- a/types/is/is-tests.ts +++ b/types/is/is-tests.ts @@ -36,6 +36,12 @@ is.all.error(new Error(), 'bar'); is.any.error(new Error(), 'bar'); is.all.error([new Error(), 'foo', 'bar']); +is.fn(toString); +is.not.fn({ foo: 'bar' }); +is.all.fn(toString, 'bar'); +is.any.fn(toString, 'bar'); +is.all.fn([toString, 'foo', 'bar']); + is.function(toString); is.not.function({ foo: 'bar' }); is.all.function(toString, 'bar'); From f41730728dd0fd4b0dac956c15553bec442073b8 Mon Sep 17 00:00:00 2001 From: Daniel Almaguer Date: Mon, 26 Mar 2018 14:25:03 -0500 Subject: [PATCH 066/109] navigo: update lastRouteResolved --- types/navigo/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/navigo/index.d.ts b/types/navigo/index.d.ts index ebc0ecb8c5..30fb656d45 100644 --- a/types/navigo/index.d.ts +++ b/types/navigo/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/krasimir/navigo // Definitions by: Adrian Ehrsam // Dancespiele +// Daniel Almaguer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -53,7 +54,7 @@ declare class Navigo { link(path: string): string; - lastRouteResolved(): {url: string, query: string}; + lastRouteResolved(): {url: string, query: string, hooks: NavigoHooks, params?: Params, name?: string}; disableIfAPINotAvailable(): void; From 2224db8ee54ee35869eb714f18bdc6959e710712 Mon Sep 17 00:00:00 2001 From: Pedro Antonio Souza Viegas Date: Mon, 26 Mar 2018 18:24:41 -0300 Subject: [PATCH 067/109] adding payment lite dialog example --- types/facebook-js-sdk/facebook-js-sdk-tests.ts | 9 +++++++++ types/facebook-js-sdk/index.d.ts | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/types/facebook-js-sdk/facebook-js-sdk-tests.ts b/types/facebook-js-sdk/facebook-js-sdk-tests.ts index f919e3290f..9652dbb86f 100644 --- a/types/facebook-js-sdk/facebook-js-sdk-tests.ts +++ b/types/facebook-js-sdk/facebook-js-sdk-tests.ts @@ -72,6 +72,15 @@ FB.ui({ console.log(data.payment_id); }); +FB.ui({ + method: 'pay', + action: 'purchaseiap', + product_id: 'com.fb.friendsmash.coins.10', + developer_payload: 'this_is_a_test_payload' +}, response => { + console.log(response); +}); + FB.ui({ method: 'pagetab', redirect_uri: 'YOUR_URL' diff --git a/types/facebook-js-sdk/index.d.ts b/types/facebook-js-sdk/index.d.ts index 4676cbf0fc..be9f71f6c9 100644 --- a/types/facebook-js-sdk/index.d.ts +++ b/types/facebook-js-sdk/index.d.ts @@ -186,7 +186,7 @@ declare namespace facebook { authResponse: { accessToken: string; expiresIn: number; - grantedScopes: string; + grantedScopes: string; signedRequest: string; userID: string; }; @@ -219,7 +219,7 @@ declare namespace facebook { purchase_time?: number; purchase_token?: string; signed_request?: string; - error_code?: number; + error_code?: number; error_message?: string; } From 8ea26416e7bb32cefa8a5f134f0f84d03b0764d9 Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Mon, 26 Mar 2018 20:40:10 -0600 Subject: [PATCH 068/109] Ember: Add `@ember/error` module export. --- types/ember/index.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index 3e776bd665..6d8adebae2 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -3500,6 +3500,12 @@ declare module '@ember/enumerable' { export default Enumerable; } +declare module '@ember/error' { + import Ember from 'ember'; + const Error: typeof Ember.Error; + export default Error; +} + declare module '@ember/instrumentation' { import Ember from 'ember'; export const instrument: typeof Ember.instrument; From 7fd7362840a0a70781c205e97ce73d01b61a543d Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Mon, 26 Mar 2018 20:49:55 -0600 Subject: [PATCH 069/109] Ember: Add test of import from '@ember/error'. --- types/ember/test/error.ts | 6 ++++++ types/ember/tsconfig.json | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 types/ember/test/error.ts diff --git a/types/ember/test/error.ts b/types/ember/test/error.ts new file mode 100644 index 0000000000..ad3c2ee8c3 --- /dev/null +++ b/types/ember/test/error.ts @@ -0,0 +1,6 @@ +import { assertType } from "./lib/assert"; + +import Ember from "ember"; +import EmberError from "@ember/error"; + +assertType(EmberError); diff --git a/types/ember/tsconfig.json b/types/ember/tsconfig.json index 19c8cf4b50..cbdb6b6afc 100755 --- a/types/ember/tsconfig.json +++ b/types/ember/tsconfig.json @@ -23,6 +23,7 @@ "test/lib/assert.ts", "test/application.ts", "test/ember-tests.ts", + "test/error.ts", "test/event.ts", "test/extend.ts", "test/create.ts", @@ -49,4 +50,4 @@ "test/route.ts", "test/view-utils.ts" ] -} \ No newline at end of file +} From 0925c2e41e5f9040e345141336adc3f3bd0bbb4b Mon Sep 17 00:00:00 2001 From: Vitor Cavalcanti Date: Tue, 27 Mar 2018 00:07:04 -0300 Subject: [PATCH 070/109] Add definition for is-color --- types/is-color/index.d.ts | 20 ++++++++++++++++++++ types/is-color/is-color-tests.ts | 23 +++++++++++++++++++++++ types/is-color/tsconfig.json | 23 +++++++++++++++++++++++ types/is-color/tslint.json | 1 + 4 files changed, 67 insertions(+) create mode 100644 types/is-color/index.d.ts create mode 100644 types/is-color/is-color-tests.ts create mode 100644 types/is-color/tsconfig.json create mode 100644 types/is-color/tslint.json diff --git a/types/is-color/index.d.ts b/types/is-color/index.d.ts new file mode 100644 index 0000000000..f6c545246f --- /dev/null +++ b/types/is-color/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for is-color 1.0 +// Project: https://github.com/morishitter/is-color +// Definitions by: Vitor Luiz Cavalcanti +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function isColor(str: string): boolean; + +declare namespace isColor { + function isRgb(str: string): boolean; + function isRgba(str: string): boolean; + function isHsl(str: string): boolean; + function isHsla(str: string): boolean; + function isHex(str: string): boolean; + function isKeyword(str: string): boolean; + function isInherit(str: string): str is 'inherit'; + function isCurrentColor(str: string): str is ('currentColor' | 'currentcolor'); + function isTransparent(str: string): str is 'transparent'; +} + +export = isColor; diff --git a/types/is-color/is-color-tests.ts b/types/is-color/is-color-tests.ts new file mode 100644 index 0000000000..a17ffc7b08 --- /dev/null +++ b/types/is-color/is-color-tests.ts @@ -0,0 +1,23 @@ +import isColor = require('is-color'); + +isColor('#000'); +// => boolean + +isColor.isHex('#000'); +// => boolean +isColor.isHsl('#000'); +// => boolean +isColor.isHsla('#000'); +// => boolean +isColor.isRgb('rgb(0, 0, 0)'); +// => boolean +isColor.isRgba('rgba(0,0,0, 0)'); +// => boolean +isColor.isKeyword('red'); +// => boolean +isColor.isInherit('inherit'); +// => is 'inherit' +isColor.isTransparent('transparent'); +// => is 'transparent' +isColor.isCurrentColor('currentColor'); +// => is 'currentColor'|'currentcolor' diff --git a/types/is-color/tsconfig.json b/types/is-color/tsconfig.json new file mode 100644 index 0000000000..41488170d8 --- /dev/null +++ b/types/is-color/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "is-color-tests.ts" + ] +} diff --git a/types/is-color/tslint.json b/types/is-color/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/is-color/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 59685b6f85c3e0cffe9aafe7692360226683e74f Mon Sep 17 00:00:00 2001 From: Mike Cook Date: Tue, 27 Mar 2018 08:04:13 +0100 Subject: [PATCH 071/109] Remove readme anchor from project link --- types/nodecredstash/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/nodecredstash/index.d.ts b/types/nodecredstash/index.d.ts index 76375aac21..9b2fed47c8 100644 --- a/types/nodecredstash/index.d.ts +++ b/types/nodecredstash/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for nodecredstash 2.0 -// Project: https://github.com/DavidTanner/nodecredstash#readme +// Project: https://github.com/DavidTanner/nodecredstash // Definitions by: Mike Cook // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 9f893b8e9e99a56f97cbaae0102fceeddff5f3cf Mon Sep 17 00:00:00 2001 From: Rafal2228 Date: Tue, 27 Mar 2018 10:15:32 +0200 Subject: [PATCH 072/109] fix(zapier-platform-core): add missing HTTP verb --- types/zapier-platform-core/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/zapier-platform-core/index.d.ts b/types/zapier-platform-core/index.d.ts index 525421abbf..474de4f0fd 100644 --- a/types/zapier-platform-core/index.d.ts +++ b/types/zapier-platform-core/index.d.ts @@ -15,7 +15,7 @@ export const version: string; export interface HttpRequestOptions { url?: string; - method?: "POST" | "GET" | "OPTIONS" | "HEAD" | "DELETE" | "PATCH"; + method?: "POST" | "GET" | "OPTIONS" | "HEAD" | "DELETE" | "PATCH" | "PUT"; body?: string | Buffer | NodeJS.ReadableStream | object | null; headers?: { [name: string]: string }; json?: object | any[] | null; From be3c84327f3727492c6e513945d4e7d13170d8c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Morch=C3=B3n=20Poveda?= Date: Tue, 27 Mar 2018 13:03:46 +0200 Subject: [PATCH 073/109] Update use with varargs --- types/jss/index.d.ts | 2 +- types/jss/jss-tests.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/types/jss/index.d.ts b/types/jss/index.d.ts index 0f77605b2c..37d2443e4a 100644 --- a/types/jss/index.d.ts +++ b/types/jss/index.d.ts @@ -125,7 +125,7 @@ declare class JSS { ): StyleSheet; removeStyleSheet(sheet: StyleSheet): this; setup(options?: Partial): this; - use(plugin: JSSPlugin): this; + use(...plugins: JSSPlugin[]): this; createRule(style: Style, options?: Partial): Rule; createRule(name: string, style: Style, options?: Partial): Rule; } diff --git a/types/jss/jss-tests.ts b/types/jss/jss-tests.ts index a5c6f34126..0211df99a8 100644 --- a/types/jss/jss-tests.ts +++ b/types/jss/jss-tests.ts @@ -7,6 +7,7 @@ import { } from 'jss'; const jss = createJSS().setup({}); +jss.use({}, {}); // $ExpectType JSS const styleSheet = jss.createStyleSheet( { From 3327220ff8a99ef392089105e9d6908c6747a588 Mon Sep 17 00:00:00 2001 From: Firede Date: Tue, 27 Mar 2018 19:48:25 +0800 Subject: [PATCH 074/109] Reformat all files using prettier. prettier --parser typescript --tab-width 4 --semi --trailing-comma es5 \ --write --print-width 120 \ types/graphql/**/*.d.ts related: #23142 #24532 --- types/graphql/error/GraphQLError.d.ts | 116 +-- types/graphql/error/formatError.d.ts | 12 +- types/graphql/error/index.d.ts | 12 +- types/graphql/error/locatedError.d.ts | 8 +- types/graphql/error/syntaxError.d.ts | 10 +- types/graphql/execution/execute.d.ts | 78 +- types/graphql/execution/index.d.ts | 10 +- types/graphql/execution/values.d.ts | 34 +- types/graphql/graphql.d.ts | 26 +- types/graphql/index.d.ts | 47 +- types/graphql/language/ast.d.ts | 758 +++++++++--------- types/graphql/language/index.d.ts | 22 +- types/graphql/language/kinds.d.ts | 86 +- types/graphql/language/lexer.d.ts | 95 ++- types/graphql/language/location.d.ts | 6 +- types/graphql/language/parser.d.ts | 104 ++- types/graphql/language/source.d.ts | 6 +- types/graphql/language/visitor.d.ts | 68 +- types/graphql/subscription/index.d.ts | 2 +- types/graphql/subscription/subscribe.d.ts | 46 +- types/graphql/type/definition.d.ts | 488 ++++++----- types/graphql/type/directives.d.ts | 68 +- types/graphql/type/index.d.ts | 70 +- types/graphql/type/introspection.d.ts | 36 +- types/graphql/type/scalars.d.ts | 2 +- types/graphql/type/schema.d.ts | 97 ++- types/graphql/utilities/TypeInfo.d.ts | 60 +- types/graphql/utilities/astFromValue.d.ts | 8 +- types/graphql/utilities/buildASTSchema.d.ts | 26 +- .../graphql/utilities/buildClientSchema.d.ts | 9 +- types/graphql/utilities/concatAST.d.ts | 2 +- types/graphql/utilities/extendSchema.d.ts | 9 +- .../utilities/findBreakingChanges.d.ts | 78 +- .../utilities/findDeprecatedUsages.d.ts | 11 +- types/graphql/utilities/getOperationAST.d.ts | 7 +- types/graphql/utilities/index.d.ts | 82 +- .../graphql/utilities/introspectionQuery.d.ts | 129 ++- types/graphql/utilities/isValidJSValue.d.ts | 2 +- .../utilities/isValidLiteralValue.d.ts | 9 +- types/graphql/utilities/schemaPrinter.d.ts | 6 +- .../graphql/utilities/separateOperations.d.ts | 6 +- types/graphql/utilities/typeComparators.d.ts | 20 +- types/graphql/utilities/typeFromAST.d.ts | 11 +- types/graphql/utilities/valueFromAST.d.ts | 19 +- types/graphql/validation/index.d.ts | 104 +-- .../rules/ArgumentsOfCorrectType.d.ts | 2 +- .../rules/DefaultValuesOfCorrectType.d.ts | 2 +- .../validation/rules/FieldsOnCorrectType.d.ts | 2 +- .../rules/FragmentsOnCompositeTypes.d.ts | 2 +- .../validation/rules/KnownArgumentNames.d.ts | 2 +- .../validation/rules/KnownDirectives.d.ts | 2 +- .../validation/rules/KnownFragmentNames.d.ts | 2 +- .../validation/rules/KnownTypeNames.d.ts | 2 +- .../rules/LoneAnonymousOperation.d.ts | 2 +- .../validation/rules/NoFragmentCycles.d.ts | 2 +- .../rules/NoUndefinedVariables.d.ts | 2 +- .../validation/rules/NoUnusedFragments.d.ts | 2 +- .../validation/rules/NoUnusedVariables.d.ts | 2 +- .../rules/OverlappingFieldsCanBeMerged.d.ts | 2 +- .../rules/PossibleFragmentSpreads.d.ts | 2 +- .../rules/ProvidedNonNullArguments.d.ts | 2 +- .../graphql/validation/rules/ScalarLeafs.d.ts | 2 +- .../rules/SingleFieldSubscriptions.d.ts | 2 +- .../validation/rules/UniqueArgumentNames.d.ts | 2 +- .../rules/UniqueDirectivesPerLocation.d.ts | 2 +- .../validation/rules/UniqueFragmentNames.d.ts | 2 +- .../rules/UniqueInputFieldNames.d.ts | 2 +- .../rules/UniqueOperationNames.d.ts | 2 +- .../validation/rules/UniqueVariableNames.d.ts | 2 +- .../rules/VariablesAreInputTypes.d.ts | 2 +- .../rules/VariablesInAllowedPosition.d.ts | 2 +- types/graphql/validation/specifiedRules.d.ts | 2 +- types/graphql/validation/validate.d.ts | 94 +-- 73 files changed, 1405 insertions(+), 1648 deletions(-) diff --git a/types/graphql/error/GraphQLError.d.ts b/types/graphql/error/GraphQLError.d.ts index abcc6be5b9..a4aa3f17c6 100644 --- a/types/graphql/error/GraphQLError.d.ts +++ b/types/graphql/error/GraphQLError.d.ts @@ -1,6 +1,6 @@ -import { getLocation } from '../language'; -import { ASTNode } from '../language/ast'; -import { Source } from '../language/source'; +import { getLocation } from "../language"; +import { ASTNode } from "../language/ast"; +import { Source } from "../language/source"; /** * A GraphQLError describes an Error found during the parse, validate, or @@ -9,66 +9,66 @@ import { Source } from '../language/source'; * GraphQL document and/or execution result that correspond to the Error. */ export class GraphQLError extends Error { - /** - * A message describing the Error for debugging purposes. - * - * Enumerable, and appears in the result of JSON.stringify(). - */ - message: string; + /** + * A message describing the Error for debugging purposes. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + message: string; - /** - * An array of { line, column } locations within the source GraphQL document - * which correspond to this error. - * - * Errors during validation often contain multiple locations, for example to - * point out two things with the same name. Errors during execution include a - * single location, the field which produced the error. - * - * Enumerable, and appears in the result of JSON.stringify(). - */ - locations?: Array<{ line: number; column: number }> | undefined; + /** + * An array of { line, column } locations within the source GraphQL document + * which correspond to this error. + * + * Errors during validation often contain multiple locations, for example to + * point out two things with the same name. Errors during execution include a + * single location, the field which produced the error. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + locations?: Array<{ line: number; column: number }> | undefined; - /** - * An array describing the JSON-path into the execution response which - * corresponds to this error. Only included for errors during execution. - * - * Enumerable, and appears in the result of JSON.stringify(). - */ - path?: Array | undefined; + /** + * An array describing the JSON-path into the execution response which + * corresponds to this error. Only included for errors during execution. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + path?: Array | undefined; - /** - * An array of GraphQL AST Nodes corresponding to this error. - */ - nodes?: ASTNode[] | undefined; + /** + * An array of GraphQL AST Nodes corresponding to this error. + */ + nodes?: ASTNode[] | undefined; - /** - * The source GraphQL document corresponding to this error. - */ - source?: Source | undefined; + /** + * The source GraphQL document corresponding to this error. + */ + source?: Source | undefined; - /** - * An array of character offsets within the source GraphQL document - * which correspond to this error. - */ - positions?: number[] | undefined; + /** + * An array of character offsets within the source GraphQL document + * which correspond to this error. + */ + positions?: number[] | undefined; - /** - * The original error thrown from a field resolver during execution. - */ - originalError?: Error; - - /** - * Extension fields to add to the formatted error. - */ - extensions?: { [key: string]: any } | undefined; + /** + * The original error thrown from a field resolver during execution. + */ + originalError?: Error; - constructor( - message: string, - nodes?: any[], - source?: Source, - positions?: number[], - path?: Array, - originalError?: Error, - extensions?: { [key: string]: any }, - ); + /** + * Extension fields to add to the formatted error. + */ + extensions?: { [key: string]: any } | undefined; + + constructor( + message: string, + nodes?: any[], + source?: Source, + positions?: number[], + path?: Array, + originalError?: Error, + extensions?: { [key: string]: any } + ); } diff --git a/types/graphql/error/formatError.d.ts b/types/graphql/error/formatError.d.ts index 26dbe0f743..a683da0375 100644 --- a/types/graphql/error/formatError.d.ts +++ b/types/graphql/error/formatError.d.ts @@ -1,4 +1,4 @@ -import { GraphQLError } from './GraphQLError'; +import { GraphQLError } from "./GraphQLError"; /** * Given a GraphQLError, format it according to the rules described by the @@ -7,12 +7,12 @@ import { GraphQLError } from './GraphQLError'; export function formatError(error: GraphQLError): GraphQLFormattedError; export interface GraphQLFormattedError { - message: string; - locations?: GraphQLErrorLocation[]; - path?: Array; + message: string; + locations?: GraphQLErrorLocation[]; + path?: Array; } export interface GraphQLErrorLocation { - line: number; - column: number; + line: number; + column: number; } diff --git a/types/graphql/error/index.d.ts b/types/graphql/error/index.d.ts index 0e9a557794..8d81175bcc 100644 --- a/types/graphql/error/index.d.ts +++ b/types/graphql/error/index.d.ts @@ -1,8 +1,4 @@ -export { GraphQLError } from './GraphQLError'; -export { syntaxError } from './syntaxError'; -export { locatedError } from './locatedError'; -export { - formatError, - GraphQLFormattedError, - GraphQLErrorLocation, -} from './formatError'; +export { GraphQLError } from "./GraphQLError"; +export { syntaxError } from "./syntaxError"; +export { locatedError } from "./locatedError"; +export { formatError, GraphQLFormattedError, GraphQLErrorLocation } from "./formatError"; diff --git a/types/graphql/error/locatedError.d.ts b/types/graphql/error/locatedError.d.ts index 64fadf49f4..c41fd0df50 100644 --- a/types/graphql/error/locatedError.d.ts +++ b/types/graphql/error/locatedError.d.ts @@ -1,12 +1,8 @@ -import { GraphQLError } from './GraphQLError'; +import { GraphQLError } from "./GraphQLError"; /** * Given an arbitrary Error, presumably thrown while attempting to execute a * GraphQL operation, produce a new GraphQLError aware of the location in the * document responsible for the original Error. */ -export function locatedError( - originalError: Error, - nodes: T[], - path: Array, -): GraphQLError; +export function locatedError(originalError: Error, nodes: T[], path: Array): GraphQLError; diff --git a/types/graphql/error/syntaxError.d.ts b/types/graphql/error/syntaxError.d.ts index ccf84044ca..bc33cd8107 100644 --- a/types/graphql/error/syntaxError.d.ts +++ b/types/graphql/error/syntaxError.d.ts @@ -1,12 +1,8 @@ -import { Source } from '../language/source'; -import { GraphQLError } from './GraphQLError'; +import { Source } from "../language/source"; +import { GraphQLError } from "./GraphQLError"; /** * Produces a GraphQLError representing a syntax error, containing useful * descriptive information about the syntax error's position in the source. */ -export function syntaxError( - source: Source, - position: number, - description: string, -): GraphQLError; +export function syntaxError(source: Source, position: number, description: string): GraphQLError; diff --git a/types/graphql/execution/execute.d.ts b/types/graphql/execution/execute.d.ts index ea6ab8ed39..387a3d4d73 100644 --- a/types/graphql/execution/execute.d.ts +++ b/types/graphql/execution/execute.d.ts @@ -1,19 +1,15 @@ -import { GraphQLError, locatedError } from '../error'; -import { GraphQLSchema } from '../type/schema'; +import { GraphQLError, locatedError } from "../error"; +import { GraphQLSchema } from "../type/schema"; +import { GraphQLField, GraphQLFieldResolver, ResponsePath } from "../type/definition"; import { - GraphQLField, - GraphQLFieldResolver, - ResponsePath, -} from '../type/definition'; -import { - DirectiveNode, - DocumentNode, - OperationDefinitionNode, - SelectionSetNode, - FieldNode, - InlineFragmentNode, - FragmentDefinitionNode, -} from '../language/ast'; + DirectiveNode, + DocumentNode, + OperationDefinitionNode, + SelectionSetNode, + FieldNode, + InlineFragmentNode, + FragmentDefinitionNode, +} from "../language/ast"; /** * Data that must be available at all points during query execution. * @@ -21,13 +17,13 @@ import { * and the fragments defined in the query document */ export interface ExecutionContext { - schema: GraphQLSchema; - fragments: { [key: string]: FragmentDefinitionNode }; - rootValue: any; - operation: OperationDefinitionNode; - variableValues: { [key: string]: any }; - fieldResolver: GraphQLFieldResolver; - errors: GraphQLError[]; + schema: GraphQLSchema; + fragments: { [key: string]: FragmentDefinitionNode }; + rootValue: any; + operation: OperationDefinitionNode; + variableValues: { [key: string]: any }; + fieldResolver: GraphQLFieldResolver; + errors: GraphQLError[]; } /** @@ -37,19 +33,19 @@ export interface ExecutionContext { * non-empty array if an error occurred. */ export interface ExecutionResult { - data?: { [key: string]: any }; - extensions?: { [key: string]: any }; - errors?: GraphQLError[]; + data?: { [key: string]: any }; + extensions?: { [key: string]: any }; + errors?: GraphQLError[]; } export type ExecutionArgs = { - schema: GraphQLSchema; - document: DocumentNode; - rootValue?: any; - contextValue?: any; - variableValues?: { [key: string]: any }; - operationName?: string; - fieldResolver?: GraphQLFieldResolver; + schema: GraphQLSchema; + document: DocumentNode; + rootValue?: any; + contextValue?: any; + variableValues?: { [key: string]: any }; + operationName?: string; + fieldResolver?: GraphQLFieldResolver; }; /** @@ -64,15 +60,15 @@ export type ExecutionArgs = { */ export function execute(args: ExecutionArgs): Promise; export function execute( - schema: GraphQLSchema, - document: DocumentNode, - rootValue?: any, - contextValue?: any, - variableValues?: { - [key: string]: any; - }, - operationName?: string, - fieldResolver?: GraphQLFieldResolver, + schema: GraphQLSchema, + document: DocumentNode, + rootValue?: any, + contextValue?: any, + variableValues?: { + [key: string]: any; + }, + operationName?: string, + fieldResolver?: GraphQLFieldResolver ): Promise; /** diff --git a/types/graphql/execution/index.d.ts b/types/graphql/execution/index.d.ts index a5c4980c0a..74aef224ce 100644 --- a/types/graphql/execution/index.d.ts +++ b/types/graphql/execution/index.d.ts @@ -1,9 +1,3 @@ -export { - execute, - defaultFieldResolver, - responsePathAsArray, - ExecutionArgs, - ExecutionResult, -} from './execute'; +export { execute, defaultFieldResolver, responsePathAsArray, ExecutionArgs, ExecutionResult } from "./execute"; -export { getDirectiveValues } from './values'; +export { getDirectiveValues } from "./values"; diff --git a/types/graphql/execution/values.d.ts b/types/graphql/execution/values.d.ts index 08e6041aa2..d8e1ec2e7e 100644 --- a/types/graphql/execution/values.d.ts +++ b/types/graphql/execution/values.d.ts @@ -1,15 +1,7 @@ -import { - GraphQLInputType, - GraphQLField, - GraphQLArgument, -} from '../type/definition'; -import { GraphQLDirective } from '../type/directives'; -import { GraphQLSchema } from '../type/schema'; -import { - FieldNode, - DirectiveNode, - VariableDefinitionNode, -} from '../language/ast'; +import { GraphQLInputType, GraphQLField, GraphQLArgument } from "../type/definition"; +import { GraphQLDirective } from "../type/directives"; +import { GraphQLSchema } from "../type/schema"; +import { FieldNode, DirectiveNode, VariableDefinitionNode } from "../language/ast"; /** * Prepares an object map of variableValues of the correct type based on the @@ -17,9 +9,9 @@ import { * parsed to match the variable definitions, a GraphQLError will be thrown. */ export function getVariableValues( - schema: GraphQLSchema, - varDefNodes: VariableDefinitionNode[], - inputs: { [key: string]: any }, + schema: GraphQLSchema, + varDefNodes: VariableDefinitionNode[], + inputs: { [key: string]: any } ): { [key: string]: any }; /** @@ -27,9 +19,9 @@ export function getVariableValues( * definitions and list of argument AST nodes. */ export function getArgumentValues( - def: GraphQLField | GraphQLDirective, - node: FieldNode | DirectiveNode, - variableValues?: { [key: string]: any }, + def: GraphQLField | GraphQLDirective, + node: FieldNode | DirectiveNode, + variableValues?: { [key: string]: any } ): { [key: string]: any }; /** @@ -40,7 +32,7 @@ export function getArgumentValues( * If the directive does not exist on the node, returns undefined. */ export function getDirectiveValues( - directiveDef: GraphQLDirective, - node: { directives?: Array }, - variableValues?: { [key: string]: any }, + directiveDef: GraphQLDirective, + node: { directives?: Array }, + variableValues?: { [key: string]: any } ): void | { [key: string]: any }; diff --git a/types/graphql/graphql.d.ts b/types/graphql/graphql.d.ts index f5469d7d8c..386cdd9e1b 100644 --- a/types/graphql/graphql.d.ts +++ b/types/graphql/graphql.d.ts @@ -1,7 +1,7 @@ -import { Source } from './language/source'; -import { GraphQLFieldResolver } from './type/definition'; -import { GraphQLSchema } from './type/schema'; -import { ExecutionResult } from './execution/execute'; +import { Source } from "./language/source"; +import { GraphQLFieldResolver } from "./type/definition"; +import { GraphQLSchema } from "./type/schema"; +import { ExecutionResult } from "./execution/execute"; /** * This is the primary entry point function for fulfilling GraphQL operations @@ -34,15 +34,15 @@ import { ExecutionResult } from './execution/execute'; * value or method on the source value with the field's name). */ export function graphql(args: { - schema: GraphQLSchema, - source: string | Source, - rootValue?: any, - contextValue?: any, + schema: GraphQLSchema; + source: string | Source; + rootValue?: any; + contextValue?: any; variableValues?: { - [key: string]: any - }, - operationName?: string, - fieldResolver?: GraphQLFieldResolver + [key: string]: any; + }; + operationName?: string; + fieldResolver?: GraphQLFieldResolver; }): Promise; export function graphql( schema: GraphQLSchema, @@ -50,7 +50,7 @@ export function graphql( rootValue?: any, contextValue?: any, variableValues?: { - [key: string]: any + [key: string]: any; }, operationName?: string, fieldResolver?: GraphQLFieldResolver diff --git a/types/graphql/index.d.ts b/types/graphql/index.d.ts index 49185e11a1..017f006787 100644 --- a/types/graphql/index.d.ts +++ b/types/graphql/index.d.ts @@ -17,17 +17,15 @@ // TypeScript Version: 2.3 // The primary entry point into fulfilling a GraphQL request. -export { - graphql -} from './graphql'; +export { graphql } from "./graphql"; // Create and operate on GraphQL type definitions and schema. -export * from './type'; +export * from "./type"; // Parse and operate on GraphQL language source files. -export * from './language'; +export * from "./language"; -export * from './subscription'; +export * from "./subscription"; // Execute GraphQL queries. export { @@ -37,16 +35,14 @@ export { getDirectiveValues, ExecutionArgs, ExecutionResult, -} from './execution'; +} from "./execution"; // Validate GraphQL queries. export { validate, ValidationContext, - // All validation rules in the GraphQL Specification. specifiedRules, - // Individual validation rules. ArgumentsOfCorrectTypeRule, DefaultValuesOfCorrectTypeRule, @@ -74,87 +70,60 @@ export { UniqueVariableNamesRule, VariablesAreInputTypesRule, VariablesInAllowedPositionRule, -} from './validation'; +} from "./validation"; // Create and format GraphQL errors. -export { - GraphQLError, - formatError, - GraphQLFormattedError, - GraphQLErrorLocation, -} from './error'; +export { GraphQLError, formatError, GraphQLFormattedError, GraphQLErrorLocation } from "./error"; // Utilities for operating on GraphQL type schema and parsed sources. export { // The GraphQL query recommended for a full schema introspection. introspectionQuery, - // Gets the target Operation from a Document getOperationAST, - // Build a GraphQLSchema from an introspection result. buildClientSchema, - // Build a GraphQLSchema from a parsed GraphQL Schema language AST. buildASTSchema, - // Build a GraphQLSchema from a GraphQL schema language document. buildSchema, - // Get the description of an AST node getDescription, - // Extends an existing GraphQLSchema from a parsed GraphQL Schema // language AST. extendSchema, - // Print a GraphQLSchema to GraphQL Schema language. printSchema, - // Print a GraphQLType to GraphQL Schema language. printType, - // Create a GraphQLType from a GraphQL language AST. typeFromAST, - // Create a JavaScript value from a GraphQL language AST. valueFromAST, - // Create a GraphQL language AST from a JavaScript value. astFromValue, - // A helper to use within recursive-descent visitors which need to be aware of // the GraphQL type system. TypeInfo, - // Determine if JavaScript values adhere to a GraphQL type. isValidJSValue, - // Determine if AST values adhere to a GraphQL type. isValidLiteralValue, - // Concatenates multiple AST together. concatAST, - // Separates an AST into an AST per Operation. separateOperations, - // Comparators for types isEqualType, isTypeSubTypeOf, doTypesOverlap, - // Asserts a string is a valid GraphQL name. assertValidName, - // Compares two GraphQLSchemas and detects breaking changes. findBreakingChanges, - // Report all deprecated usage within a GraphQL document. findDeprecatedUsages, - BreakingChange, - IntrospectionDirective, IntrospectionEnumType, IntrospectionEnumValue, @@ -172,4 +141,4 @@ export { IntrospectionType, IntrospectionTypeRef, IntrospectionUnionType, -} from './utilities'; +} from "./utilities"; diff --git a/types/graphql/language/ast.d.ts b/types/graphql/language/ast.d.ts index 1873caeb1f..21dbe83361 100644 --- a/types/graphql/language/ast.d.ts +++ b/types/graphql/language/ast.d.ts @@ -1,34 +1,34 @@ -import { Source } from './source'; +import { Source } from "./source"; /** * Contains a range of UTF-8 character offsets and token references that * identify the region of the source from which the AST derived. */ export interface Location { - /** - * The character offset at which this Node begins. - */ - start: number; + /** + * The character offset at which this Node begins. + */ + start: number; - /** - * The character offset at which this Node ends. - */ - end: number; + /** + * The character offset at which this Node ends. + */ + end: number; - /** - * The Token at which this Node begins. - */ - startToken: Token; + /** + * The Token at which this Node begins. + */ + startToken: Token; - /** - * The Token at which this Node ends. - */ - endToken: Token; + /** + * The Token at which this Node ends. + */ + endToken: Token; - /** - * The Source document the AST represents. - */ - source: Source; + /** + * The Source document the AST represents. + */ + source: Source; } /** @@ -37,346 +37,342 @@ export interface Location { * *only*. */ type TokenKind = - | '' - | '' - | '!' - | '$' - | '(' - | ')' - | '...' - | ':' - | '=' - | '@' - | '[' - | ']' - | '{' - | '|' - | '}' - | 'Name' - | 'Int' - | 'Float' - | 'String' - | 'BlockString' - | 'Comment'; + | "" + | "" + | "!" + | "$" + | "(" + | ")" + | "..." + | ":" + | "=" + | "@" + | "[" + | "]" + | "{" + | "|" + | "}" + | "Name" + | "Int" + | "Float" + | "String" + | "BlockString" + | "Comment"; /** * Represents a range of characters represented by a lexical token * within a Source. */ export interface Token { - /** - * The kind of Token. - */ - kind: TokenKind; + /** + * The kind of Token. + */ + kind: TokenKind; - /** - * The character offset at which this Node begins. - */ - start: number; + /** + * The character offset at which this Node begins. + */ + start: number; - /** - * The character offset at which this Node ends. - */ - end: number; + /** + * The character offset at which this Node ends. + */ + end: number; - /** - * The 1-indexed line number on which this Token appears. - */ - line: number; + /** + * The 1-indexed line number on which this Token appears. + */ + line: number; - /** - * The 1-indexed column number at which this Token begins. - */ - column: number; + /** + * The 1-indexed column number at which this Token begins. + */ + column: number; - /** - * For non-punctuation tokens, represents the interpreted value of the token. - */ - value: string | undefined; + /** + * For non-punctuation tokens, represents the interpreted value of the token. + */ + value: string | undefined; - /** - * Tokens exist as nodes in a double-linked-list amongst all tokens - * including ignored tokens. is always the first node and - * the last. - */ - prev?: Token; - next?: Token; + /** + * Tokens exist as nodes in a double-linked-list amongst all tokens + * including ignored tokens. is always the first node and + * the last. + */ + prev?: Token; + next?: Token; } /** * The list of all possible AST node types. */ export type ASTNode = - | NameNode - | DocumentNode - | OperationDefinitionNode - | VariableDefinitionNode - | VariableNode - | SelectionSetNode - | FieldNode - | ArgumentNode - | FragmentSpreadNode - | InlineFragmentNode - | FragmentDefinitionNode - | IntValueNode - | FloatValueNode - | StringValueNode - | BooleanValueNode - | NullValueNode - | EnumValueNode - | ListValueNode - | ObjectValueNode - | ObjectFieldNode - | DirectiveNode - | NamedTypeNode - | ListTypeNode - | NonNullTypeNode - | SchemaDefinitionNode - | OperationTypeDefinitionNode - | ScalarTypeDefinitionNode - | ObjectTypeDefinitionNode - | FieldDefinitionNode - | InputValueDefinitionNode - | InterfaceTypeDefinitionNode - | UnionTypeDefinitionNode - | EnumTypeDefinitionNode - | EnumValueDefinitionNode - | InputObjectTypeDefinitionNode - | ScalarTypeExtensionNode - | ObjectTypeExtensionNode - | InterfaceTypeExtensionNode - | UnionTypeExtensionNode - | EnumTypeExtensionNode - | InputObjectTypeExtensionNode - | DirectiveDefinitionNode; + | NameNode + | DocumentNode + | OperationDefinitionNode + | VariableDefinitionNode + | VariableNode + | SelectionSetNode + | FieldNode + | ArgumentNode + | FragmentSpreadNode + | InlineFragmentNode + | FragmentDefinitionNode + | IntValueNode + | FloatValueNode + | StringValueNode + | BooleanValueNode + | NullValueNode + | EnumValueNode + | ListValueNode + | ObjectValueNode + | ObjectFieldNode + | DirectiveNode + | NamedTypeNode + | ListTypeNode + | NonNullTypeNode + | SchemaDefinitionNode + | OperationTypeDefinitionNode + | ScalarTypeDefinitionNode + | ObjectTypeDefinitionNode + | FieldDefinitionNode + | InputValueDefinitionNode + | InterfaceTypeDefinitionNode + | UnionTypeDefinitionNode + | EnumTypeDefinitionNode + | EnumValueDefinitionNode + | InputObjectTypeDefinitionNode + | ScalarTypeExtensionNode + | ObjectTypeExtensionNode + | InterfaceTypeExtensionNode + | UnionTypeExtensionNode + | EnumTypeExtensionNode + | InputObjectTypeExtensionNode + | DirectiveDefinitionNode; /** * Utility type listing all nodes indexed by their kind. */ export interface ASTKindToNode { - Name: NameNode; - Document: DocumentNode; - OperationDefinition: OperationDefinitionNode; - VariableDefinition: VariableDefinitionNode; - Variable: VariableNode; - SelectionSet: SelectionSetNode; - Field: FieldNode; - Argument: ArgumentNode; - FragmentSpread: FragmentSpreadNode; - InlineFragment: InlineFragmentNode; - FragmentDefinition: FragmentDefinitionNode; - IntValue: IntValueNode; - FloatValue: FloatValueNode; - StringValue: StringValueNode; - BooleanValue: BooleanValueNode; - NullValue: NullValueNode; - EnumValue: EnumValueNode; - ListValue: ListValueNode; - ObjectValue: ObjectValueNode; - ObjectField: ObjectFieldNode; - Directive: DirectiveNode; - NamedType: NamedTypeNode; - ListType: ListTypeNode; - NonNullType: NonNullTypeNode; - SchemaDefinition: SchemaDefinitionNode; - OperationTypeDefinition: OperationTypeDefinitionNode; - ScalarTypeDefinition: ScalarTypeDefinitionNode; - ObjectTypeDefinition: ObjectTypeDefinitionNode; - FieldDefinition: FieldDefinitionNode; - InputValueDefinition: InputValueDefinitionNode; - InterfaceTypeDefinition: InterfaceTypeDefinitionNode; - UnionTypeDefinition: UnionTypeDefinitionNode; - EnumTypeDefinition: EnumTypeDefinitionNode; - EnumValueDefinition: EnumValueDefinitionNode; - InputObjectTypeDefinition: InputObjectTypeDefinitionNode; - ScalarTypeExtension: ScalarTypeExtensionNode; - ObjectTypeExtension: ObjectTypeExtensionNode; - InterfaceTypeExtension: InterfaceTypeExtensionNode; - UnionTypeExtension: UnionTypeExtensionNode; - EnumTypeExtension: EnumTypeExtensionNode; - InputObjectTypeExtension: InputObjectTypeExtensionNode; - DirectiveDefinition: DirectiveDefinitionNode; + Name: NameNode; + Document: DocumentNode; + OperationDefinition: OperationDefinitionNode; + VariableDefinition: VariableDefinitionNode; + Variable: VariableNode; + SelectionSet: SelectionSetNode; + Field: FieldNode; + Argument: ArgumentNode; + FragmentSpread: FragmentSpreadNode; + InlineFragment: InlineFragmentNode; + FragmentDefinition: FragmentDefinitionNode; + IntValue: IntValueNode; + FloatValue: FloatValueNode; + StringValue: StringValueNode; + BooleanValue: BooleanValueNode; + NullValue: NullValueNode; + EnumValue: EnumValueNode; + ListValue: ListValueNode; + ObjectValue: ObjectValueNode; + ObjectField: ObjectFieldNode; + Directive: DirectiveNode; + NamedType: NamedTypeNode; + ListType: ListTypeNode; + NonNullType: NonNullTypeNode; + SchemaDefinition: SchemaDefinitionNode; + OperationTypeDefinition: OperationTypeDefinitionNode; + ScalarTypeDefinition: ScalarTypeDefinitionNode; + ObjectTypeDefinition: ObjectTypeDefinitionNode; + FieldDefinition: FieldDefinitionNode; + InputValueDefinition: InputValueDefinitionNode; + InterfaceTypeDefinition: InterfaceTypeDefinitionNode; + UnionTypeDefinition: UnionTypeDefinitionNode; + EnumTypeDefinition: EnumTypeDefinitionNode; + EnumValueDefinition: EnumValueDefinitionNode; + InputObjectTypeDefinition: InputObjectTypeDefinitionNode; + ScalarTypeExtension: ScalarTypeExtensionNode; + ObjectTypeExtension: ObjectTypeExtensionNode; + InterfaceTypeExtension: InterfaceTypeExtensionNode; + UnionTypeExtension: UnionTypeExtensionNode; + EnumTypeExtension: EnumTypeExtensionNode; + InputObjectTypeExtension: InputObjectTypeExtensionNode; + DirectiveDefinition: DirectiveDefinitionNode; } // Name export interface NameNode { - kind: 'Name'; - loc?: Location; - value: string; + kind: "Name"; + loc?: Location; + value: string; } // Document export interface DocumentNode { - kind: 'Document'; - loc?: Location; - definitions: DefinitionNode[]; + kind: "Document"; + loc?: Location; + definitions: DefinitionNode[]; } -export type DefinitionNode = - | ExecutableDefinitionNode - | TypeSystemDefinitionNode; // experimental non-spec addition. +export type DefinitionNode = ExecutableDefinitionNode | TypeSystemDefinitionNode; // experimental non-spec addition. -export type ExecutableDefinitionNode = - | OperationDefinitionNode - | FragmentDefinitionNode; +export type ExecutableDefinitionNode = OperationDefinitionNode | FragmentDefinitionNode; export interface OperationDefinitionNode { - kind: 'OperationDefinition'; - loc?: Location; - operation: OperationTypeNode; - name?: NameNode; - variableDefinitions?: VariableDefinitionNode[]; - directives?: DirectiveNode[]; - selectionSet: SelectionSetNode; + kind: "OperationDefinition"; + loc?: Location; + operation: OperationTypeNode; + name?: NameNode; + variableDefinitions?: VariableDefinitionNode[]; + directives?: DirectiveNode[]; + selectionSet: SelectionSetNode; } // Note: subscription is an experimental non-spec addition. -export type OperationTypeNode = 'query' | 'mutation' | 'subscription'; +export type OperationTypeNode = "query" | "mutation" | "subscription"; export interface VariableDefinitionNode { - kind: 'VariableDefinition'; - loc?: Location; - variable: VariableNode; - type: TypeNode; - defaultValue?: ValueNode; + kind: "VariableDefinition"; + loc?: Location; + variable: VariableNode; + type: TypeNode; + defaultValue?: ValueNode; } export interface VariableNode { - kind: 'Variable'; - loc?: Location; - name: NameNode; + kind: "Variable"; + loc?: Location; + name: NameNode; } export interface SelectionSetNode { - kind: 'SelectionSet'; - loc?: Location; - selections: SelectionNode[]; + kind: "SelectionSet"; + loc?: Location; + selections: SelectionNode[]; } export type SelectionNode = FieldNode | FragmentSpreadNode | InlineFragmentNode; export interface FieldNode { - kind: 'Field'; - loc?: Location; - alias?: NameNode; - name: NameNode; - arguments?: ArgumentNode[]; - directives?: DirectiveNode[]; - selectionSet?: SelectionSetNode; + kind: "Field"; + loc?: Location; + alias?: NameNode; + name: NameNode; + arguments?: ArgumentNode[]; + directives?: DirectiveNode[]; + selectionSet?: SelectionSetNode; } export interface ArgumentNode { - kind: 'Argument'; - loc?: Location; - name: NameNode; - value: ValueNode; + kind: "Argument"; + loc?: Location; + name: NameNode; + value: ValueNode; } // Fragments export interface FragmentSpreadNode { - kind: 'FragmentSpread'; - loc?: Location; - name: NameNode; - directives?: DirectiveNode[]; + kind: "FragmentSpread"; + loc?: Location; + name: NameNode; + directives?: DirectiveNode[]; } export interface InlineFragmentNode { - kind: 'InlineFragment'; - loc?: Location; - typeCondition?: NamedTypeNode; - directives?: DirectiveNode[]; - selectionSet: SelectionSetNode; + kind: "InlineFragment"; + loc?: Location; + typeCondition?: NamedTypeNode; + directives?: DirectiveNode[]; + selectionSet: SelectionSetNode; } export interface FragmentDefinitionNode { - kind: 'FragmentDefinition'; - loc?: Location; - name: NameNode; - // Note: fragment variable definitions are experimental and may be changed - // or removed in the future. - variableDefinitions?: VariableDefinitionNode[]; - typeCondition: NamedTypeNode; - directives?: DirectiveNode[]; - selectionSet: SelectionSetNode; + kind: "FragmentDefinition"; + loc?: Location; + name: NameNode; + // Note: fragment variable definitions are experimental and may be changed + // or removed in the future. + variableDefinitions?: VariableDefinitionNode[]; + typeCondition: NamedTypeNode; + directives?: DirectiveNode[]; + selectionSet: SelectionSetNode; } // Values export type ValueNode = - | VariableNode - | IntValueNode - | FloatValueNode - | StringValueNode - | BooleanValueNode - | NullValueNode - | EnumValueNode - | ListValueNode - | ObjectValueNode; + | VariableNode + | IntValueNode + | FloatValueNode + | StringValueNode + | BooleanValueNode + | NullValueNode + | EnumValueNode + | ListValueNode + | ObjectValueNode; export interface IntValueNode { - kind: 'IntValue'; - loc?: Location; - value: string; + kind: "IntValue"; + loc?: Location; + value: string; } export interface FloatValueNode { - kind: 'FloatValue'; - loc?: Location; - value: string; + kind: "FloatValue"; + loc?: Location; + value: string; } export interface StringValueNode { - kind: 'StringValue'; - loc?: Location; - value: string; + kind: "StringValue"; + loc?: Location; + value: string; } export interface BooleanValueNode { - kind: 'BooleanValue'; - loc?: Location; - value: boolean; + kind: "BooleanValue"; + loc?: Location; + value: boolean; } export interface NullValueNode { - kind: 'NullValue'; - loc?: Location; + kind: "NullValue"; + loc?: Location; } export interface EnumValueNode { - kind: 'EnumValue'; - loc?: Location; - value: string; + kind: "EnumValue"; + loc?: Location; + value: string; } export interface ListValueNode { - kind: 'ListValue'; - loc?: Location; - values: ValueNode[]; + kind: "ListValue"; + loc?: Location; + values: ValueNode[]; } export interface ObjectValueNode { - kind: 'ObjectValue'; - loc?: Location; - fields: ObjectFieldNode[]; + kind: "ObjectValue"; + loc?: Location; + fields: ObjectFieldNode[]; } export interface ObjectFieldNode { - kind: 'ObjectField'; - loc?: Location; - name: NameNode; - value: ValueNode; + kind: "ObjectField"; + loc?: Location; + name: NameNode; + value: ValueNode; } // Directives export interface DirectiveNode { - kind: 'Directive'; - loc?: Location; - name: NameNode; - arguments?: ArgumentNode[]; + kind: "Directive"; + loc?: Location; + name: NameNode; + arguments?: ArgumentNode[]; } // Type Reference @@ -384,198 +380,198 @@ export interface DirectiveNode { export type TypeNode = NamedTypeNode | ListTypeNode | NonNullTypeNode; export interface NamedTypeNode { - kind: 'NamedType'; - loc?: Location; - name: NameNode; + kind: "NamedType"; + loc?: Location; + name: NameNode; } export interface ListTypeNode { - kind: 'ListType'; - loc?: Location; - type: TypeNode; + kind: "ListType"; + loc?: Location; + type: TypeNode; } export interface NonNullTypeNode { - kind: 'NonNullType'; - loc?: Location; - type: NamedTypeNode | ListTypeNode; + kind: "NonNullType"; + loc?: Location; + type: NamedTypeNode | ListTypeNode; } // Type System Definition export type TypeSystemDefinitionNode = - | SchemaDefinitionNode - | TypeDefinitionNode - | TypeExtensionNode - | DirectiveDefinitionNode; + | SchemaDefinitionNode + | TypeDefinitionNode + | TypeExtensionNode + | DirectiveDefinitionNode; export interface SchemaDefinitionNode { - kind: 'SchemaDefinition'; - loc?: Location; - directives: DirectiveNode[]; - operationTypes: OperationTypeDefinitionNode[]; + kind: "SchemaDefinition"; + loc?: Location; + directives: DirectiveNode[]; + operationTypes: OperationTypeDefinitionNode[]; } export interface OperationTypeDefinitionNode { - kind: 'OperationTypeDefinition'; - loc?: Location; - operation: OperationTypeNode; - type: NamedTypeNode; + kind: "OperationTypeDefinition"; + loc?: Location; + operation: OperationTypeNode; + type: NamedTypeNode; } export type TypeDefinitionNode = - | ScalarTypeDefinitionNode - | ObjectTypeDefinitionNode - | InterfaceTypeDefinitionNode - | UnionTypeDefinitionNode - | EnumTypeDefinitionNode - | InputObjectTypeDefinitionNode; + | ScalarTypeDefinitionNode + | ObjectTypeDefinitionNode + | InterfaceTypeDefinitionNode + | UnionTypeDefinitionNode + | EnumTypeDefinitionNode + | InputObjectTypeDefinitionNode; export interface ScalarTypeDefinitionNode { - kind: 'ScalarTypeDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - directives?: DirectiveNode[]; + kind: "ScalarTypeDefinition"; + loc?: Location; + description?: StringValueNode; + name: NameNode; + directives?: DirectiveNode[]; } export interface ObjectTypeDefinitionNode { - kind: 'ObjectTypeDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - interfaces?: NamedTypeNode[]; - directives?: DirectiveNode[]; - fields: FieldDefinitionNode[]; + kind: "ObjectTypeDefinition"; + loc?: Location; + description?: StringValueNode; + name: NameNode; + interfaces?: NamedTypeNode[]; + directives?: DirectiveNode[]; + fields: FieldDefinitionNode[]; } export interface FieldDefinitionNode { - kind: 'FieldDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - arguments: InputValueDefinitionNode[]; - type: TypeNode; - directives?: DirectiveNode[]; + kind: "FieldDefinition"; + loc?: Location; + description?: StringValueNode; + name: NameNode; + arguments: InputValueDefinitionNode[]; + type: TypeNode; + directives?: DirectiveNode[]; } export interface InputValueDefinitionNode { - kind: 'InputValueDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - type: TypeNode; - defaultValue?: ValueNode; - directives?: DirectiveNode[]; + kind: "InputValueDefinition"; + loc?: Location; + description?: StringValueNode; + name: NameNode; + type: TypeNode; + defaultValue?: ValueNode; + directives?: DirectiveNode[]; } export interface InterfaceTypeDefinitionNode { - kind: 'InterfaceTypeDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - directives?: DirectiveNode[]; - fields: FieldDefinitionNode[]; + kind: "InterfaceTypeDefinition"; + loc?: Location; + description?: StringValueNode; + name: NameNode; + directives?: DirectiveNode[]; + fields: FieldDefinitionNode[]; } export interface UnionTypeDefinitionNode { - kind: 'UnionTypeDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - directives?: DirectiveNode[]; - types: NamedTypeNode[]; + kind: "UnionTypeDefinition"; + loc?: Location; + description?: StringValueNode; + name: NameNode; + directives?: DirectiveNode[]; + types: NamedTypeNode[]; } export interface EnumTypeDefinitionNode { - kind: 'EnumTypeDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - directives?: DirectiveNode[]; - values: EnumValueDefinitionNode[]; + kind: "EnumTypeDefinition"; + loc?: Location; + description?: StringValueNode; + name: NameNode; + directives?: DirectiveNode[]; + values: EnumValueDefinitionNode[]; } export interface EnumValueDefinitionNode { - kind: 'EnumValueDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - directives?: DirectiveNode[]; + kind: "EnumValueDefinition"; + loc?: Location; + description?: StringValueNode; + name: NameNode; + directives?: DirectiveNode[]; } export interface InputObjectTypeDefinitionNode { - kind: 'InputObjectTypeDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - directives?: DirectiveNode[]; - fields: InputValueDefinitionNode[]; + kind: "InputObjectTypeDefinition"; + loc?: Location; + description?: StringValueNode; + name: NameNode; + directives?: DirectiveNode[]; + fields: InputValueDefinitionNode[]; } export type TypeExtensionNode = - | ScalarTypeExtensionNode - | ObjectTypeExtensionNode - | InterfaceTypeExtensionNode - | UnionTypeExtensionNode - | EnumTypeExtensionNode - | InputObjectTypeExtensionNode; + | ScalarTypeExtensionNode + | ObjectTypeExtensionNode + | InterfaceTypeExtensionNode + | UnionTypeExtensionNode + | EnumTypeExtensionNode + | InputObjectTypeExtensionNode; export type ScalarTypeExtensionNode = { - kind: 'ScalarTypeExtension'; - loc?: Location; - name: NameNode; - directives?: DirectiveNode[]; + kind: "ScalarTypeExtension"; + loc?: Location; + name: NameNode; + directives?: DirectiveNode[]; }; export type ObjectTypeExtensionNode = { - kind: 'ObjectTypeExtension'; - loc?: Location; - name: NameNode; - interfaces?: NamedTypeNode[]; - directives?: DirectiveNode[]; - fields?: FieldDefinitionNode[]; + kind: "ObjectTypeExtension"; + loc?: Location; + name: NameNode; + interfaces?: NamedTypeNode[]; + directives?: DirectiveNode[]; + fields?: FieldDefinitionNode[]; }; export type InterfaceTypeExtensionNode = { - kind: 'InterfaceTypeExtension'; - loc?: Location; - name: NameNode; - directives?: DirectiveNode[]; - fields?: FieldDefinitionNode[]; + kind: "InterfaceTypeExtension"; + loc?: Location; + name: NameNode; + directives?: DirectiveNode[]; + fields?: FieldDefinitionNode[]; }; export type UnionTypeExtensionNode = { - kind: 'UnionTypeExtension'; - loc?: Location; - name: NameNode; - directives?: DirectiveNode[]; - types?: NamedTypeNode[]; + kind: "UnionTypeExtension"; + loc?: Location; + name: NameNode; + directives?: DirectiveNode[]; + types?: NamedTypeNode[]; }; export type EnumTypeExtensionNode = { - kind: 'EnumTypeExtension'; - loc?: Location; - name: NameNode; - directives?: DirectiveNode[]; - values?: EnumValueDefinitionNode[]; + kind: "EnumTypeExtension"; + loc?: Location; + name: NameNode; + directives?: DirectiveNode[]; + values?: EnumValueDefinitionNode[]; }; export type InputObjectTypeExtensionNode = { - kind: 'InputObjectTypeExtension'; - loc?: Location; - name: NameNode; - directives?: DirectiveNode[]; - fields?: InputValueDefinitionNode[]; + kind: "InputObjectTypeExtension"; + loc?: Location; + name: NameNode; + directives?: DirectiveNode[]; + fields?: InputValueDefinitionNode[]; }; // Directive Definitions export interface DirectiveDefinitionNode { - kind: 'DirectiveDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - arguments?: InputValueDefinitionNode[]; - locations: NameNode[]; + kind: "DirectiveDefinition"; + loc?: Location; + description?: StringValueNode; + name: NameNode; + arguments?: InputValueDefinitionNode[]; + locations: NameNode[]; } diff --git a/types/graphql/language/index.d.ts b/types/graphql/language/index.d.ts index c8fe4b13ec..db088e6925 100644 --- a/types/graphql/language/index.d.ts +++ b/types/graphql/language/index.d.ts @@ -1,15 +1,9 @@ -export * from './ast'; -export { getLocation } from './location'; -import * as Kind from './kinds'; +export * from "./ast"; +export { getLocation } from "./location"; +import * as Kind from "./kinds"; export { Kind }; -export { createLexer, TokenKind, Lexer } from './lexer'; -export { parse, parseValue, parseType, ParseOptions } from './parser'; -export { print } from './printer'; -export { Source } from './source'; -export { - visit, - visitInParallel, - visitWithTypeInfo, - getVisitFn, - BREAK, -} from './visitor'; +export { createLexer, TokenKind, Lexer } from "./lexer"; +export { parse, parseValue, parseType, ParseOptions } from "./parser"; +export { print } from "./printer"; +export { Source } from "./source"; +export { visit, visitInParallel, visitWithTypeInfo, getVisitFn, BREAK } from "./visitor"; diff --git a/types/graphql/language/kinds.d.ts b/types/graphql/language/kinds.d.ts index f92826f891..2e7db3ad87 100644 --- a/types/graphql/language/kinds.d.ts +++ b/types/graphql/language/kinds.d.ts @@ -1,72 +1,72 @@ // Name -export const NAME: 'Name'; +export const NAME: "Name"; // Document -export const DOCUMENT: 'Document'; -export const OPERATION_DEFINITION: 'OperationDefinition'; -export const VARIABLE_DEFINITION: 'VariableDefinition'; -export const VARIABLE: 'Variable'; -export const SELECTION_SET: 'SelectionSet'; -export const FIELD: 'Field'; -export const ARGUMENT: 'Argument'; +export const DOCUMENT: "Document"; +export const OPERATION_DEFINITION: "OperationDefinition"; +export const VARIABLE_DEFINITION: "VariableDefinition"; +export const VARIABLE: "Variable"; +export const SELECTION_SET: "SelectionSet"; +export const FIELD: "Field"; +export const ARGUMENT: "Argument"; // Fragments -export const FRAGMENT_SPREAD: 'FragmentSpread'; -export const INLINE_FRAGMENT: 'InlineFragment'; -export const FRAGMENT_DEFINITION: 'FragmentDefinition'; +export const FRAGMENT_SPREAD: "FragmentSpread"; +export const INLINE_FRAGMENT: "InlineFragment"; +export const FRAGMENT_DEFINITION: "FragmentDefinition"; // Values -export const INT: 'IntValue'; -export const FLOAT: 'FloatValue'; -export const STRING: 'StringValue'; -export const BOOLEAN: 'BooleanValue'; -export const NULL: 'NullValue'; -export const ENUM: 'EnumValue'; -export const LIST: 'ListValue'; -export const OBJECT: 'ObjectValue'; -export const OBJECT_FIELD: 'ObjectField'; +export const INT: "IntValue"; +export const FLOAT: "FloatValue"; +export const STRING: "StringValue"; +export const BOOLEAN: "BooleanValue"; +export const NULL: "NullValue"; +export const ENUM: "EnumValue"; +export const LIST: "ListValue"; +export const OBJECT: "ObjectValue"; +export const OBJECT_FIELD: "ObjectField"; // Directives -export const DIRECTIVE: 'Directive'; +export const DIRECTIVE: "Directive"; // Types -export const NAMED_TYPE: 'NamedType'; -export const LIST_TYPE: 'ListType'; -export const NON_NULL_TYPE: 'NonNullType'; +export const NAMED_TYPE: "NamedType"; +export const LIST_TYPE: "ListType"; +export const NON_NULL_TYPE: "NonNullType"; // Type System Definitions -export const SCHEMA_DEFINITION: 'SchemaDefinition'; -export const OPERATION_TYPE_DEFINITION: 'OperationTypeDefinition'; +export const SCHEMA_DEFINITION: "SchemaDefinition"; +export const OPERATION_TYPE_DEFINITION: "OperationTypeDefinition"; // Type Definitions -export const SCALAR_TYPE_DEFINITION: 'ScalarTypeDefinition'; -export const OBJECT_TYPE_DEFINITION: 'ObjectTypeDefinition'; -export const FIELD_DEFINITION: 'FieldDefinition'; -export const INPUT_VALUE_DEFINITION: 'InputValueDefinition'; -export const INTERFACE_TYPE_DEFINITION: 'InterfaceTypeDefinition'; -export const UNION_TYPE_DEFINITION: 'UnionTypeDefinition'; -export const ENUM_TYPE_DEFINITION: 'EnumTypeDefinition'; -export const ENUM_VALUE_DEFINITION: 'EnumValueDefinition'; -export const INPUT_OBJECT_TYPE_DEFINITION: 'InputObjectTypeDefinition'; +export const SCALAR_TYPE_DEFINITION: "ScalarTypeDefinition"; +export const OBJECT_TYPE_DEFINITION: "ObjectTypeDefinition"; +export const FIELD_DEFINITION: "FieldDefinition"; +export const INPUT_VALUE_DEFINITION: "InputValueDefinition"; +export const INTERFACE_TYPE_DEFINITION: "InterfaceTypeDefinition"; +export const UNION_TYPE_DEFINITION: "UnionTypeDefinition"; +export const ENUM_TYPE_DEFINITION: "EnumTypeDefinition"; +export const ENUM_VALUE_DEFINITION: "EnumValueDefinition"; +export const INPUT_OBJECT_TYPE_DEFINITION: "InputObjectTypeDefinition"; // Type Extensions -export const TYPE_EXTENSION_DEFINITION: 'TypeExtensionDefinition'; -export const SCALAR_TYPE_EXTENSION: 'ScalarTypeExtension'; -export const OBJECT_TYPE_EXTENSION: 'ObjectTypeExtension'; -export const INTERFACE_TYPE_EXTENSION: 'InterfaceTypeExtension'; -export const UNION_TYPE_EXTENSION: 'UnionTypeExtension'; -export const ENUM_TYPE_EXTENSION: 'EnumTypeExtension'; -export const INPUT_OBJECT_TYPE_EXTENSION: 'InputObjectTypeExtension'; +export const TYPE_EXTENSION_DEFINITION: "TypeExtensionDefinition"; +export const SCALAR_TYPE_EXTENSION: "ScalarTypeExtension"; +export const OBJECT_TYPE_EXTENSION: "ObjectTypeExtension"; +export const INTERFACE_TYPE_EXTENSION: "InterfaceTypeExtension"; +export const UNION_TYPE_EXTENSION: "UnionTypeExtension"; +export const ENUM_TYPE_EXTENSION: "EnumTypeExtension"; +export const INPUT_OBJECT_TYPE_EXTENSION: "InputObjectTypeExtension"; // Directive Definitions -export const DIRECTIVE_DEFINITION: 'DirectiveDefinition'; +export const DIRECTIVE_DEFINITION: "DirectiveDefinition"; diff --git a/types/graphql/language/lexer.d.ts b/types/graphql/language/lexer.d.ts index 0db85434e2..27db5b04cc 100644 --- a/types/graphql/language/lexer.d.ts +++ b/types/graphql/language/lexer.d.ts @@ -1,6 +1,6 @@ -import { Token } from './ast'; -import { Source } from './source'; -import { syntaxError } from '../error'; +import { Token } from "./ast"; +import { Source } from "./source"; +import { syntaxError } from "../error"; /** * Given a Source object, this returns a Lexer for that source. @@ -10,42 +10,39 @@ import { syntaxError } from '../error'; * EOF, after which the lexer will repeatedly return the same EOF token * whenever called. */ -export function createLexer( - source: Source, - options: TOptions, -): Lexer; +export function createLexer(source: Source, options: TOptions): Lexer; /** * The return type of createLexer. */ export interface Lexer { - source: Source; - options: TOptions; + source: Source; + options: TOptions; - /** - * The previously focused non-ignored token. - */ - lastToken: Token; + /** + * The previously focused non-ignored token. + */ + lastToken: Token; - /** - * The currently focused non-ignored token. - */ - token: Token; + /** + * The currently focused non-ignored token. + */ + token: Token; - /** - * The (1-indexed) line containing the current token. - */ - line: number; + /** + * The (1-indexed) line containing the current token. + */ + line: number; - /** - * The character offset at which the current line begins. - */ - lineStart: number; + /** + * The character offset at which the current line begins. + */ + lineStart: number; - /** - * Advances the token stream to the next non-ignored token. - */ - advance(): Token; + /** + * Advances the token stream to the next non-ignored token. + */ + advance(): Token; } /** @@ -53,26 +50,26 @@ export interface Lexer { * lexer emits. */ export const TokenKind: { - SOF: ''; - EOF: ''; - BANG: '!'; - DOLLAR: '$'; - PAREN_L: '('; - PAREN_R: ')'; - SPREAD: '...'; - COLON: ':'; - EQUALS: '='; - AT: '@'; - BRACKET_L: '['; - BRACKET_R: ']'; - BRACE_L: '{'; - PIPE: '|'; - BRACE_R: '}'; - NAME: 'Name'; - INT: 'Int'; - FLOAT: 'Float'; - STRING: 'String'; - COMMENT: 'Comment'; + SOF: ""; + EOF: ""; + BANG: "!"; + DOLLAR: "$"; + PAREN_L: "("; + PAREN_R: ")"; + SPREAD: "..."; + COLON: ":"; + EQUALS: "="; + AT: "@"; + BRACKET_L: "["; + BRACKET_R: "]"; + BRACE_L: "{"; + PIPE: "|"; + BRACE_R: "}"; + NAME: "Name"; + INT: "Int"; + FLOAT: "Float"; + STRING: "String"; + COMMENT: "Comment"; }; /** diff --git a/types/graphql/language/location.d.ts b/types/graphql/language/location.d.ts index cb9744e0d5..4d7a13e314 100644 --- a/types/graphql/language/location.d.ts +++ b/types/graphql/language/location.d.ts @@ -1,8 +1,8 @@ -import { Source } from './source'; +import { Source } from "./source"; export interface SourceLocation { - line: number; - column: number; + line: number; + column: number; } export function getLocation(source: Source, position: number): SourceLocation; diff --git a/types/graphql/language/parser.d.ts b/types/graphql/language/parser.d.ts index ffafaae7fb..3cdb3462ae 100644 --- a/types/graphql/language/parser.d.ts +++ b/types/graphql/language/parser.d.ts @@ -1,66 +1,62 @@ -import { NamedTypeNode, TypeNode, ValueNode, DocumentNode } from './ast'; -import { Source } from './source'; -import { Lexer } from './lexer'; +import { NamedTypeNode, TypeNode, ValueNode, DocumentNode } from "./ast"; +import { Source } from "./source"; +import { Lexer } from "./lexer"; /** * Configuration options to control parser behavior */ export interface ParseOptions { + /** + * By default, the parser creates AST nodes that know the location + * in the source that they correspond to. This configuration flag + * disables that behavior for performance or testing. + */ + noLocation?: boolean; - /** - * By default, the parser creates AST nodes that know the location - * in the source that they correspond to. This configuration flag - * disables that behavior for performance or testing. - */ - noLocation?: boolean, + /** + * If enabled, the parser will parse empty fields sets in the Schema + * Definition Language. Otherwise, the parser will follow the current + * specification. + * + * This option is provided to ease adoption of the final SDL specification + * and will be removed in a future major release. + */ + allowLegacySDLEmptyFields?: boolean; - /** - * If enabled, the parser will parse empty fields sets in the Schema - * Definition Language. Otherwise, the parser will follow the current - * specification. - * - * This option is provided to ease adoption of the final SDL specification - * and will be removed in a future major release. - */ - allowLegacySDLEmptyFields?: boolean, + /** + * If enabled, the parser will parse implemented interfaces with no `&` + * character between each interface. Otherwise, the parser will follow the + * current specification. + * + * This option is provided to ease adoption of the final SDL specification + * and will be removed in a future major release. + */ + allowLegacySDLImplementsInterfaces?: boolean; - /** - * If enabled, the parser will parse implemented interfaces with no `&` - * character between each interface. Otherwise, the parser will follow the - * current specification. - * - * This option is provided to ease adoption of the final SDL specification - * and will be removed in a future major release. - */ - allowLegacySDLImplementsInterfaces?: boolean, - - /** - * EXPERIMENTAL: - * - * If enabled, the parser will understand and parse variable definitions - * contained in a fragment definition. They'll be represented in the - * `variableDefinitions` field of the FragmentDefinitionNode. - * - * The syntax is identical to normal, query-defined variables. For example: - * - * fragment A($var: Boolean = false) on T { - * ... - * } - * - * Note: this feature is experimental and may change or be removed in the - * future. - */ - experimentalFragmentVariables?: boolean, + /** + * EXPERIMENTAL: + * + * If enabled, the parser will understand and parse variable definitions + * contained in a fragment definition. They'll be represented in the + * `variableDefinitions` field of the FragmentDefinitionNode. + * + * The syntax is identical to normal, query-defined variables. For example: + * + * fragment A($var: Boolean = false) on T { + * ... + * } + * + * Note: this feature is experimental and may change or be removed in the + * future. + */ + experimentalFragmentVariables?: boolean; } /** * Given a GraphQL source, parses it into a Document. * Throws GraphQLError if a syntax error is encountered. */ -export function parse( - source: string | Source, - options?: ParseOptions, -): DocumentNode; +export function parse(source: string | Source, options?: ParseOptions): DocumentNode; /** * Given a string containing a GraphQL value, parse the AST for that value. @@ -69,10 +65,7 @@ export function parse( * This is useful within tools that operate upon GraphQL Values directly and * in isolation of complete GraphQL documents. */ -export function parseValue( - source: Source | string, - options?: ParseOptions, -): ValueNode; +export function parseValue(source: Source | string, options?: ParseOptions): ValueNode; /** * Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for @@ -84,10 +77,7 @@ export function parseValue( * * Consider providing the results to the utility function: typeFromAST(). */ -export function parseType( - source: Source | string, - options?: ParseOptions, -): TypeNode; +export function parseType(source: Source | string, options?: ParseOptions): TypeNode; export function parseConstValue(lexer: Lexer): ValueNode; diff --git a/types/graphql/language/source.d.ts b/types/graphql/language/source.d.ts index 236028b7df..80e68f5557 100644 --- a/types/graphql/language/source.d.ts +++ b/types/graphql/language/source.d.ts @@ -1,5 +1,5 @@ export class Source { - body: string; - name: string; - constructor(body: string, name?: string); + body: string; + name: string; + constructor(body: string, name?: string); } diff --git a/types/graphql/language/visitor.d.ts b/types/graphql/language/visitor.d.ts index e7e9d67da0..320d181e4a 100644 --- a/types/graphql/language/visitor.d.ts +++ b/types/graphql/language/visitor.d.ts @@ -1,43 +1,43 @@ export const QueryDocumentKeys: { - Name: any[]; - Document: string[]; - OperationDefinition: string[]; - VariableDefinition: string[]; - Variable: string[]; - SelectionSet: string[]; - Field: string[]; - Argument: string[]; + Name: any[]; + Document: string[]; + OperationDefinition: string[]; + VariableDefinition: string[]; + Variable: string[]; + SelectionSet: string[]; + Field: string[]; + Argument: string[]; - FragmentSpread: string[]; - InlineFragment: string[]; - FragmentDefinition: string[]; + FragmentSpread: string[]; + InlineFragment: string[]; + FragmentDefinition: string[]; - IntValue: number[]; - FloatValue: number[]; - StringValue: string[]; - BooleanValue: boolean[]; - NullValue: null[]; - EnumValue: any[]; - ListValue: string[]; - ObjectValue: string[]; - ObjectField: string[]; + IntValue: number[]; + FloatValue: number[]; + StringValue: string[]; + BooleanValue: boolean[]; + NullValue: null[]; + EnumValue: any[]; + ListValue: string[]; + ObjectValue: string[]; + ObjectField: string[]; - Directive: string[]; + Directive: string[]; - NamedType: string[]; - ListType: string[]; - NonNullType: string[]; + NamedType: string[]; + ListType: string[]; + NonNullType: string[]; - ObjectTypeDefinition: string[]; - FieldDefinition: string[]; - InputValueDefinition: string[]; - InterfaceTypeDefinition: string[]; - UnionTypeDefinition: string[]; - ScalarTypeDefinition: string[]; - EnumTypeDefinition: string[]; - EnumValueDefinition: string[]; - InputObjectTypeDefinition: string[]; - TypeExtensionDefinition: string[]; + ObjectTypeDefinition: string[]; + FieldDefinition: string[]; + InputValueDefinition: string[]; + InterfaceTypeDefinition: string[]; + UnionTypeDefinition: string[]; + ScalarTypeDefinition: string[]; + EnumTypeDefinition: string[]; + EnumValueDefinition: string[]; + InputObjectTypeDefinition: string[]; + TypeExtensionDefinition: string[]; }; export const BREAK: any; diff --git a/types/graphql/subscription/index.d.ts b/types/graphql/subscription/index.d.ts index 11b0a7f26d..71583e7ff3 100644 --- a/types/graphql/subscription/index.d.ts +++ b/types/graphql/subscription/index.d.ts @@ -1 +1 @@ -export { subscribe, createSourceEventStream } from './subscribe'; +export { subscribe, createSourceEventStream } from "./subscribe"; diff --git a/types/graphql/subscription/subscribe.d.ts b/types/graphql/subscription/subscribe.d.ts index dc2c096b86..c4eec87ac9 100644 --- a/types/graphql/subscription/subscribe.d.ts +++ b/types/graphql/subscription/subscribe.d.ts @@ -1,29 +1,29 @@ -import { GraphQLSchema } from '../type/schema'; -import { DocumentNode } from '../language/ast'; -import { GraphQLFieldResolver } from '../type/definition'; -import { ExecutionResult } from '../execution/execute'; +import { GraphQLSchema } from "../type/schema"; +import { DocumentNode } from "../language/ast"; +import { GraphQLFieldResolver } from "../type/definition"; +import { ExecutionResult } from "../execution/execute"; export function subscribe( - schema: GraphQLSchema, - document: DocumentNode, - rootValue?: any, - contextValue?: any, - variableValues?: { - [key: string]: any; - }, - operationName?: string, - fieldResolver?: GraphQLFieldResolver, - subscribeFieldResolver?: GraphQLFieldResolver, + schema: GraphQLSchema, + document: DocumentNode, + rootValue?: any, + contextValue?: any, + variableValues?: { + [key: string]: any; + }, + operationName?: string, + fieldResolver?: GraphQLFieldResolver, + subscribeFieldResolver?: GraphQLFieldResolver ): Promise | ExecutionResult>; export function createSourceEventStream( - schema: GraphQLSchema, - document: DocumentNode, - rootValue?: any, - contextValue?: any, - variableValues?: { - [key: string]: any; - }, - operationName?: string, - fieldResolver?: GraphQLFieldResolver, + schema: GraphQLSchema, + document: DocumentNode, + rootValue?: any, + contextValue?: any, + variableValues?: { + [key: string]: any; + }, + operationName?: string, + fieldResolver?: GraphQLFieldResolver ): Promise>; diff --git a/types/graphql/type/definition.d.ts b/types/graphql/type/definition.d.ts index 098f7376ef..b31ac6bbed 100644 --- a/types/graphql/type/definition.d.ts +++ b/types/graphql/type/definition.d.ts @@ -1,33 +1,33 @@ import { - ScalarTypeDefinitionNode, - ObjectTypeDefinitionNode, - FieldDefinitionNode, - InputValueDefinitionNode, - InterfaceTypeDefinitionNode, - UnionTypeDefinitionNode, - EnumTypeDefinitionNode, - EnumValueDefinitionNode, - InputObjectTypeDefinitionNode, - TypeExtensionNode, - OperationDefinitionNode, - FieldNode, - FragmentDefinitionNode, - ValueNode, -} from '../language/ast'; -import { GraphQLSchema } from './schema'; + ScalarTypeDefinitionNode, + ObjectTypeDefinitionNode, + FieldDefinitionNode, + InputValueDefinitionNode, + InterfaceTypeDefinitionNode, + UnionTypeDefinitionNode, + EnumTypeDefinitionNode, + EnumValueDefinitionNode, + InputObjectTypeDefinitionNode, + TypeExtensionNode, + OperationDefinitionNode, + FieldNode, + FragmentDefinitionNode, + ValueNode, +} from "../language/ast"; +import { GraphQLSchema } from "./schema"; /** * These are all of the possible kinds of types. */ export type GraphQLType = - | GraphQLScalarType - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType - | GraphQLEnumType - | GraphQLInputObjectType - | GraphQLList - | GraphQLNonNull; + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList + | GraphQLNonNull; export function isType(type: any): type is GraphQLType; @@ -37,16 +37,11 @@ export function assertType(type: any): GraphQLType; * These types may be used as input types for arguments and directives. */ export type GraphQLInputType = - | GraphQLScalarType - | GraphQLEnumType - | GraphQLInputObjectType - | GraphQLList - | GraphQLNonNull< - | GraphQLScalarType - | GraphQLEnumType - | GraphQLInputObjectType - | GraphQLList - >; + | GraphQLScalarType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList + | GraphQLNonNull>; export function isInputType(type: GraphQLType): type is GraphQLInputType; @@ -56,20 +51,20 @@ export function assertInputType(type: GraphQLType): GraphQLInputType; * These types may be used as output types as the result of fields. */ export type GraphQLOutputType = - | GraphQLScalarType - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType - | GraphQLEnumType - | GraphQLList - | GraphQLNonNull< - | GraphQLScalarType - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType - | GraphQLEnumType - | GraphQLList - >; + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLList + | GraphQLNonNull< + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLList + >; export function isOutputType(type: GraphQLType): type is GraphQLOutputType; @@ -87,14 +82,9 @@ export function assertLeafType(type: GraphQLType): GraphQLLeafType; /** * These types may describe the parent context of a selection set. */ -export type GraphQLCompositeType = - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType; +export type GraphQLCompositeType = GraphQLObjectType | GraphQLInterfaceType | GraphQLUnionType; -export function isCompositeType( - type: GraphQLType, -): type is GraphQLCompositeType; +export function isCompositeType(type: GraphQLType): type is GraphQLCompositeType; export function assertCompositeType(type: GraphQLType): GraphQLCompositeType; @@ -111,28 +101,26 @@ export function assertAbstractType(type: GraphQLType): GraphQLAbstractType; * These types can all accept null as a value. */ export type GraphQLNullableType = - | GraphQLScalarType - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType - | GraphQLEnumType - | GraphQLInputObjectType - | GraphQLList; + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList; -export function getNullableType( - type: T, -): T & GraphQLNullableType; +export function getNullableType(type: T): T & GraphQLNullableType; /** * These named types do not include modifiers like List or NonNull. */ export type GraphQLNamedType = - | GraphQLScalarType - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType - | GraphQLEnumType - | GraphQLInputObjectType; + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLInputObjectType; export function isNamedType(type: GraphQLType): boolean; @@ -164,30 +152,30 @@ export type Thunk = (() => T) | T; * */ export class GraphQLScalarType { - name: string; - description: string; - astNode?: ScalarTypeDefinitionNode; - constructor(config: GraphQLScalarTypeConfig); + name: string; + description: string; + astNode?: ScalarTypeDefinitionNode; + constructor(config: GraphQLScalarTypeConfig); - // Serializes an internal value to include in a response. - serialize(value: any): any; + // Serializes an internal value to include in a response. + serialize(value: any): any; - // Parses an externally provided value to use as an input. - parseValue(value: any): any; + // Parses an externally provided value to use as an input. + parseValue(value: any): any; - // Parses an externally provided literal value to use as an input. - parseLiteral(valueNode: ValueNode): any; + // Parses an externally provided literal value to use as an input. + parseLiteral(valueNode: ValueNode): any; - toString(): string; + toString(): string; } export interface GraphQLScalarTypeConfig { - name: string; - description?: string; - astNode?: ScalarTypeDefinitionNode; - serialize(value: any): TExternal | null | undefined; - parseValue?(value: any): TInternal | null | undefined; - parseLiteral?(valueNode: ValueNode): TInternal | null | undefined; + name: string; + description?: string; + astNode?: ScalarTypeDefinitionNode; + serialize(value: any): TExternal | null | undefined; + parseValue?(value: any): TInternal | null | undefined; + parseLiteral?(valueNode: ValueNode): TInternal | null | undefined; } /** @@ -228,123 +216,109 @@ export interface GraphQLScalarTypeConfig { * */ export class GraphQLObjectType { - name: string; - description: string; - astNode?: ObjectTypeDefinitionNode; - extensionASTNodes: Array; - isTypeOf: GraphQLIsTypeOfFn; + name: string; + description: string; + astNode?: ObjectTypeDefinitionNode; + extensionASTNodes: Array; + isTypeOf: GraphQLIsTypeOfFn; - constructor(config: GraphQLObjectTypeConfig); - getFields(): GraphQLFieldMap; - getInterfaces(): GraphQLInterfaceType[]; - toString(): string; + constructor(config: GraphQLObjectTypeConfig); + getFields(): GraphQLFieldMap; + getInterfaces(): GraphQLInterfaceType[]; + toString(): string; } export interface GraphQLObjectTypeConfig { - name: string; - interfaces?: Thunk; - fields: Thunk>; - isTypeOf?: GraphQLIsTypeOfFn; - description?: string; - astNode?: ObjectTypeDefinitionNode; - extensionASTNodes?: Array; + name: string; + interfaces?: Thunk; + fields: Thunk>; + isTypeOf?: GraphQLIsTypeOfFn; + description?: string; + astNode?: ObjectTypeDefinitionNode; + extensionASTNodes?: Array; } export type GraphQLTypeResolver = ( - value: TSource, - context: TContext, - info: GraphQLResolveInfo, + value: TSource, + context: TContext, + info: GraphQLResolveInfo ) => GraphQLObjectType | string | Promise; export type GraphQLIsTypeOfFn = ( - source: TSource, - context: TContext, - info: GraphQLResolveInfo, + source: TSource, + context: TContext, + info: GraphQLResolveInfo ) => boolean | Promise; -export type GraphQLFieldResolver< - TSource, - TContext, - TArgs = { [argName: string]: any } -> = ( - source: TSource, - args: TArgs, - context: TContext, - info: GraphQLResolveInfo, +export type GraphQLFieldResolver = ( + source: TSource, + args: TArgs, + context: TContext, + info: GraphQLResolveInfo ) => any; export interface GraphQLResolveInfo { - fieldName: string; - fieldNodes: FieldNode[]; - returnType: GraphQLOutputType; - parentType: GraphQLCompositeType; - path: ResponsePath; - schema: GraphQLSchema; - fragments: { [fragmentName: string]: FragmentDefinitionNode }; - rootValue: any; - operation: OperationDefinitionNode; - variableValues: { [variableName: string]: any }; + fieldName: string; + fieldNodes: FieldNode[]; + returnType: GraphQLOutputType; + parentType: GraphQLCompositeType; + path: ResponsePath; + schema: GraphQLSchema; + fragments: { [fragmentName: string]: FragmentDefinitionNode }; + rootValue: any; + operation: OperationDefinitionNode; + variableValues: { [variableName: string]: any }; } -export type ResponsePath = - | { prev: ResponsePath; key: string | number } - | undefined; +export type ResponsePath = { prev: ResponsePath; key: string | number } | undefined; -export interface GraphQLFieldConfig< - TSource, - TContext, - TArgs = { [argName: string]: any } -> { - type: GraphQLOutputType; - args?: GraphQLFieldConfigArgumentMap; - resolve?: GraphQLFieldResolver; - subscribe?: GraphQLFieldResolver; - deprecationReason?: string; - description?: string; - astNode?: FieldDefinitionNode; +export interface GraphQLFieldConfig { + type: GraphQLOutputType; + args?: GraphQLFieldConfigArgumentMap; + resolve?: GraphQLFieldResolver; + subscribe?: GraphQLFieldResolver; + deprecationReason?: string; + description?: string; + astNode?: FieldDefinitionNode; } export interface GraphQLFieldConfigArgumentMap { - [argName: string]: GraphQLArgumentConfig; + [argName: string]: GraphQLArgumentConfig; } export interface GraphQLArgumentConfig { - type: GraphQLInputType; - defaultValue?: any; - description?: string; - astNode?: InputValueDefinitionNode; + type: GraphQLInputType; + defaultValue?: any; + description?: string; + astNode?: InputValueDefinitionNode; } export interface GraphQLFieldConfigMap { - [fieldName: string]: GraphQLFieldConfig; + [fieldName: string]: GraphQLFieldConfig; } -export interface GraphQLField< - TSource, - TContext, - TArgs = { [argName: string]: any } -> { - name: string; - description: string; - type: GraphQLOutputType; - args: GraphQLArgument[]; - resolve?: GraphQLFieldResolver; - subscribe?: GraphQLFieldResolver; - isDeprecated?: boolean; - deprecationReason?: string; - astNode?: FieldDefinitionNode; +export interface GraphQLField { + name: string; + description: string; + type: GraphQLOutputType; + args: GraphQLArgument[]; + resolve?: GraphQLFieldResolver; + subscribe?: GraphQLFieldResolver; + isDeprecated?: boolean; + deprecationReason?: string; + astNode?: FieldDefinitionNode; } export interface GraphQLArgument { - name: string; - type: GraphQLInputType; - defaultValue?: any; - description?: string; - astNode?: InputValueDefinitionNode; + name: string; + type: GraphQLInputType; + defaultValue?: any; + description?: string; + astNode?: InputValueDefinitionNode; } export interface GraphQLFieldMap { - [fieldName: string]: GraphQLField; + [fieldName: string]: GraphQLField; } /** @@ -366,29 +340,29 @@ export interface GraphQLFieldMap { * */ export class GraphQLInterfaceType { - name: string; - description: string; - astNode?: InterfaceTypeDefinitionNode; - resolveType: GraphQLTypeResolver; + name: string; + description: string; + astNode?: InterfaceTypeDefinitionNode; + resolveType: GraphQLTypeResolver; - constructor(config: GraphQLInterfaceTypeConfig); + constructor(config: GraphQLInterfaceTypeConfig); - getFields(): GraphQLFieldMap; + getFields(): GraphQLFieldMap; - toString(): string; + toString(): string; } export interface GraphQLInterfaceTypeConfig { - name: string; - fields: Thunk>; - /** - * Optionally provide a custom type resolver function. If one is not provided, - * the default implementation will call `isTypeOf` on each implementing - * Object type. - */ - resolveType?: GraphQLTypeResolver; - description?: string; - astNode?: InterfaceTypeDefinitionNode; + name: string; + fields: Thunk>; + /** + * Optionally provide a custom type resolver function. If one is not provided, + * the default implementation will call `isTypeOf` on each implementing + * Object type. + */ + resolveType?: GraphQLTypeResolver; + description?: string; + astNode?: InterfaceTypeDefinitionNode; } /** @@ -415,29 +389,29 @@ export interface GraphQLInterfaceTypeConfig { * */ export class GraphQLUnionType { - name: string; - description: string; - astNode?: UnionTypeDefinitionNode; - resolveType: GraphQLTypeResolver; + name: string; + description: string; + astNode?: UnionTypeDefinitionNode; + resolveType: GraphQLTypeResolver; - constructor(config: GraphQLUnionTypeConfig); + constructor(config: GraphQLUnionTypeConfig); - getTypes(): GraphQLObjectType[]; + getTypes(): GraphQLObjectType[]; - toString(): string; + toString(): string; } export interface GraphQLUnionTypeConfig { - name: string; - types: Thunk; - /** - * Optionally provide a custom type resolver function. If one is not provided, - * the default implementation will call `isTypeOf` on each implementing - * Object type. - */ - resolveType?: GraphQLTypeResolver; - description?: string; - astNode?: UnionTypeDefinitionNode; + name: string; + types: Thunk; + /** + * Optionally provide a custom type resolver function. If one is not provided, + * the default implementation will call `isTypeOf` on each implementing + * Object type. + */ + resolveType?: GraphQLTypeResolver; + description?: string; + astNode?: UnionTypeDefinitionNode; } /** @@ -462,45 +436,45 @@ export interface GraphQLUnionTypeConfig { * will be used as its internal value. */ export class GraphQLEnumType { - name: string; - description: string; - astNode?: EnumTypeDefinitionNode; + name: string; + description: string; + astNode?: EnumTypeDefinitionNode; - constructor(config: GraphQLEnumTypeConfig); - getValues(): GraphQLEnumValue[]; - getValue(name: string): GraphQLEnumValue; - isValidValue(value: any): boolean; - serialize(value: any): string; - parseValue(value: any): any; - parseLiteral(valueNode: ValueNode): any; - toString(): string; + constructor(config: GraphQLEnumTypeConfig); + getValues(): GraphQLEnumValue[]; + getValue(name: string): GraphQLEnumValue; + isValidValue(value: any): boolean; + serialize(value: any): string; + parseValue(value: any): any; + parseLiteral(valueNode: ValueNode): any; + toString(): string; } export interface GraphQLEnumTypeConfig { - name: string; - values: GraphQLEnumValueConfigMap; - description?: string; - astNode?: EnumTypeDefinitionNode; + name: string; + values: GraphQLEnumValueConfigMap; + description?: string; + astNode?: EnumTypeDefinitionNode; } export interface GraphQLEnumValueConfigMap { - [valueName: string]: GraphQLEnumValueConfig; + [valueName: string]: GraphQLEnumValueConfig; } export interface GraphQLEnumValueConfig { - value?: any; - deprecationReason?: string; - description?: string; - astNode?: EnumValueDefinitionNode; + value?: any; + deprecationReason?: string; + description?: string; + astNode?: EnumValueDefinitionNode; } export interface GraphQLEnumValue { - name: string; - description: string; - isDeprecated?: boolean; - deprecationReason: string; - astNode?: EnumValueDefinitionNode; - value: any; + name: string; + description: string; + isDeprecated?: boolean; + deprecationReason: string; + astNode?: EnumValueDefinitionNode; + value: any; } /** @@ -524,42 +498,42 @@ export interface GraphQLEnumValue { * */ export class GraphQLInputObjectType { - name: string; - description: string; - astNode?: InputObjectTypeDefinitionNode; - constructor(config: GraphQLInputObjectTypeConfig); - getFields(): GraphQLInputFieldMap; - toString(): string; + name: string; + description: string; + astNode?: InputObjectTypeDefinitionNode; + constructor(config: GraphQLInputObjectTypeConfig); + getFields(): GraphQLInputFieldMap; + toString(): string; } export interface GraphQLInputObjectTypeConfig { - name: string; - fields: Thunk; - description?: string; - astNode?: InputObjectTypeDefinitionNode; + name: string; + fields: Thunk; + description?: string; + astNode?: InputObjectTypeDefinitionNode; } export interface GraphQLInputFieldConfig { - type: GraphQLInputType; - defaultValue?: any; - description?: string; - astNode?: InputValueDefinitionNode; + type: GraphQLInputType; + defaultValue?: any; + description?: string; + astNode?: InputValueDefinitionNode; } export interface GraphQLInputFieldConfigMap { - [fieldName: string]: GraphQLInputFieldConfig; + [fieldName: string]: GraphQLInputFieldConfig; } export interface GraphQLInputField { - name: string; - type: GraphQLInputType; - defaultValue?: any; - description?: string; - astNode?: InputValueDefinitionNode; + name: string; + type: GraphQLInputType; + defaultValue?: any; + description?: string; + astNode?: InputValueDefinitionNode; } export interface GraphQLInputFieldMap { - [fieldName: string]: GraphQLInputField; + [fieldName: string]: GraphQLInputField; } /** @@ -581,9 +555,9 @@ export interface GraphQLInputFieldMap { * */ export class GraphQLList { - ofType: T; - constructor(type: T); - toString(): string; + ofType: T; + constructor(type: T); + toString(): string; } /** @@ -607,9 +581,9 @@ export class GraphQLList { * Note: the enforcement of non-nullability occurs within the executor. */ export class GraphQLNonNull { - ofType: T; + ofType: T; - constructor(type: T); + constructor(type: T); - toString(): string; + toString(): string; } diff --git a/types/graphql/type/directives.d.ts b/types/graphql/type/directives.d.ts index b6962bc4ae..bf1fc8df16 100644 --- a/types/graphql/type/directives.d.ts +++ b/types/graphql/type/directives.d.ts @@ -1,27 +1,27 @@ -import { GraphQLFieldConfigArgumentMap, GraphQLArgument } from './definition'; -import { DirectiveDefinitionNode } from '../language/ast'; +import { GraphQLFieldConfigArgumentMap, GraphQLArgument } from "./definition"; +import { DirectiveDefinitionNode } from "../language/ast"; export const DirectiveLocation: { - // Operations - QUERY: 'QUERY'; - MUTATION: 'MUTATION'; - SUBSCRIPTION: 'SUBSCRIPTION'; - FIELD: 'FIELD'; - FRAGMENT_DEFINITION: 'FRAGMENT_DEFINITION'; - FRAGMENT_SPREAD: 'FRAGMENT_SPREAD'; - INLINE_FRAGMENT: 'INLINE_FRAGMENT'; - // Schema Definitions - SCHEMA: 'SCHEMA'; - SCALAR: 'SCALAR'; - OBJECT: 'OBJECT'; - FIELD_DEFINITION: 'FIELD_DEFINITION'; - ARGUMENT_DEFINITION: 'ARGUMENT_DEFINITION'; - INTERFACE: 'INTERFACE'; - UNION: 'UNION'; - ENUM: 'ENUM'; - ENUM_VALUE: 'ENUM_VALUE'; - INPUT_OBJECT: 'INPUT_OBJECT'; - INPUT_FIELD_DEFINITION: 'INPUT_FIELD_DEFINITION'; + // Operations + QUERY: "QUERY"; + MUTATION: "MUTATION"; + SUBSCRIPTION: "SUBSCRIPTION"; + FIELD: "FIELD"; + FRAGMENT_DEFINITION: "FRAGMENT_DEFINITION"; + FRAGMENT_SPREAD: "FRAGMENT_SPREAD"; + INLINE_FRAGMENT: "INLINE_FRAGMENT"; + // Schema Definitions + SCHEMA: "SCHEMA"; + SCALAR: "SCALAR"; + OBJECT: "OBJECT"; + FIELD_DEFINITION: "FIELD_DEFINITION"; + ARGUMENT_DEFINITION: "ARGUMENT_DEFINITION"; + INTERFACE: "INTERFACE"; + UNION: "UNION"; + ENUM: "ENUM"; + ENUM_VALUE: "ENUM_VALUE"; + INPUT_OBJECT: "INPUT_OBJECT"; + INPUT_FIELD_DEFINITION: "INPUT_FIELD_DEFINITION"; }; export type DirectiveLocationEnum = keyof typeof DirectiveLocation; @@ -31,21 +31,21 @@ export type DirectiveLocationEnum = keyof typeof DirectiveLocation; * behavior. Type system creators will usually not create these directly. */ export class GraphQLDirective { - name: string; - description?: string; - locations: DirectiveLocationEnum[]; - args: GraphQLArgument[]; - astNode?: DirectiveDefinitionNode; + name: string; + description?: string; + locations: DirectiveLocationEnum[]; + args: GraphQLArgument[]; + astNode?: DirectiveDefinitionNode; - constructor(config: GraphQLDirectiveConfig); + constructor(config: GraphQLDirectiveConfig); } export interface GraphQLDirectiveConfig { - name: string; - description?: string; - locations: DirectiveLocationEnum[]; - args?: GraphQLFieldConfigArgumentMap; - astNode?: DirectiveDefinitionNode; + name: string; + description?: string; + locations: DirectiveLocationEnum[]; + args?: GraphQLFieldConfigArgumentMap; + astNode?: DirectiveDefinitionNode; } /** @@ -61,7 +61,7 @@ export const GraphQLSkipDirective: GraphQLDirective; /** * Constant string used for default reason for a deprecation. */ -export const DEFAULT_DEPRECATION_REASON: 'No longer supported'; +export const DEFAULT_DEPRECATION_REASON: "No longer supported"; /** * Used to declare element of a GraphQL schema as deprecated. diff --git a/types/graphql/type/index.d.ts b/types/graphql/type/index.d.ts index 5fdfb1190a..551ade35e7 100644 --- a/types/graphql/type/index.d.ts +++ b/types/graphql/type/index.d.ts @@ -1,47 +1,41 @@ // GraphQL Schema definition -export { GraphQLSchema } from './schema'; +export { GraphQLSchema } from "./schema"; -export * from './definition'; +export * from "./definition"; export { - // "Enum" of Directive Locations - DirectiveLocation, - // Directives Definition - GraphQLDirective, - // Built-in Directives defined by the Spec - specifiedDirectives, - GraphQLIncludeDirective, - GraphQLSkipDirective, - GraphQLDeprecatedDirective, - // Constant Deprecation Reason - DEFAULT_DEPRECATION_REASON, -} from './directives'; + // "Enum" of Directive Locations + DirectiveLocation, + // Directives Definition + GraphQLDirective, + // Built-in Directives defined by the Spec + specifiedDirectives, + GraphQLIncludeDirective, + GraphQLSkipDirective, + GraphQLDeprecatedDirective, + // Constant Deprecation Reason + DEFAULT_DEPRECATION_REASON, +} from "./directives"; // Common built-in scalar instances. -export { - GraphQLInt, - GraphQLFloat, - GraphQLString, - GraphQLBoolean, - GraphQLID, -} from './scalars'; +export { GraphQLInt, GraphQLFloat, GraphQLString, GraphQLBoolean, GraphQLID } from "./scalars"; export { - // "Enum" of Type Kinds - TypeKind, - // GraphQL Types for introspection. - __Schema, - __Directive, - __DirectiveLocation, - __Type, - __Field, - __InputValue, - __EnumValue, - __TypeKind, - // Meta-field definitions. - SchemaMetaFieldDef, - TypeMetaFieldDef, - TypeNameMetaFieldDef, -} from './introspection'; + // "Enum" of Type Kinds + TypeKind, + // GraphQL Types for introspection. + __Schema, + __Directive, + __DirectiveLocation, + __Type, + __Field, + __InputValue, + __EnumValue, + __TypeKind, + // Meta-field definitions. + SchemaMetaFieldDef, + TypeMetaFieldDef, + TypeNameMetaFieldDef, +} from "./introspection"; -export { DirectiveLocationEnum } from './directives'; +export { DirectiveLocationEnum } from "./directives"; diff --git a/types/graphql/type/introspection.d.ts b/types/graphql/type/introspection.d.ts index 48ac468ed0..042c3e2b6b 100644 --- a/types/graphql/type/introspection.d.ts +++ b/types/graphql/type/introspection.d.ts @@ -1,14 +1,14 @@ import { - GraphQLScalarType, - GraphQLObjectType, - GraphQLInterfaceType, - GraphQLUnionType, - GraphQLEnumType, - GraphQLInputObjectType, - GraphQLList, - GraphQLNonNull, -} from './definition'; -import { GraphQLField } from './definition'; + GraphQLScalarType, + GraphQLObjectType, + GraphQLInterfaceType, + GraphQLUnionType, + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLList, + GraphQLNonNull, +} from "./definition"; +import { GraphQLField } from "./definition"; export const __Schema: GraphQLObjectType; export const __Directive: GraphQLObjectType; @@ -19,14 +19,14 @@ export const __InputValue: GraphQLObjectType; export const __EnumValue: GraphQLObjectType; export const TypeKind: { - SCALAR: 'SCALAR'; - OBJECT: 'OBJECT'; - INTERFACE: 'INTERFACE'; - UNION: 'UNION'; - ENUM: 'ENUM'; - INPUT_OBJECT: 'INPUT_OBJECT'; - LIST: 'LIST'; - NON_NULL: 'NON_NULL'; + SCALAR: "SCALAR"; + OBJECT: "OBJECT"; + INTERFACE: "INTERFACE"; + UNION: "UNION"; + ENUM: "ENUM"; + INPUT_OBJECT: "INPUT_OBJECT"; + LIST: "LIST"; + NON_NULL: "NON_NULL"; }; export const __TypeKind: GraphQLEnumType; diff --git a/types/graphql/type/scalars.d.ts b/types/graphql/type/scalars.d.ts index 31a33aafad..287d99602a 100644 --- a/types/graphql/type/scalars.d.ts +++ b/types/graphql/type/scalars.d.ts @@ -1,4 +1,4 @@ -import { GraphQLScalarType } from './definition'; +import { GraphQLScalarType } from "./definition"; export const GraphQLInt: GraphQLScalarType; export const GraphQLFloat: GraphQLScalarType; diff --git a/types/graphql/type/schema.d.ts b/types/graphql/type/schema.d.ts index 26500c6ed3..bdd1089756 100644 --- a/types/graphql/type/schema.d.ts +++ b/types/graphql/type/schema.d.ts @@ -1,11 +1,7 @@ -import { GraphQLObjectType } from './definition'; -import { - GraphQLType, - GraphQLNamedType, - GraphQLAbstractType, -} from './definition'; -import { SchemaDefinitionNode } from '../language/ast'; -import { GraphQLDirective } from './directives'; +import { GraphQLObjectType } from "./definition"; +import { GraphQLType, GraphQLNamedType, GraphQLAbstractType } from "./definition"; +import { SchemaDefinitionNode } from "../language/ast"; +import { GraphQLDirective } from "./directives"; /** * Schema Definition @@ -34,59 +30,56 @@ import { GraphQLDirective } from './directives'; * */ export class GraphQLSchema { - astNode?: SchemaDefinitionNode; - // private _queryType: GraphQLObjectType; - // private _mutationType: GraphQLObjectType; - // private _subscriptionType: GraphQLObjectType; - // private _directives: Array; - // private _typeMap: TypeMap; - // private _implementations: { [interfaceName: string]: Array }; - // private _possibleTypeMap: { [abstractName: string]: { [possibleName: string]: boolean } }; + astNode?: SchemaDefinitionNode; + // private _queryType: GraphQLObjectType; + // private _mutationType: GraphQLObjectType; + // private _subscriptionType: GraphQLObjectType; + // private _directives: Array; + // private _typeMap: TypeMap; + // private _implementations: { [interfaceName: string]: Array }; + // private _possibleTypeMap: { [abstractName: string]: { [possibleName: string]: boolean } }; - constructor(config: GraphQLSchemaConfig); + constructor(config: GraphQLSchemaConfig); - getQueryType(): GraphQLObjectType; - getMutationType(): GraphQLObjectType | null | undefined; - getSubscriptionType(): GraphQLObjectType | null | undefined; - getTypeMap(): { [typeName: string]: GraphQLNamedType }; - getType(name: string): GraphQLNamedType; - getPossibleTypes(abstractType: GraphQLAbstractType): GraphQLObjectType[]; + getQueryType(): GraphQLObjectType; + getMutationType(): GraphQLObjectType | null | undefined; + getSubscriptionType(): GraphQLObjectType | null | undefined; + getTypeMap(): { [typeName: string]: GraphQLNamedType }; + getType(name: string): GraphQLNamedType; + getPossibleTypes(abstractType: GraphQLAbstractType): GraphQLObjectType[]; - isPossibleType( - abstractType: GraphQLAbstractType, - possibleType: GraphQLObjectType, - ): boolean; + isPossibleType(abstractType: GraphQLAbstractType, possibleType: GraphQLObjectType): boolean; - getDirectives(): GraphQLDirective[]; - getDirective(name: string): GraphQLDirective; + getDirectives(): GraphQLDirective[]; + getDirective(name: string): GraphQLDirective; } export type GraphQLSchemaValidationOptions = { - /** - * When building a schema from a GraphQL service's introspection result, it - * might be safe to assume the schema is valid. Set to true to assume the - * produced schema is valid. - * - * Default: false - */ - assumeValid?: boolean; + /** + * When building a schema from a GraphQL service's introspection result, it + * might be safe to assume the schema is valid. Set to true to assume the + * produced schema is valid. + * + * Default: false + */ + assumeValid?: boolean; - /** - * If provided, the schema will consider fields or types with names included - * in this list valid, even if they do not adhere to the specification's - * schema validation rules. - * - * This option is provided to ease adoption and may be removed in a future - * major release. - */ - allowedLegacyNames?: ReadonlyArray; + /** + * If provided, the schema will consider fields or types with names included + * in this list valid, even if they do not adhere to the specification's + * schema validation rules. + * + * This option is provided to ease adoption and may be removed in a future + * major release. + */ + allowedLegacyNames?: ReadonlyArray; }; export interface GraphQLSchemaConfig { - query: GraphQLObjectType; - mutation?: GraphQLObjectType; - subscription?: GraphQLObjectType; - types?: GraphQLNamedType[]; - directives?: GraphQLDirective[]; - astNode?: SchemaDefinitionNode; + query: GraphQLObjectType; + mutation?: GraphQLObjectType; + subscription?: GraphQLObjectType; + types?: GraphQLNamedType[]; + directives?: GraphQLDirective[]; + astNode?: SchemaDefinitionNode; } diff --git a/types/graphql/utilities/TypeInfo.d.ts b/types/graphql/utilities/TypeInfo.d.ts index a04a24a1a7..8b1ddc6206 100644 --- a/types/graphql/utilities/TypeInfo.d.ts +++ b/types/graphql/utilities/TypeInfo.d.ts @@ -1,15 +1,15 @@ -import { GraphQLSchema } from '../type/schema'; +import { GraphQLSchema } from "../type/schema"; import { - GraphQLOutputType, - GraphQLCompositeType, - GraphQLInputType, - GraphQLField, - GraphQLArgument, - GraphQLEnumValue, - GraphQLType, -} from '../type/definition'; -import { GraphQLDirective } from '../type/directives'; -import { ASTNode, FieldNode } from '../language/ast'; + GraphQLOutputType, + GraphQLCompositeType, + GraphQLInputType, + GraphQLField, + GraphQLArgument, + GraphQLEnumValue, + GraphQLType, +} from "../type/definition"; +import { GraphQLDirective } from "../type/directives"; +import { ASTNode, FieldNode } from "../language/ast"; /** * TypeInfo is a utility class which, given a GraphQL schema, can keep track @@ -17,27 +17,27 @@ import { ASTNode, FieldNode } from '../language/ast'; * AST during a recursive descent by calling `enter(node)` and `leave(node)`. */ export class TypeInfo { - constructor( - schema: GraphQLSchema, - // NOTE: this experimental optional second parameter is only needed in order - // to support non-spec-compliant codebases. You should never need to use it. - // It may disappear in the future. - getFieldDefFn?: getFieldDef, - ); + constructor( + schema: GraphQLSchema, + // NOTE: this experimental optional second parameter is only needed in order + // to support non-spec-compliant codebases. You should never need to use it. + // It may disappear in the future. + getFieldDefFn?: getFieldDef + ); - getType(): GraphQLOutputType; - getParentType(): GraphQLCompositeType; - getInputType(): GraphQLInputType; - getFieldDef(): GraphQLField; - getDirective(): GraphQLDirective; - getArgument(): GraphQLArgument; - getEnumValue(): GraphQLEnumValue; - enter(node: ASTNode): any; - leave(node: ASTNode): any; + getType(): GraphQLOutputType; + getParentType(): GraphQLCompositeType; + getInputType(): GraphQLInputType; + getFieldDef(): GraphQLField; + getDirective(): GraphQLDirective; + getArgument(): GraphQLArgument; + getEnumValue(): GraphQLEnumValue; + enter(node: ASTNode): any; + leave(node: ASTNode): any; } export type getFieldDef = ( - schema: GraphQLSchema, - parentType: GraphQLType, - fieldNode: FieldNode, + schema: GraphQLSchema, + parentType: GraphQLType, + fieldNode: FieldNode ) => GraphQLField; diff --git a/types/graphql/utilities/astFromValue.d.ts b/types/graphql/utilities/astFromValue.d.ts index 557a07dd9d..57f7f977ad 100644 --- a/types/graphql/utilities/astFromValue.d.ts +++ b/types/graphql/utilities/astFromValue.d.ts @@ -1,6 +1,6 @@ import { - ValueNode, - /* + ValueNode, + /* TODO: IntValueNode, FloatValueNode, @@ -10,8 +10,8 @@ import { ListValueNode, ObjectValueNode, */ -} from '../language/ast'; -import { GraphQLInputType } from '../type/definition'; +} from "../language/ast"; +import { GraphQLInputType } from "../type/definition"; /** * Produces a GraphQL Value AST given a JavaScript value. diff --git a/types/graphql/utilities/buildASTSchema.d.ts b/types/graphql/utilities/buildASTSchema.d.ts index 6b8aa56327..4d256fe180 100644 --- a/types/graphql/utilities/buildASTSchema.d.ts +++ b/types/graphql/utilities/buildASTSchema.d.ts @@ -1,16 +1,16 @@ -import { DocumentNode, Location, StringValueNode } from '../language/ast'; -import { Source } from '../language/source'; -import { GraphQLSchema, GraphQLSchemaValidationOptions } from '../type/schema'; +import { DocumentNode, Location, StringValueNode } from "../language/ast"; +import { Source } from "../language/source"; +import { GraphQLSchema, GraphQLSchemaValidationOptions } from "../type/schema"; interface BuildSchemaOptions extends GraphQLSchemaValidationOptions { - /** - * Descriptions are defined as preceding string literals, however an older - * experimental version of the SDL supported preceding comments as - * descriptions. Set to true to enable this deprecated behavior. - * - * Default: false - */ - commentDescriptions?: boolean; + /** + * Descriptions are defined as preceding string literals, however an older + * experimental version of the SDL supported preceding comments as + * descriptions. Set to true to enable this deprecated behavior. + * + * Default: false + */ + commentDescriptions?: boolean; } /** @@ -35,8 +35,8 @@ export function buildASTSchema(ast: DocumentNode): GraphQLSchema; * */ export function getDescription( - node: { description?: StringValueNode; loc?: Location }, - options: BuildSchemaOptions + node: { description?: StringValueNode; loc?: Location }, + options: BuildSchemaOptions ): string; /** diff --git a/types/graphql/utilities/buildClientSchema.d.ts b/types/graphql/utilities/buildClientSchema.d.ts index 26b0b3cdd5..80516c2111 100644 --- a/types/graphql/utilities/buildClientSchema.d.ts +++ b/types/graphql/utilities/buildClientSchema.d.ts @@ -1,5 +1,5 @@ -import { IntrospectionQuery } from './introspectionQuery'; -import { GraphQLSchema, GraphQLSchemaValidationOptions } from '../type/schema'; +import { IntrospectionQuery } from "./introspectionQuery"; +import { GraphQLSchema, GraphQLSchemaValidationOptions } from "../type/schema"; interface Options extends GraphQLSchemaValidationOptions {} @@ -12,7 +12,4 @@ interface Options extends GraphQLSchemaValidationOptions {} * represent the "resolver", "parse" or "serialize" functions or any other * server-internal mechanisms. */ -export function buildClientSchema( - introspection: IntrospectionQuery, - options?: Options, -): GraphQLSchema; +export function buildClientSchema(introspection: IntrospectionQuery, options?: Options): GraphQLSchema; diff --git a/types/graphql/utilities/concatAST.d.ts b/types/graphql/utilities/concatAST.d.ts index 405ac69936..6e4c33aed5 100644 --- a/types/graphql/utilities/concatAST.d.ts +++ b/types/graphql/utilities/concatAST.d.ts @@ -1,4 +1,4 @@ -import { DocumentNode } from '../language/ast'; +import { DocumentNode } from "../language/ast"; /** * Provided a collection of ASTs, presumably each from different files, diff --git a/types/graphql/utilities/extendSchema.d.ts b/types/graphql/utilities/extendSchema.d.ts index 389bd02d8b..027c4d5745 100644 --- a/types/graphql/utilities/extendSchema.d.ts +++ b/types/graphql/utilities/extendSchema.d.ts @@ -1,5 +1,5 @@ -import { DocumentNode } from '../language/ast'; -import { GraphQLSchema } from '../type/schema'; +import { DocumentNode } from "../language/ast"; +import { GraphQLSchema } from "../type/schema"; /** * Produces a new schema given an existing schema and a document which may @@ -13,7 +13,4 @@ import { GraphQLSchema } from '../type/schema'; * This algorithm copies the provided schema, applying extensions while * producing the copy. The original schema remains unaltered. */ -export function extendSchema( - schema: GraphQLSchema, - documentAST: DocumentNode, -): GraphQLSchema; +export function extendSchema(schema: GraphQLSchema, documentAST: DocumentNode): GraphQLSchema; diff --git a/types/graphql/utilities/findBreakingChanges.d.ts b/types/graphql/utilities/findBreakingChanges.d.ts index 0d5fc0041a..37b98dae34 100644 --- a/types/graphql/utilities/findBreakingChanges.d.ts +++ b/types/graphql/utilities/findBreakingChanges.d.ts @@ -1,88 +1,70 @@ import { - getNamedType, - GraphQLScalarType, - GraphQLEnumType, - GraphQLInputObjectType, - GraphQLInterfaceType, - GraphQLObjectType, - GraphQLUnionType, - GraphQLNamedType, -} from '../type/definition'; -import { GraphQLSchema } from '../type/schema'; + getNamedType, + GraphQLScalarType, + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLInterfaceType, + GraphQLObjectType, + GraphQLUnionType, + GraphQLNamedType, +} from "../type/definition"; +import { GraphQLSchema } from "../type/schema"; export const BreakingChangeType: { - FIELD_CHANGED_KIND: 'FIELD_CHANGED_KIND'; - FIELD_REMOVED: 'FIELD_REMOVED'; - TYPE_CHANGED_KIND: 'TYPE_CHANGED_KIND'; - TYPE_REMOVED: 'TYPE_REMOVED'; - TYPE_REMOVED_FROM_UNION: 'TYPE_REMOVED_FROM_UNION'; - VALUE_REMOVED_FROM_ENUM: 'VALUE_REMOVED_FROM_ENUM'; + FIELD_CHANGED_KIND: "FIELD_CHANGED_KIND"; + FIELD_REMOVED: "FIELD_REMOVED"; + TYPE_CHANGED_KIND: "TYPE_CHANGED_KIND"; + TYPE_REMOVED: "TYPE_REMOVED"; + TYPE_REMOVED_FROM_UNION: "TYPE_REMOVED_FROM_UNION"; + VALUE_REMOVED_FROM_ENUM: "VALUE_REMOVED_FROM_ENUM"; }; export type BreakingChangeKey = - | 'FIELD_CHANGED_KIND' - | 'FIELD_REMOVED' - | 'TYPE_CHANGED_KIND' - | 'TYPE_REMOVED' - | 'TYPE_REMOVED_FROM_UNION' - | 'VALUE_REMOVED_FROM_ENUM'; + | "FIELD_CHANGED_KIND" + | "FIELD_REMOVED" + | "TYPE_CHANGED_KIND" + | "TYPE_REMOVED" + | "TYPE_REMOVED_FROM_UNION" + | "VALUE_REMOVED_FROM_ENUM"; export interface BreakingChange { - type: BreakingChangeKey; - description: string; + type: BreakingChangeKey; + description: string; } /** * Given two schemas, returns an Array containing descriptions of all the types * of breaking changes covered by the other functions down below. */ -export function findBreakingChanges( - oldSchema: GraphQLSchema, - newSchema: GraphQLSchema, -): BreakingChange[]; +export function findBreakingChanges(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): BreakingChange[]; /** * Given two schemas, returns an Array containing descriptions of any breaking * changes in the newSchema related to removing an entire type. */ -export function findRemovedTypes( - oldSchema: GraphQLSchema, - newSchema: GraphQLSchema, -): BreakingChange[]; +export function findRemovedTypes(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): BreakingChange[]; /** * Given two schemas, returns an Array containing descriptions of any breaking * changes in the newSchema related to changing the type of a type. */ -export function findTypesThatChangedKind( - oldSchema: GraphQLSchema, - newSchema: GraphQLSchema, -): BreakingChange[]; +export function findTypesThatChangedKind(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): BreakingChange[]; /** * Given two schemas, returns an Array containing descriptions of any breaking * changes in the newSchema related to the fields on a type. This includes if * a field has been removed from a type or if a field has changed type. */ -export function findFieldsThatChangedType( - oldSchema: GraphQLSchema, - newSchema: GraphQLSchema, -): BreakingChange[]; +export function findFieldsThatChangedType(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): BreakingChange[]; /** * Given two schemas, returns an Array containing descriptions of any breaking * changes in the newSchema related to removing types from a union type. */ -export function findTypesRemovedFromUnions( - oldSchema: GraphQLSchema, - newSchema: GraphQLSchema, -): BreakingChange[]; +export function findTypesRemovedFromUnions(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): BreakingChange[]; /** * Given two schemas, returns an Array containing descriptions of any breaking * changes in the newSchema related to removing values from an enum type. */ -export function findValuesRemovedFromEnums( - oldSchema: GraphQLSchema, - newSchema: GraphQLSchema, -): BreakingChange[]; +export function findValuesRemovedFromEnums(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): BreakingChange[]; diff --git a/types/graphql/utilities/findDeprecatedUsages.d.ts b/types/graphql/utilities/findDeprecatedUsages.d.ts index 8cd844e15f..da99c98269 100644 --- a/types/graphql/utilities/findDeprecatedUsages.d.ts +++ b/types/graphql/utilities/findDeprecatedUsages.d.ts @@ -1,13 +1,10 @@ -import { GraphQLSchema } from '../type/schema'; -import { DocumentNode } from '../language/ast'; -import { GraphQLError } from '../error/GraphQLError'; +import { GraphQLSchema } from "../type/schema"; +import { DocumentNode } from "../language/ast"; +import { GraphQLError } from "../error/GraphQLError"; /** * A validation rule which reports deprecated usages. * * Returns a list of GraphQLError instances describing each deprecated use. */ -export function findDeprecatedUsages( - schema: GraphQLSchema, - ast: DocumentNode, -): GraphQLError[]; +export function findDeprecatedUsages(schema: GraphQLSchema, ast: DocumentNode): GraphQLError[]; diff --git a/types/graphql/utilities/getOperationAST.d.ts b/types/graphql/utilities/getOperationAST.d.ts index 0d5064d48d..5a1e0dc7a7 100644 --- a/types/graphql/utilities/getOperationAST.d.ts +++ b/types/graphql/utilities/getOperationAST.d.ts @@ -1,11 +1,8 @@ -import { DocumentNode, OperationDefinitionNode } from '../language/ast'; +import { DocumentNode, OperationDefinitionNode } from "../language/ast"; /** * Returns an operation AST given a document AST and optionally an operation * name. If a name is not provided, an operation is only returned if only one is * provided in the document. */ -export function getOperationAST( - documentAST: DocumentNode, - operationName?: string, -): OperationDefinitionNode; +export function getOperationAST(documentAST: DocumentNode, operationName?: string): OperationDefinitionNode; diff --git a/types/graphql/utilities/index.d.ts b/types/graphql/utilities/index.d.ts index c2b2c182ff..91777235d1 100644 --- a/types/graphql/utilities/index.d.ts +++ b/types/graphql/utilities/index.d.ts @@ -1,82 +1,74 @@ // The GraphQL query recommended for a full schema introspection. -export { introspectionQuery } from './introspectionQuery'; +export { introspectionQuery } from "./introspectionQuery"; export { - IntrospectionQuery, - IntrospectionSchema, - IntrospectionType, - IntrospectionScalarType, - IntrospectionObjectType, - IntrospectionInterfaceType, - IntrospectionUnionType, - IntrospectionEnumType, - IntrospectionInputObjectType, - IntrospectionTypeRef, - IntrospectionNamedTypeRef, - IntrospectionListTypeRef, - IntrospectionNonNullTypeRef, - IntrospectionField, - IntrospectionInputValue, - IntrospectionEnumValue, - IntrospectionDirective, -} from './introspectionQuery'; + IntrospectionQuery, + IntrospectionSchema, + IntrospectionType, + IntrospectionScalarType, + IntrospectionObjectType, + IntrospectionInterfaceType, + IntrospectionUnionType, + IntrospectionEnumType, + IntrospectionInputObjectType, + IntrospectionTypeRef, + IntrospectionNamedTypeRef, + IntrospectionListTypeRef, + IntrospectionNonNullTypeRef, + IntrospectionField, + IntrospectionInputValue, + IntrospectionEnumValue, + IntrospectionDirective, +} from "./introspectionQuery"; // Gets the target Operation from a Document -export { getOperationAST } from './getOperationAST'; +export { getOperationAST } from "./getOperationAST"; // Build a GraphQLSchema from an introspection result. -export { buildClientSchema } from './buildClientSchema'; +export { buildClientSchema } from "./buildClientSchema"; // Build a GraphQLSchema from GraphQL Schema language. -export { buildASTSchema, buildSchema, getDescription } from './buildASTSchema'; +export { buildASTSchema, buildSchema, getDescription } from "./buildASTSchema"; // Extends an existing GraphQLSchema from a parsed GraphQL Schema language AST. -export { extendSchema } from './extendSchema'; +export { extendSchema } from "./extendSchema"; // Print a GraphQLSchema to GraphQL Schema language. -export { - printSchema, - printType, - printIntrospectionSchema, -} from './schemaPrinter'; +export { printSchema, printType, printIntrospectionSchema } from "./schemaPrinter"; // Create a GraphQLType from a GraphQL language AST. -export { typeFromAST } from './typeFromAST'; +export { typeFromAST } from "./typeFromAST"; // Create a JavaScript value from a GraphQL language AST. -export { valueFromAST } from './valueFromAST'; +export { valueFromAST } from "./valueFromAST"; // Create a GraphQL language AST from a JavaScript value. -export { astFromValue } from './astFromValue'; +export { astFromValue } from "./astFromValue"; // A helper to use within recursive-descent visitors which need to be aware of // the GraphQL type system. -export { TypeInfo } from './TypeInfo'; +export { TypeInfo } from "./TypeInfo"; // Determine if JavaScript values adhere to a GraphQL type. -export { isValidJSValue } from './isValidJSValue'; +export { isValidJSValue } from "./isValidJSValue"; // Determine if AST values adhere to a GraphQL type. -export { isValidLiteralValue } from './isValidLiteralValue'; +export { isValidLiteralValue } from "./isValidLiteralValue"; // Concatenates multiple AST together. -export { concatAST } from './concatAST'; +export { concatAST } from "./concatAST"; // Separates an AST into an AST per Operation. -export { separateOperations } from './separateOperations'; +export { separateOperations } from "./separateOperations"; // Comparators for types -export { - isEqualType, - isTypeSubTypeOf, - doTypesOverlap, -} from './typeComparators'; +export { isEqualType, isTypeSubTypeOf, doTypesOverlap } from "./typeComparators"; // Asserts that a string is a valid GraphQL name -export { assertValidName } from './assertValidName'; +export { assertValidName } from "./assertValidName"; // Compares two GraphQLSchemas and detects breaking changes. -export { findBreakingChanges } from './findBreakingChanges'; -export { BreakingChange } from './findBreakingChanges'; +export { findBreakingChanges } from "./findBreakingChanges"; +export { BreakingChange } from "./findBreakingChanges"; // Report all deprecated usage within a GraphQL document. -export { findDeprecatedUsages } from './findDeprecatedUsages'; +export { findDeprecatedUsages } from "./findDeprecatedUsages"; diff --git a/types/graphql/utilities/introspectionQuery.d.ts b/types/graphql/utilities/introspectionQuery.d.ts index f16b873a3a..10c3b0a200 100644 --- a/types/graphql/utilities/introspectionQuery.d.ts +++ b/types/graphql/utilities/introspectionQuery.d.ts @@ -1,4 +1,4 @@ -import { DirectiveLocationEnum } from '../type/directives'; +import { DirectiveLocationEnum } from "../type/directives"; /* query IntrospectionQuery { @@ -96,114 +96,111 @@ fragment TypeRef on __Type { export const introspectionQuery: string; export interface IntrospectionQuery { - __schema: IntrospectionSchema; + __schema: IntrospectionSchema; } export interface IntrospectionSchema { - queryType: IntrospectionNamedTypeRef; - mutationType?: IntrospectionNamedTypeRef; - subscriptionType?: IntrospectionNamedTypeRef; - types: IntrospectionType[]; - directives: IntrospectionDirective[]; + queryType: IntrospectionNamedTypeRef; + mutationType?: IntrospectionNamedTypeRef; + subscriptionType?: IntrospectionNamedTypeRef; + types: IntrospectionType[]; + directives: IntrospectionDirective[]; } export type IntrospectionType = - | IntrospectionScalarType - | IntrospectionObjectType - | IntrospectionInterfaceType - | IntrospectionUnionType - | IntrospectionEnumType - | IntrospectionInputObjectType; + | IntrospectionScalarType + | IntrospectionObjectType + | IntrospectionInterfaceType + | IntrospectionUnionType + | IntrospectionEnumType + | IntrospectionInputObjectType; export interface IntrospectionScalarType { - kind: 'SCALAR'; - name: string; - description?: string; + kind: "SCALAR"; + name: string; + description?: string; } export interface IntrospectionObjectType { - kind: 'OBJECT'; - name: string; - description?: string; - fields: IntrospectionField[]; - interfaces: IntrospectionNamedTypeRef[]; + kind: "OBJECT"; + name: string; + description?: string; + fields: IntrospectionField[]; + interfaces: IntrospectionNamedTypeRef[]; } export interface IntrospectionInterfaceType { - kind: 'INTERFACE'; - name: string; - description?: string; - fields: IntrospectionField[]; - possibleTypes: IntrospectionNamedTypeRef[]; + kind: "INTERFACE"; + name: string; + description?: string; + fields: IntrospectionField[]; + possibleTypes: IntrospectionNamedTypeRef[]; } export interface IntrospectionUnionType { - kind: 'UNION'; - name: string; - description?: string; - possibleTypes: IntrospectionNamedTypeRef[]; + kind: "UNION"; + name: string; + description?: string; + possibleTypes: IntrospectionNamedTypeRef[]; } export interface IntrospectionEnumType { - kind: 'ENUM'; - name: string; - description?: string; - enumValues: IntrospectionEnumValue[]; + kind: "ENUM"; + name: string; + description?: string; + enumValues: IntrospectionEnumValue[]; } export interface IntrospectionInputObjectType { - kind: 'INPUT_OBJECT'; - name: string; - description?: string; - inputFields: IntrospectionInputValue[]; + kind: "INPUT_OBJECT"; + name: string; + description?: string; + inputFields: IntrospectionInputValue[]; } -export type IntrospectionTypeRef = - | IntrospectionNamedTypeRef - | IntrospectionListTypeRef - | IntrospectionNonNullTypeRef; +export type IntrospectionTypeRef = IntrospectionNamedTypeRef | IntrospectionListTypeRef | IntrospectionNonNullTypeRef; export interface IntrospectionNamedTypeRef { - kind: string; - name: string; + kind: string; + name: string; } export interface IntrospectionListTypeRef { - kind: 'LIST'; - ofType?: IntrospectionTypeRef; + kind: "LIST"; + ofType?: IntrospectionTypeRef; } export interface IntrospectionNonNullTypeRef { - kind: 'NON_NULL'; - ofType?: IntrospectionTypeRef; + kind: "NON_NULL"; + ofType?: IntrospectionTypeRef; } export interface IntrospectionField { - name: string; - description?: string; - args: IntrospectionInputValue[]; - type: IntrospectionTypeRef; - isDeprecated: boolean; - deprecationReason?: string; + name: string; + description?: string; + args: IntrospectionInputValue[]; + type: IntrospectionTypeRef; + isDeprecated: boolean; + deprecationReason?: string; } export interface IntrospectionInputValue { - name: string; - description?: string; - type: IntrospectionTypeRef; - defaultValue?: string; + name: string; + description?: string; + type: IntrospectionTypeRef; + defaultValue?: string; } export interface IntrospectionEnumValue { - name: string; - description?: string; - isDeprecated: boolean; - deprecationReason?: string; + name: string; + description?: string; + isDeprecated: boolean; + deprecationReason?: string; } export interface IntrospectionDirective { - name: string; - description?: string; - locations: DirectiveLocationEnum[]; - args: IntrospectionInputValue[]; + name: string; + description?: string; + locations: DirectiveLocationEnum[]; + args: IntrospectionInputValue[]; } diff --git a/types/graphql/utilities/isValidJSValue.d.ts b/types/graphql/utilities/isValidJSValue.d.ts index 911d8fea67..557429c7f4 100644 --- a/types/graphql/utilities/isValidJSValue.d.ts +++ b/types/graphql/utilities/isValidJSValue.d.ts @@ -1,4 +1,4 @@ -import { GraphQLInputType } from '../type/definition'; +import { GraphQLInputType } from "../type/definition"; /** * Given a JavaScript value and a GraphQL type, determine if the value will be diff --git a/types/graphql/utilities/isValidLiteralValue.d.ts b/types/graphql/utilities/isValidLiteralValue.d.ts index 4ad03d1013..bf54f6bb22 100644 --- a/types/graphql/utilities/isValidLiteralValue.d.ts +++ b/types/graphql/utilities/isValidLiteralValue.d.ts @@ -1,5 +1,5 @@ -import { ValueNode } from '../language/ast'; -import { GraphQLInputType } from '../type/definition'; +import { ValueNode } from "../language/ast"; +import { GraphQLInputType } from "../type/definition"; /** * Utility for validators which determines if a value literal AST is valid given @@ -8,7 +8,4 @@ import { GraphQLInputType } from '../type/definition'; * Note that this only validates literal values, variables are assumed to * provide values of the correct type. */ -export function isValidLiteralValue( - type: GraphQLInputType, - valueNode: ValueNode, -): string[]; +export function isValidLiteralValue(type: GraphQLInputType, valueNode: ValueNode): string[]; diff --git a/types/graphql/utilities/schemaPrinter.d.ts b/types/graphql/utilities/schemaPrinter.d.ts index f9cf9ad209..d49e6aee58 100644 --- a/types/graphql/utilities/schemaPrinter.d.ts +++ b/types/graphql/utilities/schemaPrinter.d.ts @@ -1,8 +1,8 @@ -import { GraphQLSchema } from '../type/schema'; -import { GraphQLType } from '../type/definition'; +import { GraphQLSchema } from "../type/schema"; +import { GraphQLType } from "../type/definition"; export interface PrinterOptions { - commentDescriptions?: boolean; + commentDescriptions?: boolean; } export function printSchema(schema: GraphQLSchema, options?: PrinterOptions): string; diff --git a/types/graphql/utilities/separateOperations.d.ts b/types/graphql/utilities/separateOperations.d.ts index a10ad0a29e..8269b22d75 100644 --- a/types/graphql/utilities/separateOperations.d.ts +++ b/types/graphql/utilities/separateOperations.d.ts @@ -1,5 +1,3 @@ -import { DocumentNode, OperationDefinitionNode } from '../language/ast'; +import { DocumentNode, OperationDefinitionNode } from "../language/ast"; -export function separateOperations( - documentAST: DocumentNode, -): { [operationName: string]: DocumentNode }; +export function separateOperations(documentAST: DocumentNode): { [operationName: string]: DocumentNode }; diff --git a/types/graphql/utilities/typeComparators.d.ts b/types/graphql/utilities/typeComparators.d.ts index ca0cdaf6c2..7bf0b9ebdf 100644 --- a/types/graphql/utilities/typeComparators.d.ts +++ b/types/graphql/utilities/typeComparators.d.ts @@ -1,9 +1,5 @@ -import { - GraphQLType, - GraphQLCompositeType, - GraphQLAbstractType, -} from '../type/definition'; -import { GraphQLSchema } from '../type/schema'; +import { GraphQLType, GraphQLCompositeType, GraphQLAbstractType } from "../type/definition"; +import { GraphQLSchema } from "../type/schema"; /** * Provided two types, return true if the types are equal (invariant). @@ -14,11 +10,7 @@ export function isEqualType(typeA: GraphQLType, typeB: GraphQLType): boolean; * Provided a type and a super type, return true if the first type is either * equal or a subset of the second super type (covariant). */ -export function isTypeSubTypeOf( - schema: GraphQLSchema, - maybeSubType: GraphQLType, - superType: GraphQLType, -): boolean; +export function isTypeSubTypeOf(schema: GraphQLSchema, maybeSubType: GraphQLType, superType: GraphQLType): boolean; /** * Provided two composite types, determine if they "overlap". Two composite @@ -30,7 +22,7 @@ export function isTypeSubTypeOf( * This function is commutative. */ export function doTypesOverlap( - schema: GraphQLSchema, - typeA: GraphQLCompositeType, - typeB: GraphQLCompositeType, + schema: GraphQLSchema, + typeA: GraphQLCompositeType, + typeB: GraphQLCompositeType ): boolean; diff --git a/types/graphql/utilities/typeFromAST.d.ts b/types/graphql/utilities/typeFromAST.d.ts index 415cbd2636..79b7b24a38 100644 --- a/types/graphql/utilities/typeFromAST.d.ts +++ b/types/graphql/utilities/typeFromAST.d.ts @@ -1,8 +1,5 @@ -import { TypeNode } from '../language/ast'; -import { GraphQLType, GraphQLNullableType } from '../type/definition'; -import { GraphQLSchema } from '../type/schema'; +import { TypeNode } from "../language/ast"; +import { GraphQLType, GraphQLNullableType } from "../type/definition"; +import { GraphQLSchema } from "../type/schema"; -export function typeFromAST( - schema: GraphQLSchema, - typeNode: TypeNode, -): GraphQLType; +export function typeFromAST(schema: GraphQLSchema, typeNode: TypeNode): GraphQLType; diff --git a/types/graphql/utilities/valueFromAST.d.ts b/types/graphql/utilities/valueFromAST.d.ts index 0bfbf04981..e0b06b0506 100644 --- a/types/graphql/utilities/valueFromAST.d.ts +++ b/types/graphql/utilities/valueFromAST.d.ts @@ -1,15 +1,10 @@ -import { GraphQLInputType } from '../type/definition'; -import { - ValueNode, - VariableNode, - ListValueNode, - ObjectValueNode, -} from '../language/ast'; +import { GraphQLInputType } from "../type/definition"; +import { ValueNode, VariableNode, ListValueNode, ObjectValueNode } from "../language/ast"; export function valueFromAST( - valueNode: ValueNode, - type: GraphQLInputType, - variables?: { - [key: string]: any; - }, + valueNode: ValueNode, + type: GraphQLInputType, + variables?: { + [key: string]: any; + } ): any; diff --git a/types/graphql/validation/index.d.ts b/types/graphql/validation/index.d.ts index b8cb9ddd00..4353da53fa 100644 --- a/types/graphql/validation/index.d.ts +++ b/types/graphql/validation/index.d.ts @@ -1,128 +1,80 @@ -export { validate, ValidationContext } from './validate'; -export { specifiedRules } from './specifiedRules'; +export { validate, ValidationContext } from "./validate"; +export { specifiedRules } from "./specifiedRules"; // Spec Section: "Argument Values Type Correctness" -export { - ArgumentsOfCorrectType as ArgumentsOfCorrectTypeRule, -} from './rules/ArgumentsOfCorrectType'; +export { ArgumentsOfCorrectType as ArgumentsOfCorrectTypeRule } from "./rules/ArgumentsOfCorrectType"; // Spec Section: "Variable Default Values Are Correctly Typed" -export { - DefaultValuesOfCorrectType as DefaultValuesOfCorrectTypeRule, -} from './rules/DefaultValuesOfCorrectType'; +export { DefaultValuesOfCorrectType as DefaultValuesOfCorrectTypeRule } from "./rules/DefaultValuesOfCorrectType"; // Spec Section: "Field Selections on Objects, Interfaces, and Unions Types" -export { - FieldsOnCorrectType as FieldsOnCorrectTypeRule, -} from './rules/FieldsOnCorrectType'; +export { FieldsOnCorrectType as FieldsOnCorrectTypeRule } from "./rules/FieldsOnCorrectType"; // Spec Section: "Fragments on Composite Types" -export { - FragmentsOnCompositeTypes as FragmentsOnCompositeTypesRule, -} from './rules/FragmentsOnCompositeTypes'; +export { FragmentsOnCompositeTypes as FragmentsOnCompositeTypesRule } from "./rules/FragmentsOnCompositeTypes"; // Spec Section: "Argument Names" -export { - KnownArgumentNames as KnownArgumentNamesRule, -} from './rules/KnownArgumentNames'; +export { KnownArgumentNames as KnownArgumentNamesRule } from "./rules/KnownArgumentNames"; // Spec Section: "Directives Are Defined" -export { - KnownDirectives as KnownDirectivesRule, -} from './rules/KnownDirectives'; +export { KnownDirectives as KnownDirectivesRule } from "./rules/KnownDirectives"; // Spec Section: "Fragment spread target defined" -export { - KnownFragmentNames as KnownFragmentNamesRule, -} from './rules/KnownFragmentNames'; +export { KnownFragmentNames as KnownFragmentNamesRule } from "./rules/KnownFragmentNames"; // Spec Section: "Fragment Spread Type Existence" -export { KnownTypeNames as KnownTypeNamesRule } from './rules/KnownTypeNames'; +export { KnownTypeNames as KnownTypeNamesRule } from "./rules/KnownTypeNames"; // Spec Section: "Lone Anonymous Operation" -export { - LoneAnonymousOperation as LoneAnonymousOperationRule, -} from './rules/LoneAnonymousOperation'; +export { LoneAnonymousOperation as LoneAnonymousOperationRule } from "./rules/LoneAnonymousOperation"; // Spec Section: "Fragments must not form cycles" -export { - NoFragmentCycles as NoFragmentCyclesRule, -} from './rules/NoFragmentCycles'; +export { NoFragmentCycles as NoFragmentCyclesRule } from "./rules/NoFragmentCycles"; // Spec Section: "All Variable Used Defined" -export { - NoUndefinedVariables as NoUndefinedVariablesRule, -} from './rules/NoUndefinedVariables'; +export { NoUndefinedVariables as NoUndefinedVariablesRule } from "./rules/NoUndefinedVariables"; // Spec Section: "Fragments must be used" -export { - NoUnusedFragments as NoUnusedFragmentsRule, -} from './rules/NoUnusedFragments'; +export { NoUnusedFragments as NoUnusedFragmentsRule } from "./rules/NoUnusedFragments"; // Spec Section: "All Variables Used" -export { - NoUnusedVariables as NoUnusedVariablesRule, -} from './rules/NoUnusedVariables'; +export { NoUnusedVariables as NoUnusedVariablesRule } from "./rules/NoUnusedVariables"; // Spec Section: "Field Selection Merging" -export { - OverlappingFieldsCanBeMerged as OverlappingFieldsCanBeMergedRule, -} from './rules/OverlappingFieldsCanBeMerged'; +export { OverlappingFieldsCanBeMerged as OverlappingFieldsCanBeMergedRule } from "./rules/OverlappingFieldsCanBeMerged"; // Spec Section: "Fragment spread is possible" -export { - PossibleFragmentSpreads as PossibleFragmentSpreadsRule, -} from './rules/PossibleFragmentSpreads'; +export { PossibleFragmentSpreads as PossibleFragmentSpreadsRule } from "./rules/PossibleFragmentSpreads"; // Spec Section: "Argument Optionality" -export { - ProvidedNonNullArguments as ProvidedNonNullArgumentsRule, -} from './rules/ProvidedNonNullArguments'; +export { ProvidedNonNullArguments as ProvidedNonNullArgumentsRule } from "./rules/ProvidedNonNullArguments"; // Spec Section: "Leaf Field Selections" -export { ScalarLeafs as ScalarLeafsRule } from './rules/ScalarLeafs'; +export { ScalarLeafs as ScalarLeafsRule } from "./rules/ScalarLeafs"; // Spec Section: "Subscriptions with Single Root Field" -export { - SingleFieldSubscriptions as SingleFieldSubscriptionsRule, -} from './rules/SingleFieldSubscriptions'; +export { SingleFieldSubscriptions as SingleFieldSubscriptionsRule } from "./rules/SingleFieldSubscriptions"; // Spec Section: "Argument Uniqueness" -export { - UniqueArgumentNames as UniqueArgumentNamesRule, -} from './rules/UniqueArgumentNames'; +export { UniqueArgumentNames as UniqueArgumentNamesRule } from "./rules/UniqueArgumentNames"; // Spec Section: "Directives Are Unique Per Location" -export { - UniqueDirectivesPerLocation as UniqueDirectivesPerLocationRule, -} from './rules/UniqueDirectivesPerLocation'; +export { UniqueDirectivesPerLocation as UniqueDirectivesPerLocationRule } from "./rules/UniqueDirectivesPerLocation"; // Spec Section: "Fragment Name Uniqueness" -export { - UniqueFragmentNames as UniqueFragmentNamesRule, -} from './rules/UniqueFragmentNames'; +export { UniqueFragmentNames as UniqueFragmentNamesRule } from "./rules/UniqueFragmentNames"; // Spec Section: "Input Object Field Uniqueness" -export { - UniqueInputFieldNames as UniqueInputFieldNamesRule, -} from './rules/UniqueInputFieldNames'; +export { UniqueInputFieldNames as UniqueInputFieldNamesRule } from "./rules/UniqueInputFieldNames"; // Spec Section: "Operation Name Uniqueness" -export { - UniqueOperationNames as UniqueOperationNamesRule, -} from './rules/UniqueOperationNames'; +export { UniqueOperationNames as UniqueOperationNamesRule } from "./rules/UniqueOperationNames"; // Spec Section: "Variable Uniqueness" -export { - UniqueVariableNames as UniqueVariableNamesRule, -} from './rules/UniqueVariableNames'; +export { UniqueVariableNames as UniqueVariableNamesRule } from "./rules/UniqueVariableNames"; // Spec Section: "Variables are Input Types" -export { - VariablesAreInputTypes as VariablesAreInputTypesRule, -} from './rules/VariablesAreInputTypes'; +export { VariablesAreInputTypes as VariablesAreInputTypesRule } from "./rules/VariablesAreInputTypes"; // Spec Section: "All Variable Usages Are Allowed" -export { - VariablesInAllowedPosition as VariablesInAllowedPositionRule, -} from './rules/VariablesInAllowedPosition'; +export { VariablesInAllowedPosition as VariablesInAllowedPositionRule } from "./rules/VariablesInAllowedPosition"; diff --git a/types/graphql/validation/rules/ArgumentsOfCorrectType.d.ts b/types/graphql/validation/rules/ArgumentsOfCorrectType.d.ts index f7247d0a9c..235db84162 100644 --- a/types/graphql/validation/rules/ArgumentsOfCorrectType.d.ts +++ b/types/graphql/validation/rules/ArgumentsOfCorrectType.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Argument values of correct type diff --git a/types/graphql/validation/rules/DefaultValuesOfCorrectType.d.ts b/types/graphql/validation/rules/DefaultValuesOfCorrectType.d.ts index 88b3a824f2..b617538a74 100644 --- a/types/graphql/validation/rules/DefaultValuesOfCorrectType.d.ts +++ b/types/graphql/validation/rules/DefaultValuesOfCorrectType.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Variable default values of correct type diff --git a/types/graphql/validation/rules/FieldsOnCorrectType.d.ts b/types/graphql/validation/rules/FieldsOnCorrectType.d.ts index 19609b2b65..247de1298c 100644 --- a/types/graphql/validation/rules/FieldsOnCorrectType.d.ts +++ b/types/graphql/validation/rules/FieldsOnCorrectType.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Fields on correct type diff --git a/types/graphql/validation/rules/FragmentsOnCompositeTypes.d.ts b/types/graphql/validation/rules/FragmentsOnCompositeTypes.d.ts index d6fffd4337..384f43beb3 100644 --- a/types/graphql/validation/rules/FragmentsOnCompositeTypes.d.ts +++ b/types/graphql/validation/rules/FragmentsOnCompositeTypes.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Fragments on composite type diff --git a/types/graphql/validation/rules/KnownArgumentNames.d.ts b/types/graphql/validation/rules/KnownArgumentNames.d.ts index 4477b62a75..bd56137311 100644 --- a/types/graphql/validation/rules/KnownArgumentNames.d.ts +++ b/types/graphql/validation/rules/KnownArgumentNames.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Known argument names diff --git a/types/graphql/validation/rules/KnownDirectives.d.ts b/types/graphql/validation/rules/KnownDirectives.d.ts index 68c6acf549..40e58ce0c3 100644 --- a/types/graphql/validation/rules/KnownDirectives.d.ts +++ b/types/graphql/validation/rules/KnownDirectives.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Known directives diff --git a/types/graphql/validation/rules/KnownFragmentNames.d.ts b/types/graphql/validation/rules/KnownFragmentNames.d.ts index b904f22d89..c5fa899995 100644 --- a/types/graphql/validation/rules/KnownFragmentNames.d.ts +++ b/types/graphql/validation/rules/KnownFragmentNames.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Known fragment names diff --git a/types/graphql/validation/rules/KnownTypeNames.d.ts b/types/graphql/validation/rules/KnownTypeNames.d.ts index 48b15318da..ab8abce9d5 100644 --- a/types/graphql/validation/rules/KnownTypeNames.d.ts +++ b/types/graphql/validation/rules/KnownTypeNames.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Known type names diff --git a/types/graphql/validation/rules/LoneAnonymousOperation.d.ts b/types/graphql/validation/rules/LoneAnonymousOperation.d.ts index 4ce6abcba9..f281df2bce 100644 --- a/types/graphql/validation/rules/LoneAnonymousOperation.d.ts +++ b/types/graphql/validation/rules/LoneAnonymousOperation.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Lone anonymous operation diff --git a/types/graphql/validation/rules/NoFragmentCycles.d.ts b/types/graphql/validation/rules/NoFragmentCycles.d.ts index fed5982fc8..4cce233cd5 100644 --- a/types/graphql/validation/rules/NoFragmentCycles.d.ts +++ b/types/graphql/validation/rules/NoFragmentCycles.d.ts @@ -1,3 +1,3 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; export function NoFragmentCycles(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/NoUndefinedVariables.d.ts b/types/graphql/validation/rules/NoUndefinedVariables.d.ts index 51d30b8fd1..418e3cf2b5 100644 --- a/types/graphql/validation/rules/NoUndefinedVariables.d.ts +++ b/types/graphql/validation/rules/NoUndefinedVariables.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * No undefined variables diff --git a/types/graphql/validation/rules/NoUnusedFragments.d.ts b/types/graphql/validation/rules/NoUnusedFragments.d.ts index 7f4d431299..7a099e66be 100644 --- a/types/graphql/validation/rules/NoUnusedFragments.d.ts +++ b/types/graphql/validation/rules/NoUnusedFragments.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * No unused fragments diff --git a/types/graphql/validation/rules/NoUnusedVariables.d.ts b/types/graphql/validation/rules/NoUnusedVariables.d.ts index 6eb2d984aa..53692ed494 100644 --- a/types/graphql/validation/rules/NoUnusedVariables.d.ts +++ b/types/graphql/validation/rules/NoUnusedVariables.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * No unused variables diff --git a/types/graphql/validation/rules/OverlappingFieldsCanBeMerged.d.ts b/types/graphql/validation/rules/OverlappingFieldsCanBeMerged.d.ts index f21edbd2cb..302617386b 100644 --- a/types/graphql/validation/rules/OverlappingFieldsCanBeMerged.d.ts +++ b/types/graphql/validation/rules/OverlappingFieldsCanBeMerged.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Overlapping fields can be merged diff --git a/types/graphql/validation/rules/PossibleFragmentSpreads.d.ts b/types/graphql/validation/rules/PossibleFragmentSpreads.d.ts index 8defb47721..e9e10aca14 100644 --- a/types/graphql/validation/rules/PossibleFragmentSpreads.d.ts +++ b/types/graphql/validation/rules/PossibleFragmentSpreads.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Possible fragment spread diff --git a/types/graphql/validation/rules/ProvidedNonNullArguments.d.ts b/types/graphql/validation/rules/ProvidedNonNullArguments.d.ts index 4d5334b9fb..291a3ab5bc 100644 --- a/types/graphql/validation/rules/ProvidedNonNullArguments.d.ts +++ b/types/graphql/validation/rules/ProvidedNonNullArguments.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Provided required arguments diff --git a/types/graphql/validation/rules/ScalarLeafs.d.ts b/types/graphql/validation/rules/ScalarLeafs.d.ts index afdc575671..8505cc2512 100644 --- a/types/graphql/validation/rules/ScalarLeafs.d.ts +++ b/types/graphql/validation/rules/ScalarLeafs.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Scalar leafs diff --git a/types/graphql/validation/rules/SingleFieldSubscriptions.d.ts b/types/graphql/validation/rules/SingleFieldSubscriptions.d.ts index 01a2654a16..d6f8fa2c6b 100644 --- a/types/graphql/validation/rules/SingleFieldSubscriptions.d.ts +++ b/types/graphql/validation/rules/SingleFieldSubscriptions.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Subscriptions must only include one field. diff --git a/types/graphql/validation/rules/UniqueArgumentNames.d.ts b/types/graphql/validation/rules/UniqueArgumentNames.d.ts index 8cc166d07a..f4cc750b86 100644 --- a/types/graphql/validation/rules/UniqueArgumentNames.d.ts +++ b/types/graphql/validation/rules/UniqueArgumentNames.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Unique argument names diff --git a/types/graphql/validation/rules/UniqueDirectivesPerLocation.d.ts b/types/graphql/validation/rules/UniqueDirectivesPerLocation.d.ts index 70ea02cd9c..80d4a252c6 100644 --- a/types/graphql/validation/rules/UniqueDirectivesPerLocation.d.ts +++ b/types/graphql/validation/rules/UniqueDirectivesPerLocation.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Unique directive names per location diff --git a/types/graphql/validation/rules/UniqueFragmentNames.d.ts b/types/graphql/validation/rules/UniqueFragmentNames.d.ts index c505968f6a..525befc0a9 100644 --- a/types/graphql/validation/rules/UniqueFragmentNames.d.ts +++ b/types/graphql/validation/rules/UniqueFragmentNames.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Unique fragment names diff --git a/types/graphql/validation/rules/UniqueInputFieldNames.d.ts b/types/graphql/validation/rules/UniqueInputFieldNames.d.ts index cebd71b79b..f81fb25e5c 100644 --- a/types/graphql/validation/rules/UniqueInputFieldNames.d.ts +++ b/types/graphql/validation/rules/UniqueInputFieldNames.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Unique input field names diff --git a/types/graphql/validation/rules/UniqueOperationNames.d.ts b/types/graphql/validation/rules/UniqueOperationNames.d.ts index 5b12cc0eed..5080307d4b 100644 --- a/types/graphql/validation/rules/UniqueOperationNames.d.ts +++ b/types/graphql/validation/rules/UniqueOperationNames.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Unique operation names diff --git a/types/graphql/validation/rules/UniqueVariableNames.d.ts b/types/graphql/validation/rules/UniqueVariableNames.d.ts index ef8712fbc1..a0a029d165 100644 --- a/types/graphql/validation/rules/UniqueVariableNames.d.ts +++ b/types/graphql/validation/rules/UniqueVariableNames.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Unique variable names diff --git a/types/graphql/validation/rules/VariablesAreInputTypes.d.ts b/types/graphql/validation/rules/VariablesAreInputTypes.d.ts index df079e52f9..79846a3073 100644 --- a/types/graphql/validation/rules/VariablesAreInputTypes.d.ts +++ b/types/graphql/validation/rules/VariablesAreInputTypes.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Variables are input types diff --git a/types/graphql/validation/rules/VariablesInAllowedPosition.d.ts b/types/graphql/validation/rules/VariablesInAllowedPosition.d.ts index 6d3e513876..bd302a73b4 100644 --- a/types/graphql/validation/rules/VariablesInAllowedPosition.d.ts +++ b/types/graphql/validation/rules/VariablesInAllowedPosition.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from '../index'; +import { ValidationContext } from "../index"; /** * Variables passed to field arguments conform to type diff --git a/types/graphql/validation/specifiedRules.d.ts b/types/graphql/validation/specifiedRules.d.ts index c09c358cb1..5afc1a09e5 100644 --- a/types/graphql/validation/specifiedRules.d.ts +++ b/types/graphql/validation/specifiedRules.d.ts @@ -1,4 +1,4 @@ -import { ValidationContext } from './validate'; // It needs to check. +import { ValidationContext } from "./validate"; // It needs to check. /** * This set includes all validation rules defined by the GraphQL spec. diff --git a/types/graphql/validation/validate.d.ts b/types/graphql/validation/validate.d.ts index 9e2fd479f1..c60c3bf072 100644 --- a/types/graphql/validation/validate.d.ts +++ b/types/graphql/validation/validate.d.ts @@ -1,23 +1,23 @@ -import { GraphQLError } from '../error'; +import { GraphQLError } from "../error"; import { - DocumentNode, - OperationDefinitionNode, - VariableNode, - SelectionSetNode, - FragmentSpreadNode, - FragmentDefinitionNode, -} from '../language/ast'; -import { GraphQLSchema } from '../type/schema'; + DocumentNode, + OperationDefinitionNode, + VariableNode, + SelectionSetNode, + FragmentSpreadNode, + FragmentDefinitionNode, +} from "../language/ast"; +import { GraphQLSchema } from "../type/schema"; import { - GraphQLInputType, - GraphQLOutputType, - GraphQLCompositeType, - GraphQLField, - GraphQLArgument, -} from '../type/definition'; -import { GraphQLDirective } from '../type/directives'; -import { TypeInfo } from '../utilities/TypeInfo'; -import { specifiedRules } from './specifiedRules'; + GraphQLInputType, + GraphQLOutputType, + GraphQLCompositeType, + GraphQLField, + GraphQLArgument, +} from "../type/definition"; +import { GraphQLDirective } from "../type/directives"; +import { TypeInfo } from "../utilities/TypeInfo"; +import { specifiedRules } from "./specifiedRules"; /** * Implements the "Validation" section of the spec. @@ -32,11 +32,7 @@ import { specifiedRules } from './specifiedRules'; * (see the language/visitor API). Visitor methods are expected to return * GraphQLErrors, or Arrays of GraphQLErrors when invalid. */ -export function validate( - schema: GraphQLSchema, - ast: DocumentNode, - rules?: any[], -): GraphQLError[]; +export function validate(schema: GraphQLSchema, ast: DocumentNode, rules?: any[]): GraphQLError[]; /** * This uses a specialized visitor which runs multiple visitors in parallel, @@ -45,18 +41,16 @@ export function validate( * @internal */ export function visitUsingRules( - schema: GraphQLSchema, - typeInfo: TypeInfo, - documentAST: DocumentNode, - rules: any[], + schema: GraphQLSchema, + typeInfo: TypeInfo, + documentAST: DocumentNode, + rules: any[] ): GraphQLError[]; -export type NodeWithSelectionSet = - | OperationDefinitionNode - | FragmentDefinitionNode; +export type NodeWithSelectionSet = OperationDefinitionNode | FragmentDefinitionNode; export interface VariableUsage { - node: VariableNode; - type: GraphQLInputType; + node: VariableNode; + type: GraphQLInputType; } /** @@ -65,38 +59,34 @@ export interface VariableUsage { * validation rule. */ export class ValidationContext { - constructor(schema: GraphQLSchema, ast: DocumentNode, typeInfo: TypeInfo); - reportError(error: GraphQLError): void; + constructor(schema: GraphQLSchema, ast: DocumentNode, typeInfo: TypeInfo); + reportError(error: GraphQLError): void; - getErrors(): GraphQLError[]; + getErrors(): GraphQLError[]; - getSchema(): GraphQLSchema; + getSchema(): GraphQLSchema; - getDocument(): DocumentNode; + getDocument(): DocumentNode; - getFragment(name: string): FragmentDefinitionNode; + getFragment(name: string): FragmentDefinitionNode; - getFragmentSpreads(node: SelectionSetNode): FragmentSpreadNode[]; + getFragmentSpreads(node: SelectionSetNode): FragmentSpreadNode[]; - getRecursivelyReferencedFragments( - operation: OperationDefinitionNode, - ): FragmentDefinitionNode[]; + getRecursivelyReferencedFragments(operation: OperationDefinitionNode): FragmentDefinitionNode[]; - getVariableUsages(node: NodeWithSelectionSet): VariableUsage[]; + getVariableUsages(node: NodeWithSelectionSet): VariableUsage[]; - getRecursiveVariableUsages( - operation: OperationDefinitionNode, - ): VariableUsage[]; + getRecursiveVariableUsages(operation: OperationDefinitionNode): VariableUsage[]; - getType(): GraphQLOutputType; + getType(): GraphQLOutputType; - getParentType(): GraphQLCompositeType; + getParentType(): GraphQLCompositeType; - getInputType(): GraphQLInputType; + getInputType(): GraphQLInputType; - getFieldDef(): GraphQLField; + getFieldDef(): GraphQLField; - getDirective(): GraphQLDirective; + getDirective(): GraphQLDirective; - getArgument(): GraphQLArgument; + getArgument(): GraphQLArgument; } From 674904267086c4d9da061a888805901bfaceb95d Mon Sep 17 00:00:00 2001 From: Alex Dunne Date: Tue, 27 Mar 2018 14:46:53 +0100 Subject: [PATCH 075/109] [react-native] Added missing ReactART types --- types/react-native/index.d.ts | 56 +++++++++++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 5 deletions(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index ee2ad9adc1..934b738293 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -6,6 +6,7 @@ // Tim Wang // Kamal Mahyuddin // Naoufal El Yousfi +// Alex Dunne // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -8258,26 +8259,71 @@ interface ImageEditorStatic { ): void; } -export interface ARTShapeProps { - d: string; - strokeWidth: number; +export interface ARTNodeMixin { + opacity?: number; + originX?: number; + originY?: number; + scaleX?: number; + scaleY?: number; + scale?: number; + title?: string; + x?: number; + y?: number; + visible?: boolean; +} + +export interface ARTGroupProps extends ARTNodeMixin { + width?: number; + height?: number; +} + +export interface ARTClippingRectangleProps extends ARTNodeMixin { + width?: number; + height?: number; +} + +export interface ARTRenderableMixin extends ARTNodeMixin { + fill?: string; + stroke?: string; + strokeCap?: "butt" | "square" | "round"; strokeDash?: number[]; - stroke: string; + strokeJoin?: "bevel" | "miter" | "round"; + strokeWidth?: number; +} + +export interface ARTShapeProps extends ARTRenderableMixin { + d: string; + width?: number; + height?: number; +} + +export interface ARTTextProps extends ARTRenderableMixin { + font?: string; + alignment?: string; } export interface ARTSurfaceProps { - style: StyleProp; + style?: StyleProp; width: number; height: number; } +export interface ClippingRectangleStatic extends React.ComponentClass {} + +export interface GroupStatic extends React.ComponentClass {} + export interface ShapeStatic extends React.ComponentClass {} export interface SurfaceStatic extends React.ComponentClass {} +export interface ARTTextStatic extends React.ComponentClass {} + export interface ARTStatic { + ClippingRectangle: ClippingRectangleStatic; + Group: GroupStatic; Shape: ShapeStatic; Surface: SurfaceStatic; + Text: ARTTextStatic; } export interface KeyboardStatic extends NativeEventEmitter { From ecd09a22a92ecba606f474b9ec504ca72d12c9af Mon Sep 17 00:00:00 2001 From: Alex Cason Date: Tue, 27 Mar 2018 14:52:06 +0100 Subject: [PATCH 076/109] Update google drive API typing --- .../gapi.client.drive-tests.ts | 86 ++++++++++--------- types/gapi.client.drive/index.d.ts | 84 +++++++++++++----- types/gapi.client.drive/tsconfig.json | 2 +- 3 files changed, 111 insertions(+), 61 deletions(-) diff --git a/types/gapi.client.drive/gapi.client.drive-tests.ts b/types/gapi.client.drive/gapi.client.drive-tests.ts index f9fa0ce332..002b5e7eb6 100644 --- a/types/gapi.client.drive/gapi.client.drive-tests.ts +++ b/types/gapi.client.drive/gapi.client.drive-tests.ts @@ -43,15 +43,15 @@ gapi.load('client', () => { async function run() { /** Gets information about the user, the user's Drive, and system capabilities. */ - await gapi.client.about.get({ + await gapi.client.drive.about.get({ }); /** Gets the starting pageToken for listing future changes. */ - await gapi.client.changes.getStartPageToken({ + await gapi.client.drive.changes.getStartPageToken({ supportsTeamDrives: true, teamDriveId: "teamDriveId", }); /** Lists the changes for a user or Team Drive. */ - await gapi.client.changes.list({ + await gapi.client.drive.changes.list({ includeCorpusRemovals: true, includeRemoved: true, includeTeamDriveItems: true, @@ -63,7 +63,7 @@ gapi.load('client', () => { teamDriveId: "teamDriveId", }); /** Subscribes to changes for a user. */ - await gapi.client.changes.watch({ + await gapi.client.drive.changes.watch({ includeCorpusRemovals: true, includeRemoved: true, includeTeamDriveItems: true, @@ -75,25 +75,25 @@ gapi.load('client', () => { teamDriveId: "teamDriveId", }); /** Stop watching resources through this channel */ - await gapi.client.channels.stop({ + await gapi.client.drive.channels.stop({ }); /** Creates a new comment on a file. */ - await gapi.client.comments.create({ + await gapi.client.drive.comments.create({ fileId: "fileId", }); /** Deletes a comment. */ - await gapi.client.comments.delete({ + await gapi.client.drive.comments.delete({ commentId: "commentId", fileId: "fileId", }); /** Gets a comment by ID. */ - await gapi.client.comments.get({ + await gapi.client.drive.comments.get({ commentId: "commentId", fileId: "fileId", includeDeleted: true, }); /** Lists a file's comments. */ - await gapi.client.comments.list({ + await gapi.client.drive.comments.list({ fileId: "fileId", includeDeleted: true, pageSize: 3, @@ -101,12 +101,12 @@ gapi.load('client', () => { startModifiedTime: "startModifiedTime", }); /** Updates a comment with patch semantics. */ - await gapi.client.comments.update({ + await gapi.client.drive.comments.update({ commentId: "commentId", fileId: "fileId", }); /** Creates a copy of a file and applies any requested updates with patch semantics. */ - await gapi.client.files.copy({ + await gapi.client.drive.files.copy({ fileId: "fileId", ignoreDefaultVisibility: true, keepRevisionForever: true, @@ -114,7 +114,7 @@ gapi.load('client', () => { supportsTeamDrives: true, }); /** Creates a new file. */ - await gapi.client.files.create({ + await gapi.client.drive.files.create({ ignoreDefaultVisibility: true, keepRevisionForever: true, ocrLanguage: "ocrLanguage", @@ -125,31 +125,31 @@ gapi.load('client', () => { * Permanently deletes a file owned by the user without moving it to the trash. If the file belongs to a Team Drive the user must be an organizer on the * parent. If the target is a folder, all descendants owned by the user are also deleted. */ - await gapi.client.files.delete({ + await gapi.client.drive.files.delete({ fileId: "fileId", supportsTeamDrives: true, }); /** Permanently deletes all of the user's trashed files. */ - await gapi.client.files.emptyTrash({ + await gapi.client.drive.files.emptyTrash({ }); /** Exports a Google Doc to the requested MIME type and returns the exported content. Please note that the exported content is limited to 10MB. */ - await gapi.client.files.export({ + await gapi.client.drive.files.export({ fileId: "fileId", mimeType: "mimeType", }); /** Generates a set of file IDs which can be provided in create requests. */ - await gapi.client.files.generateIds({ + await gapi.client.drive.files.generateIds({ count: 1, space: "space", }); /** Gets a file's metadata or content by ID. */ - await gapi.client.files.get({ + await gapi.client.drive.files.get({ acknowledgeAbuse: true, fileId: "fileId", supportsTeamDrives: true, }); /** Lists or searches files. */ - await gapi.client.files.list({ + await gapi.client.drive.files.list({ corpora: "corpora", corpus: "corpus", includeTeamDriveItems: true, @@ -162,7 +162,7 @@ gapi.load('client', () => { teamDriveId: "teamDriveId", }); /** Updates a file's metadata and/or content with patch semantics. */ - await gapi.client.files.update({ + await gapi.client.drive.files.update({ addParents: "addParents", fileId: "fileId", keepRevisionForever: true, @@ -172,66 +172,71 @@ gapi.load('client', () => { useContentAsIndexableText: true, }); /** Subscribes to changes to a file */ - await gapi.client.files.watch({ + await gapi.client.drive.files.watch({ acknowledgeAbuse: true, fileId: "fileId", supportsTeamDrives: true, }); /** Creates a permission for a file or Team Drive. */ - await gapi.client.permissions.create({ + await gapi.client.drive.permissions.create({ emailMessage: "emailMessage", fileId: "fileId", sendNotificationEmail: true, supportsTeamDrives: true, transferOwnership: true, + useDomainAdminAccess: true, }); /** Deletes a permission. */ - await gapi.client.permissions.delete({ + await gapi.client.drive.permissions.delete({ fileId: "fileId", permissionId: "permissionId", supportsTeamDrives: true, + useDomainAdminAccess: true, }); /** Gets a permission by ID. */ - await gapi.client.permissions.get({ + await gapi.client.drive.permissions.get({ fileId: "fileId", permissionId: "permissionId", supportsTeamDrives: true, + useDomainAdminAccess: true, }); /** Lists a file's or Team Drive's permissions. */ - await gapi.client.permissions.list({ + await gapi.client.drive.permissions.list({ fileId: "fileId", pageSize: 2, pageToken: "pageToken", supportsTeamDrives: true, + useDomainAdminAccess: true, }); /** Updates a permission with patch semantics. */ - await gapi.client.permissions.update({ + await gapi.client.drive.permissions.update({ fileId: "fileId", permissionId: "permissionId", removeExpiration: true, supportsTeamDrives: true, transferOwnership: true, + useDomainAdminAccess: true, }); /** Creates a new reply to a comment. */ - await gapi.client.replies.create({ + await gapi.client.drive.replies.create({ commentId: "commentId", fileId: "fileId", }); /** Deletes a reply. */ - await gapi.client.replies.delete({ + await gapi.client.drive.replies.delete({ commentId: "commentId", fileId: "fileId", replyId: "replyId", }); /** Gets a reply by ID. */ - await gapi.client.replies.get({ + await gapi.client.drive.replies.get({ commentId: "commentId", fileId: "fileId", includeDeleted: true, replyId: "replyId", }); /** Lists a comment's replies. */ - await gapi.client.replies.list({ + await gapi.client.drive.replies.list({ commentId: "commentId", fileId: "fileId", includeDeleted: true, @@ -239,52 +244,55 @@ gapi.load('client', () => { pageToken: "pageToken", }); /** Updates a reply with patch semantics. */ - await gapi.client.replies.update({ + await gapi.client.drive.replies.update({ commentId: "commentId", fileId: "fileId", replyId: "replyId", }); /** Permanently deletes a revision. This method is only applicable to files with binary content in Drive. */ - await gapi.client.revisions.delete({ + await gapi.client.drive.revisions.delete({ fileId: "fileId", revisionId: "revisionId", }); /** Gets a revision's metadata or content by ID. */ - await gapi.client.revisions.get({ + await gapi.client.drive.revisions.get({ acknowledgeAbuse: true, fileId: "fileId", revisionId: "revisionId", }); /** Lists a file's revisions. */ - await gapi.client.revisions.list({ + await gapi.client.drive.revisions.list({ fileId: "fileId", pageSize: 2, pageToken: "pageToken", }); /** Updates a revision with patch semantics. */ - await gapi.client.revisions.update({ + await gapi.client.drive.revisions.update({ fileId: "fileId", revisionId: "revisionId", }); /** Creates a new Team Drive. */ - await gapi.client.teamdrives.create({ + await gapi.client.drive.teamdrives.create({ requestId: "requestId", }); /** Permanently deletes a Team Drive for which the user is an organizer. The Team Drive cannot contain any untrashed items. */ - await gapi.client.teamdrives.delete({ + await gapi.client.drive.teamdrives.delete({ teamDriveId: "teamDriveId", }); /** Gets a Team Drive's metadata by ID. */ - await gapi.client.teamdrives.get({ + await gapi.client.drive.teamdrives.get({ teamDriveId: "teamDriveId", + useDomainAdminAccess: true, }); /** Lists the user's Team Drives. */ - await gapi.client.teamdrives.list({ + await gapi.client.drive.teamdrives.list({ pageSize: 1, pageToken: "pageToken", + q: "q", + useDomainAdminAccess: true, }); /** Updates a Team Drive's metadata */ - await gapi.client.teamdrives.update({ + await gapi.client.drive.teamdrives.update({ teamDriveId: "teamDriveId", }); } diff --git a/types/gapi.client.drive/index.d.ts b/types/gapi.client.drive/index.d.ts index 7004e2c0bb..a2fbec1a34 100644 --- a/types/gapi.client.drive/index.d.ts +++ b/types/gapi.client.drive/index.d.ts @@ -16,28 +16,12 @@ declare namespace gapi.client { function load(name: "drive", version: "v3"): PromiseLike; function load(name: "drive", version: "v3", callback: () => any): void; - const about: drive.AboutResource; - - const changes: drive.ChangesResource; - - const channels: drive.ChannelsResource; - - const comments: drive.CommentsResource; - - const files: drive.FilesResource; - - const permissions: drive.PermissionsResource; - - const replies: drive.RepliesResource; - - const revisions: drive.RevisionsResource; - - const teamdrives: drive.TeamdrivesResource; - namespace drive { interface About { /** Whether the user has installed the requesting app. */ appInstalled?: boolean; + /** Whether the user can create Team Drives. */ + canCreateTeamDrives?: boolean; /** A map of source MIME type to possible targets for all supported exports. */ exportFormats?: Record; /** The currently supported folder colors as RGB hex strings. */ @@ -363,8 +347,9 @@ declare namespace gapi.client { owners?: User[]; /** * The IDs of the parent folders which contain the file. - * If not specified as part of a create request, the file will be placed directly in the My Drive folder. Update requests must use the addParents and - * removeParents parameters to modify the values. + * If not specified as part of a create request, the file will be placed directly in the user's My Drive folder. If not specified as part of a copy + * request, the file will inherit any discoverable parents of the source file. Update requests must use the addParents and removeParents parameters to + * modify the parents list. */ parents?: string[]; /** List of permission IDs for users with access to this file. */ @@ -683,6 +668,8 @@ declare namespace gapi.client { }; /** The color of this Team Drive as an RGB hex string. It can only be set on a drive.teamdrives.update request that does not set themeId. */ colorRgb?: string; + /** The time at which the Team Drive was created (RFC 3339 date-time). */ + createdTime?: string; /** The ID of this Team Drive which is also the ID of the top level folder for this Team Drive. */ id?: string; /** Identifies what kind of resource this is. Value: the fixed string "drive#teamDrive". */ @@ -1322,7 +1309,7 @@ declare namespace gapi.client { create(request: { /** Data format for the response. */ alt?: string; - /** A custom message to include in the notification email. */ + /** A plain text custom message to include in the notification email. */ emailMessage?: string; /** Selector specifying which fields to include in a partial response. */ fields?: string; @@ -1351,6 +1338,11 @@ declare namespace gapi.client { * the side effect. */ transferOwnership?: boolean; + /** + * Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they + * are an administrator of the domain to which the item belongs. + */ + useDomainAdminAccess?: boolean; /** IP address of the site where the request originates. Use this if you want to enforce per-user limits. */ userIp?: string; }): Request; @@ -1377,6 +1369,11 @@ declare namespace gapi.client { quotaUser?: string; /** Whether the requesting application supports Team Drives. */ supportsTeamDrives?: boolean; + /** + * Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they + * are an administrator of the domain to which the item belongs. + */ + useDomainAdminAccess?: boolean; /** IP address of the site where the request originates. Use this if you want to enforce per-user limits. */ userIp?: string; }): Request; @@ -1403,6 +1400,11 @@ declare namespace gapi.client { quotaUser?: string; /** Whether the requesting application supports Team Drives. */ supportsTeamDrives?: boolean; + /** + * Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they + * are an administrator of the domain to which the item belongs. + */ + useDomainAdminAccess?: boolean; /** IP address of the site where the request originates. Use this if you want to enforce per-user limits. */ userIp?: string; }): Request; @@ -1434,6 +1436,11 @@ declare namespace gapi.client { quotaUser?: string; /** Whether the requesting application supports Team Drives. */ supportsTeamDrives?: boolean; + /** + * Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they + * are an administrator of the domain to which the item belongs. + */ + useDomainAdminAccess?: boolean; /** IP address of the site where the request originates. Use this if you want to enforce per-user limits. */ userIp?: string; }): Request; @@ -1467,6 +1474,11 @@ declare namespace gapi.client { * the side effect. */ transferOwnership?: boolean; + /** + * Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they + * are an administrator of the domain to which the item belongs. + */ + useDomainAdminAccess?: boolean; /** IP address of the site where the request originates. Use this if you want to enforce per-user limits. */ userIp?: string; }): Request; @@ -1777,6 +1789,11 @@ declare namespace gapi.client { quotaUser?: string; /** The ID of the Team Drive */ teamDriveId: string; + /** + * Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they + * are an administrator of the domain to which the Team Drive belongs. + */ + useDomainAdminAccess?: boolean; /** IP address of the site where the request originates. Use this if you want to enforce per-user limits. */ userIp?: string; }): Request; @@ -1796,11 +1813,18 @@ declare namespace gapi.client { pageToken?: string; /** Returns response with indentations and line breaks. */ prettyPrint?: boolean; + /** Query string for searching Team Drives. */ + q?: string; /** * Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. * Overrides userIp if both are provided. */ quotaUser?: string; + /** + * Whether the request should be treated as if it was issued by a domain administrator; if set to true, then all Team Drives of the domain in which the + * requester is an administrator are returned. + */ + useDomainAdminAccess?: boolean; /** IP address of the site where the request originates. Use this if you want to enforce per-user limits. */ userIp?: string; }): Request; @@ -1827,5 +1851,23 @@ declare namespace gapi.client { userIp?: string; }): Request; } + + const about: drive.AboutResource; + + const changes: drive.ChangesResource; + + const channels: drive.ChannelsResource; + + const comments: drive.CommentsResource; + + const files: drive.FilesResource; + + const permissions: drive.PermissionsResource; + + const replies: drive.RepliesResource; + + const revisions: drive.RevisionsResource; + + const teamdrives: drive.TeamdrivesResource; } } diff --git a/types/gapi.client.drive/tsconfig.json b/types/gapi.client.drive/tsconfig.json index 0cdc6f7fab..6d5901b410 100644 --- a/types/gapi.client.drive/tsconfig.json +++ b/types/gapi.client.drive/tsconfig.json @@ -14,7 +14,7 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true, + "forceConsistentCasingInFileNames": true, "strictFunctionTypes": true }, "files": [ From 514ac95272fc18a82cd7f2795b2f75e69470c850 Mon Sep 17 00:00:00 2001 From: Fathy Boundjadj Date: Tue, 27 Mar 2018 15:53:10 +0200 Subject: [PATCH 077/109] Add Parcel environment typings --- types/parcel-env/index.d.ts | 177 +++++++++++++++++++++++++++ types/parcel-env/parcel-env-tests.ts | 76 ++++++++++++ types/parcel-env/tsconfig.json | 23 ++++ types/parcel-env/tslint.json | 79 ++++++++++++ 4 files changed, 355 insertions(+) create mode 100644 types/parcel-env/index.d.ts create mode 100644 types/parcel-env/parcel-env-tests.ts create mode 100644 types/parcel-env/tsconfig.json create mode 100644 types/parcel-env/tslint.json diff --git a/types/parcel-env/index.d.ts b/types/parcel-env/index.d.ts new file mode 100644 index 0000000000..3de90c93bf --- /dev/null +++ b/types/parcel-env/index.d.ts @@ -0,0 +1,177 @@ +// Type definitions for Parcel (module API) +// Project: https://github.com/parcel/parcel-bundler +// Definitions by: Fathy Boundjadj +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Based on @types/webpack-env + +/** + * Parcel module API - variables and global functions available inside modules + */ + +declare namespace __ParcelModuleApi { + interface RequireFunction { + /** + * Returns the exports from a dependency. The call is sync. No request to the server is fired. The compiler ensures that the dependency is available. + */ + (path: string): any; + (path: string): T; + } + + interface Module { + exports: any; + require(id: string): any; + require(id: string): T; + id: string; + filename: string; + loaded: boolean; + parent: any; + children: any[]; + hot?: Hot; + } + type ModuleId = string|number; + + interface Hot { + /** + * Accept code updates for the specified dependencies. The callback is called when dependencies were replaced. + * @param dependencies + * @param callback + */ + accept(dependencies: string[], callback: (updatedDependencies: ModuleId[]) => void): void; + /** + * Accept code updates for the specified dependencies. The callback is called when dependencies were replaced. + * @param dependency + * @param callback + */ + accept(dependency: string, callback: () => void): void; + /** + * Accept code updates for this module without notification of parents. + * This should only be used if the module doesn’t export anything. + * The errHandler can be used to handle errors that occur while loading the updated module. + * @param errHandler + */ + accept(errHandler?: (err: Error) => void): void; + /** + * Do not accept updates for the specified dependencies. If any dependencies is updated, the code update fails with code "decline". + */ + decline(dependencies: string[]): void; + /** + * Do not accept updates for the specified dependencies. If any dependencies is updated, the code update fails with code "decline". + */ + decline(dependency: string): void; + /** + * Flag the current module as not update-able. If updated the update code would fail with code "decline". + */ + decline(): void; + /** + * Add a one time handler, which is executed when the current module code is replaced. + * Here you should destroy/remove any persistent resource you have claimed/created. + * If you want to transfer state to the new module, add it to data object. + * The data will be available at module.hot.data on the new module. + * @param callback + */ + dispose(callback: (data: any) => void): void; + dispose(callback: (data: T) => void): void; + /** + * Add a one time handler, which is executed when the current module code is replaced. + * Here you should destroy/remove any persistent resource you have claimed/created. + * If you want to transfer state to the new module, add it to data object. + * The data will be available at module.hot.data on the new module. + * @param callback + */ + addDisposeHandler(callback: (data: any) => void): void; + addDisposeHandler(callback: (data: T) => void): void; + /** + * Remove a handler. + * This can useful to add a temporary dispose handler. You could i. e. replace code while in the middle of a multi-step async function. + * @param callback + */ + removeDisposeHandler(callback: (data: any) => void): void; + removeDisposeHandler(callback: (data: T) => void): void; + /** + * Throws an exceptions if status() is not idle. + * Check all currently loaded modules for updates and apply updates if found. + * If no update was found, the callback is called with null. + * If autoApply is truthy the callback will be called with all modules that were disposed. + * apply() is automatically called with autoApply as options parameter. + * If autoApply is not set the callback will be called with all modules that will be disposed on apply(). + * @param autoApply + * @param callback + */ + check(autoApply: boolean, callback: (err: Error, outdatedModules: ModuleId[]) => void): void; + /** + * Throws an exceptions if status() is not idle. + * Check all currently loaded modules for updates and apply updates if found. + * If no update was found, the callback is called with null. + * The callback will be called with all modules that will be disposed on apply(). + * @param callback + */ + check(callback: (err: Error, outdatedModules: ModuleId[]) => void): void; + /** + * If status() != "ready" it throws an error. + * Continue the update process. + * @param options + * @param callback + */ + apply(options: AcceptOptions, callback: (err: Error, outdatedModules: ModuleId[]) => void): void; + /** + * If status() != "ready" it throws an error. + * Continue the update process. + * @param callback + */ + apply(callback: (err: Error, outdatedModules: ModuleId[]) => void): void; + /** + * Return one of idle, check, watch, watch-delay, prepare, ready, dispose, apply, abort or fail. + */ + status(): string; + /** Register a callback on status change. */ + status(callback: (status: string) => void): void; + /** Register a callback on status change. */ + addStatusHandler(callback: (status: string) => void): void; + /** + * Remove a registered status change handler. + * @param callback + */ + removeStatusHandler(callback: (status: string) => void): void; + + active: boolean; + data: any; + } + + interface AcceptOptions { + /** + * If true the update process continues even if some modules are not accepted (and would bubble to the entry point). + */ + ignoreUnaccepted?: boolean; + /** + * Indicates that apply() is automatically called by check function + */ + autoApply?: boolean; + } + /** + * Inside env you can pass any variable + */ + interface NodeProcess { + env?: any; + } + + type __Require1 = (id: string) => any; + type __Require2 = (id: string) => T; + type RequireLambda = __Require1 & __Require2; +} + +interface NodeRequire extends __ParcelModuleApi.RequireFunction { +} + +declare var require: NodeRequire; + +interface NodeModule extends __ParcelModuleApi.Module {} + +declare var module: NodeModule; + +/** +* Declare process variable +*/ +declare namespace NodeJS { + interface Process extends __ParcelModuleApi.NodeProcess {} +} +declare var process: NodeJS.Process; diff --git a/types/parcel-env/parcel-env-tests.ts b/types/parcel-env/parcel-env-tests.ts new file mode 100644 index 0000000000..9c17be0748 --- /dev/null +++ b/types/parcel-env/parcel-env-tests.ts @@ -0,0 +1,76 @@ + + +interface SomeModule { + someMethod(): void; +} + +let someModule = require('./someModule'); +someModule.someMethod(); + +let otherModule = require('./otherModule'); +otherModule.otherMethod(); + +// check if HMR is enabled +if(module.hot) { + // accept update of dependency + module.hot.accept("./handler.js", function() { + //... + }); +} + +module.exports = null; + +// check if HMR is enabled +if(module.hot) { + + // accept itself + module.hot.accept(); + + // dispose handler + module.hot.dispose(function() { + // revoke the side effect + //... + }); +} + +class ModuleData { + updated: boolean; +} + +if (module.hot) { + module.hot.accept((err: Error) => { + //... + }); + + module.hot.decline("./someModule"); + + module.hot.dispose((data: ModuleData) => { + data.updated = true; + // ... + }); + + let disposeHandler: ((data: ModuleData) => void) = data => { + // ... + }; + module.hot.addDisposeHandler(disposeHandler); + module.hot.removeDisposeHandler(disposeHandler); + + module.hot.check(true, (err: Error, outdatedModules: (string|number)[]) => { + // ... + }); + + module.hot.apply({ ignoreUnaccepted: true }, (err: Error, outdatedModules: (string|number)[]) => { + // ... + }); + + var status: string = module.hot.status(); + let statusHandler: ((status: string) => void) = status => { + // ... + }; + module.hot.status(statusHandler); + module.hot.addStatusHandler(statusHandler); + module.hot.removeStatusHandler(statusHandler); +} + + + diff --git a/types/parcel-env/tsconfig.json b/types/parcel-env/tsconfig.json new file mode 100644 index 0000000000..bf765d8bae --- /dev/null +++ b/types/parcel-env/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "parcel-env-tests.ts" + ] +} diff --git a/types/parcel-env/tslint.json b/types/parcel-env/tslint.json new file mode 100644 index 0000000000..a41bf5d19a --- /dev/null +++ b/types/parcel-env/tslint.json @@ -0,0 +1,79 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "adjacent-overload-signatures": false, + "array-type": false, + "arrow-return-shorthand": false, + "ban-types": false, + "callable-types": false, + "comment-format": false, + "dt-header": false, + "eofline": false, + "export-just-namespace": false, + "import-spacing": false, + "interface-name": false, + "interface-over-type-literal": false, + "jsdoc-format": false, + "max-line-length": false, + "member-access": false, + "new-parens": false, + "no-any-union": false, + "no-boolean-literal-compare": false, + "no-conditional-assignment": false, + "no-consecutive-blank-lines": false, + "no-construct": false, + "no-declare-current-package": false, + "no-duplicate-imports": false, + "no-duplicate-variable": false, + "no-empty-interface": false, + "no-for-in-array": false, + "no-inferrable-types": false, + "no-internal-module": false, + "no-irregular-whitespace": false, + "no-mergeable-namespace": false, + "no-misused-new": false, + "no-namespace": false, + "no-object-literal-type-assertion": false, + "no-padding": false, + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false, + "no-redundant-undefined": false, + "no-reference-import": false, + "no-relative-import-in-test": false, + "no-self-import": false, + "no-single-declare-module": false, + "no-string-throw": false, + "no-unnecessary-callback-wrapper": false, + "no-unnecessary-class": false, + "no-unnecessary-generics": false, + "no-unnecessary-qualifier": false, + "no-unnecessary-type-assertion": false, + "no-useless-files": false, + "no-var-keyword": false, + "no-var-requires": false, + "no-void-expression": false, + "no-trailing-whitespace": false, + "object-literal-key-quotes": false, + "object-literal-shorthand": false, + "one-line": false, + "one-variable-per-declaration": false, + "only-arrow-functions": false, + "prefer-conditional-expression": false, + "prefer-const": false, + "prefer-declare-function": false, + "prefer-for-of": false, + "prefer-method-signature": false, + "prefer-template": false, + "radix": false, + "semicolon": false, + "space-before-function-paren": false, + "space-within-parens": false, + "strict-export-declare-modifiers": false, + "trim-file": false, + "triple-equals": false, + "typedef-whitespace": false, + "unified-signatures": false, + "void-return": false, + "whitespace": false + } +} From 6e7636d31b361fa1c596875a3c83faf5ecd8b709 Mon Sep 17 00:00:00 2001 From: Alex Cason Date: Tue, 27 Mar 2018 15:09:08 +0100 Subject: [PATCH 078/109] Resolve linting errors --- types/gapi.client.drive/index.d.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/types/gapi.client.drive/index.d.ts b/types/gapi.client.drive/index.d.ts index a2fbec1a34..1b2a939a7d 100644 --- a/types/gapi.client.drive/index.d.ts +++ b/types/gapi.client.drive/index.d.ts @@ -1852,22 +1852,22 @@ declare namespace gapi.client { }): Request; } - const about: drive.AboutResource; + const about: AboutResource; - const changes: drive.ChangesResource; + const changes: ChangesResource; - const channels: drive.ChannelsResource; + const channels: ChannelsResource; - const comments: drive.CommentsResource; + const comments: CommentsResource; - const files: drive.FilesResource; + const files: FilesResource; - const permissions: drive.PermissionsResource; + const permissions: PermissionsResource; - const replies: drive.RepliesResource; + const replies: RepliesResource; - const revisions: drive.RevisionsResource; + const revisions: RevisionsResource; - const teamdrives: drive.TeamdrivesResource; + const teamdrives: TeamdrivesResource; } } From b4dd9f41919bbe7efe99a7d6b9d1a1322a61037f Mon Sep 17 00:00:00 2001 From: Tom Wanzek Date: Tue, 27 Mar 2018 11:12:31 -0400 Subject: [PATCH 079/109] feat(d3-fetch): update to minor version 1.1 * Update d3-fetch to minor version 1.1. * Add `html(...)` * Add `svg(...)` * Add `xml(...)` Closes #24516 --- types/d3-fetch/d3-fetch-tests.ts | 11 +++++++++++ types/d3-fetch/index.d.ts | 34 ++++++++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/types/d3-fetch/d3-fetch-tests.ts b/types/d3-fetch/d3-fetch-tests.ts index 941955c996..3cffde0c9e 100644 --- a/types/d3-fetch/d3-fetch-tests.ts +++ b/types/d3-fetch/d3-fetch-tests.ts @@ -49,3 +49,14 @@ promise1 = d3Fetch.tsv(url); promise1 = d3Fetch.tsv(url, init); promise2 = d3Fetch.tsv(url, parseRow); promise2 = d3Fetch.tsv(url, init, parseRow); + +let docPromise: Promise; +docPromise = d3Fetch.hmtl(url); +docPromise = d3Fetch.hmtl(url, init); + +docPromise = d3Fetch.svg(url); +docPromise = d3Fetch.svg(url, init); + +let xmlDocPromise: Promise; +xmlDocPromise = d3Fetch.xml(url); +xmlDocPromise = d3Fetch.xml(url, init); diff --git a/types/d3-fetch/index.d.ts b/types/d3-fetch/index.d.ts index 3eb11ce48a..fc0d5e0e66 100644 --- a/types/d3-fetch/index.d.ts +++ b/types/d3-fetch/index.d.ts @@ -1,10 +1,10 @@ -// Type definitions for d3-fetch 1.0 +// Type definitions for d3-fetch 1.1 // Project: https://d3js.org/d3-fetch/ // Definitions by: Hugues Stefanski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -// Last module patch version validated against: 1.0.1 +// Last module patch version validated against: 1.1.0 import { DSVParsedArray, DSVRowString, DSVRowAny } from 'd3-dsv'; @@ -146,6 +146,16 @@ export function dsv( row: (rawRow: DSVRowString, index: number, columns: string[]) => ParsedRow | undefined | null ): Promise>; +/** + * Fetches the file at the specified input URL as text, parses it as HTML and returns a Promise of an HTML DOM Document. + * + * If init is specified, it is passed along to the underlying call to fetch. + * + * @param url A valid URL string. + * @param init An optional request initialization object. + */ +export function hmtl(url: string, init?: RequestInit): Promise; + /** * Fetches the image at the specified input URL and returns a promise of an HTML image element. * @@ -168,6 +178,16 @@ export function image(url: string, init?: {[key: string]: any}): Promise(url: string, init?: RequestInit): Promise; +/** + * Fetches the file at the specified input URL as text, parses it as SVG and returns a Promise of an SVG Document. + * + * If init is specified, it is passed along to the underlying call to fetch. + * + * @param url A valid URL string. + * @param init An optional request initialization object. + */ +export function svg(url: string, init?: RequestInit): Promise; + /** * Fetches the text file at the specified input URL and returns it as a Promise of a string. * @@ -234,3 +254,13 @@ export function tsv( init: RequestInit, row: (rawRow: DSVRowString, index: number, columns: string[]) => ParsedRow | undefined | null ): Promise>; + +/** + * Fetches the file at the specified input URL as text, parses it as XML and returns a Promise of an XML Document. + * + * If init is specified, it is passed along to the underlying call to fetch. + * + * @param url A valid URL string. + * @param init An optional request initialization object. + */ +export function xml(url: string, init?: RequestInit): Promise; From 20b6406514e34d59f0b913973ef7725613d3224b Mon Sep 17 00:00:00 2001 From: nickp10 Date: Tue, 27 Mar 2018 11:23:23 -0600 Subject: [PATCH 080/109] Add types for the jwt-express package --- types/jwt-express/index.d.ts | 221 +++++++++++++++++++++++++ types/jwt-express/jwt-express-tests.ts | 54 ++++++ types/jwt-express/tsconfig.json | 24 +++ types/jwt-express/tslint.json | 1 + 4 files changed, 300 insertions(+) create mode 100644 types/jwt-express/index.d.ts create mode 100644 types/jwt-express/jwt-express-tests.ts create mode 100644 types/jwt-express/tsconfig.json create mode 100644 types/jwt-express/tslint.json diff --git a/types/jwt-express/index.d.ts b/types/jwt-express/index.d.ts new file mode 100644 index 0000000000..78e69c8a28 --- /dev/null +++ b/types/jwt-express/index.d.ts @@ -0,0 +1,221 @@ +// Type definitions for jwt-express 1.1 +// Project: https://github.com/AustP/jwt-express#readme +// Definitions by: Nick Paddock +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import express = require("express"); +import jsonwebtoken = require("jsonwebtoken"); + +declare global { + namespace Express { + interface Request { + jwt: JWT; + } + + interface JWT { + /** + * Indicates if the JWT is expired. valid will always be false if this is true. + */ + expired: boolean; + + /** + * The jwt-express options. + */ + options: JWTExpressOptions; + + /** + * The payload of the JWT (must be an object). jwt-express will add a stales key-value pair to the payload for stale. + */ + payload: any; + + /** + * The secret used to sign /verify the JWT. + */ + secret: string; + + /** + * Indicates if the JWT is stale. The default timeout before a JWT is considered stale is 15 minutes. + */ + stale: boolean; + + /** + * The signed token of the JWT. + */ + token: string; + + /** + * Indicates if this JWT is valid. This means that the payload hasn't been tampered with and that the JWT hasn't expired yet. + */ + valid: boolean; + + /** + * Resigns this JWT Objects's payload. + * + * @return this + */ + resign(): JWT; + + /** + * Calls the revoke function defined in the jwt.init() options with this JWT Object as the first parameter. + * + * @return this + */ + revoke(): JWT; + + /** + * Generates a signed token from the payload. + * + * @param payload The payload of the JWT (must be an object). + * @return this + */ + sign(payload: any): JWT; + + /** + * Stores this JWT in the cookie (if configured to use cookies). + * + * @param res The response in which to store the JWT. + * @return this + */ + store(res: express.Response): JWT; + + /** + * This function is called when the jwt is passed through JSON.stringify. + * We don't want the secret or options to be stringified. + * + * @return The JSON form of the object. + */ + toJSON(): any; + + /** + * Verify the token and load the info into this JWT. + * + * @param token The signed token to verify. + * @return this + */ + verify(token: string): JWT; + } + + interface JWTExpressOptions { + /** + * The name of the cookie (default: 'jwt-express') + */ + cookie?: string; + + /** + * Options to use when storing the cookie (default: {httpOnly: true}) + */ + cookieOptions?: express.CookieOptions; + + /** + * If true, will use cookies, otherwise will use the Authorization header (default: true) + */ + cookies?: boolean; + + /** + * Indicates if the JWT should be refreshed and stored every request (default: true) + */ + refresh?: boolean; + + /** + * The property of req to populate (default: 'jwt') + */ + reqProperty?: string; + + /** + * jwt.revoke() will call this function (default: function(jwt) {}) + */ + revoke?: (jwt: JWT) => void; + + /** + * Options to use when signing the JWT (default: {}) + */ + signOptions?: jsonwebtoken.SignOptions; + + /** + * Milliseconds when the jwt will go stale (default: 900000 (15 minutes)) + */ + stales?: number; + + /** + * Additional verification. Must return a boolean (default: function(jwt) {return true}) + */ + verify?: (jwt: JWT) => boolean; + + /** + * Options to use when verifying the JWT (default: {}) + */ + verifyOptions?: jsonwebtoken.VerifyOptions; + } + } +} + +export let options: Express.JWTExpressOptions; + +/** + * Returns a middleware function that ensures a JWT is valid and fresh. Useful to protect + * sensitive actions from CSRF. This method will trigger error handling if the JWT is not active. + * + * @return Express middleware + */ +export function active(): express.RequestHandler; + +/** + * If using cookies, this method will clear the current JWT out of the cookie. + * + * @return Express middleware + */ +export function clear(): express.RequestHandler; + +/** + * Returns a newly created / signed JWT Object from the payload. + * + * @param secret + * If secret is a string, that string will be used to verify / sign with. + * If secret is a function, that function will be called with the payload as its first parameter, + * and must return a string which will be used to verify / sign with. + * @param payload The payload of the JWT. + * @return JWT + */ +export function create(secret: string | ((payload: any) => string), payload: any): Express.JWT; + +/** + * The jwt.init() function returns a middleware function for Express so it must be called inside app.use(). + * It will automatically read in the JWT from either the cookie or the Authorization header (configured by you) + * and add a JWT object to the Request object (req). It will also add the jwt() method to the Response object (res) + * to create / store JWTs. jwt.init() must be called before any other jwt method. + * + * @param secret + * If secret is a string, that string will be used to verify / sign with. + * If secret is a function, that function will be called with the Express HTTP Request as its first parameter, + * and must return a string which will be used to verify / sign with. + * @param options The options of jwt-express. + * @return Express middleware + */ +export function init(secret: string | ((req: express.Request) => string), options?: Express.JWTExpressOptions): express.RequestHandler; + +/** + * Returns a middleware function that requires the payload to contain / match certain data. + * This method will trigger error handling if the JWT fails the requirement. + * + * @param key + * This is they key used to look up the value in the payload. + * If only this value is passed to jwt.require(), then the middleware function will check that the value is truthy. + * @param operator The operator to compare the information + * @param value The value to compare the payload data against + * @return Express middleware + */ +export function require(key: string, operator?: string, value?: any): express.RequestHandler; + +/** + * Returns a middleware function that ensures a JWT is valid. This method will trigger error handling if the JWT is not valid. + * + * @return Express middleware + */ +export function valid(): express.RequestHandler; + +export interface JWTExpressError extends Error { + name: string; + message: string; +} diff --git a/types/jwt-express/jwt-express-tests.ts b/types/jwt-express/jwt-express-tests.ts new file mode 100644 index 0000000000..c604dde550 --- /dev/null +++ b/types/jwt-express/jwt-express-tests.ts @@ -0,0 +1,54 @@ +import express = require("express"); +import jwt = require("jwt-express"); + +const app = express(); + +app.use(jwt.active()); +app.use(jwt.clear()); +let jwtObj = jwt.create("Secret", { }); +jwtObj = jwt.create((p) => "Secret", { }); +app.use(jwt.init("Secret")); +app.use(jwt.init(req => "Secret")); +app.use(jwt.init("Secret", { + cookie: "jwt-express", + cookieOptions: { + httpOnly: true + }, + cookies: true, + refresh: true, + reqProperty: "jwt", + revoke: (revokeJWT) => { jwtObj = revokeJWT; }, + signOptions: { + expiresIn: "1h" + }, + stales: 1000, + verify: (verifyJWT) => { jwtObj = verifyJWT; return true; }, + verifyOptions: { + ignoreExpiration: true + } +})); +app.use(jwt.require("key")); +app.use(jwt.require("key", "==", "value")); +app.use(jwt.valid()); + +let resObj: express.Response = {}; +app.use((err: jwt.JWTExpressError, req: express.Request, res: express.Response, next: express.NextFunction) => { + err.message.startsWith(""); + err.name.startsWith(""); + resObj = res; +}); + +jwtObj.expired.valueOf(); +app.use(jwt.init(req => "Secret", jwtObj.options)); +jwtObj.payload; +jwtObj.secret.startsWith(""); +jwtObj.stale.valueOf(); +jwtObj.token.startsWith(""); +jwtObj.valid.valueOf(); + +jwtObj = jwtObj.resign(); +jwtObj = jwtObj.revoke(); +jwtObj = jwtObj.sign(jwtObj.payload); +jwtObj = jwtObj.store(resObj); +jwtObj = jwtObj.verify(jwtObj.token); +jwtObj.toJSON(); diff --git a/types/jwt-express/tsconfig.json b/types/jwt-express/tsconfig.json new file mode 100644 index 0000000000..293e5e4548 --- /dev/null +++ b/types/jwt-express/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jwt-express-tests.ts" + ] +} diff --git a/types/jwt-express/tslint.json b/types/jwt-express/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/jwt-express/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 06163d88898bbed112af9d288806a1486230ba42 Mon Sep 17 00:00:00 2001 From: nickp10 Date: Tue, 27 Mar 2018 11:34:37 -0600 Subject: [PATCH 081/109] Fix the TypeScript version to match express --- types/jwt-express/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/jwt-express/index.d.ts b/types/jwt-express/index.d.ts index 78e69c8a28..dcb579e804 100644 --- a/types/jwt-express/index.d.ts +++ b/types/jwt-express/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/AustP/jwt-express#readme // Definitions by: Nick Paddock // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// From ac7ab1c5c357cfd4c20d7450ebc637dc0ee896dd Mon Sep 17 00:00:00 2001 From: Scott Davis Date: Tue, 27 Mar 2018 10:49:50 -0700 Subject: [PATCH 082/109] Types for eventsource --- types/eventsource/eventsource-tests.ts | 15 ++++++++ types/eventsource/index.d.ts | 35 +++++++++++++++++++ .../lib/eventsource-polyfill/index.d.ts | 29 +++++++++++++++ types/eventsource/tsconfig.json | 25 +++++++++++++ types/eventsource/tslint.json | 1 + 5 files changed, 105 insertions(+) create mode 100644 types/eventsource/eventsource-tests.ts create mode 100644 types/eventsource/index.d.ts create mode 100644 types/eventsource/lib/eventsource-polyfill/index.d.ts create mode 100644 types/eventsource/tsconfig.json create mode 100644 types/eventsource/tslint.json diff --git a/types/eventsource/eventsource-tests.ts b/types/eventsource/eventsource-tests.ts new file mode 100644 index 0000000000..b476e112a8 --- /dev/null +++ b/types/eventsource/eventsource-tests.ts @@ -0,0 +1,15 @@ +import * as EventSource from "eventsource"; + +const eventSource = new EventSource("http://foobar"); +eventSource.onmessage = (x: any) => {}; +eventSource.onerror = (x: any) => {}; +eventSource.onopen = (x: any) => {}; +eventSource.close(); + +import * as EventSourcePolyfill from "eventsource/lib/eventsource-polyfill"; + +const eventSourcePolyfill = new EventSourcePolyfill("http://foobar"); +eventSourcePolyfill.onmessage = (x: any) => {}; +eventSourcePolyfill.onerror = (x: any) => {}; +eventSourcePolyfill.onopen = (x: any) => {}; +eventSourcePolyfill.close(); diff --git a/types/eventsource/index.d.ts b/types/eventsource/index.d.ts new file mode 100644 index 0000000000..3620b6116f --- /dev/null +++ b/types/eventsource/index.d.ts @@ -0,0 +1,35 @@ +// Type definitions for eventsource 1.0 +// Project: http://github.com/EventSource/eventsource +// Definitions by: Scott Lee Davis +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +declare class EventSource { + constructor(url: string, eventSourceInitDict?: EventSource.EventSourceInitDict); + + static CLOSED: EventSource.ReadyState; + static CONNECTING: EventSource.ReadyState; + static OPEN: EventSource.ReadyState; + + url: string; + readyState: EventSource.ReadyState; + onopen: EventListener; + onmessage: EventListener; + onerror: EventListener; + close(): void; +} + +declare namespace EventSource { + enum ReadyState {CONNECTING = 0, OPEN = 1, CLOSED = 2} + + interface EventSourceInitDict { + withCredentials?: boolean; + headers?: object; + proxy?: string; + https?: object; + rejectUnauthorized?: boolean; + } +} + +export = EventSource; +export as namespace EventSource; diff --git a/types/eventsource/lib/eventsource-polyfill/index.d.ts b/types/eventsource/lib/eventsource-polyfill/index.d.ts new file mode 100644 index 0000000000..6246355dfe --- /dev/null +++ b/types/eventsource/lib/eventsource-polyfill/index.d.ts @@ -0,0 +1,29 @@ +declare class EventSource { + constructor(url: string, eventSourceInitDict?: EventSource.EventSourceInitDict); + + static CLOSED: EventSource.ReadyState; + static CONNECTING: EventSource.ReadyState; + static OPEN: EventSource.ReadyState; + + url: string; + readyState: EventSource.ReadyState; + onopen: EventListener; + onmessage: EventListener; + onerror: EventListener; + close(): void; +} + +declare namespace EventSource { + enum ReadyState {CONNECTING = 0, OPEN = 1, CLOSED = 2} + + interface EventSourceInitDict { + withCredentials?: boolean; + headers?: object; + proxy?: string; + https?: object; + rejectUnauthorized?: boolean; + } +} + +export = EventSource; +export as namespace EventSource; diff --git a/types/eventsource/tsconfig.json b/types/eventsource/tsconfig.json new file mode 100644 index 0000000000..440f5427c3 --- /dev/null +++ b/types/eventsource/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": false, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "eventsource-tests.ts", + "lib/eventsource-polyfill/index.d.ts" + ] +} diff --git a/types/eventsource/tslint.json b/types/eventsource/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/eventsource/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From f8543da289e25dc8568714f9e8c6c747bb539157 Mon Sep 17 00:00:00 2001 From: Michael Zlatkovsky Date: Tue, 27 Mar 2018 10:58:20 -0700 Subject: [PATCH 083/109] Add placeholder comment markers for ease of tooling --- types/office-js/index.d.ts | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 3b1173505d..3e8fa0d012 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -8,6 +8,11 @@ office-js Copyright (c) Microsoft Corporation */ + +//////////////////////////////////////////////////////////////// +//////////////////// Begin Office namespace //////////////////// +//////////////////////////////////////////////////////////////// + declare namespace Office { export var context: Context; /** @@ -1548,6 +1553,12 @@ declare namespace Office { } +//////////////////////////////////////////////////////////////// +///////////////////// End Office namespace ///////////////////// +//////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////// @@ -2886,6 +2897,18 @@ declare namespace OfficeExtension { } +//////////////////////////////////////////////////////////////// +///////////////// End OfficeExtension runtime ////////////////// +//////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////// +////////////////////// Begin OfficeCore //////////////////////// +//////////////////////////////////////////////////////////////// + declare namespace OfficeCore { /** @@ -2960,7 +2983,7 @@ declare namespace OfficeCore { //////////////////////////////////////////////////////////////// -///////////////// End OfficeExtension runtime ////////////////// +/////////////////////// End OfficeCore ///////////////////////// //////////////////////////////////////////////////////////////// @@ -22317,6 +22340,10 @@ declare namespace OneNote { +//////////////////////////////////////////////////////////////// + + + //////////////////////////////////////////////////////////////// /////////////////////// Begin Visio APIs /////////////////////// //////////////////////////////////////////////////////////////// From 30bb434d2f8d2e13631d7f9b044b9de26b9e55d2 Mon Sep 17 00:00:00 2001 From: Scott Davis Date: Tue, 27 Mar 2018 11:00:49 -0700 Subject: [PATCH 084/109] configured tslint up to spec. --- types/eventsource/tsconfig.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/eventsource/tsconfig.json b/types/eventsource/tsconfig.json index 440f5427c3..4a714cf00a 100644 --- a/types/eventsource/tsconfig.json +++ b/types/eventsource/tsconfig.json @@ -6,8 +6,8 @@ "dom" ], "noImplicitAny": true, - "noImplicitThis": false, - "strictNullChecks": false, + "noImplicitThis": true, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ From d5cbb8d3cb0ac96269fff70c9174b820339e46e8 Mon Sep 17 00:00:00 2001 From: Mohsen Azimi Date: Tue, 27 Mar 2018 11:32:31 -0700 Subject: [PATCH 085/109] Add MultiHook and _pluginCompat to Tapable (#24527) * Fix Tapable types * .. * Clean up * Undo instance member change * Add constructor to Hookmap --- types/tapable/index.d.ts | 18 ++++++++++++++++++ types/tapable/tapable-tests.ts | 4 +++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/types/tapable/index.d.ts b/types/tapable/index.d.ts index c044a245ce..502b408e9e 100644 --- a/types/tapable/index.d.ts +++ b/types/tapable/index.d.ts @@ -9,6 +9,9 @@ export declare abstract class Tapable { [propName: string]: Tapable.Handler[] } + /** @deprecated Private internals. Do not use directly */ + _pluginCompat: Hook; + /** * @deprecated Tapable.plugin is deprecated. Use new API on `.hooks` instead * Register plugin(s) @@ -275,7 +278,9 @@ export class HookInterceptor { context: boolean; } +/** A HookMap is a helper class for a Map with Hooks */ export class HookMap { + constructor(fn: () => Hook); get: (key: any) => Hook | undefined; for: (key: any) => Hook; tap: (key: any, name: string | Tap, fn: (arg1: T1, arg2: T2, arg3: T3, ...args: any[]) => any) => void; @@ -287,3 +292,16 @@ export class HookMap { export class HookMapInterceptor { factory: (key: any, hook: Hook) => Hook; } + +/** + * A helper Hook-like class to redirect taps to multiple other hooks + * + * ``` + * const { MultiHook } = require("tapable"); + * + * this.hooks.allHooks = new MultiHook([this.hooks.hookA, this.hooks.hookB]); + * ``` + */ +export class MultiHook { + constructor(hooks: Hook[]) +} diff --git a/types/tapable/tapable-tests.ts b/types/tapable/tapable-tests.ts index 4d82e60a66..c78196c194 100644 --- a/types/tapable/tapable-tests.ts +++ b/types/tapable/tapable-tests.ts @@ -1,4 +1,4 @@ -import {Tapable} from "tapable"; +import {Tapable, MultiHook, SyncHook} from "tapable"; class DllPlugin { apply(compiler: Compiler) { @@ -43,3 +43,5 @@ compiler.applyPluginsAsyncWaterfall('doSomething', 'a', callback); compiler.applyPluginsParallel('doSomething', 'a', 'b'); compiler.applyPluginsParallelBailResult('doSomething', 'a', 'b'); compiler.applyPluginsParallelBailResult1('doSomething', 'a', callback); + +const multi = new MultiHook([new SyncHook(['hi'])]); From a5e131585fcf0439e55077703a957e026551d32e Mon Sep 17 00:00:00 2001 From: Scott Davis Date: Tue, 27 Mar 2018 12:40:49 -0700 Subject: [PATCH 086/109] Made changes as requested by sandersn --- types/eventsource/eventsource-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/eventsource/eventsource-tests.ts b/types/eventsource/eventsource-tests.ts index b476e112a8..d081e87e42 100644 --- a/types/eventsource/eventsource-tests.ts +++ b/types/eventsource/eventsource-tests.ts @@ -1,4 +1,4 @@ -import * as EventSource from "eventsource"; +import EventSource = require("eventsource"); const eventSource = new EventSource("http://foobar"); eventSource.onmessage = (x: any) => {}; @@ -6,7 +6,7 @@ eventSource.onerror = (x: any) => {}; eventSource.onopen = (x: any) => {}; eventSource.close(); -import * as EventSourcePolyfill from "eventsource/lib/eventsource-polyfill"; +import EventSourcePolyfill = require("eventsource/lib/eventsource-polyfill"); const eventSourcePolyfill = new EventSourcePolyfill("http://foobar"); eventSourcePolyfill.onmessage = (x: any) => {}; From 7c9424cf2433f8ac16a4031b270f1754cfcf2e52 Mon Sep 17 00:00:00 2001 From: Timur Amirov Date: Tue, 27 Mar 2018 22:20:29 +0200 Subject: [PATCH 087/109] curcuit-breaker-js: introduce @types/curcuit-breaker-js --- .../circuit-breaker-js-tests.ts | 12 ++++++ types/circuit-breaker-js/index.d.ts | 38 +++++++++++++++++++ types/circuit-breaker-js/tsconfig.json | 23 +++++++++++ types/circuit-breaker-js/tslint.json | 1 + 4 files changed, 74 insertions(+) create mode 100644 types/circuit-breaker-js/circuit-breaker-js-tests.ts create mode 100644 types/circuit-breaker-js/index.d.ts create mode 100644 types/circuit-breaker-js/tsconfig.json create mode 100644 types/circuit-breaker-js/tslint.json diff --git a/types/circuit-breaker-js/circuit-breaker-js-tests.ts b/types/circuit-breaker-js/circuit-breaker-js-tests.ts new file mode 100644 index 0000000000..1436e13e90 --- /dev/null +++ b/types/circuit-breaker-js/circuit-breaker-js-tests.ts @@ -0,0 +1,12 @@ +import CircuitBreaker = require('circuit-breaker-js'); + +const breaker = new CircuitBreaker(); +breaker.isOpen(); + +const options: CircuitBreaker.Options = {}; + +let status: number = CircuitBreaker.CLOSED; +status = CircuitBreaker.OPEN; + +breaker.forceOpen(); +breaker.forceClose(); diff --git a/types/circuit-breaker-js/index.d.ts b/types/circuit-breaker-js/index.d.ts new file mode 100644 index 0000000000..6fc58bd40d --- /dev/null +++ b/types/circuit-breaker-js/index.d.ts @@ -0,0 +1,38 @@ +// Type definitions for circuit-breaker-js 0.0 +// Project: http://yammer.github.io/circuit-breaker-js/ +// Definitions by: Timur Amirov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = CircuitBreaker; + +declare namespace CircuitBreaker { + interface Options { + windowDuration?: number; + numBuckets?: number; + timeoutDuration?: number; + errorThreshold?: number; + volumeThreshold?: number; + + onCircuitOpen?: (m: Metrics) => void; + onCircuitClose?: (m: Metrics) => void; + } + + interface Metrics { + totalCount: number; + errorCount: number; + errorPercentage: number; + } +} + +declare class CircuitBreaker { + static OPEN: 0; + static HALF_OPEN: 1; + static CLOSED: 2; + + constructor(options?: CircuitBreaker.Options); + run(command: () => void, fallback?: () => void): void; + forceClose(): void; + forceOpen(): void; + unforce(): void; + isOpen(): boolean; +} diff --git a/types/circuit-breaker-js/tsconfig.json b/types/circuit-breaker-js/tsconfig.json new file mode 100644 index 0000000000..67d9c57cc0 --- /dev/null +++ b/types/circuit-breaker-js/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "circuit-breaker-js-tests.ts" + ] +} diff --git a/types/circuit-breaker-js/tslint.json b/types/circuit-breaker-js/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/circuit-breaker-js/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 9ca4a519d10ec6ae6c48f6059e66bbdddd904bea Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 27 Mar 2018 13:43:37 -0700 Subject: [PATCH 088/109] yeoman-generator: Update required TypeScript version (#24567) --- types/yeoman-generator/index.d.ts | 2 +- types/yeoman-test/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/yeoman-generator/index.d.ts b/types/yeoman-generator/index.d.ts index fb5c1b881c..9db6a70946 100644 --- a/types/yeoman-generator/index.d.ts +++ b/types/yeoman-generator/index.d.ts @@ -4,7 +4,7 @@ // Jay Anslow // Ika // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.3 import { EventEmitter } from 'events'; import * as inquirer from 'inquirer'; diff --git a/types/yeoman-test/index.d.ts b/types/yeoman-test/index.d.ts index 7602d94a87..d6b2d50a09 100644 --- a/types/yeoman-test/index.d.ts +++ b/types/yeoman-test/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/yeoman/yeoman-test // Definitions by: Ika // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.3 import { EventEmitter } from 'events'; import Generator = require('yeoman-generator'); From a34abe5ba3a828d6e95d0c2d5a0b4f01d84bb10b Mon Sep 17 00:00:00 2001 From: nickp10 Date: Tue, 27 Mar 2018 14:46:19 -0600 Subject: [PATCH 089/109] Fix interface exports and add more tests --- types/jwt-express/index.d.ts | 270 ++++++++++++------------- types/jwt-express/jwt-express-tests.ts | 21 +- 2 files changed, 150 insertions(+), 141 deletions(-) diff --git a/types/jwt-express/index.d.ts b/types/jwt-express/index.d.ts index dcb579e804..7e33cc7e6b 100644 --- a/types/jwt-express/index.d.ts +++ b/types/jwt-express/index.d.ts @@ -9,150 +9,147 @@ import express = require("express"); import jsonwebtoken = require("jsonwebtoken"); -declare global { - namespace Express { - interface Request { - jwt: JWT; - } +export interface JWT { + /** + * Indicates if the JWT is expired. valid will always be false if this is true. + */ + expired: boolean; - interface JWT { - /** - * Indicates if the JWT is expired. valid will always be false if this is true. - */ - expired: boolean; + /** + * The jwt-express options. + */ + options: JWTExpressOptions; - /** - * The jwt-express options. - */ - options: JWTExpressOptions; + /** + * The payload of the JWT (must be an object). jwt-express will add a stales key-value pair to the payload for stale. + */ + payload: any; - /** - * The payload of the JWT (must be an object). jwt-express will add a stales key-value pair to the payload for stale. - */ - payload: any; + /** + * The secret used to sign /verify the JWT. + */ + secret: string; - /** - * The secret used to sign /verify the JWT. - */ - secret: string; + /** + * Indicates if the JWT is stale. The default timeout before a JWT is considered stale is 15 minutes. + */ + stale: boolean; - /** - * Indicates if the JWT is stale. The default timeout before a JWT is considered stale is 15 minutes. - */ - stale: boolean; + /** + * The signed token of the JWT. + */ + token: string; - /** - * The signed token of the JWT. - */ - token: string; + /** + * Indicates if this JWT is valid. This means that the payload hasn't been tampered with and that the JWT hasn't expired yet. + */ + valid: boolean; - /** - * Indicates if this JWT is valid. This means that the payload hasn't been tampered with and that the JWT hasn't expired yet. - */ - valid: boolean; + /** + * Resigns this JWT Objects's payload. + * + * @return this + */ + resign(): JWT; - /** - * Resigns this JWT Objects's payload. - * - * @return this - */ - resign(): JWT; + /** + * Calls the revoke function defined in the jwt.init() options with this JWT Object as the first parameter. + * + * @return this + */ + revoke(): JWT; - /** - * Calls the revoke function defined in the jwt.init() options with this JWT Object as the first parameter. - * - * @return this - */ - revoke(): JWT; + /** + * Generates a signed token from the payload. + * + * @param payload The payload of the JWT (must be an object). + * @return this + */ + sign(payload: any): JWT; - /** - * Generates a signed token from the payload. - * - * @param payload The payload of the JWT (must be an object). - * @return this - */ - sign(payload: any): JWT; + /** + * Stores this JWT in the cookie (if configured to use cookies). + * + * @param res The response in which to store the JWT. + * @return this + */ + store(res: express.Response): JWT; - /** - * Stores this JWT in the cookie (if configured to use cookies). - * - * @param res The response in which to store the JWT. - * @return this - */ - store(res: express.Response): JWT; + /** + * This function is called when the jwt is passed through JSON.stringify. + * We don't want the secret or options to be stringified. + * + * @return The JSON form of the object. + */ + toJSON(): any; - /** - * This function is called when the jwt is passed through JSON.stringify. - * We don't want the secret or options to be stringified. - * - * @return The JSON form of the object. - */ - toJSON(): any; - - /** - * Verify the token and load the info into this JWT. - * - * @param token The signed token to verify. - * @return this - */ - verify(token: string): JWT; - } - - interface JWTExpressOptions { - /** - * The name of the cookie (default: 'jwt-express') - */ - cookie?: string; - - /** - * Options to use when storing the cookie (default: {httpOnly: true}) - */ - cookieOptions?: express.CookieOptions; - - /** - * If true, will use cookies, otherwise will use the Authorization header (default: true) - */ - cookies?: boolean; - - /** - * Indicates if the JWT should be refreshed and stored every request (default: true) - */ - refresh?: boolean; - - /** - * The property of req to populate (default: 'jwt') - */ - reqProperty?: string; - - /** - * jwt.revoke() will call this function (default: function(jwt) {}) - */ - revoke?: (jwt: JWT) => void; - - /** - * Options to use when signing the JWT (default: {}) - */ - signOptions?: jsonwebtoken.SignOptions; - - /** - * Milliseconds when the jwt will go stale (default: 900000 (15 minutes)) - */ - stales?: number; - - /** - * Additional verification. Must return a boolean (default: function(jwt) {return true}) - */ - verify?: (jwt: JWT) => boolean; - - /** - * Options to use when verifying the JWT (default: {}) - */ - verifyOptions?: jsonwebtoken.VerifyOptions; - } - } + /** + * Verify the token and load the info into this JWT. + * + * @param token The signed token to verify. + * @return this + */ + verify(token: string): JWT; } -export let options: Express.JWTExpressOptions; +export interface JWTExpressOptions { + /** + * The name of the cookie (default: 'jwt-express') + */ + cookie?: string; + + /** + * Options to use when storing the cookie (default: {httpOnly: true}) + */ + cookieOptions?: express.CookieOptions; + + /** + * If true, will use cookies, otherwise will use the Authorization header (default: true) + */ + cookies?: boolean; + + /** + * Indicates if the JWT should be refreshed and stored every request (default: true) + */ + refresh?: boolean; + + /** + * The property of req to populate (default: 'jwt') + */ + reqProperty?: string; + + /** + * jwt.revoke() will call this function (default: function(jwt) {}) + */ + revoke?: (jwt: JWT) => void; + + /** + * Options to use when signing the JWT (default: {}) + */ + signOptions?: jsonwebtoken.SignOptions; + + /** + * Milliseconds when the jwt will go stale (default: 900000 (15 minutes)) + */ + stales?: number; + + /** + * Additional verification. Must return a boolean (default: function(jwt) {return true}) + */ + verify?: (jwt: JWT) => boolean; + + /** + * Options to use when verifying the JWT (default: {}) + */ + verifyOptions?: jsonwebtoken.VerifyOptions; +} + +export interface JWTExpressError extends Error { + name: string; + message: string; +} + +export let options: JWTExpressOptions; /** * Returns a middleware function that ensures a JWT is valid and fresh. Useful to protect @@ -179,7 +176,7 @@ export function clear(): express.RequestHandler; * @param payload The payload of the JWT. * @return JWT */ -export function create(secret: string | ((payload: any) => string), payload: any): Express.JWT; +export function create(secret: string | ((payload: any) => string), payload: any): JWT; /** * The jwt.init() function returns a middleware function for Express so it must be called inside app.use(). @@ -194,7 +191,7 @@ export function create(secret: string | ((payload: any) => string), payload: any * @param options The options of jwt-express. * @return Express middleware */ -export function init(secret: string | ((req: express.Request) => string), options?: Express.JWTExpressOptions): express.RequestHandler; +export function init(secret: string | ((req: express.Request) => string), options?: JWTExpressOptions): express.RequestHandler; /** * Returns a middleware function that requires the payload to contain / match certain data. @@ -216,7 +213,10 @@ export function require(key: string, operator?: string, value?: any): express.Re */ export function valid(): express.RequestHandler; -export interface JWTExpressError extends Error { - name: string; - message: string; +declare global { + namespace Express { + interface Request { + jwt: JWT; + } + } } diff --git a/types/jwt-express/jwt-express-tests.ts b/types/jwt-express/jwt-express-tests.ts index c604dde550..450f835ded 100644 --- a/types/jwt-express/jwt-express-tests.ts +++ b/types/jwt-express/jwt-express-tests.ts @@ -1,7 +1,7 @@ -import express = require("express"); +import exp = require("express"); import jwt = require("jwt-express"); -const app = express(); +const app = exp(); app.use(jwt.active()); app.use(jwt.clear()); @@ -17,12 +17,12 @@ app.use(jwt.init("Secret", { cookies: true, refresh: true, reqProperty: "jwt", - revoke: (revokeJWT) => { jwtObj = revokeJWT; }, + revoke: (revokeJWT: jwt.JWT) => { jwtObj = revokeJWT; }, signOptions: { expiresIn: "1h" }, stales: 1000, - verify: (verifyJWT) => { jwtObj = verifyJWT; return true; }, + verify: (verifyJWT: jwt.JWT) => { jwtObj = verifyJWT; return true; }, verifyOptions: { ignoreExpiration: true } @@ -31,11 +31,14 @@ app.use(jwt.require("key")); app.use(jwt.require("key", "==", "value")); app.use(jwt.valid()); -let resObj: express.Response = {}; -app.use((err: jwt.JWTExpressError, req: express.Request, res: express.Response, next: express.NextFunction) => { +let resObj: exp.Response = {}; +app.use((err: jwt.JWTExpressError, req: exp.Request, res: exp.Response, next: exp.NextFunction) => { err.message.startsWith(""); err.name.startsWith(""); resObj = res; + jwtObj = req.jwt; + req.jwt.payload; + req.hostname.startsWith(""); }); jwtObj.expired.valueOf(); @@ -52,3 +55,9 @@ jwtObj = jwtObj.sign(jwtObj.payload); jwtObj = jwtObj.store(resObj); jwtObj = jwtObj.verify(jwtObj.token); jwtObj.toJSON(); + +app.get("", (req: exp.Request, res: exp.Response, next: exp.NextFunction) => { + jwtObj = req.jwt; + req.jwt.payload; + req.hostname.startsWith(""); +}); From 853933598ab468fca5a6b508ddf6a3741d8e1d26 Mon Sep 17 00:00:00 2001 From: nickp10 Date: Tue, 27 Mar 2018 15:33:40 -0600 Subject: [PATCH 090/109] Add missing jwt function on the express response object --- types/jwt-express/index.d.ts | 11 +++++++++++ types/jwt-express/jwt-express-tests.ts | 2 ++ 2 files changed, 13 insertions(+) diff --git a/types/jwt-express/index.d.ts b/types/jwt-express/index.d.ts index 7e33cc7e6b..cbae9f5b8a 100644 --- a/types/jwt-express/index.d.ts +++ b/types/jwt-express/index.d.ts @@ -218,5 +218,16 @@ declare global { interface Request { jwt: JWT; } + + interface Response { + /** + * Returns a newly created / signed JWT Object from the payload. If you are using cookies, + * it will automatically store the JWT in the cookie as well. + * + * @param payload The payload of the JWT + * @return The newly created JWT + */ + jwt(payload: any): JWT; + } } } diff --git a/types/jwt-express/jwt-express-tests.ts b/types/jwt-express/jwt-express-tests.ts index 450f835ded..fedf8137b3 100644 --- a/types/jwt-express/jwt-express-tests.ts +++ b/types/jwt-express/jwt-express-tests.ts @@ -39,6 +39,7 @@ app.use((err: jwt.JWTExpressError, req: exp.Request, res: exp.Response, next: ex jwtObj = req.jwt; req.jwt.payload; req.hostname.startsWith(""); + jwtObj = res.jwt({ }); }); jwtObj.expired.valueOf(); @@ -60,4 +61,5 @@ app.get("", (req: exp.Request, res: exp.Response, next: exp.NextFunction) => { jwtObj = req.jwt; req.jwt.payload; req.hostname.startsWith(""); + jwtObj = res.jwt({ }); }); From 6eb449c46ddc7499c8394ba443265eb1bfeb4061 Mon Sep 17 00:00:00 2001 From: krauseStefan Date: Tue, 27 Mar 2018 23:23:55 +0200 Subject: [PATCH 091/109] Added uiGridConstants.scrollbars.WHEN_NEEDED The option is documented here: http://ui-grid.info/docs/#!/api/ui.grid.service:uiGridConstants#properties_scrollbars --- types/ui-grid/index.d.ts | 7 ++++--- types/ui-grid/ui-grid-tests.ts | 9 ++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/types/ui-grid/index.d.ts b/types/ui-grid/index.d.ts index 748dda3bf9..683c906087 100644 --- a/types/ui-grid/index.d.ts +++ b/types/ui-grid/index.d.ts @@ -127,6 +127,7 @@ declare namespace uiGrid { scrollbars: { NEVER: number; ALWAYS: number; + WHEN_NEEDED: number; }; } export type IGridInstance = IGridInstanceOf; @@ -627,7 +628,7 @@ declare namespace uiGrid { enableGridMenu?: boolean; /** * uiGridConstants.scrollbars.ALWAYS by default. This settings controls the horizontal scrollbar for the grid. - * Supported values: uiGridConstants.scrollbars.ALWAYS, uiGridConstants.scrollbars.NEVER + * Supported values: uiGridConstants.scrollbars.ALWAYS, uiGridConstants.scrollbars.NEVER, uiGridConstants.scrollbars.WHEN_NEEDED * @default 1 */ enableHorizontalScrollbar?: boolean | number; @@ -660,7 +661,7 @@ declare namespace uiGrid { enableSorting?: boolean; /** * uiGridConstants.scrollbars.ALWAYS by default. This settings controls the vertical scrollbar for the grid. - * Supported values: uiGridConstants.scrollbars.ALWAYS, uiGridConstants.scrollbars.NEVER + * Supported values: uiGridConstants.scrollbars.ALWAYS, uiGridConstants.scrollbars.NEVER, uiGridConstants.scrollbars.WHEN_NEEDED * @default 1 */ enableVerticalScrollbar?: boolean | number; @@ -897,7 +898,7 @@ declare namespace uiGrid { * which is provided when you want to remove an item. The id should be unique. */ - addToGridMenu(grid: IGridInstanceOf, items: Array): void; + addToGridMenu(grid: IGridInstanceOf, items: Array): void; /** * Clears all filters and optionally refreshes the visible rows. * @param {boolean} [refreshRows=true] Defaults to true. diff --git a/types/ui-grid/ui-grid-tests.ts b/types/ui-grid/ui-grid-tests.ts index e1d49a481d..1e424985fb 100644 --- a/types/ui-grid/ui-grid-tests.ts +++ b/types/ui-grid/ui-grid-tests.ts @@ -98,7 +98,7 @@ columnDef.sort = { priority: 1 }; columnDef.sortCellFiltered = false; -columnDef.sortDirectionCycle = [null, 'asc' , 'desc']; +columnDef.sortDirectionCycle = [null, 'asc', 'desc']; columnDef.sortingAlgorithm = (a: any, b: any, rowA: uiGrid.IGridRowOf, rowB: uiGrid.IGridRowOf, direction: string) => { return -1; }; @@ -113,6 +113,7 @@ var gridApi: uiGrid.IGridApiOf; var gridInstance: uiGrid.IGridInstanceOf; var menuItem: uiGrid.IMenuItem; var colProcessor: uiGrid.IColumnProcessor; +var uiGridConstants: uiGrid.IUiGridConstants; gridApi.core.clearAllFilters(true); gridApi.core.addToGridMenu(gridInstance, [menuItem]); @@ -131,6 +132,12 @@ var gridOptions: uiGrid.IGridOptionsOf = { } }; gridOptions.isRowSelectable = () => true; +gridOptions.enableVerticalScrollbar = uiGridConstants.scrollbars.ALWAYS; +gridOptions.enableVerticalScrollbar = uiGridConstants.scrollbars.WHEN_NEEDED; +gridOptions.enableVerticalScrollbar = uiGridConstants.scrollbars.NEVER; +gridOptions.enableHorizontalScrollbar = uiGridConstants.scrollbars.ALWAYS; +gridOptions.enableHorizontalScrollbar = uiGridConstants.scrollbars.WHEN_NEEDED; +gridOptions.enableHorizontalScrollbar = uiGridConstants.scrollbars.NEVER; interface IAnotherEntity { anObject: string From be1c86fffe1cf5e375f939795b9288f57d28c872 Mon Sep 17 00:00:00 2001 From: ckboyjiy Date: Wed, 28 Mar 2018 11:08:51 +0900 Subject: [PATCH 092/109] Modified submodules --- types/navermaps/index.d.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/types/navermaps/index.d.ts b/types/navermaps/index.d.ts index 92409a44b0..aa36578e63 100644 --- a/types/navermaps/index.d.ts +++ b/types/navermaps/index.d.ts @@ -1082,6 +1082,7 @@ declare namespace naver.maps { } // Sub module: drawing + function drawing(): void; namespace drawing { interface DrawingOptions { map?: Map; @@ -1149,6 +1150,7 @@ declare namespace naver.maps { } // Sub module: visualization + function visualization(): void; namespace visualization { interface DotMapOptions { map: Map; @@ -1218,6 +1220,7 @@ declare namespace naver.maps { } // Sub module: geocoder + function Service(): void; namespace Service { interface ServiceOptions { encoding?: any; @@ -1274,6 +1277,7 @@ declare namespace naver.maps { callback?: (status: Status, response: ReverseGeocodeResponse) => void): void; } + function TransCoord(): void; namespace TransCoord { function fromEPSG3857ToLatLng(coord: Point): LatLng; function fromEPSG3857ToNaver(coord: Point): Point; @@ -1297,6 +1301,7 @@ declare namespace naver.maps { function fromUTMKToTM128(utmk: Point): Point; } + function Event(): void; namespace Event { function addDOMListener(element: HTMLElement, eventName: string, listener: () => any): void; function addListener(target: any, eventName: string, listener: () => any): MapEventListener; @@ -1314,6 +1319,7 @@ declare namespace naver.maps { } // Projection + function EPSG3857(): void; namespace EPSG3857 { // implements Projection function fromCoordToPoint(coord: Coord): Point; function fromLatLngToPoint(latlng: LatLng): Point; @@ -1322,6 +1328,8 @@ declare namespace naver.maps { function getDestinationCoord(fromLatLng: LatLng, angle: number, meter: number): LatLng; function getDistance(latlng1: LatLng, latlng2: LatLng): number; } + + function UTMK(): void; namespace UTMK { let name: string; let pointPerMeter: number; @@ -1338,6 +1346,8 @@ declare namespace naver.maps { function getDestinationCoord(fromLatLng: LatLng, angle: number, meter: number): LatLng; function getDistance(latlng1: LatLng, latlng2: LatLng): number; } + + function UTMK_NAVER(): void; namespace UTMK_NAVER { // extends UTMK let name: string; let pointPerMeter: number; @@ -1350,6 +1360,8 @@ declare namespace naver.maps { function fromPointToNaver(point: Point): Point; function fromUTMKToNaver(utmk: Point): Point; } + + function EPSG3857Coord(): void; namespace EPSG3857Coord { function fromCoordToLatLng(coord: Point): LatLng; function fromCoordToPoint(coord: Point): Point; @@ -1360,10 +1372,14 @@ declare namespace naver.maps { function fromPointToCoord(point: Point): Point; function fromPointToEPSG3857(point: Point): Point; } + + function TM128(): void; namespace TM128 { // extends TM128Coord function fromCoordToPoint(latlng: Coord): Point; function fromPointToCoord(point: Point): LatLng; } + + function TM128Coord(): void; namespace TM128Coord { // extends UTMK function fromCoordToLatLng(tm128: Point): LatLng; function fromCoordToPoint(tm128: Point): Point; @@ -1376,12 +1392,16 @@ declare namespace naver.maps { function fromTM128ToUTMK(tm128: Point): Point; function fromUTMKToTM128(utmk: Point): Point; } + + function UTMK_NAVERCoord(): void; namespace UTMK_NAVERCoord { // extends UTMK_NAVER function fromCoordToLatLng(n: Point): LatLng; function fromCoordToPoint(n: Point): Point; function fromLatLngToCoord(latlng: Coord): Point; function fromPointToCoord(point: Point): Point; } + + function UTMKCoord(): void; namespace UTMKCoord { // extends UTMK function fromCoordToLatLng(utmk: Point): LatLng; function fromCoordToPoint(utmk: Point): Point; From 6ed5c800004cd6a5275056e137dcbb13a683edee Mon Sep 17 00:00:00 2001 From: Ke Zhang Date: Tue, 27 Mar 2018 21:06:48 -0700 Subject: [PATCH 093/109] Add proper type for AccessToken.token. --- types/simple-oauth2/index.d.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/types/simple-oauth2/index.d.ts b/types/simple-oauth2/index.d.ts index 499f39e56e..c1eb324348 100644 --- a/types/simple-oauth2/index.d.ts +++ b/types/simple-oauth2/index.d.ts @@ -44,8 +44,12 @@ export interface ModuleOptions { export type TokenType = "access_token" | "refresh_token"; +export interface Token { + [x: string]: any; +} + export interface AccessToken { - token: {}; + token: Token; /** Check if the access token is expired or not */ expired(): boolean; @@ -56,9 +60,6 @@ export interface AccessToken { revoke(tokenType: TokenType, callback?: (error: any) => void): Bluebird; } -export interface Token { - [x: string]: any; -} export type AuthorizationCode = string; export interface AuthorizationTokenConfig { code: AuthorizationCode; From 454e0ecd2826835f90963ccc24168fb15fe35eff Mon Sep 17 00:00:00 2001 From: Ke Zhang Date: Tue, 27 Mar 2018 21:29:18 -0700 Subject: [PATCH 094/109] Update package version of @type/simple-oauth2 --- types/simple-oauth2/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/simple-oauth2/index.d.ts b/types/simple-oauth2/index.d.ts index c1eb324348..b93bbc229f 100644 --- a/types/simple-oauth2/index.d.ts +++ b/types/simple-oauth2/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for simple-oauth2 1.0 +// Type definitions for simple-oauth2 1.1 // Project: https://github.com/lelylan/simple-oauth2 // Definitions by: [Michael Müller] // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 8988aee224efd4df06a9a70b543e6938a68f4302 Mon Sep 17 00:00:00 2001 From: Firede Date: Wed, 28 Mar 2018 14:39:26 +0800 Subject: [PATCH 095/109] Reformat all files using prettier. prettier --parser typescript --tab-width 4 --semi --trailing-comma es5 \ --write --print-width 120 \ types/express-graphql/*.ts related: #24552 --- .../express-graphql/express-graphql-tests.ts | 22 +++++++++---------- types/express-graphql/index.d.ts | 8 +++---- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/types/express-graphql/express-graphql-tests.ts b/types/express-graphql/express-graphql-tests.ts index 1557c4c0ac..958be4f5ff 100644 --- a/types/express-graphql/express-graphql-tests.ts +++ b/types/express-graphql/express-graphql-tests.ts @@ -1,7 +1,7 @@ -import express = require('express'); -import 'express-session'; -import graphqlHTTP = require('express-graphql'); -import { GraphQLSchema } from 'graphql/type/schema'; +import express = require("express"); +import "express-session"; +import graphqlHTTP = require("express-graphql"); +import { GraphQLSchema } from "graphql/type/schema"; const app = express(); const schema: GraphQLSchema = { @@ -20,10 +20,10 @@ const graphqlOption: graphqlHTTP.OptionsData = { graphiql: true, schema, formatError: (error: Error) => ({ - message: error.message + message: error.message, }), validationRules: [() => false, () => true], - extensions: ({ document, variables, operationName, result }) => ({ key: "value", key2: "value"}), + extensions: ({ document, variables, operationName, result }) => ({ key: "value", key2: "value" }), }; const graphqlOptionRequest = (request: express.Request): graphqlHTTP.OptionsData => ({ @@ -38,15 +38,15 @@ const graphqlOptionRequestAsync = async (request: express.Request): Promise { }, + extensions: async args => {}, validationRules: [() => false, () => true], }; }; -app.use('/graphql1', graphqlHTTP(graphqlOption)); +app.use("/graphql1", graphqlHTTP(graphqlOption)); -app.use('/graphql2', graphqlHTTP(graphqlOptionRequest)); +app.use("/graphql2", graphqlHTTP(graphqlOptionRequest)); -app.use('/graphqlasync', graphqlHTTP(graphqlOptionRequestAsync)); +app.use("/graphqlasync", graphqlHTTP(graphqlOptionRequestAsync)); -app.listen(8080, () => console.log('GraphQL Server running on localhost:8080')); +app.listen(8080, () => console.log("GraphQL Server running on localhost:8080")); diff --git a/types/express-graphql/index.d.ts b/types/express-graphql/index.d.ts index 4b2d10c99b..b00259e158 100644 --- a/types/express-graphql/index.d.ts +++ b/types/express-graphql/index.d.ts @@ -9,7 +9,7 @@ // TypeScript Version: 2.3 import { Request, Response } from "express"; -import { DocumentNode, GraphQLSchema, GraphQLError } from 'graphql'; +import { DocumentNode, GraphQLSchema, GraphQLError } from "graphql"; export = graphqlHTTP; declare namespace graphqlHTTP { @@ -17,9 +17,9 @@ declare namespace graphqlHTTP { * Used to configure the graphQLHTTP middleware by providing a schema * and other configuration options. */ - export type Options = ((request: Request, - response: Response, - params?: GraphQLParams) => OptionsResult) | OptionsResult; + export type Options = + | ((request: Request, response: Response, params?: GraphQLParams) => OptionsResult) + | OptionsResult; export type OptionsResult = OptionsData | Promise; export interface OptionsData { /** From 08716e9683a4c86ad8ea0bd9143d8387337156a7 Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Wed, 28 Mar 2018 08:47:59 +0200 Subject: [PATCH 096/109] Replace forEach with for...of in tests --- types/activex-wia/activex-wia-tests.ts | 39 ++++++++++++++------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/types/activex-wia/activex-wia-tests.ts b/types/activex-wia/activex-wia-tests.ts index c33385af14..8fc7dcfd2e 100644 --- a/types/activex-wia/activex-wia-tests.ts +++ b/types/activex-wia/activex-wia-tests.ts @@ -11,6 +11,9 @@ const collectionToArray = (col: { Item(key: any): T }): T[] => { return results; }; +WScript.Echo('Hello, world'); +WScript.Quit(); + // source -- https://msdn.microsoft.com/en-us/library/windows/desktop/ms630826(v=vs.85).aspx { const cd = new ActiveXObject('WIA.CommonDialog'); @@ -51,7 +54,7 @@ const collectionToArray = (col: { Item(key: any): T }): T[] => { { const dev = cd.ShowSelectDevice(); if (dev) { - collectionToArray(dev.Properties).forEach(p => { + for (const p of collectionToArray(dev.Properties)) { let s = `${p.Name} (${p.PropertyID}) = `; if (p.IsVector) { s += '[vector of data]'; @@ -84,7 +87,7 @@ const collectionToArray = (col: { Item(key: any): T }): T[] => { } WScript.Echo(s); - }); + } } } @@ -112,7 +115,7 @@ const collectionToArray = (col: { Item(key: any): T }): T[] => { { const img = cd.ShowAcquireImage(); if (img) { - collectionToArray(img.Properties).forEach(p => { + for (const p of collectionToArray(img.Properties)) { let contents = ''; if (p.IsVector) { contents = '[vector data not emitted]'; @@ -124,7 +127,7 @@ const collectionToArray = (col: { Item(key: any): T }): T[] => { contents = p.Value; } WScript.Echo(`${p.Name} (${p.PropertyID}) = ${contents}`); - }); + } } } @@ -133,12 +136,12 @@ const collectionToArray = (col: { Item(key: any): T }): T[] => { const dev = cd.ShowSelectDevice(); if (dev) { const actionEvent = WIA.WiaEventFlag.ActionEvent; - collectionToArray(dev.Events).forEach(e => { + for (const e of collectionToArray(dev.Events)) { const msg = (e.Type & actionEvent) === actionEvent ? `${e.Name} is an Action event` : `${e.Name} is not an Action event`; WScript.Echo(msg); - }); + } } } @@ -208,14 +211,14 @@ Frame count = ${img.FrameCount}} // Create an imageprocess object and enumerate filters { const ip = new ActiveXObject('WIA.ImageProcess'); - collectionToArray(ip.FilterInfos).forEach(fi => { + for (const fi of collectionToArray(ip.FilterInfos)) { const s = [ fi.Name, new Array(51).join('='), fi.Description ].join('\n'); WScript.Echo(s); - }); + } } // Create an imageprocess object and create one of each available filter @@ -269,11 +272,11 @@ Frame count = ${img.FrameCount}} WScript.Echo(s); }; - collectionToArray(ip.FilterInfos).forEach(fi => { + for (const fi of collectionToArray(ip.FilterInfos)) { ip.Filters.Add(fi.FilterID); listProperties(ip.Filters(1)); ip.Filters.Remove(1); - }); + } } // List the supported transfer formats @@ -308,14 +311,14 @@ Frame count = ${img.FrameCount}} { const dev = cd.ShowSelectDevice(); if (dev) { - collectionToArray(dev.Items).forEach(item => { + for (const item of collectionToArray(dev.Items)) { let s: string = item.Properties("Item Name").Value; if (item.Properties.Exists("Item Time Stamp")) { const v: WIA.Vector = item.Properties("Item Time Stamp").Value; if (v.Count === 8) { s += ` (${v.Date})`; } } WScript.Echo(s); - }); + } } } @@ -340,16 +343,16 @@ Frame count = ${img.FrameCount}} } // List all available devices by name and deviceid - collectionToArray(dm.DeviceInfos).forEach(di => { + for (const di of collectionToArray(dm.DeviceInfos)) { const name: string = di.Properties("Name").Value; WScript.Echo(`${name} (${di.DeviceID})`); - }); + } // Display all the properties for the selected device { const dev = cd.ShowSelectDevice(); if (dev) { - collectionToArray(dev.Properties).forEach(p => { + for (const p of collectionToArray(dev.Properties)) { const name = `${p.Name} (${p.PropertyID})`; let contents: string; if (p.IsVector) { @@ -360,7 +363,7 @@ Frame count = ${img.FrameCount}} contents = p.Value; } WScript.Echo(`${name} = ${contents}`); - }); + } } } @@ -430,7 +433,7 @@ Frame count = ${img.FrameCount}} if (args[0] === 'connect') { const deviceID = args[1].substr(12); const device = dm.DeviceInfos(deviceID).Connect(); - collectionToArray(device.Items).forEach(item => { + for (const item of collectionToArray(device.Items)) { const img = item.Transfer(); img.SaveFile(`C:\\${item.Properties('Item Name').Value}.${img.FileExtension}`); @@ -445,7 +448,7 @@ Frame count = ${img.FrameCount}} WScript.Echo(error); } } - }); + } WScript.Quit(); } break; From 73c777a74a44cb85e5be44e19d0afde8a94c44d8 Mon Sep 17 00:00:00 2001 From: Firede Date: Wed, 28 Mar 2018 14:49:05 +0800 Subject: [PATCH 097/109] Fixed the definition of some optional fields. `express-graphql` version: 0.6.12 --- types/express-graphql/index.d.ts | 34 ++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/types/express-graphql/index.d.ts b/types/express-graphql/index.d.ts index b00259e158..78c988204f 100644 --- a/types/express-graphql/index.d.ts +++ b/types/express-graphql/index.d.ts @@ -5,6 +5,7 @@ // Daniel Fader // Ehsan Ziya // Margus Lamp +// Firede // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -14,8 +15,11 @@ export = graphqlHTTP; declare namespace graphqlHTTP { /** - * Used to configure the graphQLHTTP middleware by providing a schema + * Used to configure the graphqlHTTP middleware by providing a schema * and other configuration options. + * + * Options can be provided as an Object, a Promise for an Object, or a Function + * that returns an Object or a Promise for an Object. */ export type Options = | ((request: Request, response: Response, params?: GraphQLParams) => OptionsResult) @@ -40,20 +44,20 @@ declare namespace graphqlHTTP { /** * A boolean to configure whether the output should be pretty-printed. */ - pretty?: boolean; + pretty?: boolean | null; /** * An optional function which will be used to format any errors produced by * fulfilling a GraphQL operation. If no function is provided, GraphQL's * default spec-compliant `formatError` function will be used. */ - formatError?: (error: GraphQLError) => any; + formatError?: ((error: GraphQLError) => any) | null; /** * An optional array of validation rules that will be applied on the document * in additional to those defined by the GraphQL spec. */ - validationRules?: any[]; + validationRules?: any[] | null; /** * An optional function for adding additional metadata to the GraphQL response @@ -65,12 +69,12 @@ declare namespace graphqlHTTP { * * This function may be async. */ - extensions?: (info: RequestInfo) => { [key: string]: any }; + extensions?: ((info: RequestInfo) => { [key: string]: any }) | null; /** * A boolean to optionally enable GraphiQL mode. */ - graphiql?: boolean; + graphiql?: boolean | null; } /** @@ -80,32 +84,32 @@ declare namespace graphqlHTTP { /** * The parsed GraphQL document. */ - document?: DocumentNode; + document: DocumentNode | null | undefined; /** * The variable values used at runtime. */ - variables?: { [name: string]: any }; + variables: { [name: string]: any } | null | undefined; /** * The (optional) operation name requested. */ - operationName?: string; + operationName: string | null | undefined; /** * The result of executing the operation. */ - result?: any; + result: any; } export interface GraphQLParams { - query?: string; - variables?: { [name: string]: any }; - operationName?: string; - raw?: boolean; + query: string | null | undefined; + variables: { [name: string]: any } | null | undefined; + operationName: string | null | undefined; + raw: boolean | null | undefined; } - type Middleware = (request: Request, response: Response) => void; + type Middleware = (request: Request, response: Response) => Promise; } /** From 3e6f8de9dc2724547d1e938787051a4d000ff8c7 Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Wed, 28 Mar 2018 09:04:28 +0200 Subject: [PATCH 098/109] Use ReadonlyArray --- types/activex-wia/activex-wia-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/activex-wia/activex-wia-tests.ts b/types/activex-wia/activex-wia-tests.ts index 8fc7dcfd2e..1effbe99ee 100644 --- a/types/activex-wia/activex-wia-tests.ts +++ b/types/activex-wia/activex-wia-tests.ts @@ -1,6 +1,6 @@ // Note -- running these tests under cscript requires some ES5 polyfills -const collectionToArray = (col: { Item(key: any): T }): T[] => { +const collectionToArray = (col: { Item(key: any): T }): ReadonlyArray => { const results: T[] = []; const enumerator = new Enumerator(col); enumerator.moveFirst(); From f7255883d0126c51a61a1bc874bf5de4b437c396 Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Wed, 28 Mar 2018 09:05:30 +0200 Subject: [PATCH 099/109] Undo ReadonlyArray --- types/activex-wia/activex-wia-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/activex-wia/activex-wia-tests.ts b/types/activex-wia/activex-wia-tests.ts index 1effbe99ee..8fc7dcfd2e 100644 --- a/types/activex-wia/activex-wia-tests.ts +++ b/types/activex-wia/activex-wia-tests.ts @@ -1,6 +1,6 @@ // Note -- running these tests under cscript requires some ES5 polyfills -const collectionToArray = (col: { Item(key: any): T }): ReadonlyArray => { +const collectionToArray = (col: { Item(key: any): T }): T[] => { const results: T[] = []; const enumerator = new Enumerator(col); enumerator.moveFirst(); From ac6eb13e40e93553c1d9743924a5aa408d548cf0 Mon Sep 17 00:00:00 2001 From: Firede Date: Wed, 28 Mar 2018 15:25:04 +0800 Subject: [PATCH 100/109] Defining `schema` the right way. Otherwise, it will cause the new version `@types/graphql` test to fail. Related: #24566 --- types/express-graphql/express-graphql-tests.ts | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/types/express-graphql/express-graphql-tests.ts b/types/express-graphql/express-graphql-tests.ts index 958be4f5ff..52071cea07 100644 --- a/types/express-graphql/express-graphql-tests.ts +++ b/types/express-graphql/express-graphql-tests.ts @@ -1,20 +1,10 @@ import express = require("express"); import "express-session"; import graphqlHTTP = require("express-graphql"); -import { GraphQLSchema } from "graphql/type/schema"; +import { buildSchema } from "graphql"; const app = express(); -const schema: GraphQLSchema = { - getQueryType: null, - getMutationType: null, - getSubscriptionType: null, - getTypeMap: null, - getType: null, - getPossibleTypes: null, - isPossibleType: null, - getDirective: null, - getDirectives: null, -}; +const schema = buildSchema(`type Query { hello: String }`); const graphqlOption: graphqlHTTP.OptionsData = { graphiql: true, From cd800800a9ef8c060ac209ae6b88604fc1d5d6f2 Mon Sep 17 00:00:00 2001 From: Firede Date: Wed, 28 Mar 2018 16:05:34 +0800 Subject: [PATCH 101/109] Rewrite tests. `GraphQLResolveInfo` is usually generated internally by graphql. --- .../graphql-list-fields-tests.ts | 62 ++++++++----------- 1 file changed, 26 insertions(+), 36 deletions(-) diff --git a/types/graphql-list-fields/graphql-list-fields-tests.ts b/types/graphql-list-fields/graphql-list-fields-tests.ts index ee9bcc6851..e90d609f1d 100644 --- a/types/graphql-list-fields/graphql-list-fields-tests.ts +++ b/types/graphql-list-fields/graphql-list-fields-tests.ts @@ -1,41 +1,31 @@ import getFieldNames = require("graphql-list-fields"); -import { - GraphQLID, - GraphQLObjectType, - GraphQLResolveInfo, - GraphQLSchema, - GraphQLString -} from "graphql"; +import { GraphQLID, GraphQLObjectType, GraphQLSchema, GraphQLString } from "graphql"; -const sampleGraphQLResolveInfo: GraphQLResolveInfo = { - fieldName: "", - fieldNodes: [], - returnType: GraphQLString, - parentType: new GraphQLObjectType({ - name: "Sample", +const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: "SampleType", fields: { - name: { type: GraphQLString } - } + scalarField: { + type: GraphQLString, + resolve(source, args, context, info) { + const fieldNames: string[] = getFieldNames(info); + }, + }, + someType: { + type: new GraphQLObjectType({ + name: "SomeType", + fields: { + a: { type: GraphQLID }, + b: { type: GraphQLString }, + c: { type: GraphQLString }, + d: { type: GraphQLString }, + }, + }), + resolve(source, args, context, info) { + const fieldNames: string[] = getFieldNames(info); + }, + }, + }, }), - path: undefined, - schema: new GraphQLSchema({ - query: new GraphQLObjectType({ - name: "SampleType", - fields: {} - }) - }), - fragments: {}, - rootValue: null, - operation: { - kind: "OperationDefinition", - operation: "query", - selectionSet: { - kind: "SelectionSet", - selections: [] - } - }, - variableValues: {} -}; - -const fieldNames: string[] = getFieldNames(sampleGraphQLResolveInfo); +}); From 026dc969c2cf6077a21271d37cc3c912fa43be89 Mon Sep 17 00:00:00 2001 From: Mykolas Kairys Date: Wed, 28 Mar 2018 11:24:08 +0300 Subject: [PATCH 102/109] updated react-router-redux createMatchSelector definition to not have generic --- types/react-router-redux/index.d.ts | 2 +- types/react-router-redux/tslint.json | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/types/react-router-redux/index.d.ts b/types/react-router-redux/index.d.ts index 89ef136014..7c8d78ccc9 100644 --- a/types/react-router-redux/index.d.ts +++ b/types/react-router-redux/index.d.ts @@ -80,4 +80,4 @@ export interface LocationChangeAction { export function routerMiddleware(history: History): Middleware; -export function createMatchSelector(path: string): (state: State) => match | null; +export function createMatchSelector(path: string): (state: { router: RouterState }) => match<{}> | null; diff --git a/types/react-router-redux/tslint.json b/types/react-router-redux/tslint.json index 71ee04c4e1..f93cf8562a 100644 --- a/types/react-router-redux/tslint.json +++ b/types/react-router-redux/tslint.json @@ -1,6 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "no-unnecessary-generics": false - } + "extends": "dtslint/dt.json" } From cd12005ec0bd6bd4fb06aeb69b9b58aa1db259f7 Mon Sep 17 00:00:00 2001 From: Juan Jimenez-Anca Date: Wed, 28 Mar 2018 10:14:40 +0100 Subject: [PATCH 103/109] add Uint8Array for browsers --- types/ethereumjs-util/index.d.ts | 54 ++++++++++++++++---------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/types/ethereumjs-util/index.d.ts b/types/ethereumjs-util/index.d.ts index 7a29b38ff5..eb47d3a6a9 100644 --- a/types/ethereumjs-util/index.d.ts +++ b/types/ethereumjs-util/index.d.ts @@ -20,64 +20,64 @@ export function addHexPrefix(str: string): string; export function arrayContainsArray(superset: any, subset: any, some: any): any; -export function baToJSON(ba: Buffer | string[]): Buffer | string[]; +export function baToJSON(ba: Buffer | Uint8Array | string[]): Buffer | Uint8Array | string[]; -export function bufferToHex(buf: Buffer): string; +export function bufferToHex(buf: Buffer | Uint8Array): string; -export function bufferToInt(buf: Buffer): string; +export function bufferToInt(buf: Buffer | Uint8Array): string; export function defineProperties(self: {[k: string]: any}, fields: string[], data: {[k: string]: any}): {[k: string]: any}; -export function ecrecover(msgHash: Buffer, v: number, r: Buffer, s: Buffer): Buffer; +export function ecrecover(msgHash: Buffer | Uint8Array, v: number, r: Buffer | Uint8Array, s: Buffer | Uint8Array): Buffer | Uint8Array; -export function ecsign(msgHash: Buffer, privateKey: Buffer): {[k: string]: any}; +export function ecsign(msgHash: Buffer | Uint8Array, privateKey: Buffer | Uint8Array): {[k: string]: any}; export function fromRpcSig(sig: string): {[k: string]: any}; -export function fromSigned(num: Buffer): any; +export function fromSigned(num: Buffer | Uint8Array): any; -export function generateAddress(from: Buffer, nonce: Buffer): Buffer; +export function generateAddress(from: Buffer | Uint8Array, nonce: Buffer | Uint8Array): Buffer | Uint8Array; -export function hashPersonalMessage(message: string): Buffer; +export function hashPersonalMessage(message: string): Buffer | Uint8Array; -export function importPublic(publicKey: Buffer): Buffer; +export function importPublic(publicKey: Buffer | Uint8Array): Buffer | Uint8Array; export function isValidAddress(address: string): boolean; -export function isValidChecksumAddress(address: Buffer): boolean; +export function isValidChecksumAddress(address: Buffer | Uint8Array): boolean; -export function isValidPrivate(privateKey: Buffer): boolean; +export function isValidPrivate(privateKey: Buffer | Uint8Array): boolean; -export function isValidPublic(publicKey: Buffer, sanitize?: boolean): any; +export function isValidPublic(publicKey: Buffer | Uint8Array, sanitize?: boolean): any; -export function isValidSignature(v: Buffer, r: Buffer, s: Buffer, homestead?: boolean): boolean; +export function isValidSignature(v: Buffer | Uint8Array, r: Buffer | Uint8Array, s: Buffer | Uint8Array, homestead?: boolean): boolean; -export function privateToAddress(privateKey: Buffer): Buffer; +export function privateToAddress(privateKey: Buffer | Uint8Array): Buffer | Uint8Array; -export function privateToPublic(privateKey: Buffer): Buffer; +export function privateToPublic(privateKey: Buffer | Uint8Array): Buffer | Uint8Array; -export function pubToAddress(pubKey: Buffer, sanitize: boolean): Buffer; +export function pubToAddress(pubKey: Buffer | Uint8Array, sanitize: boolean): Buffer | Uint8Array; -export function ripemd160(a: Buffer | any[] | string | number, padded: boolean): Buffer; +export function ripemd160(a: Buffer | Uint8Array | any[] | string | number, padded: boolean): Buffer | Uint8Array; -export function rlphash(a: Buffer | any[] | string | number): Buffer; +export function rlphash(a: Buffer | Uint8Array | any[] | string | number): Buffer | Uint8Array; -export function setLengthLeft(msg: Buffer | any[], length: number, right?: boolean): Buffer | any[]; +export function setLengthLeft(msg: Buffer | Uint8Array | any[], length: number, right?: boolean): Buffer | Uint8Array | any[]; -export function setLengthRight(msg: Buffer | any[], length: number): Buffer | any[]; +export function setLengthRight(msg: Buffer | Uint8Array | any[], length: number): Buffer | Uint8Array | any[]; -export function sha256(a: Buffer | any[] | string | number): Buffer; +export function sha256(a: Buffer | Uint8Array | any[] | string | number): Buffer | Uint8Array; -export function sha3(a: Buffer | any[] | string | number, bits?: number): Buffer; +export function sha3(a: Buffer | Uint8Array | any[] | string | number, bits?: number): Buffer | Uint8Array; -export function toBuffer(v: any): Buffer; +export function toBuffer(v: any): Buffer | Uint8Array; export function toChecksumAddress(address: string): string; -export function toRpcSig(v: number, r: Buffer, s: Buffer): string; +export function toRpcSig(v: number, r: Buffer | Uint8Array, s: Buffer | Uint8Array): string; -export function toUnsigned(num: any): Buffer; +export function toUnsigned(num: any): Buffer | Uint8Array; -export function unpad(a: T): T; +export function unpad(a: T): T; -export function zeros(bytes: number): Buffer; +export function zeros(bytes: number): Buffer | Uint8Array; From 7addf7ae18cfc3f62fe74dd3a8a813606eb05029 Mon Sep 17 00:00:00 2001 From: Timur Amirov Date: Wed, 28 Mar 2018 13:14:26 +0200 Subject: [PATCH 104/109] Update typing for circuit-breaker-js --- types/circuit-breaker-js/circuit-breaker-js-tests.ts | 8 ++++++++ types/circuit-breaker-js/index.d.ts | 8 +++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/types/circuit-breaker-js/circuit-breaker-js-tests.ts b/types/circuit-breaker-js/circuit-breaker-js-tests.ts index 1436e13e90..b9a3c70a63 100644 --- a/types/circuit-breaker-js/circuit-breaker-js-tests.ts +++ b/types/circuit-breaker-js/circuit-breaker-js-tests.ts @@ -10,3 +10,11 @@ status = CircuitBreaker.OPEN; breaker.forceOpen(); breaker.forceClose(); + +breaker.run((success, failure) => { + if (Math.random() > 0.5) { + success(); + } else { + failure(); + } +}); diff --git a/types/circuit-breaker-js/index.d.ts b/types/circuit-breaker-js/index.d.ts index 6fc58bd40d..7b6854e61f 100644 --- a/types/circuit-breaker-js/index.d.ts +++ b/types/circuit-breaker-js/index.d.ts @@ -30,7 +30,13 @@ declare class CircuitBreaker { static CLOSED: 2; constructor(options?: CircuitBreaker.Options); - run(command: () => void, fallback?: () => void): void; + run( + command: ( + success: () => void, + failure: () => void, + ) => void, + fallback?: () => void + ): void; forceClose(): void; forceOpen(): void; unforce(): void; From 6623a7ee2549759ee82486e6f15159ed94bdcd00 Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Wed, 28 Mar 2018 15:16:59 +0200 Subject: [PATCH 105/109] feat(types): add typings for bell --- types/bell/bell-tests.ts | 110 ++++++++++++++++ types/bell/index.d.ts | 273 +++++++++++++++++++++++++++++++++++++++ types/bell/tsconfig.json | 23 ++++ types/bell/tslint.json | 6 + 4 files changed, 412 insertions(+) create mode 100644 types/bell/bell-tests.ts create mode 100644 types/bell/index.d.ts create mode 100644 types/bell/tsconfig.json create mode 100644 types/bell/tslint.json diff --git a/types/bell/bell-tests.ts b/types/bell/bell-tests.ts new file mode 100644 index 0000000000..f8821f22ad --- /dev/null +++ b/types/bell/bell-tests.ts @@ -0,0 +1,110 @@ +import { RequestQuery, Server } from 'hapi'; +import * as bell from 'bell'; + +async function run() { + const server = new Server({ port: 8000 }); + await server.register(bell); + + // You'll need to go to https://developers.arcgis.com/en/applications and set up an application to get started + // Once you create your app you will get your ClientID and Client Secret. + // Also be sure to set redirect URL as well at the bottom of the screen in Redirect URIs section. + + server.auth.strategy('arcgisonline', 'bell', { + provider: 'twitter', + password: 'some cookie password', + location: 'http://example.com/oauth', + clientId: '', + clientSecret: '', + scope(request) { + const scopes = ['public_profile', 'email']; + if (( request.query).wantsSharePermission) { + scopes.push('publish_actions'); + } + return scopes; + } + }); + + const providers: bell.BellOptions[] = [{ + provider: 'discord', + password: 'cookie_encryption_password_secure', + isSecure: false, + clientId: '', + clientSecret: '', + location: () => '', + }, + { + provider: 'facebook', + password: 'cookie_encryption_password_secure', + isSecure: false, + clientId: '', + clientSecret: '', + location: server.info.uri + }, + { + provider: 'google', + password: 'cookie_encryption_password_secure', + isSecure: false, + clientId: '', + clientSecret: '', + location: server.info.uri + }, + { + provider: 'linkedin', + password: 'cookie_encryption_password_secure', + isSecure: false, + clientId: '', + clientSecret: '', + providerParams: { + redirect_uri: server.info.uri + '/bell/door' + } + }, + { + provider: 'meetup', + password: 'cookie_encryption_password_secure', + isSecure: false, + clientId: '', + clientSecret: '', + scope: ['basic', 'ageless', 'group_edit', 'reporting'], + }, + { + provider: 'nest', + password: 'cookie_encryption_password_secure', + isSecure: false, + clientId: '', + clientSecret: '' + }, + { + provider: 'office365', + clientId: '', + clientSecret: '', + password: 'cookie_encryption_password_secure', + providerParams: { + response_type: 'code' + }, + scope: ['openid', 'offline_access', 'profile'] + }, + { + provider: 'okta', + config: { uri: 'https://your-organization.okta.com' }, + password: 'cookie_encryption_password_secure', + isSecure: false, + location: 'http://127.0.0.1:8000', + clientId: '', + clientSecret: '' + }, + { + provider: 'slack', + password: 'cookie_encryption_password_secure', + isSecure: false, + clientId: '', + clientSecret: '' + }, + { + provider: 'twitch', + password: 'cookie_encryption_password_secure', + isSecure: false, + clientId: '', + clientSecret: '', + scope: ['user_read', 'channel_read'] + }]; +} diff --git a/types/bell/index.d.ts b/types/bell/index.d.ts new file mode 100644 index 0000000000..2af331b2b9 --- /dev/null +++ b/types/bell/index.d.ts @@ -0,0 +1,273 @@ +// Type definitions for bell 9.1 +// Project: https://github.com/hapijs/bell +// Definitions by: Simon Schick +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.7 + +import { Server, Request, Plugin, AuthCredentials } from 'hapi'; + +declare module 'hapi' { + interface ServerAuth { + strategy(name: string, scheme: 'bell', options: BellOptions): void; + strategy( + name: string, + scheme: 'bell', + mode: boolean | 'required' | 'optional' | 'try', + options: BellOptions, + ): void; + } +} + +export interface StringLikeMap { + [key: string]: string | number; +} +export type Provider = + 'arcgisonline' | + 'auth0' | + 'azuread' | + 'bitbucket' | + 'digitalocean' | + 'discord' | + 'dropbox' | + 'dropboxV2' | + 'facebook' | + 'fitbit' | + 'foursquare' | + 'github' | + 'gitlab' | + 'google' | + 'googleplus' | + 'instagram' | + 'linkedin' | + 'live' | + 'medium' | + 'meetup' | + 'mixer' | + 'nest' | + 'office365' | + 'okta' | + 'phabricator' | + 'pingfed' | + 'pinterest' | + 'reddit' | + 'salesforce' | + 'slack' | + 'spotify' | + 'stripe' | + 'trakt' | + 'tumblr' | + 'twitch' | + 'twitter' | + 'vk' | + 'wordpress' | + 'yahoo'; + +export type RequestPassThrough = ( + request: Request, + next: (err: Error | null, credentials: AuthCredentials) => void, +) => void; + +export interface OptionalOptions { + /** + * the name of the cookie used to manage the temporary state. + * Defaults to 'bell-provider' where 'provider' is the provider name (or 'custom' for custom providers). + * For example, the Twitter cookie name defaults to 'bell-twitter'. + */ + cookie?: string; + /** + * sets the cookie secure flag. + * Defaults to true. + */ + isSecure?: boolean; + /** + * sets the cookie HTTP only flag. + * Defaults to true. + */ + isHttpOnly?: boolean; + /** + * cookie time-to-live in milliseconds. + * Defaults to null (session time-life - cookies are deleted when the browser is closed). + */ + ttl?: number; + /** + * the domain scope. + * Defaults to null (no domain). + */ + domain?: string; + /** + * provider-specific query parameters for the authentication endpoint. + * It may be passed either as an object to merge into the query string, + * or a function which takes the client's request and returns an object. + * Each provider supports its own set of parameters which customize the user's login experience. + * For example: + * * Facebook supports `display` ('page', 'popup', or 'touch'), `auth_type`, `auth_nonce`. + * * Google supports `access_type`, `approval_prompt`, `prompt`, `login_hint`, `user_id`, `hd`. + * * Twitter supports `force_login`, `screen_name`. + * * Linkedin supports `fields`. + */ + providerParams?: StringLikeMap | ((request: Request) => StringLikeMap); + /** + * allows passing query parameters from a bell protected endpoint to the auth request. + * It will merge the query params you pass along with the providerParams and any other predefined ones. + * Be aware that this will override predefined query parameters! + * Default to false. + */ + allowRuntimeProviderParams?: StringLikeMap | boolean; + /** + * Each built-in vendor comes with the required scope for basic profile information. + * Use scope to specify a different scope as required by your application. + * It may be passed either as an object to merge into the query string, + * or a function which takes the client's request and returns an object. + * Consult the provider for their specific supported scopes. + */ + scope?: string[] | ((request: Request) => string[]); + /** + * skips obtaining a user profile from the provider. + * Useful if you need specific scopes, + * but not the user profile. + * Defaults to false. + */ + skipProfile?: boolean; + /** + * a configuration object used to customize the provider settings. + * The built-in 'twitter' provider accepts the `extendedProfile` & `getMethod` options. + * option which allows disabling the extra profile request when the provider + * returns the user information in the callback (defaults to true). + * The built-in 'github' and 'phabricator' providers accept the uri + * option which allows pointing to a private enterprise installation (e.g. 'https://vpn.example.com'). + * See Providers documentation for more information. + */ + config?: { extendedProfile?: boolean; getMethod?: string } | { uri?: string }; + /** + * an object of key-value pairs that specify additional + * URL query parameters to send with the profile request to the provider. + * The built-in facebook provider, + * for example, could have fields specified to determine the fields returned from the user's graph, + * which would then be available to you in the auth.credentials.profile.raw object. + */ + profileParams?: StringLikeMap; + /** + * allows passing additional OAuth state from initial request. + * This must be a function returning a string, + * which will be appended to the bell internal state parameter for OAuth code flow. + */ + runtimeStateCallback?(req: Request): string; + + // THESE ARE IN THE *REQUIRED* section but are actually not... + /** + * A boolean indicating whether or not you want the redirect_uri to be forced to https. + * Useful if your hapi application runs as http, but is accessed through https. + */ + forceHttps?: boolean; + /** + * Set the base redirect_uri manually if it cannot be inferred properly from server settings. + * Useful to override port, protocol, and host if proxied or forwarded. + */ + location?: string | ((req: Request) => string); +} + +export interface RequiredProviderOptions { + /** + * the cookie encryption password. + * Used to encrypt the temporary state cookie used by the module in + * between the authorization protocol steps. + */ + password: string; + /** + * the OAuth client identifier (consumer key). + */ + clientId: string; + /** + * the OAuth client secret (consumer secret) + */ + clientSecret: string; +} + +export interface KnownProviderOptions extends RequiredProviderOptions, OptionalOptions { + provider: Provider; +} + +/** + * @param uri the requested resource URI (bell will add the token or authentication header as needed). + * @param params any URI query parameters (cannot include them in the URI due to signature requirements). + */ +export type AuthedRequest = (uri: string, params: { [key: string]: string } | null) => Promise; + +export interface CustomProtocol { + /** + * the authorization protocol used. + */ + protocol: 'oauth' | 'oauth2'; + /** + * the OAuth signature method (OAuth 1.0a only). Must be one of: + * * 'HMAC-SHA1' - default + * * 'RSA-SHA1' - in that case, the clientSecret is your RSA private key + */ + signatureMethod?: 'HMAC-SHA1' | 'RSA-SHA1'; + /** + * the temporary credentials (request token) endpoint (OAuth 1.0a only). + */ + temporary?: string; + /** + * boolean that determines if OAuth client id and client secret will be sent + * as parameters as opposed to an Authorization header (OAuth 2.0 only). + * Defaults to false. + */ + useParamsAuth?: boolean; + /** + * the authorization endpoint URI. + */ + auth: string; + /** + * the access token endpoint URI. + */ + token: string; + /** + * the OAuth version. + */ + version?: string; + /** + * an array of scope strings (OAuth 2.0 only). + */ + scope?: string[] | ((query: StringLikeMap) => string[]); + /** + * the scope separator character (OAuth 2.0 only). Only required when a provider has a broken OAuth 2.0 implementation. Defaults to space (Facebook and GitHub default to comma). + */ + scopeSeparator?: string; + /** + * a headers object with additional headers required by the provider + * (e.g. GitHub required the 'User-Agent' header which is set by default). + */ + headers?: { + [key: string]: string; + }; + /** + * a function used to obtain user profile information and normalize it. + * @param credentials the credentials object. + * Change the object directly within the function (profile information is typically stored under credentials.profile). + * @param params the parsed information received from the provider (e.g. token, secret, and other custom fields). + * @param get an OAuth helper function to make authenticated requests using the credentials received. + */ + profile(credentials: any, params: { [key: string]: string }, get: AuthedRequest): Promise; +} + +export interface CustomProviderOptions extends RequiredProviderOptions, OptionalOptions { + provider: CustomProtocol; +} + +export type BellOptions = CustomProviderOptions | KnownProviderOptions; + +export const plugin: Plugin; +/* + * [See docs](https://github.com/hapijs/bell/blob/master/API.md#simulated-authentication) + */ + +/** + * Enables simulation mode. + */ +export function simulate(credentialsFunc: RequestPassThrough): void; +/** + * [See docs](https://github.com/hapijs/bell/blob/master/API.md#simulated-authentication) + * Disables simulation mode + */ +export function simulate(state: false): void; diff --git a/types/bell/tsconfig.json b/types/bell/tsconfig.json new file mode 100644 index 0000000000..4db30822b8 --- /dev/null +++ b/types/bell/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "strictFunctionTypes": true, + "strictNullChecks": true, + "noImplicitAny": true, + "noImplicitThis": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bell-tests.ts" + ] +} diff --git a/types/bell/tslint.json b/types/bell/tslint.json new file mode 100644 index 0000000000..843d627f89 --- /dev/null +++ b/types/bell/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false // Disabling as it prevents me from using overloaded doctags + } +} From c1fa2b114c40bcc7c84b0209cd18709694897950 Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Wed, 28 Mar 2018 15:28:45 +0200 Subject: [PATCH 106/109] fixup! feat(types): add typings for bell --- types/bell/bell-tests.ts | 4 ---- types/bell/index.d.ts | 4 ---- 2 files changed, 8 deletions(-) diff --git a/types/bell/bell-tests.ts b/types/bell/bell-tests.ts index f8821f22ad..65b3e5f4d5 100644 --- a/types/bell/bell-tests.ts +++ b/types/bell/bell-tests.ts @@ -5,10 +5,6 @@ async function run() { const server = new Server({ port: 8000 }); await server.register(bell); - // You'll need to go to https://developers.arcgis.com/en/applications and set up an application to get started - // Once you create your app you will get your ClientID and Client Secret. - // Also be sure to set redirect URL as well at the bottom of the screen in Redirect URIs section. - server.auth.strategy('arcgisonline', 'bell', { provider: 'twitter', password: 'some cookie password', diff --git a/types/bell/index.d.ts b/types/bell/index.d.ts index 2af331b2b9..14cdc65cb9 100644 --- a/types/bell/index.d.ts +++ b/types/bell/index.d.ts @@ -258,10 +258,6 @@ export interface CustomProviderOptions extends RequiredProviderOptions, Optional export type BellOptions = CustomProviderOptions | KnownProviderOptions; export const plugin: Plugin; -/* - * [See docs](https://github.com/hapijs/bell/blob/master/API.md#simulated-authentication) - */ - /** * Enables simulation mode. */ From d87aadbf306bb63f210d4e33c99d11bab45f567b Mon Sep 17 00:00:00 2001 From: Christian Rackerseder Date: Wed, 28 Mar 2018 15:37:13 +0200 Subject: [PATCH 107/109] Added types for enquire.js --- types/enquire.js/enquire.js-tests.ts | 17 +++++++++++ types/enquire.js/index.d.ts | 43 ++++++++++++++++++++++++++++ types/enquire.js/tsconfig.json | 23 +++++++++++++++ types/enquire.js/tslint.json | 1 + 4 files changed, 84 insertions(+) create mode 100644 types/enquire.js/enquire.js-tests.ts create mode 100644 types/enquire.js/index.d.ts create mode 100644 types/enquire.js/tsconfig.json create mode 100644 types/enquire.js/tslint.json diff --git a/types/enquire.js/enquire.js-tests.ts b/types/enquire.js/enquire.js-tests.ts new file mode 100644 index 0000000000..7fce0dd571 --- /dev/null +++ b/types/enquire.js/enquire.js-tests.ts @@ -0,0 +1,17 @@ +import * as enquire from 'enquire.js'; + +enquire + .register('(min-width: 300px) and (max-width: 600px)', { + deferSetup: true, + match: () => {}, + unmatch: () => {}, + setup: () => {}, + destroy: () => {} + }) + .register('(min-width: 300px) and (max-width: 600px)', {}); + +enquire.register('(min-width: 300px) and (max-width: 600px)', [{}, {}], true); + +enquire.register('(min-width: 300px) and (max-width: 600px)', () => {}, true); + +enquire.unregister('(min-width: 300px) and (max-width: 600px)'); diff --git a/types/enquire.js/index.d.ts b/types/enquire.js/index.d.ts new file mode 100644 index 0000000000..d7dcafdc30 --- /dev/null +++ b/types/enquire.js/index.d.ts @@ -0,0 +1,43 @@ +// Type definitions for enquire.js 2.1 +// Project: https://github.com/WickyNilliams/enquire.js/ +// Definitions by: Christian Rackerseder +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +interface Options { + /** + * If set to true, defers execution of the setup function until the first time the media query is matched + */ + deferSetup?: boolean; + /** + * If supplied, triggered when a media query matches. + */ + match?(): void; + /** + * If supplied, triggered when the media query transitions from a matched state to an unmatched state. + */ + unmatch?(): void; + /** + * If supplied, triggered once, when the handler is registered. + */ + setup?(): void; + + /** + * If supplied, triggered when handler is unregistered. Place cleanup code here + */ + destroy?(): void; +} + +type Callback = () => void; + +interface EnquireJs { + register( + mediaQuery: string, + options: Options | Options[] | Callback, + shouldDegrade?: boolean, + ): EnquireJs; + unregister(mediaQuery: string, handler?: Callback | Options): void; +} + +declare const enquire: EnquireJs; +export = enquire; diff --git a/types/enquire.js/tsconfig.json b/types/enquire.js/tsconfig.json new file mode 100644 index 0000000000..ffbd13d6e2 --- /dev/null +++ b/types/enquire.js/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "enquire.js-tests.ts" + ] +} diff --git a/types/enquire.js/tslint.json b/types/enquire.js/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/enquire.js/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From f5da07c596079918095a5b3af7d104488fe05f81 Mon Sep 17 00:00:00 2001 From: Christian Rackerseder Date: Wed, 28 Mar 2018 19:49:44 +0200 Subject: [PATCH 108/109] Fixed import in test --- types/enquire.js/enquire.js-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/enquire.js/enquire.js-tests.ts b/types/enquire.js/enquire.js-tests.ts index 7fce0dd571..a11ba053c2 100644 --- a/types/enquire.js/enquire.js-tests.ts +++ b/types/enquire.js/enquire.js-tests.ts @@ -1,4 +1,4 @@ -import * as enquire from 'enquire.js'; +import enquire = require('enquire.js'); enquire .register('(min-width: 300px) and (max-width: 600px)', { From cc06c0bd237623a251bbd41fe4696321533e7a3b Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 28 Mar 2018 11:13:16 -0700 Subject: [PATCH 109/109] Update react-flatpickr with flatpickr's new exports It switched to a default export that contains nested-nested types. --- types/react-flatpickr/index.d.ts | 6 +++--- types/react-flatpickr/react-flatpickr-tests.tsx | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/types/react-flatpickr/index.d.ts b/types/react-flatpickr/index.d.ts index 68d79a2b6c..9683835e32 100644 --- a/types/react-flatpickr/index.d.ts +++ b/types/react-flatpickr/index.d.ts @@ -5,12 +5,12 @@ // TypeScript Version: 2.6 import { Component } from 'react'; -import { Options } from 'flatpickr'; +import flatpickr from 'flatpickr'; export interface DateTimePickerProps { defaultValue?: string; - options?: Options.Options; - onChange?: Options.Hook; + options?: flatpickr.Options.Options; + onChange?: flatpickr.Options.Hook; value?: string; } diff --git a/types/react-flatpickr/react-flatpickr-tests.tsx b/types/react-flatpickr/react-flatpickr-tests.tsx index c3dc0f4adc..fbbb6f45a7 100644 --- a/types/react-flatpickr/react-flatpickr-tests.tsx +++ b/types/react-flatpickr/react-flatpickr-tests.tsx @@ -1,4 +1,4 @@ -import { Instance } from 'flatpickr'; +import flatpickr from 'flatpickr'; import * as React from 'react'; import DatePicker from 'react-flatpickr'; @@ -12,7 +12,7 @@ const options = { const optionsElement = ; const onChange = ( - selectedDates: Date[], dateStr: string, instance: Instance, + selectedDates: Date[], dateStr: string, instance: flatpickr.Instance, elem: HTMLElement ) => null; const onChangeElement = ;