From fe2555fa262dc1d0d9110aa1c1ff7c0a3b9bf747 Mon Sep 17 00:00:00 2001 From: dvorakroth Date: Tue, 1 May 2018 08:27:21 +0000 Subject: [PATCH 001/163] Papaparse: added Parser.pause() & Parser.resume() --- types/papaparse/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/papaparse/index.d.ts b/types/papaparse/index.d.ts index ddad5970cb..d97a25010b 100644 --- a/types/papaparse/index.d.ts +++ b/types/papaparse/index.d.ts @@ -74,6 +74,9 @@ export class Parser { // Gets the cursor position getCharIndex(): number; + + pause(): void; + resume(): void; } export interface ParseConfig { From 6509669d3dc7a6a55c76e7dbdd31ee2f596e802d Mon Sep 17 00:00:00 2001 From: dvorakroth Date: Wed, 2 May 2018 10:55:27 +0000 Subject: [PATCH 002/163] chart.js -- ChartPoint.y is allowed to be string and Date --- types/chart.js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index 2c5de28962..621152162a 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -166,7 +166,7 @@ declare namespace Chart { interface ChartPoint { x?: number | string | Date; - y?: number; + y?: number | string | Date; r?: number; } From d76dea208f3c06a3a9feab2cc52ecf0b87179942 Mon Sep 17 00:00:00 2001 From: dvorakroth Date: Mon, 7 May 2018 08:24:19 +0000 Subject: [PATCH 003/163] chart.js -- both X and Y axes can have time-related options --- types/chart.js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index 621152162a..83bf5267fd 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -510,6 +510,7 @@ declare namespace Chart { gridLines?: GridLineOptions; barThickness?: number; scaleLabel?: ScaleTitleOptions; + time?: TimeScale; beforeUpdate?(scale?: any): void; beforeSetDimension?(scale?: any): void; beforeDataLimits?(scale?: any): void; @@ -529,7 +530,6 @@ declare namespace Chart { interface ChartXAxe extends CommonAxe { categoryPercentage?: number; barPercentage?: number; - time?: TimeScale; } // tslint:disable-next-line no-empty-interface From d89ed1ae77eecbeae082d690868934c5b0e492e0 Mon Sep 17 00:00:00 2001 From: Nikolai Ommundsen Date: Wed, 6 Jun 2018 13:17:51 +0200 Subject: [PATCH 004/163] Support extension options --- types/jquery.fancytree/index.d.ts | 278 +++++++++++++++++++++--------- 1 file changed, 194 insertions(+), 84 deletions(-) diff --git a/types/jquery.fancytree/index.d.ts b/types/jquery.fancytree/index.d.ts index 34d90d9e8f..70f3f7a2de 100644 --- a/types/jquery.fancytree/index.d.ts +++ b/types/jquery.fancytree/index.d.ts @@ -303,7 +303,7 @@ declare namespace Fancytree { * @param map callback function(NodeData) that could modify the new node * @returns new node. */ - copyTo(node: FancytreeNode, mode?: string, map?: (node: NodeData) => void) : FancytreeNode; + copyTo(node: FancytreeNode, mode?: string, map?: (node: NodeData) => void): FancytreeNode; /** Count direct and indirect children. * @@ -528,7 +528,7 @@ declare namespace Fancytree { resetLazy(): void; /** Schedule activity for delayed execution (cancel any pending request). scheduleAction('cancel') will only cancel a pending request (if any). */ - scheduleAction(mode: string, ms: number) : void; + scheduleAction(mode: string, ms: number): void; /** * @param effects animation options. @@ -757,7 +757,7 @@ declare namespace Fancytree { /** Accept passing ajax data in a property named `d` (default: true). */ enableAspx?: boolean; /** List of active extensions (default: []) */ - extensions?: string[]; + extensions?: Array; /** Set focus when node is checked by a mouse click (default: false) */ focusOnSelect?: boolean; /** Add `id="..."` to node markup (default: true). */ @@ -792,91 +792,201 @@ declare namespace Fancytree { titlesTabbable?: boolean; /** Animation options, false:off (default: { effect: "blind", options: {direction: "vertical", scale: "box"}, duration: 200 }) */ toggleEffect?: JQueryUI.EffectOptions; + + //////////////// + // EXTENSIONS // + //////////////// + dnd5?: ExtensionDragAndDrop5; + filter?: ExtensionFilter; + table?: ExtensionTable; + + /** Options for misc extensions - see docs for typings */ + [extension: string]: any; } - - /** Data object passed to FancytreeNode() constructor. Note: typically these attributes are accessed by meber methods, e.g. `node.isExpanded()` and `node.setSelected(false)`. */ - interface NodeData { - /** node text (may contain HTML tags) */ - title: string; - icon?: string; - /** unique key for this node (auto-generated if omitted) */ - key?: string; - /** (reserved) */ - refKey?: string; - expanded?: boolean; - /** (initialization only, but will not be stored with the node). */ - active?: boolean; - /** (initialization only, but will not be stored with the node). */ - focus?: boolean; - folder?: boolean; - hideCheckbox?: boolean; - lazy?: boolean; - selected?: boolean; - unselectable?: boolean; - /** optional array of child nodes */ - children?: NodeData[]; - tooltip?: string; - /** class names added to the node markup (separate with space) */ - extraClasses?: string; - /** all properties from will be copied to `node.data` */ - data?: Object; + interface Extensions { + dnd5?: ExtensionDragAndDrop5; + filter?: ExtensionFilter; + table?: ExtensionTable; + [extension: string]: any; } - - /** Data object similar to NodeData, but with additional options. - * May be passed to FancytreeNode#applyPatch (Every property that is omitted (or set to undefined) will be ignored) */ - interface NodePatch { - /** (not yet implemented) */ - appendChildren?: NodeData; - /** (not yet implemented) */ - replaceChildren?: NodeData; - /** (not yet implemented) */ - insertChildren?: NodeData; + interface ExtensionDragAndDrop5 { + /** + * Expand nodes after n milliseconds of hovering. + */ + autoExpandMS?: number; + /** + * Absolute position offset for .fancytree-drop-marker + */ + dropMarkerOffsetX?: number; + /** + * Additional offset for drop-marker with hitMode = "before"/"after" + */ + dropMarkerInsertOffsetX?: number; + /** + * true: Drag multiple (i.e. selected) nodes. + */ + multiSource?: boolean; + /** + * Prevent dropping nodes from different Fancytrees + */ + preventForeignNodes?: boolean; + /** + * Prevent dropping items other than Fancytree nodes + */ + preventNonNodes?: boolean; + /** + * Prevent dropping nodes on own descendants + */ + preventRecursiveMoves?: boolean; + /** + * Prevent dropping nodes 'before self', etc. + */ + preventVoidMoves?: boolean; + /** + * Enable auto-scrolling while dragging + */ + scroll?: boolean; + /** + * Active top/bottom margin in pixel + */ + scrollSensitivity?: number; + /** + * Pixel per event + */ + scrollSpeed?: number; + /** + * Core options + */ + source: { + url: string; + } + /** + * Events (drag support) + */ + dragStart?: (sourceNode: FancytreeNode, data: any) => void; + /** + * Events (drop support) + */ + dragEnter: (targetNode: FancytreeNode, data: any) => void; + /** + * Events (drag over) + */ + dragOver: (targetNode: FancytreeNode, data: any) => void; + /** + * Events (drag drop) + */ + dragDrop: (node: FancytreeNode, data: any) => void; + /** + * Support misc options + */ + [key: string]: any; } - - /** May be passed to Fancytree#applyPatch. */ - interface TreePatch { - [key: string]: NodePatch; + /** + * Define filter-extension options + */ + interface ExtensionFilter { + mode: string; + /** + * Support misc options + */ + [key: string]: any; } - - interface FancytreeStatic { - buildType: string; - debugLevel: number; - version: string; - - /** Throw an error if condition fails (debug method). */ - assert(cond: boolean, msg: string): void; - - /** Return a function that executes *fn* at most every *timeout* ms. */ - debounce void>(timeout: number, fn: T, invokeAsap?: boolean, ctx?: any): T; - - debug(msg: string): void; - - error(msg: string): void; - - escapeHtml(s: string): string; - - getEventTarget(event: Event): Object; - - getEventTargetType(event: Event): string; - - getNode(el: JQuery): FancytreeNode; - getNode(el: Event): FancytreeNode; - getNode(el: Element): FancytreeNode; - - info(msg: string): void; - - /** Convert a keydown event to a string like 'ctrl+a', 'ctrl+shift+f2'. */ - keyEventToString(event: Event): string; - - /** Parse tree data from HTML markup */ - parseHtml($ul: JQuery): NodeData[]; - - /** Add Fancytree extension definition to the list of globally available extensions. */ - registerExtension(definition: Object): void; - - unescapeHtml(s: string): string; - - warn(msg: string): void; + /** + * Define table-extension options + */ + interface ExtensionTable { + indentation: number; + nodeColumnIdx: number; + /** + * Support misc options + */ + [key: string]: any; } } +/** Data object passed to FancytreeNode() constructor. Note: typically these attributes are accessed by meber methods, e.g. `node.isExpanded()` and `node.setSelected(false)`. */ +interface NodeData { + /** node text (may contain HTML tags) */ + title: string; + icon?: string; + /** unique key for this node (auto-generated if omitted) */ + key?: string; + /** (reserved) */ + refKey?: string; + expanded?: boolean; + /** (initialization only, but will not be stored with the node). */ + active?: boolean; + /** (initialization only, but will not be stored with the node). */ + focus?: boolean; + folder?: boolean; + hideCheckbox?: boolean; + lazy?: boolean; + selected?: boolean; + unselectable?: boolean; + /** optional array of child nodes */ + children?: NodeData[]; + tooltip?: string; + /** class names added to the node markup (separate with space) */ + extraClasses?: string; + /** all properties from will be copied to `node.data` */ + data?: Object; +} + +/** Data object similar to NodeData, but with additional options. + * May be passed to FancytreeNode#applyPatch (Every property that is omitted (or set to undefined) will be ignored) */ +interface NodePatch { + /** (not yet implemented) */ + appendChildren?: NodeData; + /** (not yet implemented) */ + replaceChildren?: NodeData; + /** (not yet implemented) */ + insertChildren?: NodeData; +} + +/** May be passed to Fancytree#applyPatch. */ +interface TreePatch { + [key: string]: NodePatch; +} + +interface FancytreeStatic { + buildType: string; + debugLevel: number; + version: string; + + /** Throw an error if condition fails (debug method). */ + assert(cond: boolean, msg: string): void; + + /** Return a function that executes *fn* at most every *timeout* ms. */ + debounce void>(timeout: number, fn: T, invokeAsap?: boolean, ctx?: any): T; + + debug(msg: string): void; + + error(msg: string): void; + + escapeHtml(s: string): string; + + getEventTarget(event: Event): Object; + + getEventTargetType(event: Event): string; + + getNode(el: JQuery): FancytreeNode; + getNode(el: Event): FancytreeNode; + getNode(el: Element): FancytreeNode; + + info(msg: string): void; + + /** Convert a keydown event to a string like 'ctrl+a', 'ctrl+shift+f2'. */ + keyEventToString(event: Event): string; + + /** Parse tree data from HTML markup */ + parseHtml($ul: JQuery): NodeData[]; + + /** Add Fancytree extension definition to the list of globally available extensions. */ + registerExtension(definition: Object): void; + + unescapeHtml(s: string): string; + + warn(msg: string): void; +} +} + From 6b02a536fbb9eb4def5bdedc9438d0c407baf852 Mon Sep 17 00:00:00 2001 From: Nikolai Ommundsen Date: Wed, 6 Jun 2018 14:06:07 +0200 Subject: [PATCH 005/163] Finalize changes and upped typescript version --- types/jquery.fancytree/index.d.ts | 479 +++++++++++------- .../jquery.fancytree-tests.ts | 20 +- 2 files changed, 298 insertions(+), 201 deletions(-) diff --git a/types/jquery.fancytree/index.d.ts b/types/jquery.fancytree/index.d.ts index 70f3f7a2de..de1e93c273 100644 --- a/types/jquery.fancytree/index.d.ts +++ b/types/jquery.fancytree/index.d.ts @@ -2,8 +2,9 @@ // Project: https://github.com/mar10/fancytree // Definitions by: Peter Palotas // Mahdi Abedi +// Nikolai Ommundsen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.8 /// @@ -737,7 +738,20 @@ declare namespace Fancytree { /** Make sure that the active node is always visible, i.e. its parents are expanded (default: true). */ activeVisible?: boolean; /** Default options for ajax requests. */ - ajax?: Object; + ajax?: { + /** + * HTTP Method (default: 'GET') + */ + type: string; + /** + * false: Append random '_' argument to the request url to prevent caching. + */ + cache: boolean; + /** + * Default 'json' -> Expect json format and pass json object to callbacks. + */ + dataType: string; + }; /** (default: false) Add WAI-ARIA attributes to markup */ aria?: boolean; /** Activate a node when focused with the keyboard (default: true) */ @@ -750,21 +764,23 @@ declare namespace Fancytree { checkbox?: boolean; /** Defines what happens, when the user click a folder node. (default: activate_dblclick_expands) */ clickFolderMode?: FancytreeClickFolderMode; - /** 0..2 (null: use global setting $.ui.fancytree.debugInfo) */ - debugLevel?: number; + /** 0..4 (null: use global setting $.ui.fancytree.debugInfo) */ + debugLevel?: 0 | 1 | 2 | 3 | 4; /** callback(node) is called for new nodes without a key. Must return a new unique key. (default null: generates default keys like that: "_" + counter) */ defaultKey?: (node: FancytreeNode) => string; /** Accept passing ajax data in a property named `d` (default: true). */ enableAspx?: boolean; + /** Enable titles (default: false) */ + enableTitles?: boolean; /** List of active extensions (default: []) */ - extensions?: Array; + extensions?: Array; /** Set focus when node is checked by a mouse click (default: false) */ focusOnSelect?: boolean; /** Add `id="..."` to node markup (default: true). */ generateIds?: boolean; - /** Display node icons (default: true) */ - icons?: boolean; - /** (default: "ft_") */ + /** Node icon url, if only filename, please use imagePath to set the path */ + icon?: boolean | string; + /** Prefix (default: "ft_") */ idPrefix?: string; /** Path to a folder containing icons (default: null, using 'skin/' subdirectory). */ imagePath?: string; @@ -776,217 +792,298 @@ declare namespace Fancytree { minExpandLevel?: number; /** navigate to next node by typing the first letters (default: false) */ quicksearch?: boolean; + /** Right to left mode (default: false) */ + rtl?: false; /** optional margins for node.scrollIntoView() (default: {top: 0, bottom: 0}) */ - scrollOfs?: Object; + scrollOfs?: { top: number, bottom: number }; /** scrollable container for node.scrollIntoView() (default: $container) */ - scrollParent?: JQuery; + scrollParent?: JQuery | null; /** default: multi_hier */ selectMode?: FancytreeSelectMode; /** Used to Initialize the tree. */ - source?: any; + source?: any[] | any; /** Translation table */ - strings?: Object; + strings?: TranslationTable; /** Add tabindex='0' to container, so tree can be reached using TAB */ tabbable?: boolean; /** Add tabindex='0' to node title span, so it can receive keyboard focus */ titlesTabbable?: boolean; /** Animation options, false:off (default: { effect: "blind", options: {direction: "vertical", scale: "box"}, duration: 200 }) */ toggleEffect?: JQueryUI.EffectOptions; + /** Tooltips */ + tooltip?: boolean; //////////////// // EXTENSIONS // //////////////// - dnd5?: ExtensionDragAndDrop5; - filter?: ExtensionFilter; - table?: ExtensionTable; + dnd5?: Extensions.DragAndDrop5; + filter?: Extensions.Filter; + table?: Extensions.Table; /** Options for misc extensions - see docs for typings */ [extension: string]: any; } - interface Extensions { - dnd5?: ExtensionDragAndDrop5; - filter?: ExtensionFilter; - table?: ExtensionTable; - [extension: string]: any; + + interface TranslationTable { + /** + * "Loading..." // … would be escaped when escapeTitles is true + */ + loading: string; + /** + * "Load error!" + */ + loadError: string; + /** + * "More..." + */ + moreData: string; + /** + * "No data." + */ + noData: string; } - interface ExtensionDragAndDrop5 { - /** - * Expand nodes after n milliseconds of hovering. - */ - autoExpandMS?: number; - /** - * Absolute position offset for .fancytree-drop-marker - */ - dropMarkerOffsetX?: number; - /** - * Additional offset for drop-marker with hitMode = "before"/"after" - */ - dropMarkerInsertOffsetX?: number; - /** - * true: Drag multiple (i.e. selected) nodes. - */ - multiSource?: boolean; - /** - * Prevent dropping nodes from different Fancytrees - */ - preventForeignNodes?: boolean; - /** - * Prevent dropping items other than Fancytree nodes - */ - preventNonNodes?: boolean; - /** - * Prevent dropping nodes on own descendants - */ - preventRecursiveMoves?: boolean; - /** - * Prevent dropping nodes 'before self', etc. - */ - preventVoidMoves?: boolean; - /** - * Enable auto-scrolling while dragging - */ - scroll?: boolean; - /** - * Active top/bottom margin in pixel - */ - scrollSensitivity?: number; - /** - * Pixel per event - */ - scrollSpeed?: number; - /** - * Core options - */ - source: { - url: string; + + namespace Extensions { + interface List { + dnd5?: DragAndDrop5; + filter?: Filter; + table?: Table; + [extension: string]: any; + } + + interface DragAndDrop5 { + /** + * Expand nodes after n milliseconds of hovering. + */ + autoExpandMS?: number; + /** + * Absolute position offset for .fancytree-drop-marker + */ + dropMarkerOffsetX?: number; + /** + * Additional offset for drop-marker with hitMode = "before"/"after" + */ + dropMarkerInsertOffsetX?: number; + /** + * true: Drag multiple (i.e. selected) nodes. + */ + multiSource?: boolean; + /** + * Prevent dropping nodes from different Fancytrees + */ + preventForeignNodes?: boolean; + /** + * Prevent dropping items other than Fancytree nodes + */ + preventNonNodes?: boolean; + /** + * Prevent dropping nodes on own descendants + */ + preventRecursiveMoves?: boolean; + /** + * Prevent dropping nodes 'before self', etc. + */ + preventVoidMoves?: boolean; + /** + * Enable auto-scrolling while dragging + */ + scroll?: boolean; + /** + * Active top/bottom margin in pixel + */ + scrollSensitivity?: number; + /** + * Pixel per event + */ + scrollSpeed?: number; + /** + * Allow dragging of nodes to different IE windows, default: false + */ + setTextTypeJson?: boolean; + /** + * Callback(sourceNode, data), return true, to enable dnd drag + */ + dragStart?: (sourceNode: FancytreeNode, data: any) => void; + dragDrag?: (sourceNode: FancytreeNode, data: any) => void; + dragEnd?: (sourceNode: FancytreeNode, data: any) => void; + /** + * Callback(targetNode, data), return true, to enable dnd drop + */ + dragEnter?: (targetNode: FancytreeNode, data: any) => void; + /** + * Events (drag over) + */ + dragOver?: (targetNode: FancytreeNode, data: any) => void; + /** + * Callback(targetNode, data), return false to prevent autoExpand + */ + dragExpand?: (targetNode: FancytreeNode, data: any) => void; + /** + * Events (drag drop) + */ + dragDrop?: (node: FancytreeNode, data: any) => void; + dragLeave?: (targetNode: FancytreeNode, data: any) => void; + /** + * Support misc options + */ + [key: string]: any; } /** - * Events (drag support) + * Define filter-extension options */ - dragStart?: (sourceNode: FancytreeNode, data: any) => void; + interface Filter { + /** + * Re-apply last filter if lazy data is loaded + */ + autoApply: boolean; + /** + * Expand all branches that contain matches while filtered + */ + autoExpand: boolean; + /** + * Show a badge with number of matching child nodes near parent icons + */ + counter: boolean; + /** + * Match single characters in order, e.g. 'fb' will match 'FooBar' + */ + fuzzy: boolean; + /** + * Hide counter badge if parent is expanded + */ + hideExpandedCounter: boolean; + /** + * Hide expanders if all child nodes are hidden by filter + */ + hideExpanders: boolean; + /** + * Highlight matches by wrapping inside tags + */ + highlight: boolean; + /** + * Match end nodes only + */ + leavesOnly: boolean; + /** + * Display a 'no data' status node if result is empty + */ + nodata: boolean; + /** + * Grayout unmatched nodes (pass "hide" to remove unmatched node instead); default 'dimm' + */ + mode: 'dimm' | 'string'; + /** + * Support misc options + */ + [key: string]: any; + } /** - * Events (drop support) + * Define table-extension options */ - dragEnter: (targetNode: FancytreeNode, data: any) => void; - /** - * Events (drag over) - */ - dragOver: (targetNode: FancytreeNode, data: any) => void; - /** - * Events (drag drop) - */ - dragDrop: (node: FancytreeNode, data: any) => void; - /** - * Support misc options - */ - [key: string]: any; + interface Table { + /** + * Render the checkboxes into the this column index (default: nodeColumnIdx) + */ + checkboxColumnIdx: any; + /** + * Indent every node level by 16px; default: 16 + */ + indentation: number; + /** + * Render node expander, icon, and title to this column (default: 0) + */ + nodeColumnIdx: number; + /** + * Support misc options + */ + [key: string]: any; + } } - /** - * Define filter-extension options - */ - interface ExtensionFilter { - mode: string; - /** - * Support misc options - */ - [key: string]: any; + + + /** Data object passed to FancytreeNode() constructor. Note: typically these attributes are accessed by meber methods, e.g. `node.isExpanded()` and `node.setSelected(false)`. */ + interface NodeData { + /** node text (may contain HTML tags) */ + title: string; + icon?: string; + /** unique key for this node (auto-generated if omitted) */ + key?: string; + /** (reserved) */ + refKey?: string; + expanded?: boolean; + /** (initialization only, but will not be stored with the node). */ + active?: boolean; + /** (initialization only, but will not be stored with the node). */ + focus?: boolean; + folder?: boolean; + hideCheckbox?: boolean; + lazy?: boolean; + selected?: boolean; + unselectable?: boolean; + /** optional array of child nodes */ + children?: NodeData[]; + tooltip?: string; + /** class names added to the node markup (separate with space) */ + extraClasses?: string; + /** all properties from will be copied to `node.data` */ + data?: Object; } - /** - * Define table-extension options - */ - interface ExtensionTable { - indentation: number; - nodeColumnIdx: number; - /** - * Support misc options - */ - [key: string]: any; + + /** Data object similar to NodeData, but with additional options. + * May be passed to FancytreeNode#applyPatch (Every property that is omitted (or set to undefined) will be ignored) */ + interface NodePatch { + /** (not yet implemented) */ + appendChildren?: NodeData; + /** (not yet implemented) */ + replaceChildren?: NodeData; + /** (not yet implemented) */ + insertChildren?: NodeData; + } + + /** May be passed to Fancytree#applyPatch. */ + interface TreePatch { + [key: string]: NodePatch; + } + + interface FancytreeStatic { + buildType: string; + debugLevel: number; + version: string; + + /** Throw an error if condition fails (debug method). */ + assert(cond: boolean, msg: string): void; + + /** Return a function that executes *fn* at most every *timeout* ms. */ + debounce void>(timeout: number, fn: T, invokeAsap?: boolean, ctx?: any): T; + + debug(msg: string): void; + + error(msg: string): void; + + escapeHtml(s: string): string; + + getEventTarget(event: Event): Object; + + getEventTargetType(event: Event): string; + + getNode(el: JQuery): FancytreeNode; + getNode(el: Event): FancytreeNode; + getNode(el: Element): FancytreeNode; + + info(msg: string): void; + + /** Convert a keydown event to a string like 'ctrl+a', 'ctrl+shift+f2'. */ + keyEventToString(event: Event): string; + + /** Parse tree data from HTML markup */ + parseHtml($ul: JQuery): NodeData[]; + + /** Add Fancytree extension definition to the list of globally available extensions. */ + registerExtension(definition: Object): void; + + unescapeHtml(s: string): string; + + warn(msg: string): void; } } -/** Data object passed to FancytreeNode() constructor. Note: typically these attributes are accessed by meber methods, e.g. `node.isExpanded()` and `node.setSelected(false)`. */ -interface NodeData { - /** node text (may contain HTML tags) */ - title: string; - icon?: string; - /** unique key for this node (auto-generated if omitted) */ - key?: string; - /** (reserved) */ - refKey?: string; - expanded?: boolean; - /** (initialization only, but will not be stored with the node). */ - active?: boolean; - /** (initialization only, but will not be stored with the node). */ - focus?: boolean; - folder?: boolean; - hideCheckbox?: boolean; - lazy?: boolean; - selected?: boolean; - unselectable?: boolean; - /** optional array of child nodes */ - children?: NodeData[]; - tooltip?: string; - /** class names added to the node markup (separate with space) */ - extraClasses?: string; - /** all properties from will be copied to `node.data` */ - data?: Object; -} - -/** Data object similar to NodeData, but with additional options. - * May be passed to FancytreeNode#applyPatch (Every property that is omitted (or set to undefined) will be ignored) */ -interface NodePatch { - /** (not yet implemented) */ - appendChildren?: NodeData; - /** (not yet implemented) */ - replaceChildren?: NodeData; - /** (not yet implemented) */ - insertChildren?: NodeData; -} - -/** May be passed to Fancytree#applyPatch. */ -interface TreePatch { - [key: string]: NodePatch; -} - -interface FancytreeStatic { - buildType: string; - debugLevel: number; - version: string; - - /** Throw an error if condition fails (debug method). */ - assert(cond: boolean, msg: string): void; - - /** Return a function that executes *fn* at most every *timeout* ms. */ - debounce void>(timeout: number, fn: T, invokeAsap?: boolean, ctx?: any): T; - - debug(msg: string): void; - - error(msg: string): void; - - escapeHtml(s: string): string; - - getEventTarget(event: Event): Object; - - getEventTargetType(event: Event): string; - - getNode(el: JQuery): FancytreeNode; - getNode(el: Event): FancytreeNode; - getNode(el: Element): FancytreeNode; - - info(msg: string): void; - - /** Convert a keydown event to a string like 'ctrl+a', 'ctrl+shift+f2'. */ - keyEventToString(event: Event): string; - - /** Parse tree data from HTML markup */ - parseHtml($ul: JQuery): NodeData[]; - - /** Add Fancytree extension definition to the list of globally available extensions. */ - registerExtension(definition: Object): void; - - unescapeHtml(s: string): string; - - warn(msg: string): void; -} -} - diff --git a/types/jquery.fancytree/jquery.fancytree-tests.ts b/types/jquery.fancytree/jquery.fancytree-tests.ts index 4fa52c790a..9f90f74779 100644 --- a/types/jquery.fancytree/jquery.fancytree-tests.ts +++ b/types/jquery.fancytree/jquery.fancytree-tests.ts @@ -1,4 +1,4 @@ -$("#tree").fancytree({ +$("#tree").fancytree({ source: [ { title: "Node 1", key: "1" }, { @@ -12,9 +12,9 @@ $("#tree").fancytree({ { title: "Node 1", key: "1" }, { title: "Folder 2", key: "2", folder: true, children: [ - { title: "Node 2.1", key: "3" }, - { title: "Node 2.2", key: "4" } - ] + { title: "Node 2.1", key: "3" }, + { title: "Node 2.2", key: "4" } + ] } ] } @@ -44,9 +44,9 @@ $("#tree").fancytree({ //$("#tree").fancytree(); -var tree : Fancytree.Fancytree = $("#tree").fancytree("getTree"); +var tree: Fancytree.Fancytree = $("#tree").fancytree("getTree"); -var activeNode : Fancytree.FancytreeNode = tree.getRootNode(); +var activeNode: Fancytree.FancytreeNode = tree.getRootNode(); // Sort children of active node: activeNode.sortChildren(); @@ -65,15 +65,15 @@ activeNode.addChildren({ tree.loadKeyPath("/1/2", function (node, status) { if (status === "loaded") { console.log("loaded intermiediate node " + node); - } else if (status === "ok") { + } else if (status === "ok") { node.setActive(); } }); -var node = $.ui.fancytree.getNode($("#tree")); +var node = $.ui.fancytree.getNode($("#tree")); alert($.ui.fancytree.version); -var f = $.ui.fancytree.debounce(50, (a : number) => { console.log(a); }, true); -f(2); +var f = $.ui.fancytree.debounce(50, (a: number) => { console.log(a); }, true); +f(2); node = tree.getFirstChild(); node.setExpanded().done(function () { From 4c2753ac90f35cbfecd94f17d7cd3fc46c30ddcc Mon Sep 17 00:00:00 2001 From: Nikolai Ommundsen Date: Wed, 6 Jun 2018 14:23:06 +0200 Subject: [PATCH 006/163] Updated tests --- types/jquery.fancytree/jquery.fancytree-tests.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/jquery.fancytree/jquery.fancytree-tests.ts b/types/jquery.fancytree/jquery.fancytree-tests.ts index cbdbec0782..8f9707597e 100644 --- a/types/jquery.fancytree/jquery.fancytree-tests.ts +++ b/types/jquery.fancytree/jquery.fancytree-tests.ts @@ -22,6 +22,10 @@ $("#tree").fancytree({ ] } ], + extensions: ['dnd5'], + dnd5: { + dragDrag: (node, data) => { } + }, click: (ev: JQueryEventObject, node: Fancytree.EventData) => { return true; }, From 5f701a0df2536e3ba5e5a0ca8c4fe7a9d840295a Mon Sep 17 00:00:00 2001 From: Nikolai Ommundsen Date: Wed, 6 Jun 2018 14:25:03 +0200 Subject: [PATCH 007/163] Set correct version number --- types/jquery.fancytree/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jquery.fancytree/index.d.ts b/types/jquery.fancytree/index.d.ts index 2e3c8b5223..d370b06f4d 100644 --- a/types/jquery.fancytree/index.d.ts +++ b/types/jquery.fancytree/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jquery.fancytree 2.7.0 +// Type definitions for jquery.fancytree 2.28.2-0 // Project: https://github.com/mar10/fancytree // Definitions by: Peter Palotas // Mahdi Abedi From 9f22f5e16eac3bd10d6104bfb685fa97d412aa62 Mon Sep 17 00:00:00 2001 From: Anup Kishore Date: Wed, 6 Jun 2018 15:08:42 -0400 Subject: [PATCH 008/163] Update koa-bodyparser Parsed body should be `unknown` type (simulated until release in Typescript 3.0). Any manipulations on `body` should come with type assertions and/or verification. Note, this is a major change, and a significant tightening of type safety. --- types/koa-bodyparser/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/koa-bodyparser/index.d.ts b/types/koa-bodyparser/index.d.ts index 256a2fad0a..1664e86cac 100644 --- a/types/koa-bodyparser/index.d.ts +++ b/types/koa-bodyparser/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for koa-bodyparser 4.2 +// Type definitions for koa-bodyparser 5.0 // Project: https://github.com/koajs/bodyparser -// Definitions by: Jerry Chin +// Definitions by: Jerry Chin , Anup Kishore // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -18,8 +18,8 @@ import * as Koa from "koa"; declare module "koa" { interface Request { - body: any; - rawBody: any; + body: {} | null | undefined; + rawBody: {} | null | undefined; } } From 01650deebdf6e58bf47c5fbd4c26c072922e1e62 Mon Sep 17 00:00:00 2001 From: giuseppelt Date: Thu, 7 Jun 2018 00:52:25 +0200 Subject: [PATCH 009/163] Merge-stream typings definition update Merge accepts arguments that can be both a single stream or an array of streams. --- types/merge-stream/index.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/merge-stream/index.d.ts b/types/merge-stream/index.d.ts index 5a5493b06e..6c6426b902 100644 --- a/types/merge-stream/index.d.ts +++ b/types/merge-stream/index.d.ts @@ -12,6 +12,5 @@ interface IMergedStream extends NodeJS.ReadWriteStream { isEmpty(): boolean; } -declare function merge(streams: T[]): IMergedStream; -declare function merge(...streams: T[]): IMergedStream; +declare function merge(...streams: (T | T[])[]): IMergedStream; export = merge; From af0c902725e9cd72c845f110009f6f8af598f3bd Mon Sep 17 00:00:00 2001 From: Daniel Waxweiler Date: Thu, 7 Jun 2018 09:53:26 +0200 Subject: [PATCH 010/163] initial release --- types/tinycon/index.d.ts | 24 ++++++++++++++++++++++++ types/tinycon/tinycon-tests.ts | 11 +++++++++++ types/tinycon/tsconfig.json | 23 +++++++++++++++++++++++ types/tinycon/tslint.json | 7 +++++++ 4 files changed, 65 insertions(+) create mode 100644 types/tinycon/index.d.ts create mode 100644 types/tinycon/tinycon-tests.ts create mode 100644 types/tinycon/tsconfig.json create mode 100644 types/tinycon/tslint.json diff --git a/types/tinycon/index.d.ts b/types/tinycon/index.d.ts new file mode 100644 index 0000000000..9393a1aa6f --- /dev/null +++ b/types/tinycon/index.d.ts @@ -0,0 +1,24 @@ +// Type definitions for tinycon 0.6 +// Project: https://github.com/tommoor/tinycon +// Definitions by: Daniel Waxweiler +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace Tinycon { + function setBubble(count: number): void; + + function setOptions(options: TinyconOptions): void; + + interface TinyconOptions { + abbreviate?: boolean; + background?: string; + color?: string; + fallback?: boolean; + font?: string; + height?: number; + width?: number; + } +} + +declare module "tinycon" { + export = Tinycon; +} diff --git a/types/tinycon/tinycon-tests.ts b/types/tinycon/tinycon-tests.ts new file mode 100644 index 0000000000..3004a503ef --- /dev/null +++ b/types/tinycon/tinycon-tests.ts @@ -0,0 +1,11 @@ +Tinycon.setOptions({ + abbreviate: false, + background: '#549A2F', + color: '#ffffff', + fallback: true, + font: '10px arial', + height: 9, + width: 7 +}); + +Tinycon.setBubble(7); diff --git a/types/tinycon/tsconfig.json b/types/tinycon/tsconfig.json new file mode 100644 index 0000000000..2410f4bd8a --- /dev/null +++ b/types/tinycon/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", + "tinycon-tests.ts" + ] +} diff --git a/types/tinycon/tslint.json b/types/tinycon/tslint.json new file mode 100644 index 0000000000..bd3bb78849 --- /dev/null +++ b/types/tinycon/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "no-declare-current-package": false, + "no-single-declare-module": false + } +} From a780a84a3756418e9844d9a9ee80205406872323 Mon Sep 17 00:00:00 2001 From: Tim de Koning Date: Thu, 7 Jun 2018 11:27:58 +0200 Subject: [PATCH 011/163] Redux-form allows form-values of any type in the store via Field.parse() --- types/redux-form/index.d.ts | 1 + types/redux-form/lib/reducer.d.ts | 2 +- types/redux-form/v6/lib/reducer.d.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/types/redux-form/index.d.ts b/types/redux-form/index.d.ts index 8ee5fa9698..742a702505 100644 --- a/types/redux-form/index.d.ts +++ b/types/redux-form/index.d.ts @@ -7,6 +7,7 @@ // Alex Young // Anton Novik // Huw Martin +// Tim de Koning // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 diff --git a/types/redux-form/lib/reducer.d.ts b/types/redux-form/lib/reducer.d.ts index 9e865fc6c1..6324ab92e6 100644 --- a/types/redux-form/lib/reducer.d.ts +++ b/types/redux-form/lib/reducer.d.ts @@ -18,7 +18,7 @@ export interface FormStateMap { export interface FormState { registeredFields: RegisteredFieldState[]; fields?: {[name: string]: FieldState}; - values?: { [fieldName: string]: string }; + values?: { [fieldName: string]: any }; active?: string; anyTouched?: boolean; submitting?: boolean; diff --git a/types/redux-form/v6/lib/reducer.d.ts b/types/redux-form/v6/lib/reducer.d.ts index 1800391863..9089a8802d 100644 --- a/types/redux-form/v6/lib/reducer.d.ts +++ b/types/redux-form/v6/lib/reducer.d.ts @@ -29,7 +29,7 @@ export interface FormStateMap { export interface FormState { registeredFields: RegisteredFieldState[]; fields?: {[name: string]: FieldState}; - values?: { [fieldName: string]: string }; + values?: { [fieldName: string]: any }; active?: string; anyTouched?: boolean; submitting?: boolean; From 00fb68a64c7e671fa5c868149c5aa381943a7726 Mon Sep 17 00:00:00 2001 From: David Bishop Date: Thu, 7 Jun 2018 19:28:56 +1000 Subject: [PATCH 012/163] [sequelize/v3] Deferrable option mistakenly refers to the interface and not it's contents --- types/sequelize/v3/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/sequelize/v3/index.d.ts b/types/sequelize/v3/index.d.ts index eafa70b641..11b6775846 100644 --- a/types/sequelize/v3/index.d.ts +++ b/types/sequelize/v3/index.d.ts @@ -4339,7 +4339,7 @@ declare namespace sequelize { * * PostgreSQL only */ - deferrable?: Deferrable; + deferrable?: DeferrableInitiallyDeferred | DeferrableInitiallyImmediate | DeferrableNot | DeferrableSetDeferred | DeferrableSetImmediate; } From b28fdbabd902ce2615921f1eafdc30005f0f045a Mon Sep 17 00:00:00 2001 From: Tim de Koning Date: Thu, 7 Jun 2018 11:31:38 +0200 Subject: [PATCH 013/163] Bump version --- types/redux-form/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/redux-form/index.d.ts b/types/redux-form/index.d.ts index 742a702505..336ab9ade4 100644 --- a/types/redux-form/index.d.ts +++ b/types/redux-form/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for redux-form 7.2 +// Type definitions for redux-form 7.3 // Project: https://github.com/erikras/redux-form // Definitions by: Carson Full // Daniel Lytkin From 3ae8647ef0786498126cbccccac2431a1defde38 Mon Sep 17 00:00:00 2001 From: Daniel Waxweiler Date: Thu, 7 Jun 2018 12:22:53 +0200 Subject: [PATCH 014/163] initial release --- types/i18next-ko/i18next-ko-tests.ts | 24 ++++++++++++++++++++++++ types/i18next-ko/index.d.ts | 26 ++++++++++++++++++++++++++ types/i18next-ko/tsconfig.json | 23 +++++++++++++++++++++++ types/i18next-ko/tslint.json | 6 ++++++ 4 files changed, 79 insertions(+) create mode 100644 types/i18next-ko/i18next-ko-tests.ts create mode 100644 types/i18next-ko/index.d.ts create mode 100644 types/i18next-ko/tsconfig.json create mode 100644 types/i18next-ko/tslint.json diff --git a/types/i18next-ko/i18next-ko-tests.ts b/types/i18next-ko/i18next-ko-tests.ts new file mode 100644 index 0000000000..2bf683aaf6 --- /dev/null +++ b/types/i18next-ko/i18next-ko-tests.ts @@ -0,0 +1,24 @@ +import * as i18next from 'i18next'; +import i18nextko = require('i18nextko'); +import * as ko from 'knockout'; + +const resourceStore = { + en: { + translation: { + testTranslation: 'Test translation' + } + }, + + de: { + translation: { + testTranslation: 'Test-Übersetzung' + } + } +}; +i18nextko.init(resourceStore, 'en', ko); + +i18nextko.setLanguage('de'); + +i18nextko.i18n; + +i18nextko.t('testTranslation'); diff --git a/types/i18next-ko/index.d.ts b/types/i18next-ko/index.d.ts new file mode 100644 index 0000000000..6fdc771031 --- /dev/null +++ b/types/i18next-ko/index.d.ts @@ -0,0 +1,26 @@ +// Type definitions for i18next-ko 3.0 +// Project: https://github.com/leMaik/i18next-ko +// Definitions by: Daniel Waxweiler +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module 'i18nextko' { + import i18next = require('i18next'); + + const i18n: i18next.i18n; + + function init(resourceStore: i18nextkoResourceStore, language: string, ko: KnockoutStatic): void; + + function setLanguage(language: string): void; + + function t(key: string): KnockoutComputed; + + interface i18nextkoResourceStore { + [language: string]: { + translation: { + [key: string]: string + } + }; + } +} diff --git a/types/i18next-ko/tsconfig.json b/types/i18next-ko/tsconfig.json new file mode 100644 index 0000000000..9509fa509e --- /dev/null +++ b/types/i18next-ko/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", + "i18next-ko-tests.ts" + ] +} diff --git a/types/i18next-ko/tslint.json b/types/i18next-ko/tslint.json new file mode 100644 index 0000000000..075fa88707 --- /dev/null +++ b/types/i18next-ko/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "no-single-declare-module": false + } +} From b33addce043fe7402f18b3ca4230592af4f85366 Mon Sep 17 00:00:00 2001 From: Daniel Waxweiler Date: Thu, 7 Jun 2018 12:27:33 +0200 Subject: [PATCH 015/163] harmonize imports --- types/i18next-ko/i18next-ko-tests.ts | 2 +- types/i18next-ko/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/i18next-ko/i18next-ko-tests.ts b/types/i18next-ko/i18next-ko-tests.ts index 2bf683aaf6..a84a2bdbd7 100644 --- a/types/i18next-ko/i18next-ko-tests.ts +++ b/types/i18next-ko/i18next-ko-tests.ts @@ -1,5 +1,5 @@ import * as i18next from 'i18next'; -import i18nextko = require('i18nextko'); +import * as i18nextko from 'i18nextko'; import * as ko from 'knockout'; const resourceStore = { diff --git a/types/i18next-ko/index.d.ts b/types/i18next-ko/index.d.ts index 6fdc771031..11436a6211 100644 --- a/types/i18next-ko/index.d.ts +++ b/types/i18next-ko/index.d.ts @@ -6,7 +6,7 @@ /// declare module 'i18nextko' { - import i18next = require('i18next'); + import * as i18next from 'i18next'; const i18n: i18next.i18n; From 1e48ff58545a6561a5e8840ef91db27390681e35 Mon Sep 17 00:00:00 2001 From: Daniel Waxweiler Date: Thu, 7 Jun 2018 12:37:21 +0200 Subject: [PATCH 016/163] add same TypeScript version as i18next requires --- types/i18next-ko/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/i18next-ko/index.d.ts b/types/i18next-ko/index.d.ts index 11436a6211..28d33c5817 100644 --- a/types/i18next-ko/index.d.ts +++ b/types/i18next-ko/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/leMaik/i18next-ko // Definitions by: Daniel Waxweiler // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// From 5e1d37e648cab65c3bf42e5e897e24174d06243c Mon Sep 17 00:00:00 2001 From: Javier Gonzalez Date: Thu, 7 Jun 2018 20:00:54 +0200 Subject: [PATCH 017/163] [react-rnd] Fix for default export The class is exported as default. If you use TS without synthetic imports enabled then the import doesn't work. This little change fixes that (tested). --- types/react-rnd/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-rnd/index.d.ts b/types/react-rnd/index.d.ts index 31d477ca5e..78beb27c54 100644 --- a/types/react-rnd/index.d.ts +++ b/types/react-rnd/index.d.ts @@ -117,4 +117,4 @@ declare namespace Rnd { declare class Rnd extends React.Component> {} -export = Rnd; +export default Rnd; From 968ad3d444d56d178b76d3d8dc39d48463e3fe47 Mon Sep 17 00:00:00 2001 From: Javier Gonzalez Date: Thu, 7 Jun 2018 20:18:28 +0200 Subject: [PATCH 018/163] Update react-rnd-tests.tsx --- types/react-rnd/react-rnd-tests.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/types/react-rnd/react-rnd-tests.tsx b/types/react-rnd/react-rnd-tests.tsx index 9f1cbc593c..070c793f87 100644 --- a/types/react-rnd/react-rnd-tests.tsx +++ b/types/react-rnd/react-rnd-tests.tsx @@ -1,7 +1,8 @@ -import React = require('react'); -import Rnd = require('react-rnd'); +import * as React from 'react'; +import Rnd from 'react-rnd'; +import { ResizeHandler } from 'react-rnd'; -const onResize: Rnd.ResizeHandler = (e, direction, ref, delta, position) => { +const onResize: ResizeHandler = (e, direction, ref, delta, position) => { direction === 'right'; delta.width; delta.height; From 93b7d2a1d3d29b36ae461cdf79199306a05b6053 Mon Sep 17 00:00:00 2001 From: Javier Gonzalez Date: Thu, 7 Jun 2018 20:19:24 +0200 Subject: [PATCH 019/163] Update index.d.ts --- types/react-rnd/index.d.ts | 213 +++++++++++++++++++------------------ 1 file changed, 107 insertions(+), 106 deletions(-) diff --git a/types/react-rnd/index.d.ts b/types/react-rnd/index.d.ts index 78beb27c54..ff5ac2078e 100644 --- a/types/react-rnd/index.d.ts +++ b/types/react-rnd/index.d.ts @@ -4,117 +4,118 @@ // fsubal // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 -import React = require('react'); +import * as React from "react"; type CSSProperties = React.CSSProperties; -declare namespace Rnd { - type Direction = - | 'bottom' - | 'bottomLeft' - | 'bottomRight' - | 'left' - | 'right' - | 'top' - | 'topLeft' - | 'topRight'; +export type Direction = + | "bottom" + | "bottomLeft" + | "bottomRight" + | "left" + | "right" + | "top" + | "topLeft" + | "topRight"; - interface Enable { - bottom?: boolean; - bottomLeft?: boolean; - bottomRight?: boolean; - left?: boolean; - right?: boolean; - top?: boolean; - topLeft?: boolean; - topRight?: boolean; - } - - interface HandleClasses { - bottom?: string; - bottomLeft?: string; - bottomRight?: string; - left?: string; - right?: string; - top?: string; - topLeft?: string; - topRight?: string; - } - - interface HandleStyles { - bottom?: CSSProperties; - bottomLeft?: CSSProperties; - bottomRight?: CSSProperties; - left?: CSSProperties; - right?: CSSProperties; - top?: CSSProperties; - topLeft?: CSSProperties; - topRight?: CSSProperties; - } - - interface Position { - x: number; - y: number; - } - - interface Size { - width: number; - height: number; - } - - interface DraggableData { - node: HTMLElement; - x: number; - y: number; - deltaX: number; - deltaY: number; - lastX: number; - lastY: number; - } - - type DraggableEventHandler = (e: MouseEvent | TouchEvent, data: DraggableData) => void|false; - - type ResizeHandler = ( - e: MouseEvent|TouchEvent, - direction: Direction, - ref: HTMLDivElement, - delta: Size, - position: Position - ) => void; - - interface Options { - default: { - x?: number; - y?: number; - width?: number|string; - height?: number|string; - }; - className: string; - style: any; - width: number|string; - height: number|string; - minWidth: number|string; - minHeight: number|string; - maxWidth: number|string; - maxHeight: number|string; - z: number; - resizeHandleClasses: HandleClasses; - resizeHandleStyles: HandleStyles; - - lockAspectRatio: boolean; - enableResizing?: Enable; - disableDragging?: boolean; - - onResizeStart: () => void; - onResize: () => void; - onResizeStop: ResizeHandler; - - onDragStart: DraggableEventHandler; - onDrag: DraggableEventHandler; - onDragStop: DraggableEventHandler; - } +export interface Enable { + bottom?: boolean; + bottomLeft?: boolean; + bottomRight?: boolean; + left?: boolean; + right?: boolean; + top?: boolean; + topLeft?: boolean; + topRight?: boolean; } -declare class Rnd extends React.Component> {} +export interface HandleClasses { + bottom?: string; + bottomLeft?: string; + bottomRight?: string; + left?: string; + right?: string; + top?: string; + topLeft?: string; + topRight?: string; +} + +export interface HandleStyles { + bottom?: CSSProperties; + bottomLeft?: CSSProperties; + bottomRight?: CSSProperties; + left?: CSSProperties; + right?: CSSProperties; + top?: CSSProperties; + topLeft?: CSSProperties; + topRight?: CSSProperties; +} + +export interface Position { + x: number; + y: number; +} + +export interface Size { + width: number; + height: number; +} + +export interface DraggableData { + node: HTMLElement; + x: number; + y: number; + deltaX: number; + deltaY: number; + lastX: number; + lastY: number; +} + +export type DraggableEventHandler = ( + e: MouseEvent | TouchEvent, + data: DraggableData +) => void | false; + +export type ResizeHandler = ( + e: MouseEvent | TouchEvent, + direction: Direction, + ref: HTMLDivElement, + delta: Size, + position: Position +) => void; + +export interface Options { + default: { + x?: number; + y?: number; + width?: number | string; + height?: number | string; + }; + className: string; + style: any; + width: number | string; + height: number | string; + minWidth: number | string; + minHeight: number | string; + maxWidth: number | string; + maxHeight: number | string; + z: number; + resizeHandleClasses: HandleClasses; + resizeHandleStyles: HandleStyles; + + lockAspectRatio: boolean; + enableResizing?: Enable; + disableDragging?: boolean; + + onResizeStart: () => void; + onResize: () => void; + onResizeStop: ResizeHandler; + + onDragStart: DraggableEventHandler; + onDrag: DraggableEventHandler; + onDragStop: DraggableEventHandler; +} + +declare class Rnd extends React.Component> {} export default Rnd; From e61a6fdb97b739ad4d66d7ada4b4e6627b009e3a Mon Sep 17 00:00:00 2001 From: Javier Gonzalez Date: Thu, 7 Jun 2018 20:35:17 +0200 Subject: [PATCH 020/163] Update react-rnd-tests.tsx --- types/react-rnd/react-rnd-tests.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/react-rnd/react-rnd-tests.tsx b/types/react-rnd/react-rnd-tests.tsx index 070c793f87..461a0d03ba 100644 --- a/types/react-rnd/react-rnd-tests.tsx +++ b/types/react-rnd/react-rnd-tests.tsx @@ -1,6 +1,5 @@ import * as React from 'react'; -import Rnd from 'react-rnd'; -import { ResizeHandler } from 'react-rnd'; +import { default as Rnd, ResizeHandler } from "react-rnd"; const onResize: ResizeHandler = (e, direction, ref, delta, position) => { direction === 'right'; From d9a55fde8509f7d8cb32acc517f7ac1b4b9eab91 Mon Sep 17 00:00:00 2001 From: NeoDobby Date: Fri, 8 Jun 2018 09:21:48 +0200 Subject: [PATCH 021/163] [ace] Add missing parameter to setScrollLeft --- types/ace/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/ace/index.d.ts b/types/ace/index.d.ts index 828aab87c2..7faa5da4f8 100644 --- a/types/ace/index.d.ts +++ b/types/ace/index.d.ts @@ -832,8 +832,9 @@ declare namespace AceAjax { /** * [Sets the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.setScrollLeft} + * @param scrollLeft The new scroll left value **/ - setScrollLeft(): void; + setScrollLeft(scrollLeft: number): void; /** * [Returns the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.getScrollLeft} From 543cb570ecb5d01e4a0f397d18ed970ac7e7432a Mon Sep 17 00:00:00 2001 From: Matthias Juchmes Date: Fri, 8 Jun 2018 10:34:52 +0200 Subject: [PATCH 022/163] Add tests --- types/ace/test/edit_session.ts | 39 +++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/types/ace/test/edit_session.ts b/types/ace/test/edit_session.ts index 4713495f7a..29b3bb6bd8 100644 --- a/types/ace/test/edit_session.ts +++ b/types/ace/test/edit_session.ts @@ -18,6 +18,23 @@ function createFoldTestSession() { return session; } +function createScrollTestRenderer(): AceAjax.VirtualRenderer | null { + var el = document.createElement("div"); + + if (!el.getBoundingClientRect) { + console.log("Skipping test: This test only runs in the browser"); + return null; + } + + el.style.left = "20px"; + el.style.top = "30px"; + el.style.width = "300px"; + el.style.height = "100px"; + document.body.appendChild(el); + + return new AceAjax.VirtualRenderer(el); +} + function assertArray(a, b) { assert.equal(a + "", b + ""); assert.ok(a.length == b.length); @@ -915,5 +932,25 @@ const aceEditSessionTests = { session = new AceAjax.EditSession(new Array(30).join("\n")); session.documentToScreenPosition(2, 0); session.documentToScreenPosition(2, 0); + }, + + "test setScrollTop()": function() { + var renderer = createScrollTestRenderer(); + var session = new AceAjax.EditSession(["1", "2", "3", "2", "3", "4"]); + renderer.setSession(session); + assert.equal(renderer.getScrollTop(), 0); + session.setScrollTop(40); + assert.equal(renderer.getScrollTop(), 40); + renderer.getScrollTop() + }, + + "test setScrollLeft()": function() { + var renderer = createScrollTestRenderer(); + var session = new AceAjax.EditSession(["1", "2", "3", "2", "3", "4"]); + renderer.setSession(session); + assert.equal(renderer.getScrollLeft(), 0); + session.setScrollLeft(40); + assert.equal(renderer.getScrollLeft(), 40); + renderer.getScrollLeft() } -}; \ No newline at end of file +}; From 046a1d2e8a89ca99956204620f37c7a55a3c9f9b Mon Sep 17 00:00:00 2001 From: valjusha <40063546+valjusha@users.noreply.github.com> Date: Fri, 8 Jun 2018 16:21:28 +0300 Subject: [PATCH 023/163] Update index.d.ts, Added props: idPrefix added props: 'idPrefix' proof: https://github.com/mozilla-services/react-jsonschema-form/pull/806/commits/21f5049110508827cc94d8aecd9d97bbe2db8251 --- types/react-jsonschema-form/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-jsonschema-form/index.d.ts b/types/react-jsonschema-form/index.d.ts index ef1b359e5d..52903e8375 100644 --- a/types/react-jsonschema-form/index.d.ts +++ b/types/react-jsonschema-form/index.d.ts @@ -35,6 +35,7 @@ declare module "react-jsonschema-form" { >; safeRenderCompletion?: boolean; transformErrors?: (errors: AjvError[]) => AjvError[]; + idPrefix?: string; // HTML Attributes id?: string; From ef4d8921b756af4d2781d6581401529c25e7af4c Mon Sep 17 00:00:00 2001 From: enricodvn Date: Fri, 8 Jun 2018 11:08:54 -0300 Subject: [PATCH 024/163] association as string on IncludeOptions interface --- types/sequelize/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index c847c073b8..7c6bb3213d 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -3232,9 +3232,10 @@ declare namespace sequelize { as?: string; /** - * The association you want to eagerly load. (This can be used instead of providing a model/as pair) + * The association you want to eagerly load. (This can be used instead of providing a model/as pair). + * You can also use the association alias. */ - association?: IncludeAssociation; + association?: IncludeAssociation | string; /** * Where clauses to apply to the child models. Note that this converts the eager load to an inner join, From 301055840f07c5220a5597a8445dc6f7336ac028 Mon Sep 17 00:00:00 2001 From: Andrew Makarov Date: Fri, 8 Jun 2018 22:22:26 +0300 Subject: [PATCH 025/163] [react-places-autocomplete] Update typings --- types/react-places-autocomplete/index.d.ts | 6 +++ .../react-places-autocomplete-tests.tsx | 52 +++++++++++++++++++ types/react-places-autocomplete/tsconfig.json | 11 +++- 3 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 types/react-places-autocomplete/react-places-autocomplete-tests.tsx diff --git a/types/react-places-autocomplete/index.d.ts b/types/react-places-autocomplete/index.d.ts index 667106d916..f05820bbce 100644 --- a/types/react-places-autocomplete/index.d.ts +++ b/types/react-places-autocomplete/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for react-places-autocomplete 6.1 // Project: https://github.com/kenny-hibino/react-places-autocomplete/ // Definitions by: Guilherme Hübner +// Andrew Makarov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 // @@ -56,6 +57,11 @@ export interface PropTypes { } export function geocodeByAddress(address: string, callback: (results: google.maps.GeocoderResult[], status: google.maps.GeocoderStatus) => void): void; +export function geocodeByAddress(address: string): Promise; + export function geocodeByPlaceId(placeId: string, callback: (results: google.maps.GeocoderResult[], status: google.maps.GeocoderStatus) => void): void; +export function geocodeByPlaceId(placeId: string): Promise; + +export function getLatLng(results: google.maps.GeocoderResult): Promise; export default class PlacesAutocomplete extends React.Component {} diff --git a/types/react-places-autocomplete/react-places-autocomplete-tests.tsx b/types/react-places-autocomplete/react-places-autocomplete-tests.tsx new file mode 100644 index 0000000000..41e6ff37b4 --- /dev/null +++ b/types/react-places-autocomplete/react-places-autocomplete-tests.tsx @@ -0,0 +1,52 @@ +import * as React from 'react'; +import PlacesAutocomplete, { geocodeByAddress, geocodeByPlaceId, getLatLng } from 'react-places-autocomplete'; + +class Test extends React.Component { + state = { + address: 'San Francisco, CA', + placeId: '12345', + }; + + handleFormSubmit = (event: any) => { + event.preventDefault(); + + const { address, placeId } = this.state; + + // Old API + geocodeByAddress(address, (results, status) => { + const latLng = getLatLng(results[0]); + console.info(latLng, status); + }); + + geocodeByPlaceId(placeId, (results, status) => { + const latLng = getLatLng(results[0]); + console.info(latLng, status); + }); + + // New API + geocodeByAddress(address) + .then((results) => getLatLng(results[0])) + .then((latLng) => console.log('Success', latLng)) + .catch((error) => console.error('Error', error)); + + geocodeByPlaceId(placeId) + .then((results) => getLatLng(results[0])) + .then((latLng) => console.log('Success', latLng)) + .catch((error) => console.error('Error', error)); + } + + onChange = (address: string) => this.setState({ address }); + + render() { + const inputProps = { + value: this.state.address, + onChange: this.onChange, + }; + + return ( +
+ + + ); + } +} diff --git a/types/react-places-autocomplete/tsconfig.json b/types/react-places-autocomplete/tsconfig.json index 02dbd0279c..6f45bffc51 100644 --- a/types/react-places-autocomplete/tsconfig.json +++ b/types/react-places-autocomplete/tsconfig.json @@ -1,12 +1,19 @@ { - "files": ["index.d.ts"], + "files": [ + "index.d.ts", + "react-places-autocomplete-tests.tsx" + ], "compilerOptions": { "module": "commonjs", - "lib": ["es6"], + "lib": [ + "es6", + "dom" + ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, "strictFunctionTypes": true, + "jsx": "react", "baseUrl": "../", "typeRoots": ["../"], "types": [], From 7925e4a5e2c344188effb8e2907ee306993d1578 Mon Sep 17 00:00:00 2001 From: Aoinu Date: Sat, 9 Jun 2018 17:52:27 +0900 Subject: [PATCH 026/163] Corrected id_str type from number to string --- types/twit/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/twit/index.d.ts b/types/twit/index.d.ts index 89d28766b3..9e9747c256 100644 --- a/types/twit/index.d.ts +++ b/types/twit/index.d.ts @@ -24,7 +24,7 @@ declare module 'twit' { */ export interface Contributors { id: number, - id_str: number, + id_str: string, screen_name: string, } @@ -169,7 +169,7 @@ declare module 'twit' { created_at: string, current_user_retweet?: { id: number, - id_str: number, + id_str: string, }, entities: Entities, favorite_count?: number, From 4121b339e9ccd31a5385030a7c6ed1e4d160c8b4 Mon Sep 17 00:00:00 2001 From: Aoinu Date: Sat, 9 Jun 2018 17:53:39 +0900 Subject: [PATCH 027/163] Adapted Params.user_id for User.id_str --- 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 9e9747c256..f4a7be74b4 100644 --- a/types/twit/index.d.ts +++ b/types/twit/index.d.ts @@ -257,7 +257,7 @@ declare module 'twit' { id?: string, slug?: string, status?: string, - user_id?: number, + user_id?: number | string, lat?: number, long?: number, follow?: boolean, From 086916085691570c93785f63f6448107cd927da0 Mon Sep 17 00:00:00 2001 From: Resi Respati Date: Sun, 10 Jun 2018 13:19:06 +0700 Subject: [PATCH 028/163] [signale] Add typings for signale --- types/signale/index.d.ts | 134 +++++++++++++++++++++++++++++++++ types/signale/signale-tests.ts | 129 +++++++++++++++++++++++++++++++ types/signale/tsconfig.json | 23 ++++++ types/signale/tslint.json | 1 + 4 files changed, 287 insertions(+) create mode 100644 types/signale/index.d.ts create mode 100644 types/signale/signale-tests.ts create mode 100644 types/signale/tsconfig.json create mode 100644 types/signale/tslint.json diff --git a/types/signale/index.d.ts b/types/signale/index.d.ts new file mode 100644 index 0000000000..b9cca921a8 --- /dev/null +++ b/types/signale/index.d.ts @@ -0,0 +1,134 @@ +// Type definitions for signale 1.1 +// Project: https://github.com/klauscfhq/signale +// Definitions by: Resi Respati +// Kingdaro +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace Signale { + type DefaultMethods = + | "await" + | "complete" + | "error" + | "debug" + | "fatal" + | "fav" + | "info" + | "note" + | "pause" + | "pending" + | "star" + | "start" + | "success" + | "warn" + | "watch" + | "log"; + + interface CommandType { + /** The icon corresponding to the logger. */ + badge: string; + /** + * The color of the label, can be any of the foreground colors supported by + * [chalk](https://github.com/chalk/chalk#colors). + */ + color: string; + /** The label used to identify the type of the logger. */ + label: string; + } + + interface SignaleConfig { + /** Display the scope name of the logger. */ + displayScope?: boolean; + /** Display the badge of the logger. */ + displayBadge?: boolean; + /** Display the current local date in `YYYY-MM-DD` format. */ + displayDate?: boolean; + /** Display the name of the file that the logger is reporting from. */ + displayFilename?: boolean; + /** Display the label of the logger. */ + displayLabel?: boolean; + /** Display the current local time in `HH:MM:SS` format. */ + displayTimestamp?: boolean; + /** Underline the logger label. */ + underlineLabel?: boolean; + /** Underline the logger message. */ + underlineMessage?: boolean; + } + + interface SignaleOptions { + /** Sets the configuration of an instance overriding any existing global or local configuration. */ + config?: SignaleConfig; + /** + * Name of the scope. + */ + scope?: string; + /** + * Holds the configuration of the custom and default loggers. + */ + types?: Partial>; + interactive?: boolean; + timers?: Map; + /** + * Destination to which the data is written, can be any valid + * [Writable stream](https://nodejs.org/api/stream.html#stream_writable_streams). + */ + stream?: NodeJS.WriteStream; + } + + interface SignaleConstructor { + new ( + options?: SignaleOptions + ): Signale; + } + + interface SignaleBase { + /** + * Sets the configuration of an instance overriding any existing global or local configuration. + * + * @param configObj Can hold any of the documented options. + */ + config(configObj: SignaleConfig): Signale; + /** + * Defines the scope name of the logger. + * + * @param name Can be one or more comma delimited strings. + */ + scope(...name: string[]): Signale; + /** Clears the scope name of the logger. */ + unscope(): void; + /** + * Sets a timers and accepts an optional label. If none provided the timer will receive a unique label automatically. + * + * @param label Label corresponding to the timer. Each timer must have its own unique label. + * @returns {string} a string corresponding to the timer label. + */ + time(label?: string): string; + /** + * Deactivates the timer to which the given label corresponds. If no label + * is provided the most recent timer, that was created without providing a + * label, will be deactivated. + * + * @param label Label corresponding to the timer, each timer has its own unique label. + * @param span Total running time. + */ + timeEnd( + label?: string, + span?: number + ): { label: string; span?: number }; + } + + type LoggerFunc = (message?: any, ...optionalArgs: any[]) => void; + type Signale = SignaleBase & + Record & + Record; +} + +declare const Signale: Signale.Signale & { + Signale: Signale.SignaleConstructor; + SignaleConfig: Signale.SignaleConfig; + SignaleOptions: Signale.SignaleOptions; + DefaultMethods: Signale.DefaultMethods; +}; +export = Signale; +export as namespace Signale; diff --git a/types/signale/signale-tests.ts b/types/signale/signale-tests.ts new file mode 100644 index 0000000000..9d4ab8fa27 --- /dev/null +++ b/types/signale/signale-tests.ts @@ -0,0 +1,129 @@ +/// + +import signale, { Signale, SignaleOptions } from "signale"; + +// --- Test 1: Basic Usage --- // + +signale.success("Operation successful"); +signale.debug("Hello", "from", "L59"); +signale.pending("Write release notes for 1.2.0"); +signale.fatal(new Error("Unable to acquire lock")); +signale.watch("Recursively watching build directory..."); +signale.complete({ + prefix: "[task]", + message: "Fix issue #59", + suffix: "(@klauscfhq)" +}); + +// --- Test 2: Custom Loggers --- // + +type CustomLogger = "remind" | "santa"; + +const optionsCustom: SignaleOptions = { + stream: process.stdout, + scope: "custom", + types: { + remind: { + badge: "**", + color: "yellow", + label: "reminder" + }, + santa: { + badge: "🎅", + color: "red", + label: "santa" + } + } +}; + +const custom = new Signale(optionsCustom); +custom.remind("Improve documentation."); +custom.santa("Hoho! You have an unused variable on L45."); +custom.debug("This should still work"); + +// --- Test 3: Overriding Default Loggers --- // + +const optionsOverride: SignaleOptions = { + types: { + error: { + badge: "!!", + color: "red", + label: "fatal error" + }, + success: { + badge: "++", + color: "green", + label: "huge success" + } + } +}; + +signale.error("Default Error Log"); +signale.success("Default Success Log"); + +const customOverride = new Signale(optionsOverride); +customOverride.error("Custom Error Log"); +customOverride.success("Custom Success Log"); + +// --- Test 4: Scoped Loggers --- // + +const optionsScope: SignaleOptions = { + scope: "global scope" +}; + +const global = new Signale(optionsScope); +global.success("Successful Operation"); + +const global2 = signale.scope("global scope"); +global2.success("Hello from the global scope"); + +function scopedTest() { + const outer = global2.scope("outer", "scope"); + outer.success("Hello from the outer scope"); + + setTimeout(() => { + const inner = outer.scope("inner", "scope"); + inner.success("Hello from the inner scope"); + }, 500); +} + +scopedTest(); + +// --- Test 5: Timers --- // + +signale.time("test"); +signale.time(); +signale.time(); + +setTimeout(() => { + signale.timeEnd(); + signale.timeEnd(); + signale.timeEnd("test"); +}, 500); + +// --- Test 6: Configuration --- // + +// Overrides any existing `package.json` config +signale.config({ + displayFilename: true, + displayTimestamp: true, + displayDate: false +}); + +signale.success("Hello from the Global scope"); + +function scopedConfigTest() { + // `fooLogger` inherits the config of `signale` + const fooLogger = signale.scope("foo scope"); + + // Overrides both `signale` and `package.json` configs + fooLogger.config({ + displayFilename: true, + displayTimestamp: false, + displayDate: true + }); + + fooLogger.success("Hello from the Local scope"); +} + +scopedConfigTest(); diff --git a/types/signale/tsconfig.json b/types/signale/tsconfig.json new file mode 100644 index 0000000000..172a154db7 --- /dev/null +++ b/types/signale/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "signale-tests.ts" + ] +} diff --git a/types/signale/tslint.json b/types/signale/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/signale/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 7ccf7974a6d4b3d0844bcda7ad6f51613da9c743 Mon Sep 17 00:00:00 2001 From: Resi Respati Date: Sun, 10 Jun 2018 13:24:13 +0700 Subject: [PATCH 029/163] [signale] added strictFunctionTypes in tsconfig, run dtslint --- types/signale/index.d.ts | 3 ++- types/signale/tsconfig.json | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/types/signale/index.d.ts b/types/signale/index.d.ts index b9cca921a8..4bca64397d 100644 --- a/types/signale/index.d.ts +++ b/types/signale/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Resi Respati // Kingdaro // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.7 /// @@ -101,7 +102,7 @@ declare namespace Signale { * Sets a timers and accepts an optional label. If none provided the timer will receive a unique label automatically. * * @param label Label corresponding to the timer. Each timer must have its own unique label. - * @returns {string} a string corresponding to the timer label. + * @returns a string corresponding to the timer label. */ time(label?: string): string; /** diff --git a/types/signale/tsconfig.json b/types/signale/tsconfig.json index 172a154db7..ef5b67d941 100644 --- a/types/signale/tsconfig.json +++ b/types/signale/tsconfig.json @@ -7,6 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From bb008afbdb920b8974b83e32f1744001280e2c22 Mon Sep 17 00:00:00 2001 From: Resi Respati Date: Sun, 10 Jun 2018 13:32:28 +0700 Subject: [PATCH 030/163] [signale] remove unnecessary reference to node in tests --- types/signale/signale-tests.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/types/signale/signale-tests.ts b/types/signale/signale-tests.ts index 9d4ab8fa27..d4c867b018 100644 --- a/types/signale/signale-tests.ts +++ b/types/signale/signale-tests.ts @@ -1,5 +1,3 @@ -/// - import signale, { Signale, SignaleOptions } from "signale"; // --- Test 1: Basic Usage --- // From c46e2cef094e1f9d2fa34659a495f9fbbaf8952f Mon Sep 17 00:00:00 2001 From: Aankhen Date: Sun, 10 Jun 2018 15:44:17 +0530 Subject: [PATCH 031/163] [p-timeout] Accept `PromiseLike` --- types/p-timeout/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/p-timeout/index.d.ts b/types/p-timeout/index.d.ts index 882cc7adc8..40e1dc6410 100644 --- a/types/p-timeout/index.d.ts +++ b/types/p-timeout/index.d.ts @@ -5,8 +5,8 @@ export = pTimeout; -declare function pTimeout(input: Promise, ms: number, message?: string | pTimeout.TimeoutError): Promise; -declare function pTimeout(input: Promise, ms: number, fallback: () => R | Promise): Promise; +declare function pTimeout(input: PromiseLike, ms: number, message?: string | pTimeout.TimeoutError): Promise; +declare function pTimeout(input: PromiseLike, ms: number, fallback: () => R | Promise): Promise; declare namespace pTimeout { class TimeoutError extends Error { From 46412bc2c947d478f428ac37b2e3589572a1eaf2 Mon Sep 17 00:00:00 2001 From: Tobenna Date: Mon, 11 Jun 2018 00:23:28 +0100 Subject: [PATCH 032/163] Types for bencode --- types/bencode/bencode-tests.ts | 6 ++++++ types/bencode/index.d.ts | 24 ++++++++++++++++++++++++ types/bencode/tsconfig.json | 23 +++++++++++++++++++++++ types/bencode/tslint.json | 1 + 4 files changed, 54 insertions(+) create mode 100644 types/bencode/bencode-tests.ts create mode 100644 types/bencode/index.d.ts create mode 100644 types/bencode/tsconfig.json create mode 100644 types/bencode/tslint.json diff --git a/types/bencode/bencode-tests.ts b/types/bencode/bencode-tests.ts new file mode 100644 index 0000000000..9099587819 --- /dev/null +++ b/types/bencode/bencode-tests.ts @@ -0,0 +1,6 @@ +import bencode from 'bencode'; + +bencode.byteLength('abcde'); // $ExpectType number +bencode.encodingLength('abcde'); // $ExpectType number +bencode.encode([1, 2, 3, 4] , new Buffer([]), 1); // $ExpectType Buffer +bencode.decode(new Buffer('abcde'), 1, 3); // $ExpectType any diff --git a/types/bencode/index.d.ts b/types/bencode/index.d.ts new file mode 100644 index 0000000000..0efab7e2dc --- /dev/null +++ b/types/bencode/index.d.ts @@ -0,0 +1,24 @@ +// Type definitions for bencode 2.0 +// Project: https://github.com/themasch/node-bencode#readme +// Definitions by: Tobenna +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace bencode { + function byteLength(value: any): number; + function encodingLength(value: any): number; + function encode( + data: any, + buffer?: Buffer, + offset?: number + ): Buffer; + function decode( + data: Buffer, + start?: number, + end?: number, + encoding?: string + ): any; +} + +export default bencode; diff --git a/types/bencode/tsconfig.json b/types/bencode/tsconfig.json new file mode 100644 index 0000000000..47220efa5a --- /dev/null +++ b/types/bencode/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", + "bencode-tests.ts" + ] +} diff --git a/types/bencode/tslint.json b/types/bencode/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/bencode/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From ff48240ce0f8a8ad49dff72880780dde64b66eb1 Mon Sep 17 00:00:00 2001 From: Resi Respati Date: Mon, 11 Jun 2018 12:09:40 +0700 Subject: [PATCH 033/163] [signale] renamed Signale namespace, minor fixes to tests --- types/signale/index.d.ts | 18 ++++++++++-------- types/signale/signale-tests.ts | 4 +++- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/types/signale/index.d.ts b/types/signale/index.d.ts index 4bca64397d..8690a4dcef 100644 --- a/types/signale/index.d.ts +++ b/types/signale/index.d.ts @@ -2,12 +2,13 @@ // Project: https://github.com/klauscfhq/signale // Definitions by: Resi Respati // Kingdaro +// Joydip Roy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.7 /// -declare namespace Signale { +declare namespace signale { type DefaultMethods = | "await" | "complete" @@ -125,11 +126,12 @@ declare namespace Signale { Record; } -declare const Signale: Signale.Signale & { - Signale: Signale.SignaleConstructor; - SignaleConfig: Signale.SignaleConfig; - SignaleOptions: Signale.SignaleOptions; - DefaultMethods: Signale.DefaultMethods; +declare const signale: signale.Signale & { + Signale: signale.SignaleConstructor; + SignaleConfig: signale.SignaleConfig; + SignaleOptions: signale.SignaleOptions; + DefaultMethods: signale.DefaultMethods; }; -export = Signale; -export as namespace Signale; + +export = signale; +export as namespace signale; diff --git a/types/signale/signale-tests.ts b/types/signale/signale-tests.ts index d4c867b018..7fd96638a8 100644 --- a/types/signale/signale-tests.ts +++ b/types/signale/signale-tests.ts @@ -1,7 +1,9 @@ -import signale, { Signale, SignaleOptions } from "signale"; +import { Signale, SignaleOptions } from "signale"; // --- Test 1: Basic Usage --- // +const signale = new Signale(); + signale.success("Operation successful"); signale.debug("Hello", "from", "L59"); signale.pending("Write release notes for 1.2.0"); From 6c9f3c8f96047621445db6357b7cea415ea2380c Mon Sep 17 00:00:00 2001 From: Resi Respati Date: Mon, 11 Jun 2018 15:29:45 +0700 Subject: [PATCH 034/163] [signale] remove `export as namespace` declaration No globals is exported, actually. --- types/signale/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/signale/index.d.ts b/types/signale/index.d.ts index 8690a4dcef..d14660e5a9 100644 --- a/types/signale/index.d.ts +++ b/types/signale/index.d.ts @@ -134,4 +134,3 @@ declare const signale: signale.Signale & { }; export = signale; -export as namespace signale; From d21252db7de6b7cc1c1f5432f3ece29e19c7e956 Mon Sep 17 00:00:00 2001 From: Konstantin Rohde Date: Mon, 11 Jun 2018 12:24:03 +0200 Subject: [PATCH 035/163] Types for the Datatables.net Scroller Extension --- .../datatables.net-scroller-tests.ts | 13 +++ types/datatables.net-scroller/index.d.ts | 101 ++++++++++++++++++ types/datatables.net-scroller/tsconfig.json | 24 +++++ types/datatables.net-scroller/tslint.json | 1 + 4 files changed, 139 insertions(+) create mode 100644 types/datatables.net-scroller/datatables.net-scroller-tests.ts create mode 100644 types/datatables.net-scroller/index.d.ts create mode 100644 types/datatables.net-scroller/tsconfig.json create mode 100644 types/datatables.net-scroller/tslint.json diff --git a/types/datatables.net-scroller/datatables.net-scroller-tests.ts b/types/datatables.net-scroller/datatables.net-scroller-tests.ts new file mode 100644 index 0000000000..cb93306ba0 --- /dev/null +++ b/types/datatables.net-scroller/datatables.net-scroller-tests.ts @@ -0,0 +1,13 @@ +$(document).ready(() => { + const config: DataTables.Settings = { + // Scroller extension options + scroller: { + trace: true, + rowHeight: 30, + serverWait: 1000, + displayBuffer: 10, + boundaryScale: 0.6, + loadingIndicator: true + } + }; +}); diff --git a/types/datatables.net-scroller/index.d.ts b/types/datatables.net-scroller/index.d.ts new file mode 100644 index 0000000000..e6608903d6 --- /dev/null +++ b/types/datatables.net-scroller/index.d.ts @@ -0,0 +1,101 @@ +// Type definitions for datatables.net-scroller 1.4.3 +// Project: https://datatables.net/extensions/scroller/ +// Definitions by: Konstantin Rohde +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +/// +/// + +declare namespace DataTables { + interface Settings { + /* + * Select extension options + */ + scroller?: boolean | ScrollerSettings; + } + + interface ScrollerSettings { + /* + * Indicate if Scroller show show trace information on the console or not. + */ + trace?: boolean; + + /* + * Scroller will attempt to automatically calculate the height of rows for it's internal + * calculations. However the height that is used can be overridden using this parameter. + */ + rowHeight?: number | string; + + /* + * When using server-side processing, Scroller will wait a small amount of time to allow + * the scrolling to finish before requesting more data from the server. + */ + serverWait?: number; + + /* + * The display buffer is what Scroller uses to calculate how many rows it should pre-fetch + * for scrolling. + */ + displayBuffer?: number; + + /* + * Scroller uses the boundary scaling factor to decide when to redraw the table - which it + * typically does before you reach the end of the currently loaded data set (in order to + * allow the data to look continuous to a user scrolling through the data). + */ + boundaryScale?: number; + + /* + * Show (or not) the loading element in the background of the table. Note that you should + * include the dataTables.scroller.css file for this to be displayed correctly. + */ + loadingIndicator?: boolean; + } + + interface Api { + scroller: { + /* + * Calculate and store information about how many rows are to be displayed + * in the scrolling viewport, based on current dimensions in the browser's + * rendering. + */ + measure(redraw?: boolean): Api; + /* + * Get information about current displayed record range. + */ + page(): PageInfo; + }; + scroller(): ScrollerApi; + } + + interface ScrollerApi extends Api { + /* + * Calculate the pixel position from the top of the scrolling container for + * a given row + */ + rowToPixels(rowIdx: number, intParse?: boolean, virtual?: boolean): number; + /* + * Calculate the row number that will be found at the given pixel position + * (y-scroll). + */ + pixelsToRow(pixels: number, intParse?: boolean, virtual?: boolean): number; + scrollToRow(rowIdx: number, animate?: boolean): Api; + } + + /* + * start: {int}, // the 0-indexed record at the top of the viewport + * end: {int}, // the 0-indexed record at the bottom of the viewport + */ + interface PageInfo { + start: number; + end: number; + } + + interface RowMethods { + /** + * Scroll to a row + */ + scrollTo(animate?: boolean): Api; + } +} diff --git a/types/datatables.net-scroller/tsconfig.json b/types/datatables.net-scroller/tsconfig.json new file mode 100644 index 0000000000..41b8182a6e --- /dev/null +++ b/types/datatables.net-scroller/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "datatables.net-scroller-tests.ts" + ] +} \ No newline at end of file diff --git a/types/datatables.net-scroller/tslint.json b/types/datatables.net-scroller/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/datatables.net-scroller/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 4fdf91b10a5e63019969f33faa9359c71b5175af Mon Sep 17 00:00:00 2001 From: Konstantin Rohde Date: Mon, 11 Jun 2018 12:42:35 +0200 Subject: [PATCH 036/163] Reformatted for dtslint --- types/datatables.net-scroller/index.d.ts | 73 +++++++++++++----------- 1 file changed, 39 insertions(+), 34 deletions(-) diff --git a/types/datatables.net-scroller/index.d.ts b/types/datatables.net-scroller/index.d.ts index e6608903d6..e0b9e54d9a 100644 --- a/types/datatables.net-scroller/index.d.ts +++ b/types/datatables.net-scroller/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for datatables.net-scroller 1.4.3 +// Type definitions for datatables.net-scroller 1.4 // Project: https://datatables.net/extensions/scroller/ // Definitions by: Konstantin Rohde // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -35,14 +35,14 @@ declare namespace DataTables { /* * The display buffer is what Scroller uses to calculate how many rows it should pre-fetch - * for scrolling. + * for scrolling. */ displayBuffer?: number; /* * Scroller uses the boundary scaling factor to decide when to redraw the table - which it * typically does before you reach the end of the currently loaded data set (in order to - * allow the data to look continuous to a user scrolling through the data). + * allow the data to look continuous to a user scrolling through the data). */ boundaryScale?: number; @@ -54,33 +54,38 @@ declare namespace DataTables { } interface Api { - scroller: { - /* - * Calculate and store information about how many rows are to be displayed - * in the scrolling viewport, based on current dimensions in the browser's - * rendering. - */ - measure(redraw?: boolean): Api; - /* - * Get information about current displayed record range. - */ - page(): PageInfo; - }; - scroller(): ScrollerApi; + scroller: ScrollerMethodsModel; } - interface ScrollerApi extends Api { - /* - * Calculate the pixel position from the top of the scrolling container for - * a given row - */ - rowToPixels(rowIdx: number, intParse?: boolean, virtual?: boolean): number; - /* - * Calculate the row number that will be found at the given pixel position - * (y-scroll). - */ - pixelsToRow(pixels: number, intParse?: boolean, virtual?: boolean): number; - scrollToRow(rowIdx: number, animate?: boolean): Api; + interface ScrollerMethodsModel { + /* + * Calculate and store information about how many rows are to be displayed + * in the scrolling viewport, based on current dimensions in the browser's + * rendering. + */ + measure(redraw?: boolean): Api; + /* + * Get information about current displayed record range. + */ + page(): PageInfo; + /* + * Get Scroller Api + */ + scroller(): ScrollerMethods; + } + + interface ScrollerMethods extends Api { + /* + * Calculate the pixel position from the top of the scrolling container for + * a given row + */ + rowToPixels(rowIdx: number, intParse?: boolean, virtual?: boolean): number; + /* + * Calculate the row number that will be found at the given pixel position + * (y-scroll). + */ + pixelsToRow(pixels: number, intParse?: boolean, virtual?: boolean): number; + scrollToRow(rowIdx: number, animate?: boolean): Api; } /* @@ -88,14 +93,14 @@ declare namespace DataTables { * end: {int}, // the 0-indexed record at the bottom of the viewport */ interface PageInfo { - start: number; - end: number; + start: number; + end: number; } interface RowMethods { - /** - * Scroll to a row - */ - scrollTo(animate?: boolean): Api; + /** + * Scroll to a row + */ + scrollTo(animate?: boolean): Api; } } From 11c510ffedf81966bd6e72e16a5b369eabaaf1ff Mon Sep 17 00:00:00 2001 From: Konstantin Rohde Date: Mon, 11 Jun 2018 12:55:31 +0200 Subject: [PATCH 037/163] Neu erstellt mit dts-gen --- types/datatables.net-scroller/index.d.ts | 3 +-- types/datatables.net-scroller/tsconfig.json | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/types/datatables.net-scroller/index.d.ts b/types/datatables.net-scroller/index.d.ts index e0b9e54d9a..8004952d12 100644 --- a/types/datatables.net-scroller/index.d.ts +++ b/types/datatables.net-scroller/index.d.ts @@ -1,8 +1,7 @@ // Type definitions for datatables.net-scroller 1.4 -// Project: https://datatables.net/extensions/scroller/ +// Project: https://datatables.net // Definitions by: Konstantin Rohde // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 /// /// diff --git a/types/datatables.net-scroller/tsconfig.json b/types/datatables.net-scroller/tsconfig.json index 41b8182a6e..cb89487bce 100644 --- a/types/datatables.net-scroller/tsconfig.json +++ b/types/datatables.net-scroller/tsconfig.json @@ -2,13 +2,11 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6", - "dom" + "es6" ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, - "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" @@ -21,4 +19,4 @@ "index.d.ts", "datatables.net-scroller-tests.ts" ] -} \ No newline at end of file +} From 93e09c6b5e8e268f2ed8a02a78829cca9a1362f0 Mon Sep 17 00:00:00 2001 From: Konstantin Rohde Date: Mon, 11 Jun 2018 12:58:02 +0200 Subject: [PATCH 038/163] Another dtslint fix. --- types/datatables.net-scroller/tsconfig.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/datatables.net-scroller/tsconfig.json b/types/datatables.net-scroller/tsconfig.json index cb89487bce..29e1854557 100644 --- a/types/datatables.net-scroller/tsconfig.json +++ b/types/datatables.net-scroller/tsconfig.json @@ -2,11 +2,13 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From 4891dc0d009a9c1946db1a8f237d77ba18f481c4 Mon Sep 17 00:00:00 2001 From: Konstantin Rohde Date: Mon, 11 Jun 2018 13:53:16 +0200 Subject: [PATCH 039/163] Added Typescript version --- types/datatables.net-scroller/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/datatables.net-scroller/index.d.ts b/types/datatables.net-scroller/index.d.ts index 8004952d12..fe97507712 100644 --- a/types/datatables.net-scroller/index.d.ts +++ b/types/datatables.net-scroller/index.d.ts @@ -2,6 +2,7 @@ // Project: https://datatables.net // Definitions by: Konstantin Rohde // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 /// /// From 99d96642b47e5b25cb90d4b87eff54c6e89d828f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Mon, 11 Jun 2018 15:56:02 +0400 Subject: [PATCH 040/163] :bug: PouchDB-find: return ExistingDocument instead of Document --- types/pouchdb-find/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/pouchdb-find/index.d.ts b/types/pouchdb-find/index.d.ts index 7f5f925f8c..1ccd3d4c14 100644 --- a/types/pouchdb-find/index.d.ts +++ b/types/pouchdb-find/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for pouchdb-find 6.3 // Project: https://pouchdb.com/ // Definitions by: Jakub Navratil +// Sebastian Ramirez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -100,7 +101,7 @@ declare namespace PouchDB { } interface FindResponse { - docs: Array>; + docs: Array>; } interface CreateIndexOptions { From 08d10b4ee3995d4b4f499f903b580f0dee7e3c96 Mon Sep 17 00:00:00 2001 From: Konstantin Rohde Date: Mon, 11 Jun 2018 17:21:26 +0200 Subject: [PATCH 041/163] * Drilldown Module bare type * LangOption shortWeekdays was missing: (https://api.highcharts.com/highcharts/lang.shortWeekdays) --- types/highcharts/index.d.ts | 6 ++++++ types/highcharts/modules/drilldown.d.ts | 10 ++++++++++ 2 files changed, 16 insertions(+) create mode 100644 types/highcharts/modules/drilldown.d.ts diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index 1434999411..b1541031ec 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -2661,6 +2661,12 @@ declare namespace Highcharts { * @default ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] */ shortMonths?: string[]; + /** + * Short week days, starting Sunday. If not specified, Highcharts uses the first three letters of the lang.weekdays option. + * @default undefined + * @since 4.2.4 + */ + shortWeekdays?: string[]; /** * The default thousands separator used in the Highcharts.numberFormat method unless otherwise specified in the * function arguments. Since Highcharts 4.1 it defaults to a single space character, which is compatible with ISO diff --git a/types/highcharts/modules/drilldown.d.ts b/types/highcharts/modules/drilldown.d.ts new file mode 100644 index 0000000000..ec75eb5605 --- /dev/null +++ b/types/highcharts/modules/drilldown.d.ts @@ -0,0 +1,10 @@ +// Type definitions for Highcharts Drilldown 4.2.7 +// Project: http://www.highcharts.com/ +// Definitions by: Konstantin Rohde +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { Static } from "highcharts"; + +declare function HighchartsDrilldown(H: Static): Static; +export = HighchartsDrilldown; +export as namespace HighchartsDrilldown; \ No newline at end of file From 6c9e5b5b87340021caab89ce6c2afaf2c209602e Mon Sep 17 00:00:00 2001 From: Konstantin Rohde Date: Mon, 11 Jun 2018 17:40:00 +0200 Subject: [PATCH 042/163] Test and Reference in Config added --- types/highcharts/test/drilldown.ts | 1 + types/highcharts/tsconfig.json | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 types/highcharts/test/drilldown.ts diff --git a/types/highcharts/test/drilldown.ts b/types/highcharts/test/drilldown.ts new file mode 100644 index 0000000000..f4aa33ca4a --- /dev/null +++ b/types/highcharts/test/drilldown.ts @@ -0,0 +1 @@ +HighchartsDrilldown(Highcharts); diff --git a/types/highcharts/tsconfig.json b/types/highcharts/tsconfig.json index 24b0cf2dd7..e69f0eeb57 100644 --- a/types/highcharts/tsconfig.json +++ b/types/highcharts/tsconfig.json @@ -21,6 +21,7 @@ "index.d.ts", "modules/map/index.d.ts", "modules/boost.d.ts", + "modules/drilldown.d.ts", "modules/exporting.d.ts", "modules/no-data-to-display.d.ts", "modules/offline-exporting.d.ts", @@ -28,6 +29,7 @@ "highstock.d.ts", "js/highcharts/index.d.ts", "test/boost.ts", + "test/drilldown.ts", "test/exporting.ts", "test/highstock.ts", "test/index.ts", From 9021c55d20dc1663e679b95c5a415e8872f58921 Mon Sep 17 00:00:00 2001 From: Konstantin Rohde Date: Mon, 11 Jun 2018 17:52:33 +0200 Subject: [PATCH 043/163] EOF Newline --- types/highcharts/modules/drilldown.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/highcharts/modules/drilldown.d.ts b/types/highcharts/modules/drilldown.d.ts index ec75eb5605..adf9bae6f8 100644 --- a/types/highcharts/modules/drilldown.d.ts +++ b/types/highcharts/modules/drilldown.d.ts @@ -7,4 +7,4 @@ import { Static } from "highcharts"; declare function HighchartsDrilldown(H: Static): Static; export = HighchartsDrilldown; -export as namespace HighchartsDrilldown; \ No newline at end of file +export as namespace HighchartsDrilldown; From f87d0ba5f6bd0915ea72a6cc00f35ae1f0e31896 Mon Sep 17 00:00:00 2001 From: "John R. Pelt" Date: Mon, 11 Jun 2018 12:57:11 -0500 Subject: [PATCH 044/163] Fix allowed ExportingContextButton.menuItems types https://api.highcharts.com/highcharts/exporting.buttons.contextButton.menuItems menuItems are allowed to be either string[] | MenuItem[] --- types/highcharts/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index 1434999411..a675bcf084 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -2354,7 +2354,7 @@ declare namespace Highcharts { * can be customized by defining a new array of items and assigning null to unwanted positions. * @since 2.0 */ - menuItems?: MenuItem[]; + menuItems?: string[] | MenuItem[]; /** * A click handler callback to use on the button directly instead of the popup menu. * @since 2.0 From 4f4c1575beb06e1e906c1dcc6f1003f1bb2c2c23 Mon Sep 17 00:00:00 2001 From: Mitchell Wills Date: Mon, 11 Jun 2018 12:09:30 -0700 Subject: [PATCH 045/163] Fixes for Web USB typings * fix name of USBAlternateInterface interfaceName property * Add USBDevice reset method Changes based on spec: https://wicg.github.io/webusb/ --- types/w3c-web-usb/index.d.ts | 3 ++- types/w3c-web-usb/w3c-web-usb-tests.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/types/w3c-web-usb/index.d.ts b/types/w3c-web-usb/index.d.ts index d481245e14..d596351a5b 100644 --- a/types/w3c-web-usb/index.d.ts +++ b/types/w3c-web-usb/index.d.ts @@ -62,7 +62,7 @@ declare class USBAlternateInterface { readonly interfaceClass: number; readonly interfaceSubclass: number; readonly interfaceProtocol: number; - readonly alternatinterfaceName?: string; + readonly interfaceName?: string; readonly endpoints: USBEndpoint[]; } @@ -146,6 +146,7 @@ declare class USBDevice { transferOut(endpointNumber: number, data: BufferSource): Promise; isochronousTransferIn(endpointNumber: number, packetLengths: number[]): Promise; isochronousTransferOut(endpointNumber: number, data: BufferSource, packetLengths: number[]): Promise; + reset(): Promise; } interface Navigator { diff --git a/types/w3c-web-usb/w3c-web-usb-tests.ts b/types/w3c-web-usb/w3c-web-usb-tests.ts index fe29480479..49efebcdbc 100644 --- a/types/w3c-web-usb/w3c-web-usb-tests.ts +++ b/types/w3c-web-usb/w3c-web-usb-tests.ts @@ -43,6 +43,7 @@ navigator.usb.addEventListener('disconnect', evt => { }); async function handleConnectedDevice(device: USBDevice) { + await device.reset(); connectedDevices.push(device); await device.open(); From c626cf89980a9c03f0ddd7b8270fd6a4b6a7f419 Mon Sep 17 00:00:00 2001 From: Raymond Ho Date: Tue, 12 Jun 2018 09:59:20 +1000 Subject: [PATCH 046/163] Add react-amplitude definition --- types/react-amplitude/index.d.ts | 22 +++++++++++++++++++ .../react-amplitude/react-amplitude-tests.ts | 0 types/react-amplitude/tsconfig.json | 22 +++++++++++++++++++ types/react-amplitude/tslint.json | 1 + 4 files changed, 45 insertions(+) create mode 100644 types/react-amplitude/index.d.ts create mode 100644 types/react-amplitude/react-amplitude-tests.ts create mode 100644 types/react-amplitude/tsconfig.json create mode 100644 types/react-amplitude/tslint.json diff --git a/types/react-amplitude/index.d.ts b/types/react-amplitude/index.d.ts new file mode 100644 index 0000000000..151302c198 --- /dev/null +++ b/types/react-amplitude/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for react-amplitude 0.1 +// Project: https://github.com/rorygarand/react-amplitude +// Definitions by: Raymond Ho +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface AmplitudeInstance { + init(apiKey: string, userId?: string, config?: any, cb?: () => void): void; + amplitude(): void; + clearUserProperties(): void; + getSessionId(): void; + identify(idObj: any, cb: () => void): void; + isNewSession(): void; + logEvent(eventType: string, eventProperties: {}, cb: () => void): void; + logEventWithTimestamp(eventType: string, eventProperties: {}, timestamp: number, cb: () => void): void; + resetUserId(): void; + setUserId(userId: string): void; + setUserProperties(userProps: any): void; +} + +declare const Amplitude: AmplitudeInstance; + +export default Amplitude; \ No newline at end of file diff --git a/types/react-amplitude/react-amplitude-tests.ts b/types/react-amplitude/react-amplitude-tests.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/types/react-amplitude/tsconfig.json b/types/react-amplitude/tsconfig.json new file mode 100644 index 0000000000..d1336e9c2c --- /dev/null +++ b/types/react-amplitude/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", + "react-amplitude-tests.ts" + ] +} diff --git a/types/react-amplitude/tslint.json b/types/react-amplitude/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-amplitude/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From d968c600c50c1c3ca8659f49e2b53156189013cf Mon Sep 17 00:00:00 2001 From: Raymond Ho Date: Tue, 12 Jun 2018 10:21:46 +1000 Subject: [PATCH 047/163] fix lint issues --- types/react-amplitude/index.d.ts | 2 +- types/react-amplitude/react-amplitude-tests.ts | 1 + types/react-amplitude/tsconfig.json | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/types/react-amplitude/index.d.ts b/types/react-amplitude/index.d.ts index 151302c198..c6a9ff3d2d 100644 --- a/types/react-amplitude/index.d.ts +++ b/types/react-amplitude/index.d.ts @@ -19,4 +19,4 @@ export interface AmplitudeInstance { declare const Amplitude: AmplitudeInstance; -export default Amplitude; \ No newline at end of file +export default Amplitude; diff --git a/types/react-amplitude/react-amplitude-tests.ts b/types/react-amplitude/react-amplitude-tests.ts index e69de29bb2..39084405b4 100644 --- a/types/react-amplitude/react-amplitude-tests.ts +++ b/types/react-amplitude/react-amplitude-tests.ts @@ -0,0 +1 @@ +import Amplitude from 'react-amplitude'; diff --git a/types/react-amplitude/tsconfig.json b/types/react-amplitude/tsconfig.json index d1336e9c2c..6f7a8a296e 100644 --- a/types/react-amplitude/tsconfig.json +++ b/types/react-amplitude/tsconfig.json @@ -7,6 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From 156609970c33d1da8d07836d0f14d75ea37d6665 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 8 Jun 2018 14:04:18 -0700 Subject: [PATCH 048/163] Add types for ethereum-protocol --- .../ethereum-protocol-tests.ts | 4 + types/ethereum-protocol/index.d.ts | 293 ++++++++++++++++++ types/ethereum-protocol/package.json | 4 + types/ethereum-protocol/tsconfig.json | 16 + types/ethereum-protocol/tslint.json | 1 + 5 files changed, 318 insertions(+) create mode 100644 types/ethereum-protocol/ethereum-protocol-tests.ts create mode 100644 types/ethereum-protocol/index.d.ts create mode 100644 types/ethereum-protocol/package.json create mode 100644 types/ethereum-protocol/tsconfig.json create mode 100644 types/ethereum-protocol/tslint.json diff --git a/types/ethereum-protocol/ethereum-protocol-tests.ts b/types/ethereum-protocol/ethereum-protocol-tests.ts new file mode 100644 index 0000000000..a30a691e87 --- /dev/null +++ b/types/ethereum-protocol/ethereum-protocol-tests.ts @@ -0,0 +1,4 @@ +import { CallData, BlockParamLiteral } from 'ethereum-protocol'; +BlockParamLiteral.Earliest; +BlockParamLiteral.Latest; +BlockParamLiteral.Pending; diff --git a/types/ethereum-protocol/index.d.ts b/types/ethereum-protocol/index.d.ts new file mode 100644 index 0000000000..9b967cfc83 --- /dev/null +++ b/types/ethereum-protocol/index.d.ts @@ -0,0 +1,293 @@ +// Type definitions for ethereum-protocol 1.0 +// Project: https://www.npmjs.com/package/ethereum-protocol +// Definitions by: Leonid Logvinov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +import BigNumber from 'bignumber.js'; + +export type JSONRPCErrorCallback = (err: Error | null, result?: JSONRPCResponsePayload) => void; + +/** + * Do not create your own provider. Use an existing provider from a Web3 or ProviderEngine library + * Read more about Providers in the 0x wiki. + */ +export interface Provider { + sendAsync(payload: JSONRPCRequestPayload, callback: JSONRPCErrorCallback): void; +} + +export type ContractAbi = AbiDefinition[]; + +export type AbiDefinition = FunctionAbi | EventAbi; + +export type FunctionAbi = MethodAbi | ConstructorAbi | FallbackAbi; + +export type ConstructorStateMutability = 'nonpayable' | 'payable'; +export type StateMutability = 'pure' | 'view' | ConstructorStateMutability; + +export enum AbiType { + Function = 'function', + Constructor = 'constructor', + Event = 'event', + Fallback = 'fallback', +} + +export interface MethodAbi { + type: AbiType.Function; + name: string; + inputs: DataItem[]; + outputs: DataItem[]; + constant: boolean; + stateMutability: StateMutability; + payable: boolean; +} + +export interface ConstructorAbi { + type: AbiType.Constructor; + inputs: DataItem[]; + payable: boolean; + stateMutability: ConstructorStateMutability; +} + +export interface FallbackAbi { + type: AbiType.Fallback; + payable: boolean; +} + +export interface EventParameter extends DataItem { + indexed: boolean; +} + +export interface EventAbi { + type: AbiType.Event; + name: string; + inputs: EventParameter[]; + anonymous: boolean; +} + +export interface DataItem { + name: string; + type: string; + components?: DataItem[]; +} + +export enum OpCode { + DelegateCall = 'DELEGATECALL', + Revert = 'REVERT', + Create = 'CREATE', + Stop = 'STOP', + Invalid = 'INVALID', + CallCode = 'CALLCODE', + StaticCall = 'STATICCALL', + Return = 'RETURN', + Call = 'CALL', + SelfDestruct = 'SELFDESTRUCT', +} + +export interface StructLog { + depth: number; + error: string; + gas: number; + gasCost: number; + memory: string[]; + op: OpCode; + pc: number; + stack: string[]; + storage: { [location: string]: string }; +} + +export interface TransactionTrace { + gas: number; + returnValue: any; + structLogs: StructLog[]; +} + +export type Unit = + | 'kwei' + | 'ada' + | 'mwei' + | 'babbage' + | 'gwei' + | 'shannon' + | 'szabo' + | 'finney' + | 'ether' + | 'kether' + | 'grand' + | 'einstein' + | 'mether' + | 'gether' + | 'tether'; + +export interface JSONRPCRequestPayload { + params: any[]; + method: string; + id: number; + jsonrpc: string; +} + +export interface JSONRPCResponsePayload { + result: any; + id: number; + jsonrpc: string; +} + +export interface AbstractBlock { + number: number | null; + hash: string | null; + parentHash: string; + nonce: string | null; + sha3Uncles: string; + logsBloom: string | null; + transactionsRoot: string; + stateRoot: string; + miner: string; + difficulty: BigNumber; + totalDifficulty: BigNumber; + extraData: string; + size: number; + gasLimit: number; + gasUsed: number; + timestamp: number; + uncles: string[]; +} + +export interface BlockWithoutTransactionData extends AbstractBlock { + transactions: string[]; +} + +export interface BlockWithTransactionData extends AbstractBlock { + transactions: Transaction[]; +} + +export interface Transaction { + hash: string; + nonce: number; + blockHash: string | null; + blockNumber: number | null; + transactionIndex: number | null; + from: string; + to: string | null; + value: BigNumber; + gasPrice: BigNumber; + gas: number; + input: string; +} + +export interface CallTxDataBase { + to?: string; + value?: number | string | BigNumber; + gas?: number | string | BigNumber; + gasPrice?: number | string | BigNumber; + data?: string; + nonce?: number; +} + +export interface TxData extends CallTxDataBase { + from: string; +} + +export interface CallData extends CallTxDataBase { + from?: string; +} + +export interface FilterObject { + fromBlock?: number | string; + toBlock?: number | string; + address?: string; + topics?: LogTopic[]; +} + +export type LogTopic = null | string | string[]; + +export interface DecodedLogEntry extends LogEntry { + event: string; + args: A; +} + +export interface DecodedLogEntryEvent extends DecodedLogEntry { + removed: boolean; +} + +export interface LogEntryEvent extends LogEntry { + removed: boolean; +} + +export interface LogEntry { + logIndex: number | null; + transactionIndex: number | null; + transactionHash: string; + blockHash: string | null; + blockNumber: number | null; + address: string; + data: string; + topics: string[]; +} + +export interface TxDataPayable extends TxData { + value?: BigNumber; +} + +export interface TransactionReceipt { + blockHash: string; + blockNumber: number; + transactionHash: string; + transactionIndex: number; + from: string; + to: string; + status: null | string | 0 | 1; + cumulativeGasUsed: number; + gasUsed: number; + contractAddress: string | null; + logs: LogEntry[]; +} + +export type ContractEventArg = string | BigNumber | number | boolean; + +export interface DecodedLogArgs { + [argName: string]: ContractEventArg; +} + +export interface LogWithDecodedArgs extends DecodedLogEntry {} +export type RawLog = LogEntry; + +export enum BlockParamLiteral { + Earliest = 'earliest', + Latest = 'latest', + Pending = 'pending', +} + +export type BlockParam = BlockParamLiteral | number; + +export interface RawLogEntry { + logIndex: string | null; + transactionIndex: string | null; + transactionHash: string; + blockHash: string | null; + blockNumber: string | null; + address: string; + data: string; + topics: string[]; +} + +export enum SolidityTypes { + Address = 'address', + Uint256 = 'uint256', + Uint8 = 'uint8', + Uint = 'uint', +} + +/** + * Contains the logs returned by a TransactionReceipt. We attempt to decode the + * logs using AbiDecoder. If we have the logs corresponding ABI, we decode it, + * otherwise we don't. + */ +export interface TransactionReceiptWithDecodedLogs extends TransactionReceipt { + logs: Array | LogEntry>; +} + +export interface TraceParams { + disableMemory?: boolean; + disableStack?: boolean; + disableStorage?: boolean; +} diff --git a/types/ethereum-protocol/package.json b/types/ethereum-protocol/package.json new file mode 100644 index 0000000000..4eeb6b18c8 --- /dev/null +++ b/types/ethereum-protocol/package.json @@ -0,0 +1,4 @@ +{ + "private": true, + "dependencies": { "bignumber.js": "7.2.1" } +} diff --git a/types/ethereum-protocol/tsconfig.json b/types/ethereum-protocol/tsconfig.json new file mode 100644 index 0000000000..5f358a8dec --- /dev/null +++ b/types/ethereum-protocol/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "ethereum-protocol-tests.ts"] +} diff --git a/types/ethereum-protocol/tslint.json b/types/ethereum-protocol/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/ethereum-protocol/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 3b001a036cdad5812106578570c6411d1dc9f964 Mon Sep 17 00:00:00 2001 From: fbenedetto Date: Tue, 12 Jun 2018 08:48:32 +0200 Subject: [PATCH 049/163] [@types/chart.js] Fix type for 'pointStyle' chart setting --- types/chart.js/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index cb3db72855..c121840d9f 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -12,6 +12,7 @@ // Simon Archer // Ken Elkabany // Slavik Nychkalo +// Francesco Benedetto // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -483,7 +484,7 @@ declare namespace Chart { pointHoverBackgroundColor?: ChartColor | ChartColor[]; pointHoverBorderColor?: ChartColor | ChartColor[]; pointHoverBorderWidth?: number | number[]; - pointStyle?: PointStyle | HTMLImageElement | Array; + pointStyle?: PointStyle | HTMLImageElement | HTMLCanvasElement | Array; xAxisID?: string; yAxisID?: string; type?: string; From 3b8cd3954d118b832a9b56189a6f7840c250b379 Mon Sep 17 00:00:00 2001 From: Jokcy Date: Wed, 6 Jun 2018 17:45:19 +0800 Subject: [PATCH 050/163] fix webpack-serve args definition by using WebpackServe.Options --- types/webpack-serve/index.d.ts | 3 +- types/webpack-serve/webpack-serve-tests.ts | 50 +++++++++++++++++----- 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/types/webpack-serve/index.d.ts b/types/webpack-serve/index.d.ts index 5a1a302af0..f0426c5ad7 100644 --- a/types/webpack-serve/index.d.ts +++ b/types/webpack-serve/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for webpack-serve 1.0 // Project: https://github.com/webpack-contrib/webpack-serve // Definitions by: Ryan Clark +// Jokcy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -21,7 +22,7 @@ declare module 'webpack' { } declare function WebpackServe( - { config }: { config: webpack.Configuration } + options: WebpackServe.Options ): Promise; declare namespace WebpackServe { diff --git a/types/webpack-serve/webpack-serve-tests.ts b/types/webpack-serve/webpack-serve-tests.ts index 2a29cec317..d22c1adfea 100644 --- a/types/webpack-serve/webpack-serve-tests.ts +++ b/types/webpack-serve/webpack-serve-tests.ts @@ -1,19 +1,25 @@ import webpack = require('webpack'); import serve = require('webpack-serve'); -const compiler = webpack(); +const config: webpack.Configuration = { + mode: 'development', + entry: ['index.js'], // when use compiler entry must be array or object +}; + +const serveConfig = { + http2: true, + dev: { + publicPath: '/', + logLevel: 'info' + }, + host: 'localhost' +}; + +const compiler = webpack(config); const server = serve({ - config: { - serve: { - http2: true, - dev: { - publicPath: '/', - logLevel: 'info' - }, - host: 'localhost' - }, - }, + compiler, + ...serveConfig }); server @@ -22,3 +28,25 @@ server server.close(); }); }); + +const config2: webpack.Configuration = { + ...config, + serve: { + ...serveConfig, + port: 8888, + hot: { + port: 8889 + } + }, +}; + +const server2 = serve({ + config: config2 +}); + +server2 + .then((server) => { + server.on('listening', () => { + server.close(); + }); + }); From 334b07cf44e8e9ba55a57ad3a7e1a82f51566533 Mon Sep 17 00:00:00 2001 From: adelmurzin Date: Tue, 12 Jun 2018 11:40:51 +0300 Subject: [PATCH 051/163] Added type definitions for emoji-regex --- types/emoji-regex/emoji-regex-tests.ts | 3 +++ types/emoji-regex/index.d.ts | 7 +++++++ types/emoji-regex/tsconfig.json | 22 ++++++++++++++++++++++ types/emoji-regex/tslint.json | 1 + 4 files changed, 33 insertions(+) create mode 100644 types/emoji-regex/emoji-regex-tests.ts create mode 100644 types/emoji-regex/index.d.ts create mode 100644 types/emoji-regex/tsconfig.json create mode 100644 types/emoji-regex/tslint.json diff --git a/types/emoji-regex/emoji-regex-tests.ts b/types/emoji-regex/emoji-regex-tests.ts new file mode 100644 index 0000000000..6d6b0d25d9 --- /dev/null +++ b/types/emoji-regex/emoji-regex-tests.ts @@ -0,0 +1,3 @@ +import emojiRegex from "emoji-regex"; + +emojiRegex(); // $ExpectType RegExp diff --git a/types/emoji-regex/index.d.ts b/types/emoji-regex/index.d.ts new file mode 100644 index 0000000000..3eeb3b22fe --- /dev/null +++ b/types/emoji-regex/index.d.ts @@ -0,0 +1,7 @@ +// Type definitions for emoji-regex 7.0 +// Project: https://mths.be/emoji-regex +// Definitions by: iKBAHT +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare const createRegExp: () => RegExp; +export default createRegExp; diff --git a/types/emoji-regex/tsconfig.json b/types/emoji-regex/tsconfig.json new file mode 100644 index 0000000000..619fef592d --- /dev/null +++ b/types/emoji-regex/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es5" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "emoji-regex-tests.ts" + ] +} diff --git a/types/emoji-regex/tslint.json b/types/emoji-regex/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/emoji-regex/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 5cd06d648faefbb7140711b64503990452ba37e0 Mon Sep 17 00:00:00 2001 From: adelmurzin Date: Tue, 12 Jun 2018 12:07:35 +0300 Subject: [PATCH 052/163] added strictFunctionTypes --- types/emoji-regex/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/emoji-regex/tsconfig.json b/types/emoji-regex/tsconfig.json index 619fef592d..3ec3f5ac57 100644 --- a/types/emoji-regex/tsconfig.json +++ b/types/emoji-regex/tsconfig.json @@ -2,10 +2,11 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5" + "es6" ], "noImplicitAny": true, "noImplicitThis": true, + "strictFunctionTypes": true, "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ From 879f81cc6b9cd3c5bb339f6551879780e09b81f9 Mon Sep 17 00:00:00 2001 From: adelmurzin Date: Tue, 12 Jun 2018 12:07:50 +0300 Subject: [PATCH 053/163] fix for rule prefer-declare-function --- types/emoji-regex/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/emoji-regex/index.d.ts b/types/emoji-regex/index.d.ts index 3eeb3b22fe..736ef54bdd 100644 --- a/types/emoji-regex/index.d.ts +++ b/types/emoji-regex/index.d.ts @@ -3,5 +3,5 @@ // Definitions by: iKBAHT // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare const createRegExp: () => RegExp; +declare function createRegExp(): RegExp; export default createRegExp; From 178ed148f33f24bd350baee361f9e8aa6d20da75 Mon Sep 17 00:00:00 2001 From: Gareth Flowers Date: Tue, 12 Jun 2018 10:18:25 +0100 Subject: [PATCH 054/163] Report correct types in deprecation warning --- types/mocha/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mocha/index.d.ts b/types/mocha/index.d.ts index 1ada77c0a4..5f0aa3baf6 100644 --- a/types/mocha/index.d.ts +++ b/types/mocha/index.d.ts @@ -2846,7 +2846,7 @@ declare global { // #region Deprecations - /** @deprecated use `Mocha.DoneCallback` instead. */ + /** @deprecated use `Mocha.Done` instead. */ type MochaDone = Mocha.Done; /** @deprecated use `Mocha.ReporterConstructor` instead. */ From 1af294a268559d68ce6c224bc514bc2e82ebb606 Mon Sep 17 00:00:00 2001 From: kazakami Date: Wed, 13 Jun 2018 00:05:34 +0900 Subject: [PATCH 055/163] add typing for three-gltfexporter --- types/three/index.d.ts | 1 + types/three/three-gltfexporter.d.ts | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 types/three/three-gltfexporter.d.ts diff --git a/types/three/index.d.ts b/types/three/index.d.ts index cc26a82225..88cd09c70a 100644 --- a/types/three/index.d.ts +++ b/types/three/index.d.ts @@ -33,6 +33,7 @@ export * from "./three-effectcomposer"; export * from "./three-examples"; export * from "./three-fbxloader"; export * from "./three-FirstPersonControls"; +export * from "./three-gltfexporter"; export * from "./three-maskpass"; export * from "./three-mtlloader"; export * from "./three-objloader"; diff --git a/types/three/three-gltfexporter.d.ts b/types/three/three-gltfexporter.d.ts new file mode 100644 index 0000000000..2bdba480a7 --- /dev/null +++ b/types/three/three-gltfexporter.d.ts @@ -0,0 +1,9 @@ +import { Object3D } from "three"; + +export class GLTFExporter { + constructor(); + + parse(input: Object3D, onCompleted: (gltf: object) => void, options: object): null; + +} + From ad735eb279aeaaa6eef7a6d7d9318f56425988dd Mon Sep 17 00:00:00 2001 From: Carson Full Date: Tue, 12 Jun 2018 14:00:07 -0500 Subject: [PATCH 056/163] [luxon] Changes for 1.2 --- types/luxon/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/luxon/index.d.ts b/types/luxon/index.d.ts index d90ba90b13..544be249ee 100644 --- a/types/luxon/index.d.ts +++ b/types/luxon/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for luxon 0.5 +// Type definitions for luxon 1.2 // Project: https://github.com/moment/luxon#readme // Definitions by: Colby DeHart // Hyeonseok Yang @@ -207,6 +207,7 @@ declare module 'luxon' { toLocal(): DateTime; toLocaleParts(options?: DateTimeFormatOptions): any[]; toLocaleString(options?: DateTimeFormatOptions): string; + toMillis(): number; toObject(options?: { includeConfig?: boolean }): DateObject; toRFC2822(): string; toSQL(options?: Object): string; From 9d7b8fcf774749276ffb35fc752ae7054eaa27f7 Mon Sep 17 00:00:00 2001 From: Carson Full Date: Tue, 12 Jun 2018 15:01:48 -0500 Subject: [PATCH 057/163] [luxon] Tighten allowed unit values --- types/luxon/index.d.ts | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/types/luxon/index.d.ts b/types/luxon/index.d.ts index 544be249ee..6fd4f200db 100644 --- a/types/luxon/index.d.ts +++ b/types/luxon/index.d.ts @@ -180,14 +180,14 @@ declare module 'luxon' { zoneName: string; diff( other: DateTime, - unit?: string | string[], + unit?: DurationUnit | DurationUnit[], options?: DiffOptions ): Duration; - diffNow(unit?: string | string[], options?: DiffOptions): Duration; - endOf(unit: string): DateTime; + diffNow(unit?: DurationUnit | DurationUnit[], options?: DiffOptions): Duration; + endOf(unit: DurationUnit): DateTime; equals(other: DateTime): boolean; - get(unit: string): number; - hasSame(other: DateTime, unit: string): boolean; + get(unit: keyof DateTime): number; + hasSame(other: DateTime, unit: DurationUnit): boolean; minus(duration: Duration | number | DurationObject): DateTime; plus(duration: Duration | number | DurationObject): DateTime; reconfigure(properties: LocaleOptions): DateTime; @@ -195,7 +195,7 @@ declare module 'luxon' { set(values: DateObjectUnits): DateTime; setLocale(locale: any): DateTime; setZone(zone: string | Zone, options?: ZoneOptions): DateTime; - startOf(unit: string): DateTime; + startOf(unit: DurationUnit): DateTime; toFormat(format: string, options?: ToFormatOptions): string; toHTTP(): string; toISO(options?: ISOTimeOptions): string; @@ -238,6 +238,9 @@ declare module 'luxon' { type DurationObject = DurationObjectUnits & DurationOptions; + type DurationUnit = 'year' | 'years' | 'quarter' | 'quarters' | 'month' | 'months' | 'week' | 'weeks' | 'day' | 'days' + | 'hour' | 'hours' | 'minute' | 'minutes' | 'second' | 'seconds' | 'millisecond' | 'milliseconds'; + class Duration { static fromISO(text: string, options?: DurationOptions): Duration; static fromMillis( @@ -261,16 +264,16 @@ declare module 'luxon' { seconds: number; weeks: number; years: number; - as(unit: string): number; + as(unit: DurationUnit): number; equals(other: Duration): boolean; - get(unit: string): number; + get(unit: DurationUnit): number; minus(duration: Duration | number | DurationObject): Duration; negate(): Duration; normalize(): Duration; plus(duration: Duration | number | DurationObject): Duration; reconfigure(objectPattern: DurationOptions): Duration; set(values: DurationObjectUnits): Duration; - shiftTo(...units: string[]): Duration; + shiftTo(...units: DurationUnit[]): Duration; toFormat(format: string, options?: ToFormatOptions): string; toISO(): string; toJSON(): string; @@ -341,23 +344,23 @@ declare module 'luxon' { abutsEnd(other: Interval): boolean; abutsStart(other: Interval): boolean; contains(dateTime: DateTime): boolean; - count(unit?: string): number; + count(unit?: DurationUnit): number; difference(...intervals: Interval[]): Interval[]; divideEqually(numberOfParts?: number): Interval[]; engulfs(other: Interval): boolean; equals(other: Interval): boolean; - hasSame(unit: string): boolean; + hasSame(unit: DurationUnit): boolean; intersection(other: Interval): Interval; isAfter(dateTime: DateTime): boolean; isBefore(dateTime: DateTime): boolean; isEmpty(): boolean; - length(unit?: string): number; + length(unit?: DurationUnit): number; overlaps(other: Interval): boolean; set(values: IntervalObject): Interval; splitAt(...dateTimes: DateTime[]): Interval[]; splitBy(duration: Duration | DurationObject | number): Interval[]; toDuration( - unit: string | string[], + unit: DurationUnit | DurationUnit[], options?: DiffOptions ): Duration; toFormat( From 8686685640d351fcd49784d46ee335092692f703 Mon Sep 17 00:00:00 2001 From: Carson Full Date: Tue, 12 Jun 2018 15:09:26 -0500 Subject: [PATCH 058/163] [luxon] Added DateTime.toBSON() and Duration.valueOf() --- types/luxon/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/luxon/index.d.ts b/types/luxon/index.d.ts index 6fd4f200db..bcf43d0dac 100644 --- a/types/luxon/index.d.ts +++ b/types/luxon/index.d.ts @@ -196,6 +196,7 @@ declare module 'luxon' { setLocale(locale: any): DateTime; setZone(zone: string | Zone, options?: ZoneOptions): DateTime; startOf(unit: DurationUnit): DateTime; + toBSON(): Date; toFormat(format: string, options?: ToFormatOptions): string; toHTTP(): string; toISO(options?: ISOTimeOptions): string; @@ -281,6 +282,7 @@ declare module 'luxon' { includeConfig?: boolean; }): DurationObject; toString(): string; + valueOf(): number; } type EraLength = 'short' | 'long'; From 2c72e4a5424e5abf1bc0ccf2d452d3ab1cca3a78 Mon Sep 17 00:00:00 2001 From: Zak Barbuto Date: Wed, 13 Jun 2018 08:52:04 +0930 Subject: [PATCH 059/163] Add com.wikitude.phonegap.wikitudeplugin types --- ....wikitude.phonegap.wikitudeplugin-tests.ts | 33 ++++++++ .../index.d.ts | 81 +++++++++++++++++++ .../tsconfig.json | 24 ++++++ .../tslint.json | 79 ++++++++++++++++++ 4 files changed, 217 insertions(+) create mode 100644 types/com.wikitude.phonegap.wikitudeplugin/com.wikitude.phonegap.wikitudeplugin-tests.ts create mode 100644 types/com.wikitude.phonegap.wikitudeplugin/index.d.ts create mode 100644 types/com.wikitude.phonegap.wikitudeplugin/tsconfig.json create mode 100644 types/com.wikitude.phonegap.wikitudeplugin/tslint.json diff --git a/types/com.wikitude.phonegap.wikitudeplugin/com.wikitude.phonegap.wikitudeplugin-tests.ts b/types/com.wikitude.phonegap.wikitudeplugin/com.wikitude.phonegap.wikitudeplugin-tests.ts new file mode 100644 index 0000000000..00ee01f175 --- /dev/null +++ b/types/com.wikitude.phonegap.wikitudeplugin/com.wikitude.phonegap.wikitudeplugin-tests.ts @@ -0,0 +1,33 @@ +const startupConfiguration: any = { camera_position: 'back' }; + +// Some code samples from the wikitude ionic starter +WikitudePlugin.loadARchitectWorld( + function(success) { + console.log('ARchitect World loaded successfully.'); + }, + function(fail) { + console.log('Failed to load ARchitect World!'); + }, + 'www/assets/07_3dModels_6_3dModelAtGeoLocation/index.html', + ['geo'], + startupConfiguration +); + +WikitudePlugin.setOnUrlInvokeCallback(function(url) { + if (url.indexOf('captureScreen') > -1) { + WikitudePlugin.captureScreen( + absoluteFilePath => { + WikitudePlugin.callJavaScript( + "World.testFunction('Screenshot saved at: " + absoluteFilePath + "');" + ); + }, + errorMessage => { + console.log(errorMessage); + }, + true, + null + ); + } else { + alert(url + 'not handled'); + } +}); diff --git a/types/com.wikitude.phonegap.wikitudeplugin/index.d.ts b/types/com.wikitude.phonegap.wikitudeplugin/index.d.ts new file mode 100644 index 0000000000..cfa1a82a4c --- /dev/null +++ b/types/com.wikitude.phonegap.wikitudeplugin/index.d.ts @@ -0,0 +1,81 @@ +// Type definitions for com.wikitude.phonegap.wikitudeplugin 7.2.0 +// Project: https://github.com/Wikitude/wikitude-cordova-plugin +// Definitions by: zbarbuto +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// The following types are taken directly (unmodified) from the wikitude-ionic-3-starter-app +// https://github.com/pbreuss/wikitude-ionic-3-starter-app +// Latest commit at time of writing was 647cd546f6d1805765c4cee725566e246ca6259d + +/** + * Wrapper for the Wikitude SDK Phonegap Plugin - to use with IONIC2 + * (c) 2016 Schneeweis.Technology + */ +interface WikitudePlugin { + isDeviceSupported( + successCallback: (success: string) => void, + errorCallback: (message: string) => void, + requiredFeatures: [string] + ): void; + + loadARchitectWorld( + successCallback: (success: string) => void, + errorCallback: (message: string) => void, + architectWorldPath: string, + requiredFeatures: [string], + startupConfiguration: JSON | Object + ): void; + + close(): void; + + hide(): void; + + show(): void; + + // test type ok? + callJavaScript(js: any): void; + + setOnUrlInvokeCallback(onUrlInvokeCallback: (success: string) => void): void; + + setLocation(latitude: any, longitude: any, altitude: any, accuracy: any): void; + + captureScreen( + successCallback: (success: string) => void, + errorCallback: (message: string) => void, + includeWebView: boolean, + imagePathInBundleOrNullForPhotoLibrary: string | null + ): void; + + setErrorHandler(errorHandler: (message: string) => void): void; + + setDeviceSensorsNeedCalibrationHandler( + startCalibrationHandler: (message: string) => void + ): void; + + setDeviceSensorsFinishedCalibrationHandler( + finishedCalibrationHandler: (message: string) => void + ): void; + + setBackButtonCallback(onBackButtonCallback: (message: string) => void): void; + + /* Lifecycle updates */ + + onResume(): void; + onBackButton(): void; + onPause(): void; + + onWikitudeOK(): void; + onWikitudeError(): void; + + _sdkKey: string; + FeatureGeo: string; + Feature2DTracking: string; + CameraPositionUndefined: number; + CameraPositionFront: number; + CameraPositionBack: number; + CameraFocusRangeNone: number; + CameraFocusRangeNear: number; + CameraFocusRangeFar: number; +} + +declare var WikitudePlugin: WikitudePlugin; diff --git a/types/com.wikitude.phonegap.wikitudeplugin/tsconfig.json b/types/com.wikitude.phonegap.wikitudeplugin/tsconfig.json new file mode 100644 index 0000000000..ed0ce7783e --- /dev/null +++ b/types/com.wikitude.phonegap.wikitudeplugin/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "com.wikitude.phonegap.wikitudeplugin-tests.ts" + ] +} diff --git a/types/com.wikitude.phonegap.wikitudeplugin/tslint.json b/types/com.wikitude.phonegap.wikitudeplugin/tslint.json new file mode 100644 index 0000000000..a41bf5d19a --- /dev/null +++ b/types/com.wikitude.phonegap.wikitudeplugin/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 6ab9e1e26ffd5d0a8240fa6c18b8ae1492553d37 Mon Sep 17 00:00:00 2001 From: Raymond Ho Date: Wed, 13 Jun 2018 11:16:25 +1000 Subject: [PATCH 060/163] init Amp --- types/react-amplitude/react-amplitude-tests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-amplitude/react-amplitude-tests.ts b/types/react-amplitude/react-amplitude-tests.ts index 39084405b4..f311f8491f 100644 --- a/types/react-amplitude/react-amplitude-tests.ts +++ b/types/react-amplitude/react-amplitude-tests.ts @@ -1 +1,2 @@ import Amplitude from 'react-amplitude'; +Amplitude.init('YOUR_UNIQUE_TRACKING_CODE'); From a23ae6c63cd949e6e98eed7b3b28221ff88c6a6b Mon Sep 17 00:00:00 2001 From: Jiayu Liu Date: Tue, 12 Jun 2018 22:22:34 +0800 Subject: [PATCH 061/163] Add typing for wepy --- types/wepy/app.d.ts | 13 ++ types/wepy/base.d.ts | 12 ++ types/wepy/component.d.ts | 20 ++ types/wepy/event.d.ts | 6 + types/wepy/index.d.ts | 35 ++++ types/wepy/mixin.d.ts | 1 + types/wepy/page.d.ts | 23 +++ types/wepy/tsconfig.json | 27 +++ types/wepy/tslint.json | 3 + types/wepy/util.d.ts | 15 ++ types/wepy/wepy-tests.ts | 41 ++++ types/wepy/wx_enhanced.d.ts | 391 ++++++++++++++++++++++++++++++++++++ 12 files changed, 587 insertions(+) create mode 100644 types/wepy/app.d.ts create mode 100644 types/wepy/base.d.ts create mode 100644 types/wepy/component.d.ts create mode 100644 types/wepy/event.d.ts create mode 100644 types/wepy/index.d.ts create mode 100644 types/wepy/mixin.d.ts create mode 100644 types/wepy/page.d.ts create mode 100644 types/wepy/tsconfig.json create mode 100644 types/wepy/tslint.json create mode 100644 types/wepy/util.d.ts create mode 100644 types/wepy/wepy-tests.ts create mode 100644 types/wepy/wx_enhanced.d.ts diff --git a/types/wepy/app.d.ts b/types/wepy/app.d.ts new file mode 100644 index 0000000000..cc2636ed92 --- /dev/null +++ b/types/wepy/app.d.ts @@ -0,0 +1,13 @@ +export interface AppConfig { + appEvents?: string[]; + pageEvents?: string[]; + noPromiseAPI?: string[] | { [name: string]: boolean }; +} + +export interface AppConstructor { + new (): app; +} + +export default class app { + $init(wepy: any, config: AppConfig): any; +} diff --git a/types/wepy/base.d.ts b/types/wepy/base.d.ts new file mode 100644 index 0000000000..91c934b8b1 --- /dev/null +++ b/types/wepy/base.d.ts @@ -0,0 +1,12 @@ +import page, { PageConstructor } from "./page"; +import app, { AppConstructor, AppConfig } from "./app"; + +declare const defaultExport: { + $createApp?: (appClass: AppConstructor, appConfig: AppConfig) => app; + $createPage?: ( + pageClass: PageConstructor, + pagePath: string | boolean + ) => page; +}; + +export default defaultExport; diff --git a/types/wepy/component.d.ts b/types/wepy/component.d.ts new file mode 100644 index 0000000000..ddcea63ed6 --- /dev/null +++ b/types/wepy/component.d.ts @@ -0,0 +1,20 @@ +import event from "./event"; + +export default class component { + $isComponent: boolean; + $prefix: string; + data: { [name: string]: any }; + + computed?: { [name: string]: (self?: component) => any }; + methods?: { [name: string]: (evt?: event) => any }; + + $init($wxpage: any, $root: any, $parent: any): void; + $initMixins(): void; + onLoad(): void; + setData(k: string | string[], v: any): void; + getWxPage(): any; + $setIndex(index: number): void; + $getComponent(com: any): any; + $apply(fn: () => void): void; + $nextTick(fn: () => void): void; +} diff --git a/types/wepy/event.d.ts b/types/wepy/event.d.ts new file mode 100644 index 0000000000..f3a0d6c5a8 --- /dev/null +++ b/types/wepy/event.d.ts @@ -0,0 +1,6 @@ +export default class event { + active: boolean; + constructor(name: string, source: any, type: any); + $destroy(): void; + $transfor(wxevent: any[]): void; +} diff --git a/types/wepy/index.d.ts b/types/wepy/index.d.ts new file mode 100644 index 0000000000..3be681c10e --- /dev/null +++ b/types/wepy/index.d.ts @@ -0,0 +1,35 @@ +// Type definitions for wepy 1.7 +// Project: https://github.com/Tencent/wepy#readme +// Definitions by: Jiayu Liu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +import component from "./component"; +import mixin from "./mixin"; +import event from "./event"; +import page from "./page"; +import app from "./app"; +import util from "./util"; +import base from "./base"; +import { WxEnhances } from "./wx_enhanced"; + +interface DefaultExport extends WxEnhances { + event: typeof event; + app: typeof app; + component: typeof component; + page: typeof page; + mixin: typeof mixin; + $createApp: typeof base.$createApp; + $createPage: typeof base.$createPage; + $isEmpty: typeof util.$isEmpty; + $isEqual: typeof util.$isEqual; + $isDeepEqual: typeof util.$isDeepEqual; + $has: typeof util.$has; + $extend: typeof util.$extend; + $isPlainObject: typeof util.$isPlainObject; + $copy: typeof util.$copy; +} + +declare const defaultExport: DefaultExport; + +export default defaultExport; diff --git a/types/wepy/mixin.d.ts b/types/wepy/mixin.d.ts new file mode 100644 index 0000000000..c70aedd7b1 --- /dev/null +++ b/types/wepy/mixin.d.ts @@ -0,0 +1 @@ +export default class mixin {} diff --git a/types/wepy/page.d.ts b/types/wepy/page.d.ts new file mode 100644 index 0000000000..7655621106 --- /dev/null +++ b/types/wepy/page.d.ts @@ -0,0 +1,23 @@ +import component from "./component"; + +export interface UrlParam { + url: string; +} + +export interface PageConstructor { + new (): page; +} + +export default class page extends component { + $preloadData: { [key: string]: any }; + $init(wxpage: any, $parent: any): any; + $route( + type: "redirectTo" | "navigateTo", + url: string | UrlParam, + params?: { [name: string]: any } + ): any; + $preload(key: string | { [key: string]: any }, data: any): any; + $switch(url: string | UrlParam): any; + $redirect(url: string, params?: object): any; + $back(delta: number | { delta: number }): any; +} diff --git a/types/wepy/tsconfig.json b/types/wepy/tsconfig.json new file mode 100644 index 0000000000..f363a749a1 --- /dev/null +++ b/types/wepy/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "app.d.ts", + "base.d.ts", + "component.d.ts", + "event.d.ts", + "index.d.ts", + "mixin.d.ts", + "page.d.ts", + "util.d.ts", + "wx_enhanced.d.ts", + "wepy-tests.ts" + ] +} diff --git a/types/wepy/tslint.json b/types/wepy/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/wepy/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/wepy/util.d.ts b/types/wepy/util.d.ts new file mode 100644 index 0000000000..cff1be1ce5 --- /dev/null +++ b/types/wepy/util.d.ts @@ -0,0 +1,15 @@ +declare const defaultExport: { + $isEmpty: (obj: object) => boolean; + $isEqual: (a: any, b: any, aStack?: any[], bStack?: any[]) => boolean; + $isDeepEqual: (a: any, b: any, aStack?: any[], bStack?: any[]) => boolean; + $has: (obj: object, path: string) => boolean; + $extend: () => any; + $copy: (obj: T, deep?: boolean) => T; + $isPlainObject: (obj: any) => boolean; + $resolvePath: (route: string, url: string) => string; + $getParams: (url: string) => object; + hyphenate: (str: string) => string; + camelize: (str: string) => string; +}; + +export default defaultExport; diff --git a/types/wepy/wepy-tests.ts b/types/wepy/wepy-tests.ts new file mode 100644 index 0000000000..9ed5462fb9 --- /dev/null +++ b/types/wepy/wepy-tests.ts @@ -0,0 +1,41 @@ +import wepy from "wepy"; + +export class MyComponent extends wepy.component { + data = { + reveal: false, + img: "", + animationData: "", + imgClassName: "", + imgMode: "scaleToFill", + title: "loading", + titleClassName: "" + }; + + methods = {}; + + onLoad() { + super.onLoad(); + } +} + +export class BindJwc extends wepy.page { + config = { + navigationBarTitleText: "校历", + enablePullDownRefresh: true + }; + mixins = []; + data = {}; + computed = { + termName(): number { + return 1; + } + }; + methods = { + returnToday(): number { + return 123; + } + }; + + init() {} + async onLoad() {} +} diff --git a/types/wepy/wx_enhanced.d.ts b/types/wepy/wx_enhanced.d.ts new file mode 100644 index 0000000000..d5e66dea34 --- /dev/null +++ b/types/wepy/wx_enhanced.d.ts @@ -0,0 +1,391 @@ +export interface WechatProfileDetails { + photoFilePath?: string; + nickName?: string; + lastName?: string; + middleName?: string; + firstName?: string; + remark?: string; + mobilePhoneNumber?: string; + email?: string; + url?: string; + workAddressCountry?: string; + workAddressState?: string; + workAddressCity?: string; + workAddressStreet?: string; + workAddressPostalCode?: string; + homeFaxNumber?: string; + homePhoneNumber?: string; + homeAddressCountry?: string; + homeAddressState?: string; + homeAddressCity?: string; + homeAddressStreet?: string; + homeAddressPostalCode?: string; +} + +export interface RotateAnimation { + rotate(deg: number): Animation; + rotateX(deg: number): Animation; + rotateY(deg: number): Animation; + rotateZ(deg: number): Animation; + rotate3d(): Animation; +} + +export interface ScaleAnimation { + scale(sx: number): Animation; + scaleX(sx: number): Animation; + scaleY(sy: number): Animation; + scaleZ(sz: number): Animation; + scale3d(): Animation; +} + +export interface TranslateAnimation { + translate(tx: number): Animation; + translateX(tx: number): Animation; + translateY(ty: number): Animation; + translateZ(tz: number): Animation; + translate3d(): Animation; +} + +export interface SkewAnimation { + skew(ax: number): Animation; + skewX(ax: number): Animation; + skewY(ay: number): Animation; +} + +export interface Animation + extends RotateAnimation, + ScaleAnimation, + SkewAnimation, + TranslateAnimation { + opacity(x: number): Animation; + backgroundColor(x: string): Animation; + width(x: number): Animation; + height(x: number): Animation; + top(x: number): Animation; + left(x: number): Animation; + bottom(x: number): Animation; + right(x: number): Animation; +} + +export interface LagLng { + latitude: number; + longitude: number; +} + +export type CallbackFunction = ( + callbacks: { + success: (res: T) => void; + fail: () => void; + complete: () => void; + } +) => void; + +export interface MapContext { + getCenterLocation: CallbackFunction; + + moveToLocation(): void; + + translateMarker(params: { + markerId: number; + autoRotate: boolean; + duration: number; + destination: LagLng; + animationEnd: () => void; + }): void; + + includePoints(params: { padding: number[]; points: LagLng[] }): void; + + getRegion: CallbackFunction<{ southwest: LagLng; northeast: LagLng }>; + + getScale: CallbackFunction<{ scale: number }>; +} + +export interface UserInfo { + nickName: string; + avatarUrl: string; + gender: string; + city: string; + province: string; + country: string; + language: string; +} + +export interface UrlParam { + url: string; +} + +export interface FilePathParam { + filePath: string; +} + +// WePY enhanced Wx interfaces and methods below are all accessible +export interface WxEnhances { + addPhoneContact(param: WechatProfileDetails): Promise; + + authorize(param: { scope: string }): Promise; + + canIUse(name: string): Promise; + + canvasGetImageData( + params: { + canvasId: string; + x: number; + y: number; + width: number; + height: number; + }, + context: any + ): Promise<{ + width: number; + height: number; + data: Uint8ClampedArray; + }>; + + canvasPutImageData( + params: { + canvasId: string; + data: Uint8ClampedArray; + x: number; + y: number; + height?: number; + wdith: number; + }, + context: any + ): Promise; + + canvasToTempFilePath( + params: { + x: number; + y: number; + width: number; + height: number; + destWidth: number; + destHeight: number; + canvasId: string; + }, + context: any + ): Promise<{ tempFilePath: string }>; + + checkIsSoterEnrolledInDevice(params: { + checkAuthMode: "fingerPrint" | "facial" | "speech"; + }): Promise<{ + isEnrolled: boolean; + errMsg: string; + }>; + + checkIsSupportSoterAuthentication(): Promise<{ + supportMode: string[]; + }>; + + checkSession(): Promise; + + chooseInvoiceTitle(): Promise<{ + type: "0" | "1"; + title: string; + taxNumber: string; + companyAddress: string; + telephone: string; + bankName: string; + bankAccount: string; + errMsg: string; + }>; + + chooseLocation(): Promise<{ + name: string; + address: string; + latitude: number; + longitude: number; + }>; + + chooseVideo(params: { + sourceType: string[]; + compressed: boolean; + maxDuration: number; + }): Promise<{ + tempFilePath: string; + duration: number; + size: number; + height: number; + width: number; + }>; + + clearStorage(): Promise; + + createAnimation(params: { + duration: number; + timingFunction: string; + delay: number; + transformOrigin: string; + }): Promise; + + createCanvasContext(canvasId: string, context: any): Promise; + + createMapContext(mapId: string, context: any): MapContext; + + createSelectorQuery(): Promise<{}>; + + getLocation(params: { + type: string; + altitude: boolean; + }): Promise<{ + latitude: number; + longitude: number; + speed: number; + accuracy: number; + altitude: number; + verticalAccuracy: number; + horizontalAccuracy: number; + }>; + + getNetworkType(): Promise<{ networkType: string }>; + + getSavedFileInfo( + params: FilePathParam + ): Promise<{ + errMsg: string; + size: number; + createTime: number; + }>; + + getSavedFileList(): Promise<{ + errMsg: string; + fileList: object[]; + }>; + + getSetting(): Promise<{ + authSetting: { + "scope.userInfo": boolean; + "scope.userLocation": boolean; + "scope.address": boolean; + "scope.invoiceTitle": boolean; + "scope.werun": boolean; + "scope.record": boolean; + "scope.writePhotosAlbum": boolean; + "scope.camera": boolean; + }; + }>; + + getShareInfo(params: { + shareTicket: string; + timeout: number; + }): Promise<{ + errMsg: string; + encryptedData: string; + iv: string; + }>; + + getSystemInfo(): Promise<{ + brand: string; + model: string; + pixelRatio: number; + screenWidth: number; + screenHeight: number; + windowWidth: number; + windowHeight: number; + statusBarHeight: number; + language: string; + version: string; + system: string; + platform: string; + fontSizeSetting: string; + SDKVersion: string; + }>; + + getUserInfo(params: { + withCredentials: boolean; + lang: string; + timeout: number; + }): Promise<{ + userInfo: object; + rawData: string; + signature: string; + encryptedData: string; + iv: string; + }>; + + hideLoading(): Promise; + + hideNavigationBarLoading(): Promise; + + makePhoneCall(params: { phoneNumber: string }): Promise; + + navigateTo(params: UrlParam): Promise; + + onUserCaptureScreen(): Promise; + + openLocation(params: { + latitude: number; + longitude: number; + scale?: number; + name?: string; + address?: string; + }): Promise; + + pageScrollTo(params: { + scrollTop: number; + duration: number; + }): Promise; + + redirectTo(params: UrlParam): Promise; + + removeSavedFile(params: FilePathParam): Promise; + + removeStorage(params: { key: string }): Promise; + + request(params: UrlParam): Promise; + + requestPayment(params: { + timeStamp: string; + nonceStr: string; + package: string; + signType: string; + paySign: string; + }): Promise; + + scanCode(params: { + onlyFromCamera?: boolean; + scanType?: string[]; + }): Promise<{ + result: string; + scanType: string; + charSet: string; + path: string; + }>; + + setNavigationBarAlpha(params: { alpha: number }): Promise; + + setNavigationBarColor(params: { color: number }): Promise; + + setNavigationBarTitle(params: { title: string }): Promise; + + setStorage(params: { key: string; data: string | object }): Promise; + + showActionSheet(params: { + itemList: string[]; + itemColor: string; + }): Promise; + + showLoading(params: { title: string }): Promise; + + showModal(params: { + title: string; + content: string; + showCancel?: boolean; + cancelText?: string; + cancelColor?: string; + confirmText?: string; + confirmColor?: string; + }): Promise<{ confirm: boolean; cancel: boolean }>; + + showNavigationBarLoading(): Promise; + + showToast(params: { + title: string; + icon?: "success" | "loading" | "none"; + image?: string; + duration?: number; + mask?: boolean; + }): Promise; + + switchTab(params: UrlParam): Promise; +} From 8a0e97c93ffdc0d471c53d9fad2d4e63ecdd5e2c Mon Sep 17 00:00:00 2001 From: Jiayu Liu Date: Wed, 13 Jun 2018 14:52:43 +0800 Subject: [PATCH 062/163] lower typescript version --- types/wepy/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/wepy/index.d.ts b/types/wepy/index.d.ts index 3be681c10e..bff673ee8c 100644 --- a/types/wepy/index.d.ts +++ b/types/wepy/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/Tencent/wepy#readme // Definitions by: Jiayu Liu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.2 import component from "./component"; import mixin from "./mixin"; From e7e65dabaa40686c001b9aece81446998dadaaaa Mon Sep 17 00:00:00 2001 From: Daniel Waxweiler Date: Wed, 13 Jun 2018 15:25:07 +0200 Subject: [PATCH 063/163] remove module declaration and namespace --- types/tinycon/index.d.ts | 26 ++++++++++---------------- types/tinycon/tinycon-tests.ts | 2 ++ types/tinycon/tslint.json | 6 +----- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/types/tinycon/index.d.ts b/types/tinycon/index.d.ts index 9393a1aa6f..3f385603cc 100644 --- a/types/tinycon/index.d.ts +++ b/types/tinycon/index.d.ts @@ -3,22 +3,16 @@ // Definitions by: Daniel Waxweiler // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare namespace Tinycon { - function setBubble(count: number): void; +export function setBubble(count: number): void; - function setOptions(options: TinyconOptions): void; +export function setOptions(options: TinyconOptions): void; - interface TinyconOptions { - abbreviate?: boolean; - background?: string; - color?: string; - fallback?: boolean; - font?: string; - height?: number; - width?: number; - } -} - -declare module "tinycon" { - export = Tinycon; +export interface TinyconOptions { + abbreviate?: boolean; + background?: string; + color?: string; + fallback?: boolean; + font?: string; + height?: number; + width?: number; } diff --git a/types/tinycon/tinycon-tests.ts b/types/tinycon/tinycon-tests.ts index 3004a503ef..b4bcc304ac 100644 --- a/types/tinycon/tinycon-tests.ts +++ b/types/tinycon/tinycon-tests.ts @@ -1,3 +1,5 @@ +import * as Tinycon from 'tinycon'; + Tinycon.setOptions({ abbreviate: false, background: '#549A2F', diff --git a/types/tinycon/tslint.json b/types/tinycon/tslint.json index bd3bb78849..f93cf8562a 100644 --- a/types/tinycon/tslint.json +++ b/types/tinycon/tslint.json @@ -1,7 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "no-declare-current-package": false, - "no-single-declare-module": false - } + "extends": "dtslint/dt.json" } From 035c2747a87485f7c28a261046e4afe1426f2ebc Mon Sep 17 00:00:00 2001 From: Daniel Waxweiler Date: Wed, 13 Jun 2018 15:43:39 +0200 Subject: [PATCH 064/163] remove module declaration --- types/i18next-ko/i18next-ko-tests.ts | 2 +- types/i18next-ko/index.d.ts | 24 +++++++++++------------- types/i18next-ko/tslint.json | 5 +---- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/types/i18next-ko/i18next-ko-tests.ts b/types/i18next-ko/i18next-ko-tests.ts index a84a2bdbd7..1b8cd90904 100644 --- a/types/i18next-ko/i18next-ko-tests.ts +++ b/types/i18next-ko/i18next-ko-tests.ts @@ -1,5 +1,5 @@ import * as i18next from 'i18next'; -import * as i18nextko from 'i18nextko'; +import * as i18nextko from 'i18next-ko'; import * as ko from 'knockout'; const resourceStore = { diff --git a/types/i18next-ko/index.d.ts b/types/i18next-ko/index.d.ts index 28d33c5817..e9d3c2c639 100644 --- a/types/i18next-ko/index.d.ts +++ b/types/i18next-ko/index.d.ts @@ -6,22 +6,20 @@ /// -declare module 'i18nextko' { - import * as i18next from 'i18next'; +import * as i18next from 'i18next'; - const i18n: i18next.i18n; +export const i18n: i18next.i18n; - function init(resourceStore: i18nextkoResourceStore, language: string, ko: KnockoutStatic): void; +export function init(resourceStore: i18nextkoResourceStore, language: string, ko: KnockoutStatic): void; - function setLanguage(language: string): void; +export function setLanguage(language: string): void; - function t(key: string): KnockoutComputed; +export function t(key: string): KnockoutComputed; - interface i18nextkoResourceStore { - [language: string]: { - translation: { - [key: string]: string - } - }; - } +export interface i18nextkoResourceStore { + [language: string]: { + translation: { + [key: string]: string + } + }; } diff --git a/types/i18next-ko/tslint.json b/types/i18next-ko/tslint.json index 075fa88707..f93cf8562a 100644 --- a/types/i18next-ko/tslint.json +++ b/types/i18next-ko/tslint.json @@ -1,6 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "no-single-declare-module": false - } + "extends": "dtslint/dt.json" } From 9a235d9000e64ec73b397698a909cf6c09b01523 Mon Sep 17 00:00:00 2001 From: Ben Saufley Date: Mon, 14 May 2018 16:05:53 -0400 Subject: [PATCH 065/163] [next] Elaborate on Document types Adjust renderPage and Enhancer; add tests Allows Enhancer to receive a React ComponentType that accepts one set of props and return a ComponentType that accepts a different set of props, the latter including at least url --- types/next/document.d.ts | 49 ++++++++++++------ types/next/test/next-document-tests.tsx | 67 ++++++++++++++++++++++++- 2 files changed, 100 insertions(+), 16 deletions(-) diff --git a/types/next/document.d.ts b/types/next/document.d.ts index 38e20e00c0..0955877d61 100644 --- a/types/next/document.d.ts +++ b/types/next/document.d.ts @@ -1,10 +1,43 @@ import * as React from "react"; + import { NextContext } from "."; +export interface RenderPageResponse { + buildManifest: { [key: string]: any }; + chunks: { + names: string[]; + filenames: string[]; + }; + html?: string; + head: Array>; + errorHtml: string; +} + +export interface PageProps { + url: string; +} + +export interface AnyPageProps extends PageProps { + [key: string]: any; +} + +export type Enhancer = (page: React.ComponentType

) => React.ComponentType; + +/** + * Context object used inside `Document` + */ +export interface NextDocumentContext extends NextContext { + /** A callback that executes the actual React rendering logic (synchronously) */ + renderPage(enhancer?: Enhancer): RenderPageResponse; // tslint:disable-line:no-unnecessary-generics +} + export interface DocumentProps { __NEXT_DATA__?: any; dev?: boolean; - chunks?: string[]; + chunks?: { + names: string[]; + filenames: string[]; + }; html?: string; head?: Array>; errorHtml?: string; @@ -13,21 +46,9 @@ export interface DocumentProps { [key: string]: any; } -/** - * Context object used inside `Document` - */ -export interface NextDocumentContext extends NextContext { - /** A callback that executes the actual React rendering logic (synchronously) */ - renderPage( - cb?: (enhancer: () => JSX.Element) => React.ComponentType - ): { - [key: string]: any - }; -} - export class Head extends React.Component {} export class Main extends React.Component {} export class NextScript extends React.Component {} export default class extends React.Component { - static getInitialProps(ctx: NextContext): DocumentProps; + static getInitialProps(ctx: NextDocumentContext): Promise | DocumentProps; } diff --git a/types/next/test/next-document-tests.tsx b/types/next/test/next-document-tests.tsx index 2b3257cd25..6b9e25a874 100644 --- a/types/next/test/next-document-tests.tsx +++ b/types/next/test/next-document-tests.tsx @@ -1,7 +1,7 @@ -import Document, { Head, Main, NextScript, NextDocumentContext } from 'next/document'; +import Document, { DocumentProps, Enhancer, Head, Main, NextScript, NextDocumentContext, PageProps } from 'next/document'; import * as React from "react"; -const results = ( +const basicResults = ( @@ -38,3 +38,66 @@ export default class MyDocument extends Document { ); } } + +class MyDoc extends Document { + static async getInitialProps({ renderPage }: NextDocumentContext) { + const enhancer: Enhancer = (App) => (props) => (); + const { html, head, errorHtml, chunks, buildManifest } = renderPage(enhancer); + + const now = Date.now(); + + return { html, head, errorHtml, chunks, buildManifest, now }; + } + + render() { + return ( + + + My page + rendered at {this.props.now} + + +

+ + {this.props.children} + + + ); + } +} + +const extendedResults = ( + + + + +

Hey there

+
+); + +const renderPage: NextDocumentContext['renderPage'] = (enhancer) => ({ + buildManifest: {}, + chunks: { names: [], filenames: [] }, + html: '', + head: [], + errorHtml: '', +}); + +interface PageInitialProps extends PageProps { + foo: string; + bar: number; +} + +interface ProcessedInitialProps { + fooLength: number; + bar: boolean; +} + +const enhancerExplicit: Enhancer = (App) => (props) => (); +const enhancerInferred = (App: React.ComponentType) => ({ foo, bar }: PageInitialProps) => (); +const explicitEnhancerRenderResponse = renderPage(enhancerExplicit); +const inferredEnhancerRenderResponse = renderPage(enhancerInferred); +const defaultedTypesRenderResponse = renderPage((App) => (props) => ()); +const defaultedTypesExtendedRenderResponse = renderPage((App) => (props) => ()); +const explicitTypesRenderResponseOne = renderPage((App) => (props) => ()); +const explicitTypesRenderResponseTwo = renderPage((App) => ({ foo, bar }) => ()); From 008c59014acb54ba8340e4cf1e828874a6cedeb5 Mon Sep 17 00:00:00 2001 From: Ben Saufley Date: Wed, 13 Jun 2018 14:54:42 -0400 Subject: [PATCH 066/163] Consolidate --- types/next/test/next-document-tests.tsx | 44 ++++++------------------- 1 file changed, 10 insertions(+), 34 deletions(-) diff --git a/types/next/test/next-document-tests.tsx b/types/next/test/next-document-tests.tsx index 6b9e25a874..f727262b0e 100644 --- a/types/next/test/next-document-tests.tsx +++ b/types/next/test/next-document-tests.tsx @@ -11,16 +11,18 @@ const basicResults = ( ); -const Wrapper: React.SFC = ({ children }) => {children}; - -export default class MyDocument extends Document { +class MyDoc extends Document { static async getInitialProps({ renderPage }: NextDocumentContext) { - // Without callback - const page = renderPage(); - // With callback - const differentPage = renderPage(App => props => ); + // without callback + const _page = renderPage(); + + // with callback + const enhancer: Enhancer = (App) => (props) => (); + const { html, head, errorHtml, chunks, buildManifest } = renderPage(enhancer); + const style = {}; - return { ...page, style }; + + return { html, head, errorHtml, chunks, buildManifest, style }; } render() { @@ -30,32 +32,6 @@ export default class MyDocument extends Document { My page