From 60af25b105bdd2b1040366153a14d01502abea3a Mon Sep 17 00:00:00 2001 From: bobby77 Date: Tue, 26 Dec 2017 16:02:27 +0100 Subject: [PATCH 001/150] Update index.d.ts Changed error in "transform" and "inverseTransform" return type: Point instead of Matrix (L307) Changed error in clone parameters : object instead of boolean (L1358-1360) --- types/paper/index.d.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/types/paper/index.d.ts b/types/paper/index.d.ts index 64d961ed10..2c78fd6e6d 100644 --- a/types/paper/index.d.ts +++ b/types/paper/index.d.ts @@ -290,7 +290,7 @@ declare module paper { * Transforms a point and returns the result. * @param point - the point to be transformed */ - transform(point: Point): Matrix; + transform(point: Point): Point; /** * Transforms an array of coordinates by this matrix and stores the results into the destination array, which is also returned. @@ -304,7 +304,7 @@ declare module paper { * Inverse transforms a point and returns the result. * @param point - the point to be transformed */ - inverseTransform(point: Point): Matrix; + inverseTransform(point: Point): Point; /** * Attempts to decompose the affine transformation described by this matrix into scaling, rotation and shearing, and returns an object with these properties if it succeeded, null otherwise. @@ -1353,9 +1353,11 @@ declare module paper { /** * Clones the item within the same project and places the copy above the item. - * @param insert [optional] - specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true + * @param options [optional] - object with 2 parameters + * insert: specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true + * deep: specifies whether the item’s children should also be cloned — default: true */ - clone(insert?: boolean): Item; + clone(options?: any): Item; /** * When passed a project, copies the item to the project, or duplicates it within the same project. When passed an item, copies the item into the specified item. From 0868ebcbccd557c22955e6568c00c82fad15734a Mon Sep 17 00:00:00 2001 From: tquinlan1992 Date: Sun, 31 Dec 2017 10:39:36 -0500 Subject: [PATCH 002/150] Update type to include OnDragStart OnDragEnter OnDrop --- types/rc-tree/index.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/rc-tree/index.d.ts b/types/rc-tree/index.d.ts index 8091b2edd5..793a10bd6f 100644 --- a/types/rc-tree/index.d.ts +++ b/types/rc-tree/index.d.ts @@ -149,6 +149,12 @@ export interface TreeProps extends Props { * whether can drag treeNode. */ draggable?: boolean; + /* + * On Drag Start Called + */ + onDragStart?: Function; + onDragEnter?: Function; + onDrop?: Function; } export default class Tree extends Component { } From d3a97d4d25dc243a44f45d3f0356b83cca50df43 Mon Sep 17 00:00:00 2001 From: tquinlan1992 Date: Sun, 31 Dec 2017 12:00:58 -0500 Subject: [PATCH 003/150] Update onDrag types with Data Interfaces --- types/rc-tree/index.d.ts | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/types/rc-tree/index.d.ts b/types/rc-tree/index.d.ts index 793a10bd6f..4db24c2410 100644 --- a/types/rc-tree/index.d.ts +++ b/types/rc-tree/index.d.ts @@ -58,6 +58,24 @@ export interface SelectData { event: "select"; } +interface OnDragStartData { + event: Event, + node: TreeNode +} + +interface OnDragEnterData { + event: Event; + node: TreeNode; + expandedKeys: string[]; +} + +interface OnDropData { + event: Event; + node: TreeNode; + dragNode: TreeNode; + dragNodesKeys: string[]; +} + export interface TreeProps extends Props { /** * additional css class of root dom node @@ -149,12 +167,18 @@ export interface TreeProps extends Props { * whether can drag treeNode. */ draggable?: boolean; - /* - * On Drag Start Called + /** + * Event on Drag Start */ - onDragStart?: Function; - onDragEnter?: Function; - onDrop?: Function; + onDragStart?: (props: OnDragStartData) => void; + /** + * Event on Drag Enter + */ + onDragEnter?: (props: OnDragEnterData) => void; + /** + * Event on Drag Drop + */ + onDrop?: (props: OnDropData) => void; } export default class Tree extends Component { } From 82a4eba664eba92c8090deec3322399b9b8e246e Mon Sep 17 00:00:00 2001 From: tquinlan1992 Date: Sun, 31 Dec 2017 12:07:31 -0500 Subject: [PATCH 004/150] Fix comma interface to semicolon --- types/rc-tree/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/rc-tree/index.d.ts b/types/rc-tree/index.d.ts index 4db24c2410..df3db12c15 100644 --- a/types/rc-tree/index.d.ts +++ b/types/rc-tree/index.d.ts @@ -59,8 +59,8 @@ export interface SelectData { } interface OnDragStartData { - event: Event, - node: TreeNode + event: Event; + node: TreeNode; } interface OnDragEnterData { From 9a5a154ff88ff68bac20d27c19344a290fecd0ab Mon Sep 17 00:00:00 2001 From: tquinlan1992 Date: Sun, 31 Dec 2017 12:17:34 -0500 Subject: [PATCH 005/150] export onDrag interfaces --- types/rc-tree/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/rc-tree/index.d.ts b/types/rc-tree/index.d.ts index df3db12c15..103bd60adf 100644 --- a/types/rc-tree/index.d.ts +++ b/types/rc-tree/index.d.ts @@ -58,18 +58,18 @@ export interface SelectData { event: "select"; } -interface OnDragStartData { +export interface OnDragStartData { event: Event; node: TreeNode; } -interface OnDragEnterData { +export interface OnDragEnterData { event: Event; node: TreeNode; expandedKeys: string[]; } -interface OnDropData { +export interface OnDropData { event: Event; node: TreeNode; dragNode: TreeNode; From 448e451dc1a188d80dea97e21184d4c4d90bea47 Mon Sep 17 00:00:00 2001 From: tquinlan1992 Date: Sun, 31 Dec 2017 12:26:02 -0500 Subject: [PATCH 006/150] align asteriks for onDrag properties --- types/rc-tree/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/rc-tree/index.d.ts b/types/rc-tree/index.d.ts index 103bd60adf..a8e5780b97 100644 --- a/types/rc-tree/index.d.ts +++ b/types/rc-tree/index.d.ts @@ -169,15 +169,15 @@ export interface TreeProps extends Props { draggable?: boolean; /** * Event on Drag Start - */ + */ onDragStart?: (props: OnDragStartData) => void; /** * Event on Drag Enter - */ + */ onDragEnter?: (props: OnDragEnterData) => void; /** * Event on Drag Drop - */ + */ onDrop?: (props: OnDropData) => void; } From e100608648cb0e61cee3b059c737076fe5a794e4 Mon Sep 17 00:00:00 2001 From: tquinlan1992 Date: Sun, 31 Dec 2017 12:34:21 -0500 Subject: [PATCH 007/150] lowercase letters --- types/rc-tree/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/rc-tree/index.d.ts b/types/rc-tree/index.d.ts index a8e5780b97..4dc789824d 100644 --- a/types/rc-tree/index.d.ts +++ b/types/rc-tree/index.d.ts @@ -168,15 +168,15 @@ export interface TreeProps extends Props { */ draggable?: boolean; /** - * Event on Drag Start + * event on drag start */ onDragStart?: (props: OnDragStartData) => void; /** - * Event on Drag Enter + * event on drag enter */ onDragEnter?: (props: OnDragEnterData) => void; /** - * Event on Drag Drop + * event on drag drop */ onDrop?: (props: OnDropData) => void; } From c3dd0698c4e817274466f89f90e781b25db6a6d2 Mon Sep 17 00:00:00 2001 From: tquinlan1992 Date: Sun, 31 Dec 2017 15:45:17 -0500 Subject: [PATCH 008/150] add onDrag tests --- types/rc-tree/rc-tree-tests.tsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/types/rc-tree/rc-tree-tests.tsx b/types/rc-tree/rc-tree-tests.tsx index c57866284f..290e3658cc 100644 --- a/types/rc-tree/rc-tree-tests.tsx +++ b/types/rc-tree/rc-tree-tests.tsx @@ -1,5 +1,6 @@ import * as React from 'react'; import Tree, { TreeNode, SelectData, CheckData } from 'rc-tree'; +import { TreeNode as TreeNodeInterface } from './index.d.ts'; interface Props { keys: string[]; @@ -43,6 +44,18 @@ export class Demo extends React.Component { onCheck(checkedKeys: string[], info: CheckData) { console.log('onCheck', checkedKeys, info); } + + onDragStart(params: {event: Event, node: TreeNodeInterface}) { + console.log('onDragStart', params.event, params.node); + } + + OnDragEnterData(params: {event: Event, node: TreeNodeInterface, expandedKeys: string[]}) { + console.log('OnDragEnterData', params.event, params.node, params.expandedKeys); + } + + OnDropData(params: {event: Event, node: TreeNode, dragNode: TreeNode, dragNodesKeys: string[]}) { + console.log('OnDropData', params.event, params.node, params.dragNode, params.dragNodesKeys); + } onEdit() { setTimeout(() => { @@ -73,6 +86,8 @@ export class Demo extends React.Component { defaultSelectedKeys={this.state.defaultSelectedKeys} defaultCheckedKeys={this.state.defaultCheckedKeys} onSelect={this.onSelect} onCheck={this.onCheck} + onDragStart={this.onDragStart} OnDragEnterData={this.OnDragEnterData} + OnDragEnterData={this.OnDragEnterData} > From 311b5961e8076626358650a17168cd624fe101a0 Mon Sep 17 00:00:00 2001 From: tquinlan1992 Date: Sun, 31 Dec 2017 16:09:53 -0500 Subject: [PATCH 009/150] OnDropData in Tree Prop --- types/rc-tree/rc-tree-tests.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/rc-tree/rc-tree-tests.tsx b/types/rc-tree/rc-tree-tests.tsx index 290e3658cc..ff73beda86 100644 --- a/types/rc-tree/rc-tree-tests.tsx +++ b/types/rc-tree/rc-tree-tests.tsx @@ -87,7 +87,7 @@ export class Demo extends React.Component { defaultCheckedKeys={this.state.defaultCheckedKeys} onSelect={this.onSelect} onCheck={this.onCheck} onDragStart={this.onDragStart} OnDragEnterData={this.OnDragEnterData} - OnDragEnterData={this.OnDragEnterData} + OnDropData={this.OnDropData} > From ac4424f5a3d88ec14293c7c94abb2b9c3491ac28 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 2 Jan 2018 23:28:50 -0800 Subject: [PATCH 010/150] Fix lint failures --- types/rc-tree/rc-tree-tests.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/types/rc-tree/rc-tree-tests.tsx b/types/rc-tree/rc-tree-tests.tsx index ff73beda86..2d5f0426ed 100644 --- a/types/rc-tree/rc-tree-tests.tsx +++ b/types/rc-tree/rc-tree-tests.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import Tree, { TreeNode, SelectData, CheckData } from 'rc-tree'; -import { TreeNode as TreeNodeInterface } from './index.d.ts'; +import { TreeNode as TreeNodeInterface } from './index'; interface Props { keys: string[]; @@ -44,15 +44,15 @@ export class Demo extends React.Component { onCheck(checkedKeys: string[], info: CheckData) { console.log('onCheck', checkedKeys, info); } - + onDragStart(params: {event: Event, node: TreeNodeInterface}) { console.log('onDragStart', params.event, params.node); } - + OnDragEnterData(params: {event: Event, node: TreeNodeInterface, expandedKeys: string[]}) { console.log('OnDragEnterData', params.event, params.node, params.expandedKeys); } - + OnDropData(params: {event: Event, node: TreeNode, dragNode: TreeNode, dragNodesKeys: string[]}) { console.log('OnDropData', params.event, params.node, params.dragNode, params.dragNodesKeys); } @@ -86,7 +86,7 @@ export class Demo extends React.Component { defaultSelectedKeys={this.state.defaultSelectedKeys} defaultCheckedKeys={this.state.defaultCheckedKeys} onSelect={this.onSelect} onCheck={this.onCheck} - onDragStart={this.onDragStart} OnDragEnterData={this.OnDragEnterData} + onDragStart={this.onDragStart} OnDragEnter={this.OnDragEnterData} OnDropData={this.OnDropData} > From 4e6d6e05532f82ea79e28e9c79ef0103b12866b8 Mon Sep 17 00:00:00 2001 From: Georg Kaspar Date: Wed, 3 Jan 2018 15:46:00 +0100 Subject: [PATCH 011/150] Added Control.Locate class Control.Locate class was added to type definitions in order to access functions in ts. --- types/leaflet.locatecontrol/index.d.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/types/leaflet.locatecontrol/index.d.ts b/types/leaflet.locatecontrol/index.d.ts index 35c88be5be..3ed9c7968a 100644 --- a/types/leaflet.locatecontrol/index.d.ts +++ b/types/leaflet.locatecontrol/index.d.ts @@ -8,6 +8,12 @@ import * as L from 'leaflet'; declare module 'leaflet' { namespace Control { + class Locate extends Control { + onAdd(map: Map): HTMLElement; + start(): void; + stop(): void; + setView():void; + } interface LocateOptions { position?: string; layer?: Layer; @@ -40,6 +46,6 @@ declare module 'leaflet' { /** * Creates a Leaflet.Locate control */ - function locate(options?: Control.LocateOptions): Control; + function locate(options?: Control.LocateOptions): Control.Locate; } } From 40bd25bd96834f880ebb43014555b5543ace9406 Mon Sep 17 00:00:00 2001 From: Carsten Schumann Date: Sat, 13 Jan 2018 14:59:44 +0100 Subject: [PATCH 012/150] Added missing parameter format Paper.path also accepts an array of commands instead of a path string. Example: paper.path([ ["M", 5, 10], ["l", 15, 2], ["h", 30], ["Z"] ]); --- types/snapsvg/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/snapsvg/index.d.ts b/types/snapsvg/index.d.ts index ff0e9d09a9..539036b36c 100644 --- a/types/snapsvg/index.d.ts +++ b/types/snapsvg/index.d.ts @@ -279,6 +279,7 @@ declare namespace Snap { image(src:string,x:number,y:number,width:number,height:number):Snap.Element; line(x1:number,y1:number,x2:number,y2:number):Snap.Element; path(pathString?:string):Snap.Element; + path(pathSpec:(string | number)[][]):Snap.Element; polygon(varargs:any[]):Snap.Element; polyline(varargs:any[]):Snap.Element; rect(x:number,y:number,width:number,height:number,rx?:number,ry?:number):Snap.Element; From 971248855852844ddea42f8741dcaf4b505c631f Mon Sep 17 00:00:00 2001 From: Kyle Roach Date: Sat, 20 Jan 2018 05:10:48 -0400 Subject: [PATCH 013/150] feat(react-native-material-ui): Add onRightElementPress callback info --- types/react-native-material-ui/index.d.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/types/react-native-material-ui/index.d.ts b/types/react-native-material-ui/index.d.ts index 0168f557bc..f3147eecf7 100644 --- a/types/react-native-material-ui/index.d.ts +++ b/types/react-native-material-ui/index.d.ts @@ -432,6 +432,12 @@ export interface ToolBarRightElement { menu?: {icon: string, labels: string[]}; } +export interface RightElementPressEvent { + action: string; + index: number; + result?: any; +} + export interface ToolbarProps { isSearchActive?: boolean; size?: number; @@ -443,7 +449,7 @@ export interface ToolbarProps { searchable?: Searchable; onPress?(): void; onLeftElementPress?(): void; - onRightElementPress?(): void; + onRightElementPress?(e: RightElementPressEvent): void; } /** From 5f846b17b497dc53844fb7d7d906e0a046945558 Mon Sep 17 00:00:00 2001 From: Kalle Ott Date: Mon, 22 Jan 2018 19:27:37 +0100 Subject: [PATCH 014/150] added declarations for react-router-navigation packages --- .../react-router-navigation-core/.prettierrc | 1 + types/react-router-navigation-core/index.d.ts | 157 +++++++++++++++ .../react-router-navigation-core-tests.tsx | 116 +++++++++++ .../tsconfig.json | 17 ++ .../react-router-navigation-core/tslint.json | 9 + types/react-router-navigation/.prettierrc | 1 + types/react-router-navigation/index.d.ts | 182 ++++++++++++++++++ .../react-router-navigation-tests.tsx | 21 ++ types/react-router-navigation/tsconfig.json | 17 ++ types/react-router-navigation/tslint.json | 8 + 10 files changed, 529 insertions(+) create mode 100644 types/react-router-navigation-core/.prettierrc create mode 100644 types/react-router-navigation-core/index.d.ts create mode 100644 types/react-router-navigation-core/react-router-navigation-core-tests.tsx create mode 100644 types/react-router-navigation-core/tsconfig.json create mode 100644 types/react-router-navigation-core/tslint.json create mode 100644 types/react-router-navigation/.prettierrc create mode 100644 types/react-router-navigation/index.d.ts create mode 100644 types/react-router-navigation/react-router-navigation-tests.tsx create mode 100644 types/react-router-navigation/tsconfig.json create mode 100644 types/react-router-navigation/tslint.json diff --git a/types/react-router-navigation-core/.prettierrc b/types/react-router-navigation-core/.prettierrc new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/types/react-router-navigation-core/.prettierrc @@ -0,0 +1 @@ +{} diff --git a/types/react-router-navigation-core/index.d.ts b/types/react-router-navigation-core/index.d.ts new file mode 100644 index 0000000000..c452ebb94c --- /dev/null +++ b/types/react-router-navigation-core/index.d.ts @@ -0,0 +1,157 @@ +// Type definitions for react-router-navigation-core 1.0 +// Project: https://github.com/LeoLeBras/react-router-navigation#readme +// Definitions by: Kalle Ott +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +// High-level wrappers +import { PureComponent, ReactNode, ComponentClass, ReactElement } from "react"; +import { BackHandler, StyleProp, ViewStyle } from "react-native"; +import { History, Location } from "history"; +import { RouterProps, RouteProps, match } from "react-router"; + +export type Route = { + key: string; + routeName: string; + match?: match; +}; + +export type NavigationState = { + index: number; + routes: Array; +}; + +export type RouteProps = { + component?: ComponentClass; + render?: (props: RouterProps) => ReactNode; + children?: ((props: RouterProps) => ReactNode) | ReactNode; + path?: string; + exact?: boolean; + strict?: boolean; +}; + +export type Card = RouteProps & { + key: string; +}; + +export type CardsRendererProps = { + onNavigateBack: (routeKey?: string) => boolean; + navigationState: NavigationState<{ + path?: string; + params?: object; + }>; + cards: Card[]; +}; + +export type Tab = RouteProps & { + key: string; + onIndexChange?: (index: number) => void; +}; + +export type TabsRendererProps = { + onIndexChange: (index: number) => void; + navigationState: NavigationState<{ + title?: string; + testID?: string; + }>; + loadedTabs: string[]; + tabs: Tab[]; +}; + +export type CardStackProps = { + children?: ReactNode[]; + render: (props: CardsRendererProps) => ReactNode; +}; + +export class CardStack extends PureComponent< + CardStackProps, + { + key: number; + navigationState: NavigationState<{ + path?: string; + params?: object; + }>; + cards: Card[]; + } +> { + unlistenHistory: () => void; + + constructor(props: CardStackProps, context?: any); + + onListenHistory: (history: History, nextHistory: History) => void; + + // Pop to previous scene (n-1) + onNavigateBack: () => boolean; +} + +export type TabStackProps = { + children?: ReactNode[]; + render: (props: TabsRendererProps) => ReactNode; + lazy?: boolean; + forceSync?: boolean; + style?: StyleProp; +}; + +export class TabStack extends PureComponent< + TabStackProps, + { + navigationState: NavigationState<{ + title?: string; + testID?: string; + }>; + tabs: Tab[]; + loadedTabs: string[]; + rootIndex: number; + tabsHistory: { [key: number]: Location[] }; + } +> { + static defaultProps: { + forceSync: false; + }; + + unlistenHistory?: () => void; + + constructor(props: TabStackProps); + + onListenHistory: (history: History, nextHistory: History) => void; + + onIndexChange: (index: number) => void; +} + +// Test if current stack item should be updated +export const shouldUpdate: ( + currentItem: RouteProps, + nextItem: RouteProps, + currentLocation: Location, + nextLocation: Location +) => boolean; + +// Get stack item from a specific route +export const get: (items: Item[], route: Route) => Item; + +// Generate unique key +export const createKey: (route: Route) => string; + +// Get current route from a specific history location +export const getRoute: ( + stack: RouteProps[], + location: Location +) => Route | undefined; + +// Render a subview with props +export const renderSubView: ( + render: (propsA: any, propsB: any) => ReactNode, + additionalProps?: any +) => (ownProps: any) => ReactNode; + +// Build stack with React elements +export const build: ( + children: Array>, + oldBuild?: Item[] +) => Item[]; + +// eslint-disable-next-line +export const runHistoryListenner: ( + history: History, + onListenHistory: () => void +) => () => void; diff --git a/types/react-router-navigation-core/react-router-navigation-core-tests.tsx b/types/react-router-navigation-core/react-router-navigation-core-tests.tsx new file mode 100644 index 0000000000..4f4df88f5f --- /dev/null +++ b/types/react-router-navigation-core/react-router-navigation-core-tests.tsx @@ -0,0 +1,116 @@ +import * as React from "react"; +import { + StyleSheet, + Dimensions, + View, + StyleProp, + ViewStyle +} from "react-native"; +import { TabStack, renderSubView } from "react-router-navigation-core"; +import { TabViewAnimated } from "react-native-tab-view"; +import { + TabBarProps, + TabSubViewProps, + TabProps +} from "react-router-navigation"; + +const styles = StyleSheet.create({ + container: { + flex: 1 + }, + scene: { + flex: 1, + overflow: "hidden" + } +}); + +type Props = TabBarProps & { + children?: Array>; + lazy?: boolean; + style?: StyleProp; +}; + +type State = { + key: string; +}; + +class BottomNavigation extends React.Component { + static defaultProps = { + lazy: true + }; + + state = { key: Math.random().toString(10) }; + + renderPager = (sceneProps: TabSubViewProps) => ; + + renderNavigationBar = ( + sceneProps: TabSubViewProps, + props: TabSubViewProps + ) => { + // Hide tab bar + if (sceneProps.hideTabBar) return null; + // Custom tab bar + if (sceneProps.renderTabBar) { + return React.createElement(sceneProps.renderTabBar, sceneProps); + } + // Default tab bar + return ; + }; + + renderSceneView = (sceneProps: TabSubViewProps) => { + const { render, children, component, lazy, loadedTabs } = sceneProps; + const { key } = sceneProps; + if (lazy && !loadedTabs.includes(key)) { + return null; + } else if (render) { + return render(sceneProps); + } else if (children && typeof children === "function") { + return children(sceneProps); + } else if (component) { + return React.createElement(component, sceneProps); + } + return null; + }; + + renderScene = (sceneProps: TabSubViewProps) => { + return ( + {this.renderSceneView(sceneProps)} + ); + }; + + render() { + return ( + { + const ownProps = { ...this.props, ...props }; + return ( + + ); + }} + /> + ); + } +} + +export default BottomNavigation; diff --git a/types/react-router-navigation-core/tsconfig.json b/types/react-router-navigation-core/tsconfig.json new file mode 100644 index 0000000000..b4572aa56c --- /dev/null +++ b/types/react-router-navigation-core/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "module": "commonjs", + "lib": ["es6", "dom"], + "jsx": "react", + "strictNullChecks": true, + "strictFunctionTypes": true, + "noImplicitAny": true, + "noImplicitThis": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true + }, + "files": ["index.d.ts", "react-router-navigation-core-tests.tsx"] +} diff --git a/types/react-router-navigation-core/tslint.json b/types/react-router-navigation-core/tslint.json new file mode 100644 index 0000000000..9771c6e171 --- /dev/null +++ b/types/react-router-navigation-core/tslint.json @@ -0,0 +1,9 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "interface-over-type-literal": false, + "prefer-method-signature": false, + "prefer-declare-function": false, + "semicolon": false + } +} diff --git a/types/react-router-navigation/.prettierrc b/types/react-router-navigation/.prettierrc new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/types/react-router-navigation/.prettierrc @@ -0,0 +1 @@ +{} diff --git a/types/react-router-navigation/index.d.ts b/types/react-router-navigation/index.d.ts new file mode 100644 index 0000000000..452c7bea7b --- /dev/null +++ b/types/react-router-navigation/index.d.ts @@ -0,0 +1,182 @@ +// Type definitions for react-router-navigation 1.0 +// Project: https://github.com/LeoLeBras/react-router-navigation#readme +// Definitions by: Kalle Ott +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +import { Component, ReactNode, ReactElement, ComponentClass } from "react"; +import { StyleProp, ViewProperties, ViewStyle, TextStyle } from "react-native"; +import { TabViewAnimated, TabViewPagerPan } from "react-native-tab-view"; +import { RouteProps } from "react-router-navigation-core"; +import { + NavigationTransitionProps, + NavigationTransitionSpec +} from "react-navigation"; + +/** + * Navigation + */ + +export type CardProps = RouteProps & NavBarProps; + +export type CardSubViewProps = any; +// NavigationSceneRendererProps & +// CardsRendererProps & +// CardProps + +export type NavBarProps = { + // General + hideNavBar?: boolean; + renderNavBar?: (props: CardSubViewProps) => ReactNode; + navBarStyle?: StyleProp; + // Left button + hideBackButton?: boolean; + backButtonTintColor?: string; + backButtonTitle?: string; + renderLeftButton?: (props: CardSubViewProps) => ReactNode; + // Title + title?: string; + titleStyle?: StyleProp; + renderTitle?: (props: CardSubViewProps) => ReactNode; + // Right button + renderRightButton?: (props: CardSubViewProps) => ReactNode; +}; + +export type NavigationProps = NavBarProps & { + cardStyle?: StyleProp; + configureTransition?: ( + transitionProps: NavigationTransitionProps, + prevTransitionProps?: NavigationTransitionProps + ) => NavigationTransitionSpec; + onTransitionStart?: (...args: any[]) => void; + onTransitionEnd?: (...args: any[]) => void; +}; + +export type Card = CardProps & { key: string }; + +/** + * Tabs + */ + +export type TabSubViewProps = any; +// SceneRendererProps & +// TabsRendererProps & +// TabBarProps + +export type TabBarProps = { + hideTabBar?: boolean; + renderTabBar?: (props: TabSubViewProps) => ReactNode; + tabBarStyle?: StyleProp; + tabStyle?: StyleProp; + label?: string; + labelStyle?: StyleProp; + renderLabel?: (props: TabSubViewProps) => ReactNode; + tabTintColor?: string; + tabActiveTintColor?: string; + // only: + renderTabIcon?: (props: TabSubViewProps) => ReactNode; + // only: + tabBarPosition?: "top" | "bottom"; + tabBarIndicatorStyle?: StyleProp; +}; + +export type TabsProps = TabBarProps & { + // only: + initialLayout?: { width?: number; height?: number }; + configureTransition?: ( + transitionProps: NavigationTransitionProps, + prevTransitionProps?: NavigationTransitionProps + ) => NavigationTransitionSpec; +}; + +export type TabProps = RouteProps & + TabBarProps & { + onReset?: (props: TabBarProps & RouteProps) => void; + onIndexChange?: (index: number) => void; + }; + +export type Tab = TabProps & { key: string }; + +// High-level wrappers +export type BottomNavigationProps = TabBarProps & { + children?: ReactNode[]; + lazy?: boolean; + style?: StyleProp; +}; + +export class BottomNavigation extends Component< + BottomNavigationProps, + { + key: string; + } +> { + static defaultProps: { + lazy: true; + }; + + renderPager: (sceneProps: TabSubViewProps) => ReactNode; + + renderNavigationBar: ( + sceneProps: TabSubViewProps, + props: TabSubViewProps + ) => ReactNode; + + renderSceneView: (sceneProps: TabSubViewProps) => ReactNode; + + renderScene: (sceneProps: TabSubViewProps) => ReactElement; +} + +export const Card: (props: CardProps) => ReactElement; + +export class NavBar extends Component { + props: CardSubViewProps; + + renderLeftComponent: (sceneProps: CardSubViewProps) => ReactNode; + + renderTitleComponent: (sceneProps: CardSubViewProps) => ReactNode; + + renderRightComponent: (sceneProps: CardSubViewProps) => ReactNode; +} + +export type NavigationComponentProps = NavigationProps & { + children?: Array>; +}; + +export class Navigation extends Component { + props: NavigationComponentProps; + + renderHeader: ( + sceneProps: CardSubViewProps, + props: CardSubViewProps + ) => ReactNode; + + renderSceneComponent: ( + sceneProps: CardSubViewProps + ) => ComponentClass | undefined; +} + +export const Tab: (props: TabProps) => ReactElement<{}>; + +export type TabBarComponentProps = TabBarProps & { + children?: Array>; +}; + +export class Tabs extends Component< + TabBarComponentProps, + { + key: string; + } +> { + props: TabBarComponentProps; + + renderHeader: (sceneProps: TabSubViewProps) => ReactElement | null; + + renderFooter: (sceneProps: TabSubViewProps) => ReactElement | null; + + renderTabBar: ( + sceneProps: TabSubViewProps, + props: TabSubViewProps + ) => ReactElement | null; + + renderScene: (sceneProps: TabSubViewProps) => ReactElement | null; +} diff --git a/types/react-router-navigation/react-router-navigation-tests.tsx b/types/react-router-navigation/react-router-navigation-tests.tsx new file mode 100644 index 0000000000..a70ad1ef60 --- /dev/null +++ b/types/react-router-navigation/react-router-navigation-tests.tsx @@ -0,0 +1,21 @@ +import * as React from "react"; +import { Text } from "react-native"; +import { NativeRouter, Link } from "react-router-native"; +import { Navigation, Card } from "react-router-navigation"; + +const App = () => ( + + + ( + + Press it + + )} + /> + Hello} /> + + +); diff --git a/types/react-router-navigation/tsconfig.json b/types/react-router-navigation/tsconfig.json new file mode 100644 index 0000000000..d9909d32a6 --- /dev/null +++ b/types/react-router-navigation/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "module": "commonjs", + "lib": ["es6", "dom"], + "jsx": "react", + "strictNullChecks": true, + "strictFunctionTypes": true, + "noImplicitAny": true, + "noImplicitThis": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true + }, + "files": ["index.d.ts", "react-router-navigation-tests.tsx"] +} diff --git a/types/react-router-navigation/tslint.json b/types/react-router-navigation/tslint.json new file mode 100644 index 0000000000..34f6d3563e --- /dev/null +++ b/types/react-router-navigation/tslint.json @@ -0,0 +1,8 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "interface-over-type-literal": false, + "prefer-method-signature": false, + "prefer-declare-function": false + } +} From ee1c3ee4d5334d7b6ff92b6db6684b34293d191d Mon Sep 17 00:00:00 2001 From: Kalle Ott Date: Mon, 22 Jan 2018 21:10:29 +0100 Subject: [PATCH 015/150] Delete .prettierrc --- types/react-router-navigation/.prettierrc | 1 - 1 file changed, 1 deletion(-) delete mode 100644 types/react-router-navigation/.prettierrc diff --git a/types/react-router-navigation/.prettierrc b/types/react-router-navigation/.prettierrc deleted file mode 100644 index 0967ef424b..0000000000 --- a/types/react-router-navigation/.prettierrc +++ /dev/null @@ -1 +0,0 @@ -{} From 419889311a18be089410db79adac1a833be9f7c9 Mon Sep 17 00:00:00 2001 From: Kalle Ott Date: Mon, 22 Jan 2018 21:10:39 +0100 Subject: [PATCH 016/150] Delete .prettierrc --- types/react-router-navigation-core/.prettierrc | 1 - 1 file changed, 1 deletion(-) delete mode 100644 types/react-router-navigation-core/.prettierrc diff --git a/types/react-router-navigation-core/.prettierrc b/types/react-router-navigation-core/.prettierrc deleted file mode 100644 index 0967ef424b..0000000000 --- a/types/react-router-navigation-core/.prettierrc +++ /dev/null @@ -1 +0,0 @@ -{} From 3fd04b134241f40d65208f4bb268edc21017264f Mon Sep 17 00:00:00 2001 From: Kalle Ott Date: Tue, 23 Jan 2018 10:35:34 +0100 Subject: [PATCH 017/150] narrowd down test file for core lib --- .../react-router-navigation-core-tests.tsx | 77 ++----------------- 1 file changed, 5 insertions(+), 72 deletions(-) diff --git a/types/react-router-navigation-core/react-router-navigation-core-tests.tsx b/types/react-router-navigation-core/react-router-navigation-core-tests.tsx index 4f4df88f5f..6d6d048886 100644 --- a/types/react-router-navigation-core/react-router-navigation-core-tests.tsx +++ b/types/react-router-navigation-core/react-router-navigation-core-tests.tsx @@ -1,33 +1,12 @@ import * as React from "react"; -import { - StyleSheet, - Dimensions, - View, - StyleProp, - ViewStyle -} from "react-native"; +import { View } from "react-native"; import { TabStack, renderSubView } from "react-router-navigation-core"; +import { TabBarProps, TabProps } from "react-router-navigation"; import { TabViewAnimated } from "react-native-tab-view"; -import { - TabBarProps, - TabSubViewProps, - TabProps -} from "react-router-navigation"; - -const styles = StyleSheet.create({ - container: { - flex: 1 - }, - scene: { - flex: 1, - overflow: "hidden" - } -}); type Props = TabBarProps & { children?: Array>; lazy?: boolean; - style?: StyleProp; }; type State = { @@ -35,54 +14,12 @@ type State = { }; class BottomNavigation extends React.Component { - static defaultProps = { - lazy: true - }; - state = { key: Math.random().toString(10) }; - renderPager = (sceneProps: TabSubViewProps) => ; - - renderNavigationBar = ( - sceneProps: TabSubViewProps, - props: TabSubViewProps - ) => { - // Hide tab bar - if (sceneProps.hideTabBar) return null; - // Custom tab bar - if (sceneProps.renderTabBar) { - return React.createElement(sceneProps.renderTabBar, sceneProps); - } - // Default tab bar - return ; - }; - - renderSceneView = (sceneProps: TabSubViewProps) => { - const { render, children, component, lazy, loadedTabs } = sceneProps; - const { key } = sceneProps; - if (lazy && !loadedTabs.includes(key)) { - return null; - } else if (render) { - return render(sceneProps); - } else if (children && typeof children === "function") { - return children(sceneProps); - } else if (component) { - return React.createElement(component, sceneProps); - } - return null; - }; - - renderScene = (sceneProps: TabSubViewProps) => { - return ( - {this.renderSceneView(sceneProps)} - ); - }; - render() { return ( { const ownProps = { ...this.props, ...props }; @@ -90,19 +27,17 @@ class BottomNavigation extends React.Component { , ownProps )} renderFooter={renderSubView( - this.renderNavigationBar, + sceneProps => , ownProps )} renderScene={renderSubView( - this.renderScene, + sceneProps => , ownProps )} /> @@ -112,5 +47,3 @@ class BottomNavigation extends React.Component { ); } } - -export default BottomNavigation; From ea5d8731d5e5bd04c44227d4f00de4b58da86d6c Mon Sep 17 00:00:00 2001 From: Kalle Ott Date: Tue, 23 Jan 2018 10:35:53 +0100 Subject: [PATCH 018/150] added todos for any-types --- types/react-router-navigation/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/react-router-navigation/index.d.ts b/types/react-router-navigation/index.d.ts index 452c7bea7b..0053f7ea30 100644 --- a/types/react-router-navigation/index.d.ts +++ b/types/react-router-navigation/index.d.ts @@ -19,6 +19,7 @@ import { export type CardProps = RouteProps & NavBarProps; +// TODO specify exact type when lib changes export type CardSubViewProps = any; // NavigationSceneRendererProps & // CardsRendererProps & @@ -58,6 +59,7 @@ export type Card = CardProps & { key: string }; * Tabs */ +// TODO specify exact type when lib changes export type TabSubViewProps = any; // SceneRendererProps & // TabsRendererProps & From ec269fbabef474816602e98fb9d2202af8c13d0f Mon Sep 17 00:00:00 2001 From: Kalle Ott Date: Tue, 23 Jan 2018 10:36:20 +0100 Subject: [PATCH 019/150] removed eslint-comment --- types/react-router-navigation-core/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/react-router-navigation-core/index.d.ts b/types/react-router-navigation-core/index.d.ts index c452ebb94c..a7ad09748c 100644 --- a/types/react-router-navigation-core/index.d.ts +++ b/types/react-router-navigation-core/index.d.ts @@ -150,7 +150,6 @@ export const build: ( oldBuild?: Item[] ) => Item[]; -// eslint-disable-next-line export const runHistoryListenner: ( history: History, onListenHistory: () => void From 3154b51d76ad91f29ef44750c9df6f352405cfc4 Mon Sep 17 00:00:00 2001 From: Donkey-Kurt <381890216@qq.com> Date: Wed, 24 Jan 2018 10:47:40 +0800 Subject: [PATCH 020/150] add missing props for android webview adding mixedContentMode?: "never" | "always" | "compatibility"; http://facebook.github.io/react-native/docs/webview.html#mixedcontentmode --- types/react-native/index.d.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 78b1d421d4..d269517aa6 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -1945,6 +1945,15 @@ export interface WebViewPropertiesAndroid { * Sets the user-agent for the WebView. */ userAgent?: string; + + /** + * Specifies the mixed content mode. i.e WebView will allow a secure origin to load content from any other origin. +Possible values for mixedContentMode are: +'never' (default) - WebView will not allow a secure origin to load content from an insecure origin. +'always' - WebView will allow a secure origin to load content from any other origin, even if that origin is insecure. +'compatibility' - WebView will attempt to be compatible with the approach of a modern web browser with regard to mixed content. + */ + mixedContentMode?: "never" | "always" | "compatibility"; } export interface WebViewIOSLoadRequestEvent { From f6099e4f9835521a142391711089a5bea7ee3fc2 Mon Sep 17 00:00:00 2001 From: Donkey-Kurt <381890216@qq.com> Date: Wed, 24 Jan 2018 11:05:58 +0800 Subject: [PATCH 021/150] fix trailing whitespace fix trailing whitespace --- types/react-native/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index d269517aa6..28f26c8ec8 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -1945,7 +1945,7 @@ export interface WebViewPropertiesAndroid { * Sets the user-agent for the WebView. */ userAgent?: string; - + /** * Specifies the mixed content mode. i.e WebView will allow a secure origin to load content from any other origin. Possible values for mixedContentMode are: From 2707abc38abe6b7d9ddd6b27dbca14be7a3f3b02 Mon Sep 17 00:00:00 2001 From: Youen Date: Wed, 24 Jan 2018 17:16:00 +0100 Subject: [PATCH 022/150] [react-router] added possibility to specify component props in route definitions, and to specify the type of this.props.route.props when implementing such a component (#22954) * [react-router] fixed lint error due to implicit any in CustomLink test * [react-router] added possibility to specify component props in route definitions, and to specify the type of this.props.route.props when implementing such a component Example: /* component definition */ interface Props { foo: string } class MyComponent extends React.Component, State> { /* here you can use this.props.route.props.foo */ } /* route configuration */ * - fixed lint errors related to T[] instead of Array - added default type for ComponentProps in RouteComponentProps, so that it stays compatible with existing code * [react-router] added default route props type (any) so that this new feature is fully backward compatible * [react-router] fixed lint errors (T[] instead of Array for non-generic types) --- types/react-router/index.d.ts | 1 + .../test/examples-from-react-router-website/CustomLink.tsx | 6 +++--- types/react-router/v3/lib/IndexRoute.d.ts | 3 ++- types/react-router/v3/lib/Route.d.ts | 4 ++-- types/react-router/v3/lib/Router.d.ts | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/types/react-router/index.d.ts b/types/react-router/index.d.ts index cf5efbbb36..1bebd855f1 100644 --- a/types/react-router/index.d.ts +++ b/types/react-router/index.d.ts @@ -14,6 +14,7 @@ // Jérémy Fauvel // Daniel Roth // Egor Shulga +// Youen Toupin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 diff --git a/types/react-router/test/examples-from-react-router-website/CustomLink.tsx b/types/react-router/test/examples-from-react-router-website/CustomLink.tsx index f3b1fb180e..ef5173e97e 100644 --- a/types/react-router/test/examples-from-react-router-website/CustomLink.tsx +++ b/types/react-router/test/examples-from-react-router-website/CustomLink.tsx @@ -24,9 +24,9 @@ interface OldSchoolMenuLinkProps extends LinkProps { } const OldSchoolMenuLink: React.SFC = ({ label, to, activeOnlyWhenExact }) => ( - ( -
- {match ? '> ' : ''}{label} + ( +
+ {params.match ? '> ' : ''}{label}
)}/> ); diff --git a/types/react-router/v3/lib/IndexRoute.d.ts b/types/react-router/v3/lib/IndexRoute.d.ts index 9c82775c12..1132713b1a 100644 --- a/types/react-router/v3/lib/IndexRoute.d.ts +++ b/types/react-router/v3/lib/IndexRoute.d.ts @@ -12,9 +12,10 @@ import { type ComponentCallback = (err: any, component: RouteComponent) => any; type ComponentsCallback = (err: any, components: RouteComponents) => any; -export interface IndexRouteProps { +export interface IndexRouteProps { component?: RouteComponent; components?: RouteComponents; + props?: Props; getComponent?(nextState: RouterState, callback: ComponentCallback): void; getComponents?(nextState: RouterState, callback: ComponentsCallback): void; onEnter?: EnterHook; diff --git a/types/react-router/v3/lib/Route.d.ts b/types/react-router/v3/lib/Route.d.ts index 15aafebc75..a9ca90b42a 100644 --- a/types/react-router/v3/lib/Route.d.ts +++ b/types/react-router/v3/lib/Route.d.ts @@ -11,7 +11,7 @@ import { } from "react-router"; import { IndexRouteProps } from "react-router/lib/IndexRoute"; -export interface RouteProps extends IndexRouteProps { +export interface RouteProps extends IndexRouteProps { path?: RoutePattern; } @@ -23,7 +23,7 @@ export default Route; type RouteCallback = (err: any, route: PlainRoute) => void; type RoutesCallback = (err: any, routesArray: PlainRoute[]) => void; -export interface PlainRoute extends RouteProps { +export interface PlainRoute extends RouteProps { childRoutes?: PlainRoute[]; getChildRoutes?(partialNextState: LocationState, callback: RoutesCallback): void; indexRoute?: PlainRoute; diff --git a/types/react-router/v3/lib/Router.d.ts b/types/react-router/v3/lib/Router.d.ts index 02550026b9..55072a140e 100644 --- a/types/react-router/v3/lib/Router.d.ts +++ b/types/react-router/v3/lib/Router.d.ts @@ -66,10 +66,10 @@ export interface InjectedRouter { isActive: ActiveFunction; } -export interface RouteComponentProps { +export interface RouteComponentProps { location: Location; params: P & R; - route: PlainRoute; + route: PlainRoute; router: InjectedRouter; routes: PlainRoute[]; routeParams: R; From 32418893ec85f9e99e1c7a1880ba02155a11369d Mon Sep 17 00:00:00 2001 From: Rene Hamburger Date: Wed, 24 Jan 2018 17:17:26 +0100 Subject: [PATCH 023/150] Add initial typings for the New Relic Browser client (#23146) * Add typing for the New Relic Browser client * Reactivate no-redundant-jsdoc-2 & remove type info from jsdoc blocks --- types/new-relic-browser/index.d.ts | 209 ++++++++++++++++++ .../new-relic-browser-tests.ts | 87 ++++++++ types/new-relic-browser/tsconfig.json | 23 ++ types/new-relic-browser/tslint.json | 3 + 4 files changed, 322 insertions(+) create mode 100644 types/new-relic-browser/index.d.ts create mode 100644 types/new-relic-browser/new-relic-browser-tests.ts create mode 100644 types/new-relic-browser/tsconfig.json create mode 100644 types/new-relic-browser/tslint.json diff --git a/types/new-relic-browser/index.d.ts b/types/new-relic-browser/index.d.ts new file mode 100644 index 0000000000..59b2f9a8e6 --- /dev/null +++ b/types/new-relic-browser/index.d.ts @@ -0,0 +1,209 @@ +// Type definitions for NewRelicBrowser 0.1072 +// Project: https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api +// Definitions by: Rene Hamburger , Piotr Kubisa +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare const newrelic: NewRelic.Browser; + +declare namespace NewRelic { + interface Browser { + /** + * Adds a unique name and ID to identify releases with multiple JavaScript bundles on the same page. + * + * @param releaseName A short description of the component; for example, the name of a project, + * application, file, or library. + * @param releaseId The ID or version of this release; for example, a version number, build number + * from your CI environment, GitHub SHA, GUID, or a hash of the contents. Since New Relic converts this + * value into a string, you can also use null or undefined if necessary + * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/addRelease + */ + addRelease(releaseName: string, releaseId: string): void; + + /** + * Reports a Browser PageAction event to Insights along with a name and attributes. + * + * @param name Name or category of the action. Reports to Insights as the actionName attribute. + * @param attributes JSON object with one or more key/value pairs. + * The key will report to Insights as its own PageAction attribute with the specified values. + * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/addPageAction + */ + addPageAction(name: string, attributes: { [key: string]: string }): void; + + /** + * Adds a JavaScript object with a custom name, start time, etc. to an in-progress session trace. + * + * @param eventObject If you are sending the same event object to New Relic Insights as a + * PageAction, omit the TYPE attribute. If included, it will override the event type and cause the + * PageAction event to be sent incorrectly. Instead, use the NAME attribute for event information. + * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/add-to-trace + */ + addToTrace(eventObject: EventObject): void; + + /** + * Records an additional time point as "finished" in a session trace, and sends the event to Insights. + * + * @param timestamp Defaults to the current time of the call. If used, this marks the time that + * the page is "finished" according to your own criteria. + * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/finished + */ + finished(timestamp?: number): void; + + /** + * Identifies a browser error without disrupting your app's operations. + * + * @param Provide a meaningful error message that you can use when analyzing data on + * New Relic Browser's JavaScript errors page. + * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/noticeError + */ + noticeError(error: any): void; + + /** + * Adds a user-defined attribute name and value to subsequent events on the page. + * + * @param name Name of the attribute. Appears as column in the PageView event. + * It will also appear as a column in the PageAction event if you are using it. + * @param value Value of the attribute. Appears as the value in the named attribute column in the + * PageView event. It will appear as a column in the PageAction event if you are using it. Custom attribute + * values cannot be complex objects, only simple types such as strings and numbers. + * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/setCustomAttribute + */ + setCustomAttribute(name: string, value: string): void; + + /** + * Allows selective ignoring of known errors that the Browser agent captures. + * + * @param filterCallback The callback will be called with each error, so it is not + * specific to one error. `err` will usually be an error object, but it can be other data types. + * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/setErrorHandler + */ + setErrorHandler(filterCallback: (err: any) => boolean): void; + + /** + * Groups page views to help URL structure or to capture the URL's routing information. + * + * @param name Name of the page you want to use when viewing it in New Relic Browser or Insights. + * @param host Default is http://custom.transaction. Typically set host to your site's domain URI. + * To further group these custom transactions, provide a custom host. Otherwise, the page views will be + * assigned the default domain custom.transaction. Segments within the name must be explicitly added to + * the Whitelist segments in your URL whitelist settings if they do not already appear. + * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/setPageViewName + */ + setPageViewName(name: string, host?: string): void; + + /** + * Returns a new API object that is bound to the current SPA interaction. + * + * @returns This method returns an API object that is bound to a specific BrowserInteraction + * event. Each time this method is called for the same BrowserInteraction, a new object is created, but it still + * references the same interaction. + * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/interaction-browser-spa-api + */ + interaction(): BrowserInteraction; + + /** + * Gives SPA routes more accurate names than default names. Monitors specific routes rather than by default + * grouping. + * + * @param name Current route name for the page. Route names passed to setCurrentRouteName() can + * be any string, but they should represent a routing pattern rather than a specific resource. For example, + * use /users/:id rather than /users/123. If null, exits out of the route change requirement and returns to + * the default naming strategy. + * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/spa-set-current-route-name + */ + setCurrentRouteName(name: string): void; + } + + interface EventObject { + /** Event name */ + name: string; + /** Start time in ms since epoch */ + start: number; + /** End time in ms since epoch. Defaults to same as start resulting in trace object with a duration of zero. */ + end?: number; + /** Origin of event */ + origin?: string; + /** Event type */ + type?: string; + } + + interface BrowserInteraction { + /** + * Times sub-components of a SPA interaction separately, including wait time and JS execution time. + * + * @param name This will be used as the name of the tracer. If you do not include a name, + * New Relic Browser does not add a node to the interaction tree. The callback time will be + * attributed to the parent node. + * @param syncCallback + * @returns This method ends the async time. It calls (and times) the callback that was passed into createTracer(). + * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/spa-create-tracer + */ + createTracer(name: string, syncCallback?: () => void): () => void; + + /** + * Ends the New Relic SPA interaction at the current time. + * + * @returns This method returns the same API object created by interaction(). + * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/spa-end + */ + end(): BrowserInteraction; + + /** + * Stores values across the current SPA interaction asynchronously in New Relic Browser. + * + * @param callback A function that accepts the interaction context object + * as its only argument. + * @returns This method returns the same API object created by interaction(). + * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/spa-get-context + */ + getContext(callback: (contextObject: any) => void): BrowserInteraction; + + /** + * Overrides other SPA save() calls; ignores an interaction so it is not saved or sent to New Relic. + * + * @returns This method returns the same API object created by interaction(). + * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/spa-ignore-browser + */ + ignore(): BrowserInteraction; + + /** + * Adds custom attributes for SPA interactions to the end of an event. It is called when the interaction + * has finished. You can invoke methods to modify the interaction, but methods that have asynchronous + * side effects will not have an effect. + * + * @param callback + * @returns This method returns the same API object created by interaction(). + * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/spa-on-end + */ + onEnd(callback: (contextObject: any) => void): BrowserInteraction; + + /** + * Ensures a SPA browser interaction will be saved when it ends. + * + * @returns This method returns the same API object created by interaction(). + * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/spa-save + */ + save(): BrowserInteraction; + + /** + * Adds a custom SPA attribute only to the current interaction in New Relic Browser. + * + * @param key Used as the attribute name on the BrowserInteraction event. + * @param Used as the attribute value on the BrowserInteraction event. This can be a + * string, number, boolean, or object. If it is an object, New Relic serializes it to a JSON string. + * @returns This method returns the same API object created by interaction(). + * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/spa-set-attribute + */ + setAttribute(key: string, value: any): BrowserInteraction; + + /** + * Sets the name and trigger of a SPA's browser interaction that is not a route change or URL change. + * + * @param name If null, the name will be set using the targetGroupedUrl attribute. + * If not null, this will set the browserInteractionName attribute in the BrowserInteraction event. + * @param trigger If not null, this will set the TRIGGER attribute on the BrowserInteraction event. + * @returns This method returns the same API object created by interaction(). + * @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/spa-set-name + */ + setName(name: string, trigger?: string): BrowserInteraction; + } +} diff --git a/types/new-relic-browser/new-relic-browser-tests.ts b/types/new-relic-browser/new-relic-browser-tests.ts new file mode 100644 index 0000000000..b9f75b142d --- /dev/null +++ b/types/new-relic-browser/new-relic-browser-tests.ts @@ -0,0 +1,87 @@ +// The following tests are largely taken straight from the examples at https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api + +// --- NewRelic.Browser methods ---------------------------------------------- + +// addRelease() +newrelic.addRelease('checkout page', 'a818994'); + +// addPageAction() +newrelic.addPageAction('copy-text-button', { result: 'success' }); + +// addToTrace() +newrelic.addToTrace({ + name: 'Event Name', + start: 1417044274239, + end: 1417044274252, + origin: 'Origin of event', + type: 'What type of event was this' +}); +newrelic.addToTrace({ + name: 'Event Name', + start: 1417044274239 +}); + +// finished() +newrelic.finished(); + +// noticeError() +try { + JSON.parse('{ "bar"'); +} catch (err) { + newrelic.noticeError(err); +} +newrelic.noticeError(new Error('bar')); + +// setCustomAttribute() +newrelic.setCustomAttribute('nodeId', '123'); + +// setErrorHandler() +newrelic.setErrorHandler((err) => { + if (err.message !== 'foo') { + return true; + } else { + return false; + } +}); + +// setPageViewName() +newrelic.setPageViewName('/login', 'https://www.myapp.com'); + +// setCurrentRouteName() +newrelic.setCurrentRouteName('/users/:id'); + +// --- NewRelic.BrowserInteraction methods ----------------------------------- + +// createTracer() +newrelic + .interaction() + .createTracer('customSegment', () => { })(); + +// end() +newrelic.interaction().end(); + +// getContext(), setAttribute() +const interaction = newrelic.interaction(); +interaction.getContext(ctx => { + if (ctx.productId) { + interaction.setAttribute('productId', ctx.productId); + } +}); + +// ignore() +newrelic.interaction().ignore(); + +// onEnd(), setAttribute() +newrelic.interaction().onEnd(ctx => { + interaction.setAttribute( + 'averageChartLoadTime', + ctx.totalChartLoadTime / ctx.chartLoadCount + ); +}); + +// setName(), setAttribute(), save() +newrelic.interaction() + .setName('loadNextPage') + .setAttribute('username', 'userName') + .setAttribute('userId', 123) + .save(); diff --git a/types/new-relic-browser/tsconfig.json b/types/new-relic-browser/tsconfig.json new file mode 100644 index 0000000000..61ee6742c7 --- /dev/null +++ b/types/new-relic-browser/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", + "new-relic-browser-tests.ts" + ] +} diff --git a/types/new-relic-browser/tslint.json b/types/new-relic-browser/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/new-relic-browser/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From 11707d7cf458a2d9e307068d0d2582cb05f79af8 Mon Sep 17 00:00:00 2001 From: SangWon Kim Date: Thu, 25 Jan 2018 01:19:59 +0900 Subject: [PATCH 024/150] Add types for 'josa' (#23067) * Add josa * Drop some over-detail tests --- types/josa/index.d.ts | 24 ++++++++++++++++++++++++ types/josa/josa-tests.ts | 22 ++++++++++++++++++++++ types/josa/tsconfig.json | 23 +++++++++++++++++++++++ types/josa/tslint.json | 1 + 4 files changed, 70 insertions(+) create mode 100644 types/josa/index.d.ts create mode 100644 types/josa/josa-tests.ts create mode 100644 types/josa/tsconfig.json create mode 100644 types/josa/tslint.json diff --git a/types/josa/index.d.ts b/types/josa/index.d.ts new file mode 100644 index 0000000000..3ce0d08ccc --- /dev/null +++ b/types/josa/index.d.ts @@ -0,0 +1,24 @@ +// Type definitions for josa 3.0 +// Project: https://github.com/kimdhoe/josa +// Definitions by: Vichyssoise +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export type Topic = '은' | '는'; +export type Subject = '이' | '가'; +export type Objective = '을' | '를'; +export type Conjunction = '와' | '과'; +export type Means = '으로' | '로'; +export type Josa = Topic | Subject | Objective | Conjunction | Means; + +/** 조사 플레이스홀더(ex. #{은})가 포함된 문자열을 입력받아 완성된 문자열을 반환합니다. */ +export function josa(sentence: string): string; + +/** 명사에 맞는 조사를 찾아주는 함수를 반환합니다. 예를 들면, 임의의 명사에 대해 _을_과 를 중 하나를 선택하는 함수가 필요할 때 사용할 수 있습니다. */ +export function getJosaPicker(josa: Topic): (noun: string) => Topic; +export function getJosaPicker(josa: Subject): (noun: string) => Subject; +export function getJosaPicker(josa: Objective): (noun: string) => Objective; +export function getJosaPicker(josa: Conjunction): (noun: string) => Conjunction; +export function getJosaPicker(josa: Means): (noun: string) => Means; + +/** 명사에 조사를 붙이는 함수를 반환합니다. */ +export function makeJosaify(josa: Josa): (noun: string) => string; diff --git a/types/josa/josa-tests.ts b/types/josa/josa-tests.ts new file mode 100644 index 0000000000..6dd2ab771d --- /dev/null +++ b/types/josa/josa-tests.ts @@ -0,0 +1,22 @@ +import { josa, getJosaPicker, makeJosaify } from 'josa'; + +josa('비시스와즈'); // $ExpectType string +josa('사람들#{은} 작동만 되면 그 원리#{는} 신경#{을} 안쓰지'); // $ExpectType string + +getJosaPicker('은'); +getJosaPicker('은')('사람'); + +getJosaPicker('이'); +getJosaPicker('이')('사람'); + +getJosaPicker('을'); +getJosaPicker('을')('사람'); + +getJosaPicker('와'); +getJosaPicker('와')('사람'); + +getJosaPicker('로'); +getJosaPicker('로')('사람'); + +makeJosaify('은'); +makeJosaify('은')('사람'); // $ExpectType string diff --git a/types/josa/tsconfig.json b/types/josa/tsconfig.json new file mode 100644 index 0000000000..0c56aa9a72 --- /dev/null +++ b/types/josa/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", + "josa-tests.ts" + ] +} diff --git a/types/josa/tslint.json b/types/josa/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/josa/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From e19b0d4f73cd91eb244e7cff1133d5bd4868a872 Mon Sep 17 00:00:00 2001 From: Sehrope Sarkuni Date: Wed, 24 Jan 2018 11:56:56 -0500 Subject: [PATCH 025/150] Redis add all caps PING and PUBLISH functions (#23160) * redis: Add missing PUBLISH function * redis: Add missing PING function --- types/redis/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/redis/index.d.ts b/types/redis/index.d.ts index db0dd122ba..85dfc05596 100644 --- a/types/redis/index.d.ts +++ b/types/redis/index.d.ts @@ -128,11 +128,14 @@ export interface Commands { */ ping(callback?: Callback): R; ping(message: string, callback?: Callback): R; + PING(callback?: Callback): R; + PING(message: string, callback?: Callback): R; /** * Post a message to a channel. */ publish(channel: string, value: string, cb?: Callback): R; + PUBLISH(channel: string, value: string, cb?: Callback): R; /** * Authenticate to the server. From 6eb3057805eaf400846bd8e0c4d8a7b02fb5f9d7 Mon Sep 17 00:00:00 2001 From: georgberecz Date: Wed, 24 Jan 2018 17:57:17 +0100 Subject: [PATCH 026/150] Add missing mouse event typings for View (#23156) --- types/paper/index.d.ts | 48 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/types/paper/index.d.ts b/types/paper/index.d.ts index 64d961ed10..8b29f890cb 100644 --- a/types/paper/index.d.ts +++ b/types/paper/index.d.ts @@ -1308,12 +1308,12 @@ declare module paper { * The function to be called when the mouse button is pushed down on the item. The function receives a MouseEvent object which contains information about the mouse event. */ onMouseDown: (event: MouseEvent) => void; - + /** * The function to be called when the mouse position changes while the mouse is being dragged. The function receives a MouseEvent object which contains information about the mouse event. */ onMouseDrag: (event: MouseEvent) => void; - + /** * The function to be called when the mouse button is released over the item. * The function receives a MouseEvent object which contains information about the mouse event. @@ -3535,7 +3535,7 @@ declare module paper { * @param highlight [optional] - */ constructor(color: Gradient, origin: Point, destination: Point, highlight?: Point); - + /** * Creates a RGB Color object. * @param hex - the RGB color in hex, i.e. #000000 @@ -3769,6 +3769,48 @@ declare module paper { */ onResize: (event: Event) => void; + /** + * The function to be called when the mouse button is pushed down on the item. The function receives a MouseEvent object which contains information about the mouse event. + */ + onMouseDown: (event: MouseEvent) => void; + + /** + * The function to be called when the mouse position changes while the mouse is being dragged. The function receives a MouseEvent object which contains information about the mouse event. + */ + onMouseDrag: (event: MouseEvent) => void; + + /** + * The function to be called when the mouse button is released over the item. + * The function receives a MouseEvent object which contains information about the mouse event. + */ + onMouseUp: (event: MouseEvent) => void; + + /** + * The function to be called when the mouse clicks on the item. The function receives a MouseEvent object which contains information about the mouse event. + */ + onClick: (event: MouseEvent) => void; + + /** + * The function to be called when the mouse double clicks on the item. The function receives a MouseEvent object which contains information about the mouse event. + */ + onDoubleClick: (event: MouseEvent) => void; + + /** + * The function to be called repeatedly when the mouse moves on top of the item. The function receives a MouseEvent object which contains information about the mouse event. + */ + onMouseMove: (event: MouseEvent) => void; + + /** + * The function to be called when the mouse moves over the item. This function will only be called again, once the mouse moved outside of the item first. The function receives a MouseEvent object which contains information about the mouse event. + */ + onMouseEnter: (event: MouseEvent) => void; + + /** + * The function to be called when the mouse moves out of the item. + * The function receives a MouseEvent object which contains information about the mouse event. + */ + onMouseLeave: (event: MouseEvent) => void; + /** * Removes this view from the project and frees the associated element. */ From fef2c8c6167637d1d814bdeff19703ec3ba60286 Mon Sep 17 00:00:00 2001 From: Xiaohan Zhang Date: Wed, 24 Jan 2018 11:57:46 -0500 Subject: [PATCH 027/150] Add express-to-koa definition (#23153) * Add express-to-koa definition * Fix types --- types/express-to-koa/express-to-koa-tests.ts | 12 ++++++++++ types/express-to-koa/index.d.ts | 18 +++++++++++++++ types/express-to-koa/tsconfig.json | 23 ++++++++++++++++++++ types/express-to-koa/tslint.json | 1 + 4 files changed, 54 insertions(+) create mode 100644 types/express-to-koa/express-to-koa-tests.ts create mode 100644 types/express-to-koa/index.d.ts create mode 100644 types/express-to-koa/tsconfig.json create mode 100644 types/express-to-koa/tslint.json diff --git a/types/express-to-koa/express-to-koa-tests.ts b/types/express-to-koa/express-to-koa-tests.ts new file mode 100644 index 0000000000..73b6ae480a --- /dev/null +++ b/types/express-to-koa/express-to-koa-tests.ts @@ -0,0 +1,12 @@ +import * as Koa from 'koa'; +import * as connect from 'connect'; +import expressToKoa = require('express-to-koa'); + +const app = new Koa(); +const middleware: connect.NextHandleFunction = (req, res, next) => { + // 'express middleware' + next(); +}; + +app.use(expressToKoa(middleware)); +app.listen(3000); diff --git a/types/express-to-koa/index.d.ts b/types/express-to-koa/index.d.ts new file mode 100644 index 0000000000..9a23108943 --- /dev/null +++ b/types/express-to-koa/index.d.ts @@ -0,0 +1,18 @@ +// Type definitions for express-to-koa 1.0 +// Project: https://github.com/kaelzhang/express-to-koa +// Definitions by: Xiaohan Zhang +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as Koa from "koa"; +import { IncomingMessage, ServerResponse } from "http"; + +export = expressToKoa; + +declare function expressToKoa( + middleware: ( + req: IncomingMessage, + res: ServerResponse, + next: (err?: any) => void, + ) => void +): Koa.Middleware; diff --git a/types/express-to-koa/tsconfig.json b/types/express-to-koa/tsconfig.json new file mode 100644 index 0000000000..9c27ef439f --- /dev/null +++ b/types/express-to-koa/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", + "express-to-koa-tests.ts" + ] +} diff --git a/types/express-to-koa/tslint.json b/types/express-to-koa/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/express-to-koa/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 2c84740341dcc785783b458c32f41bad86ae5b01 Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Wed, 24 Jan 2018 10:58:16 -0600 Subject: [PATCH 028/150] Fix Auth0 createPasswordChangeTicket() parameters. (#23147) --- types/auth0/auth0-tests.ts | 10 ++++++++++ types/auth0/index.d.ts | 18 ++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/types/auth0/auth0-tests.ts b/types/auth0/auth0-tests.ts index e9e347cc69..0572c2b0e7 100644 --- a/types/auth0/auth0-tests.ts +++ b/types/auth0/auth0-tests.ts @@ -131,3 +131,13 @@ const retryableManagementClient = new auth0.ManagementClient({ enabled : true } }); + +management.createPasswordChangeTicket({ + connection_id: 'con_id', + email: 'test@me.co', + new_password: 'password', + result_url: 'https://www.google.com/', + ttl_sec: 86400, +}, (err: Error, data) => { + console.log(data.ticket); +}); diff --git a/types/auth0/index.d.ts b/types/auth0/index.d.ts index 609c1ecf0d..58013848f8 100644 --- a/types/auth0/index.d.ts +++ b/types/auth0/index.d.ts @@ -488,10 +488,16 @@ export interface UserIdParams { } export interface PasswordChangeTicketParams { - result_url: string; - user_id: string; - email: string; - new_password: string; + result_url?: string; + user_id?: string; + new_password?: string; + connection_id?: string; + email?: string; + ttl_sec?: number; +} + +export interface PasswordChangeTicketResponse { + ticket: string; } export interface EmailVerificationTicketOptions { @@ -711,8 +717,8 @@ export class ManagementClient { sendEmailVerification(data: UserIdParams, cb?: (err: Error, data: any) => void): void; // Tickets - createPasswordChangeTicket(params: PasswordChangeTicketParams): Promise; - createPasswordChangeTicket(params: PasswordChangeTicketParams, cb?: (err: Error, data: any) => void): void; + createPasswordChangeTicket(params: PasswordChangeTicketParams): Promise; + createPasswordChangeTicket(params: PasswordChangeTicketParams, cb?: (err: Error, data: PasswordChangeTicketResponse) => void): void; createEmailVerificationTicket(data: EmailVerificationTicketOptions): Promise; createEmailVerificationTicket(data: EmailVerificationTicketOptions, cb?: (err: Error, data: any) => void): void; From cf7e1301b3b741cfc76e8ebdf8e0a8efddb130d3 Mon Sep 17 00:00:00 2001 From: Omar Diab Date: Wed, 24 Jan 2018 11:59:29 -0500 Subject: [PATCH 029/150] knex cb selectors: `this` is a `QueryBuilder` (#23143) * knex cb selectors: this is a QueryBuilder * knex: tests for QueryCallback --- types/knex/index.d.ts | 37 +++++++++++----------- types/knex/knex-tests.ts | 66 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 18 deletions(-) diff --git a/types/knex/index.d.ts b/types/knex/index.d.ts index 72b9c828a4..7531082758 100644 --- a/types/knex/index.d.ts +++ b/types/knex/index.d.ts @@ -116,7 +116,7 @@ declare namespace Knex { // Union union: Union; - unionAll(callback: Function): QueryBuilder; + unionAll(callback: QueryCallback): QueryBuilder; // Having having: Having; @@ -193,19 +193,19 @@ declare namespace Knex { interface JoinClause { on(raw: Raw): JoinClause; - on(callback: Function): JoinClause; + on(callback: QueryCallback): JoinClause; on(columns: { [key: string]: string | Raw }): JoinClause; on(column1: string, column2: string): JoinClause; on(column1: string, raw: Raw): JoinClause; on(column1: string, operator: string, column2: string | Raw): JoinClause; andOn(raw: Raw): JoinClause; - andOn(callback: Function): JoinClause; + andOn(callback: QueryCallback): JoinClause; andOn(columns: { [key: string]: string | Raw }): JoinClause; andOn(column1: string, column2: string): JoinClause; andOn(column1: string, raw: Raw): JoinClause; andOn(column1: string, operator: string, column2: string | Raw): JoinClause; orOn(raw: Raw): JoinClause; - orOn(callback: Function): JoinClause; + orOn(callback: QueryCallback): JoinClause; orOn(columns: { [key: string]: string | Raw }): JoinClause; orOn(column1: string, column2: string): JoinClause; orOn(column1: string, raw: Raw): JoinClause; @@ -222,12 +222,12 @@ declare namespace Knex { onNotNull(column1: string): JoinClause; andOnNotNull(column1: string): JoinClause; orOnNotNull(column1: string): JoinClause; - onExists(callback: () => void): JoinClause; - andOnExists(callback: () => void): JoinClause; - orOnExists(callback: () => void): JoinClause; - onNotExists(callback: () => void): JoinClause; - andOnNotExists(callback: () => void): JoinClause; - orOnNotExists(callback: () => void): JoinClause; + onExists(callback: QueryCallback): JoinClause; + andOnExists(callback: QueryCallback): JoinClause; + orOnExists(callback: QueryCallback): JoinClause; + onNotExists(callback: QueryCallback): JoinClause; + andOnNotExists(callback: QueryCallback): JoinClause; + orOnNotExists(callback: QueryCallback): JoinClause; onBetween(column1: string, range: [any, any]): JoinClause; andOnBetween(column1: string, range: [any, any]): JoinClause; orOnBetween(column1: string, range: [any, any]): JoinClause; @@ -260,7 +260,7 @@ declare namespace Knex { interface Where extends WhereRaw, WhereWrapped, WhereNull { (raw: Raw): QueryBuilder; - (callback: (queryBuilder: QueryBuilder) => any): QueryBuilder; + (callback: QueryCallback): QueryBuilder; (object: Object): QueryBuilder; (columnName: string, value: Value): QueryBuilder; (columnName: string, operator: string, value: Value): QueryBuilder; @@ -272,7 +272,7 @@ declare namespace Knex { } interface WhereWrapped { - (callback: Function): QueryBuilder; + (callback: QueryCallback): QueryBuilder; } interface WhereNull { @@ -281,7 +281,7 @@ declare namespace Knex { interface WhereIn { (columnName: string, values: Value[]): QueryBuilder; - (columnName: string, callback: Function): QueryBuilder; + (columnName: string, callback: QueryCallback): QueryBuilder; (columnName: string, query: QueryBuilder): QueryBuilder; } @@ -290,7 +290,7 @@ declare namespace Knex { } interface WhereExists { - (callback: Function): QueryBuilder; + (callback: QueryCallback): QueryBuilder; (query: QueryBuilder): QueryBuilder; } @@ -310,10 +310,10 @@ declare namespace Knex { } interface Union { - (callback: Function, wrap?: boolean): QueryBuilder; - (callbacks: Function[], wrap?: boolean): QueryBuilder; - (...callbacks: Function[]): QueryBuilder; - // (...callbacks: Function[], wrap?: boolean): QueryInterface; + (callback: QueryCallback, wrap?: boolean): QueryBuilder; + (callbacks: QueryCallback[], wrap?: boolean): QueryBuilder; + (...callbacks: QueryCallback[]): QueryBuilder; + // (...callbacks: QueryCallback[], wrap?: boolean): QueryInterface; } interface Having extends RawQueryBuilder, WhereWrapped { @@ -350,6 +350,7 @@ declare namespace Knex { // QueryBuilder // + type QueryCallback = (this: QueryBuilder, builder: QueryBuilder) => void; interface QueryBuilder extends QueryInterface, ChainableInterface { or: QueryBuilder; and: QueryBuilder; diff --git a/types/knex/knex-tests.ts b/types/knex/knex-tests.ts index f85168d552..d861db3c05 100644 --- a/types/knex/knex-tests.ts +++ b/types/knex/knex-tests.ts @@ -903,6 +903,72 @@ knex.select('*') knex.select('*').from('users').where(knex.raw('id = ?', [1])).toSQL(); +// +// Callback functions +// +knex('users') + .select('*') + .join('contacts', function(builder) { + this.on(function(builder) { + let self: Knex.QueryBuilder = this; + self = builder; + }).andOn(function(builder) { + let self: Knex.QueryBuilder = this; + self = builder; + }).orOn(function(builder) { + let self: Knex.QueryBuilder = this; + self = builder; + }).onExists(function(builder) { + let self: Knex.QueryBuilder = this; + self = builder; + }).orOnExists(function(builder) { + let self: Knex.QueryBuilder = this; + self = builder; + }).andOnExists(function(builder) { + let self: Knex.QueryBuilder = this; + self = builder; + }).onNotExists(function(builder) { + let self: Knex.QueryBuilder = this; + self = builder; + }).andOnNotExists(function(builder) { + let self: Knex.QueryBuilder = this; + self = builder; + }).orOnNotExists(function(builder) { + let self: Knex.QueryBuilder = this; + self = builder; + }); + }).where(function(builder) { + let self: Knex.QueryBuilder = this; + self = builder; + }).orWhere(function(builder) { + let self: Knex.QueryBuilder = this; + self = builder; + }).andWhere(function(builder) { + let self: Knex.QueryBuilder = this; + self = builder; + }).whereIn('column', function(builder) { + let self: Knex.QueryBuilder = this; + self = builder; + }).orWhereIn('column', function(builder) { + let self: Knex.QueryBuilder = this; + self = builder; + }).whereNotIn('column', function(builder) { + let self: Knex.QueryBuilder = this; + self = builder; + }).orWhereNotIn('column', function(builder) { + let self: Knex.QueryBuilder = this; + self = builder; + }).whereWrapped(function(builder) { + let self: Knex.QueryBuilder = this; + self = builder; + }).union(function(builder) { + let self: Knex.QueryBuilder = this; + self = builder; + }).unionAll(function(builder) { + let self: Knex.QueryBuilder = this; + self = builder; + }); + // // Migrations // From ca9d8d7e0f78e2e3bd83dc01c9613c0c7ffb7213 Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Wed, 24 Jan 2018 19:00:08 +0200 Subject: [PATCH 030/150] [graphql] Reformat all files using prettier. (#23142) See https://github.com/graphql/graphql-js/pull/1112 --- types/graphql/error/GraphQLError.d.ts | 98 +-- types/graphql/error/formatError.d.ts | 10 +- types/graphql/error/index.d.ts | 6 +- types/graphql/error/locatedError.d.ts | 6 +- types/graphql/error/syntaxError.d.ts | 6 +- types/graphql/execution/execute.d.ts | 76 +- types/graphql/execution/index.d.ts | 10 +- types/graphql/execution/values.d.ts | 30 +- types/graphql/language/ast.d.ts | 744 +++++++++--------- types/graphql/language/index.d.ts | 10 +- types/graphql/language/lexer.d.ts | 88 +-- types/graphql/language/location.d.ts | 6 +- types/graphql/language/parser.d.ts | 26 +- types/graphql/language/source.d.ts | 6 +- types/graphql/language/visitor.d.ts | 68 +- types/graphql/subscription/subscribe.d.ts | 38 +- types/graphql/type/definition.d.ts | 496 ++++++------ types/graphql/type/directives.d.ts | 67 +- types/graphql/type/index.d.ts | 67 +- types/graphql/type/introspection.d.ts | 32 +- types/graphql/type/schema.d.ts | 72 +- types/graphql/utilities/TypeInfo.d.ts | 52 +- types/graphql/utilities/astFromValue.d.ts | 9 +- .../graphql/utilities/buildClientSchema.d.ts | 2 +- types/graphql/utilities/extendSchema.d.ts | 4 +- .../utilities/findBreakingChanges.d.ts | 68 +- .../utilities/findDeprecatedUsages.d.ts | 4 +- types/graphql/utilities/getOperationAST.d.ts | 4 +- types/graphql/utilities/index.d.ts | 46 +- .../graphql/utilities/introspectionQuery.d.ts | 128 +-- types/graphql/utilities/isValidJSValue.d.ts | 5 +- .../utilities/isValidLiteralValue.d.ts | 4 +- .../graphql/utilities/separateOperations.d.ts | 7 +- types/graphql/utilities/typeComparators.d.ts | 22 +- types/graphql/utilities/typeFromAST.d.ts | 4 +- types/graphql/utilities/valueFromAST.d.ts | 18 +- types/graphql/validation/index.d.ts | 56 +- types/graphql/validation/validate.d.ts | 84 +- 38 files changed, 1239 insertions(+), 1240 deletions(-) diff --git a/types/graphql/error/GraphQLError.d.ts b/types/graphql/error/GraphQLError.d.ts index fbafcb1e30..116f17c3fa 100644 --- a/types/graphql/error/GraphQLError.d.ts +++ b/types/graphql/error/GraphQLError.d.ts @@ -9,60 +9,60 @@ import { Source } from '../language/source'; * GraphQL document and/or execution result that correspond to the Error. */ export class GraphQLError extends Error { - /** - * A message describing the Error for debugging purposes. - * - * Enumerable, and appears in the result of JSON.stringify(). - */ - message: string; + /** + * A message describing the Error for debugging purposes. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + message: string; - /** - * An array of { line, column } locations within the source GraphQL document - * which correspond to this error. - * - * Errors during validation often contain multiple locations, for example to - * point out two things with the same name. Errors during execution include a - * single location, the field which produced the error. - * - * Enumerable, and appears in the result of JSON.stringify(). - */ - locations?: Array<{ line: number, column: number }> | undefined; + /** + * An array of { line, column } locations within the source GraphQL document + * which correspond to this error. + * + * Errors during validation often contain multiple locations, for example to + * point out two things with the same name. Errors during execution include a + * single location, the field which produced the error. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + locations?: Array<{ line: number; column: number }> | undefined; - /** - * An array describing the JSON-path into the execution response which - * corresponds to this error. Only included for errors during execution. - * - * Enumerable, and appears in the result of JSON.stringify(). - */ - path?: Array | undefined; + /** + * An array describing the JSON-path into the execution response which + * corresponds to this error. Only included for errors during execution. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + path?: Array | undefined; - /** - * An array of GraphQL AST Nodes corresponding to this error. - */ - nodes?: ASTNode[] | undefined; + /** + * An array of GraphQL AST Nodes corresponding to this error. + */ + nodes?: ASTNode[] | undefined; - /** - * The source GraphQL document corresponding to this error. - */ - source?: Source | undefined; + /** + * The source GraphQL document corresponding to this error. + */ + source?: Source | undefined; - /** - * An array of character offsets within the source GraphQL document - * which correspond to this error. - */ - positions?: number[] | undefined; + /** + * An array of character offsets within the source GraphQL document + * which correspond to this error. + */ + positions?: number[] | undefined; - /** - * The original error thrown from a field resolver during execution. - */ - originalError?: Error; + /** + * The original error thrown from a field resolver during execution. + */ + originalError?: Error; - constructor( - message: string, - nodes?: any[], - source?: Source, - positions?: number[], - path?: Array, - originalError?: Error, - ); + constructor( + message: string, + nodes?: any[], + source?: Source, + positions?: number[], + path?: Array, + originalError?: Error, + ); } diff --git a/types/graphql/error/formatError.d.ts b/types/graphql/error/formatError.d.ts index fbb31cdb23..26dbe0f743 100644 --- a/types/graphql/error/formatError.d.ts +++ b/types/graphql/error/formatError.d.ts @@ -7,12 +7,12 @@ import { GraphQLError } from './GraphQLError'; export function formatError(error: GraphQLError): GraphQLFormattedError; export interface GraphQLFormattedError { - message: string; - locations?: GraphQLErrorLocation[]; - path?: Array; + message: string; + locations?: GraphQLErrorLocation[]; + path?: Array; } export interface GraphQLErrorLocation { - line: number; - column: number; + line: number; + column: number; } diff --git a/types/graphql/error/index.d.ts b/types/graphql/error/index.d.ts index cfb5b92740..0e9a557794 100644 --- a/types/graphql/error/index.d.ts +++ b/types/graphql/error/index.d.ts @@ -1,4 +1,8 @@ export { GraphQLError } from './GraphQLError'; export { syntaxError } from './syntaxError'; export { locatedError } from './locatedError'; -export { formatError, GraphQLFormattedError, GraphQLErrorLocation } from './formatError'; +export { + formatError, + GraphQLFormattedError, + GraphQLErrorLocation, +} from './formatError'; diff --git a/types/graphql/error/locatedError.d.ts b/types/graphql/error/locatedError.d.ts index c827f8ede8..64fadf49f4 100644 --- a/types/graphql/error/locatedError.d.ts +++ b/types/graphql/error/locatedError.d.ts @@ -6,7 +6,7 @@ import { GraphQLError } from './GraphQLError'; * document responsible for the original Error. */ export function locatedError( - originalError: Error, - nodes: T[], - path: Array + originalError: Error, + nodes: T[], + path: Array, ): GraphQLError; diff --git a/types/graphql/error/syntaxError.d.ts b/types/graphql/error/syntaxError.d.ts index 80c4453e03..ccf84044ca 100644 --- a/types/graphql/error/syntaxError.d.ts +++ b/types/graphql/error/syntaxError.d.ts @@ -6,7 +6,7 @@ import { GraphQLError } from './GraphQLError'; * descriptive information about the syntax error's position in the source. */ export function syntaxError( - source: Source, - position: number, - description: string + source: Source, + position: number, + description: string, ): GraphQLError; diff --git a/types/graphql/execution/execute.d.ts b/types/graphql/execution/execute.d.ts index c8ee7d9215..ea6ab8ed39 100644 --- a/types/graphql/execution/execute.d.ts +++ b/types/graphql/execution/execute.d.ts @@ -1,14 +1,18 @@ import { GraphQLError, locatedError } from '../error'; import { GraphQLSchema } from '../type/schema'; -import { GraphQLField, GraphQLFieldResolver, ResponsePath } from '../type/definition'; import { - DirectiveNode, - DocumentNode, - OperationDefinitionNode, - SelectionSetNode, - FieldNode, - InlineFragmentNode, - FragmentDefinitionNode, + GraphQLField, + GraphQLFieldResolver, + ResponsePath, +} from '../type/definition'; +import { + DirectiveNode, + DocumentNode, + OperationDefinitionNode, + SelectionSetNode, + FieldNode, + InlineFragmentNode, + FragmentDefinitionNode, } from '../language/ast'; /** * Data that must be available at all points during query execution. @@ -17,13 +21,13 @@ import { * and the fragments defined in the query document */ export interface ExecutionContext { - schema: GraphQLSchema; - fragments: { [key: string]: FragmentDefinitionNode }; - rootValue: any; - operation: OperationDefinitionNode; - variableValues: { [key: string]: any }; - fieldResolver: GraphQLFieldResolver; - errors: GraphQLError[]; + schema: GraphQLSchema; + fragments: { [key: string]: FragmentDefinitionNode }; + rootValue: any; + operation: OperationDefinitionNode; + variableValues: { [key: string]: any }; + fieldResolver: GraphQLFieldResolver; + errors: GraphQLError[]; } /** @@ -33,19 +37,19 @@ export interface ExecutionContext { * non-empty array if an error occurred. */ export interface ExecutionResult { - data?: { [key: string]: any }; - extensions?: { [key: string]: any }; - errors?: GraphQLError[]; + data?: { [key: string]: any }; + extensions?: { [key: string]: any }; + errors?: GraphQLError[]; } export type ExecutionArgs = { - schema: GraphQLSchema, - document: DocumentNode, - rootValue?: any, - contextValue?: any, - variableValues?: {[key: string]: any}, - operationName?: string, - fieldResolver?: GraphQLFieldResolver + schema: GraphQLSchema; + document: DocumentNode; + rootValue?: any; + contextValue?: any; + variableValues?: { [key: string]: any }; + operationName?: string; + fieldResolver?: GraphQLFieldResolver; }; /** @@ -60,24 +64,22 @@ export type ExecutionArgs = { */ export function execute(args: ExecutionArgs): Promise; export function execute( - schema: GraphQLSchema, - document: DocumentNode, - rootValue?: any, - contextValue?: any, - variableValues?: { - [key: string]: any - }, - operationName?: string, - fieldResolver?: GraphQLFieldResolver, + schema: GraphQLSchema, + document: DocumentNode, + rootValue?: any, + contextValue?: any, + variableValues?: { + [key: string]: any; + }, + operationName?: string, + fieldResolver?: GraphQLFieldResolver, ): Promise; /** * Given a ResponsePath (found in the `path` entry in the information provided * as the last argument to a field resolver), return an Array of the path keys. */ -export function responsePathAsArray( - path: ResponsePath -): Array; +export function responsePathAsArray(path: ResponsePath): Array; export function addPath(prev: ResponsePath, key: string | number): any; diff --git a/types/graphql/execution/index.d.ts b/types/graphql/execution/index.d.ts index 4bf4e395ab..a5c4980c0a 100644 --- a/types/graphql/execution/index.d.ts +++ b/types/graphql/execution/index.d.ts @@ -1,9 +1,9 @@ export { - execute, - defaultFieldResolver, - responsePathAsArray, - ExecutionArgs, - ExecutionResult + execute, + defaultFieldResolver, + responsePathAsArray, + ExecutionArgs, + ExecutionResult, } from './execute'; export { getDirectiveValues } from './values'; diff --git a/types/graphql/execution/values.d.ts b/types/graphql/execution/values.d.ts index 79a0176f8d..08e6041aa2 100644 --- a/types/graphql/execution/values.d.ts +++ b/types/graphql/execution/values.d.ts @@ -1,7 +1,15 @@ -import { GraphQLInputType, GraphQLField, GraphQLArgument } from '../type/definition'; +import { + GraphQLInputType, + GraphQLField, + GraphQLArgument, +} from '../type/definition'; import { GraphQLDirective } from '../type/directives'; import { GraphQLSchema } from '../type/schema'; -import { FieldNode, DirectiveNode, VariableDefinitionNode } from '../language/ast'; +import { + FieldNode, + DirectiveNode, + VariableDefinitionNode, +} from '../language/ast'; /** * Prepares an object map of variableValues of the correct type based on the @@ -9,9 +17,9 @@ import { FieldNode, DirectiveNode, VariableDefinitionNode } from '../language/as * parsed to match the variable definitions, a GraphQLError will be thrown. */ export function getVariableValues( - schema: GraphQLSchema, - varDefNodes: VariableDefinitionNode[], - inputs: { [key: string]: any } + schema: GraphQLSchema, + varDefNodes: VariableDefinitionNode[], + inputs: { [key: string]: any }, ): { [key: string]: any }; /** @@ -19,9 +27,9 @@ export function getVariableValues( * definitions and list of argument AST nodes. */ export function getArgumentValues( - def: GraphQLField | GraphQLDirective, - node: FieldNode | DirectiveNode, - variableValues?: { [key: string]: any } + def: GraphQLField | GraphQLDirective, + node: FieldNode | DirectiveNode, + variableValues?: { [key: string]: any }, ): { [key: string]: any }; /** @@ -32,7 +40,7 @@ export function getArgumentValues( * If the directive does not exist on the node, returns undefined. */ export function getDirectiveValues( - directiveDef: GraphQLDirective, - node: { directives?: Array }, - variableValues?: { [key: string]: any } + directiveDef: GraphQLDirective, + node: { directives?: Array }, + variableValues?: { [key: string]: any }, ): void | { [key: string]: any }; diff --git a/types/graphql/language/ast.d.ts b/types/graphql/language/ast.d.ts index 24344fe904..1873caeb1f 100644 --- a/types/graphql/language/ast.d.ts +++ b/types/graphql/language/ast.d.ts @@ -5,30 +5,30 @@ import { Source } from './source'; * identify the region of the source from which the AST derived. */ export interface Location { - /** - * The character offset at which this Node begins. - */ - start: number; + /** + * The character offset at which this Node begins. + */ + start: number; - /** - * The character offset at which this Node ends. - */ - end: number; + /** + * The character offset at which this Node ends. + */ + end: number; - /** - * The Token at which this Node begins. - */ - startToken: Token; + /** + * The Token at which this Node begins. + */ + startToken: Token; - /** - * The Token at which this Node ends. - */ - endToken: Token; + /** + * The Token at which this Node ends. + */ + endToken: Token; - /** - * The Source document the AST represents. - */ - source: Source; + /** + * The Source document the AST represents. + */ + source: Source; } /** @@ -37,181 +37,181 @@ export interface Location { * *only*. */ type TokenKind = - | '' - | '' - | '!' - | '$' - | '(' - | ')' - | '...' - | ':' - | '=' - | '@' - | '[' - | ']' - | '{' - | '|' - | '}' - | 'Name' - | 'Int' - | 'Float' - | 'String' - | 'BlockString' - | 'Comment'; + | '' + | '' + | '!' + | '$' + | '(' + | ')' + | '...' + | ':' + | '=' + | '@' + | '[' + | ']' + | '{' + | '|' + | '}' + | 'Name' + | 'Int' + | 'Float' + | 'String' + | 'BlockString' + | 'Comment'; /** * Represents a range of characters represented by a lexical token * within a Source. */ export interface Token { - /** - * The kind of Token. - */ - kind: TokenKind; + /** + * The kind of Token. + */ + kind: TokenKind; - /** - * The character offset at which this Node begins. - */ - start: number; + /** + * The character offset at which this Node begins. + */ + start: number; - /** - * The character offset at which this Node ends. - */ - end: number; + /** + * The character offset at which this Node ends. + */ + end: number; - /** - * The 1-indexed line number on which this Token appears. - */ - line: number; + /** + * The 1-indexed line number on which this Token appears. + */ + line: number; - /** - * The 1-indexed column number at which this Token begins. - */ - column: number; + /** + * The 1-indexed column number at which this Token begins. + */ + column: number; - /** - * For non-punctuation tokens, represents the interpreted value of the token. - */ - value: string | undefined; + /** + * For non-punctuation tokens, represents the interpreted value of the token. + */ + value: string | undefined; - /** - * Tokens exist as nodes in a double-linked-list amongst all tokens - * including ignored tokens. is always the first node and - * the last. - */ - prev?: Token; - next?: Token; + /** + * Tokens exist as nodes in a double-linked-list amongst all tokens + * including ignored tokens. is always the first node and + * the last. + */ + prev?: Token; + next?: Token; } /** * The list of all possible AST node types. */ export type ASTNode = - | NameNode - | DocumentNode - | OperationDefinitionNode - | VariableDefinitionNode - | VariableNode - | SelectionSetNode - | FieldNode - | ArgumentNode - | FragmentSpreadNode - | InlineFragmentNode - | FragmentDefinitionNode - | IntValueNode - | FloatValueNode - | StringValueNode - | BooleanValueNode - | NullValueNode - | EnumValueNode - | ListValueNode - | ObjectValueNode - | ObjectFieldNode - | DirectiveNode - | NamedTypeNode - | ListTypeNode - | NonNullTypeNode - | SchemaDefinitionNode - | OperationTypeDefinitionNode - | ScalarTypeDefinitionNode - | ObjectTypeDefinitionNode - | FieldDefinitionNode - | InputValueDefinitionNode - | InterfaceTypeDefinitionNode - | UnionTypeDefinitionNode - | EnumTypeDefinitionNode - | EnumValueDefinitionNode - | InputObjectTypeDefinitionNode - | ScalarTypeExtensionNode - | ObjectTypeExtensionNode - | InterfaceTypeExtensionNode - | UnionTypeExtensionNode - | EnumTypeExtensionNode - | InputObjectTypeExtensionNode - | DirectiveDefinitionNode; + | NameNode + | DocumentNode + | OperationDefinitionNode + | VariableDefinitionNode + | VariableNode + | SelectionSetNode + | FieldNode + | ArgumentNode + | FragmentSpreadNode + | InlineFragmentNode + | FragmentDefinitionNode + | IntValueNode + | FloatValueNode + | StringValueNode + | BooleanValueNode + | NullValueNode + | EnumValueNode + | ListValueNode + | ObjectValueNode + | ObjectFieldNode + | DirectiveNode + | NamedTypeNode + | ListTypeNode + | NonNullTypeNode + | SchemaDefinitionNode + | OperationTypeDefinitionNode + | ScalarTypeDefinitionNode + | ObjectTypeDefinitionNode + | FieldDefinitionNode + | InputValueDefinitionNode + | InterfaceTypeDefinitionNode + | UnionTypeDefinitionNode + | EnumTypeDefinitionNode + | EnumValueDefinitionNode + | InputObjectTypeDefinitionNode + | ScalarTypeExtensionNode + | ObjectTypeExtensionNode + | InterfaceTypeExtensionNode + | UnionTypeExtensionNode + | EnumTypeExtensionNode + | InputObjectTypeExtensionNode + | DirectiveDefinitionNode; /** * Utility type listing all nodes indexed by their kind. */ export interface ASTKindToNode { - Name: NameNode; - Document: DocumentNode; - OperationDefinition: OperationDefinitionNode; - VariableDefinition: VariableDefinitionNode; - Variable: VariableNode; - SelectionSet: SelectionSetNode; - Field: FieldNode; - Argument: ArgumentNode; - FragmentSpread: FragmentSpreadNode; - InlineFragment: InlineFragmentNode; - FragmentDefinition: FragmentDefinitionNode; - IntValue: IntValueNode; - FloatValue: FloatValueNode; - StringValue: StringValueNode; - BooleanValue: BooleanValueNode; - NullValue: NullValueNode; - EnumValue: EnumValueNode; - ListValue: ListValueNode; - ObjectValue: ObjectValueNode; - ObjectField: ObjectFieldNode; - Directive: DirectiveNode; - NamedType: NamedTypeNode; - ListType: ListTypeNode; - NonNullType: NonNullTypeNode; - SchemaDefinition: SchemaDefinitionNode; - OperationTypeDefinition: OperationTypeDefinitionNode; - ScalarTypeDefinition: ScalarTypeDefinitionNode; - ObjectTypeDefinition: ObjectTypeDefinitionNode; - FieldDefinition: FieldDefinitionNode; - InputValueDefinition: InputValueDefinitionNode; - InterfaceTypeDefinition: InterfaceTypeDefinitionNode; - UnionTypeDefinition: UnionTypeDefinitionNode; - EnumTypeDefinition: EnumTypeDefinitionNode; - EnumValueDefinition: EnumValueDefinitionNode; - InputObjectTypeDefinition: InputObjectTypeDefinitionNode; - ScalarTypeExtension: ScalarTypeExtensionNode; - ObjectTypeExtension: ObjectTypeExtensionNode; - InterfaceTypeExtension: InterfaceTypeExtensionNode; - UnionTypeExtension: UnionTypeExtensionNode; - EnumTypeExtension: EnumTypeExtensionNode; - InputObjectTypeExtension: InputObjectTypeExtensionNode; - DirectiveDefinition: DirectiveDefinitionNode; + Name: NameNode; + Document: DocumentNode; + OperationDefinition: OperationDefinitionNode; + VariableDefinition: VariableDefinitionNode; + Variable: VariableNode; + SelectionSet: SelectionSetNode; + Field: FieldNode; + Argument: ArgumentNode; + FragmentSpread: FragmentSpreadNode; + InlineFragment: InlineFragmentNode; + FragmentDefinition: FragmentDefinitionNode; + IntValue: IntValueNode; + FloatValue: FloatValueNode; + StringValue: StringValueNode; + BooleanValue: BooleanValueNode; + NullValue: NullValueNode; + EnumValue: EnumValueNode; + ListValue: ListValueNode; + ObjectValue: ObjectValueNode; + ObjectField: ObjectFieldNode; + Directive: DirectiveNode; + NamedType: NamedTypeNode; + ListType: ListTypeNode; + NonNullType: NonNullTypeNode; + SchemaDefinition: SchemaDefinitionNode; + OperationTypeDefinition: OperationTypeDefinitionNode; + ScalarTypeDefinition: ScalarTypeDefinitionNode; + ObjectTypeDefinition: ObjectTypeDefinitionNode; + FieldDefinition: FieldDefinitionNode; + InputValueDefinition: InputValueDefinitionNode; + InterfaceTypeDefinition: InterfaceTypeDefinitionNode; + UnionTypeDefinition: UnionTypeDefinitionNode; + EnumTypeDefinition: EnumTypeDefinitionNode; + EnumValueDefinition: EnumValueDefinitionNode; + InputObjectTypeDefinition: InputObjectTypeDefinitionNode; + ScalarTypeExtension: ScalarTypeExtensionNode; + ObjectTypeExtension: ObjectTypeExtensionNode; + InterfaceTypeExtension: InterfaceTypeExtensionNode; + UnionTypeExtension: UnionTypeExtensionNode; + EnumTypeExtension: EnumTypeExtensionNode; + InputObjectTypeExtension: InputObjectTypeExtensionNode; + DirectiveDefinition: DirectiveDefinitionNode; } // Name export interface NameNode { - kind: 'Name'; - loc?: Location; - value: string; + kind: 'Name'; + loc?: Location; + value: string; } // Document export interface DocumentNode { - kind: 'Document'; - loc?: Location; - definitions: DefinitionNode[]; + kind: 'Document'; + loc?: Location; + definitions: DefinitionNode[]; } export type DefinitionNode = @@ -223,300 +223,294 @@ export type ExecutableDefinitionNode = | FragmentDefinitionNode; export interface OperationDefinitionNode { - kind: 'OperationDefinition'; - loc?: Location; - operation: OperationTypeNode; - name?: NameNode; - variableDefinitions?: VariableDefinitionNode[]; - directives?: DirectiveNode[]; - selectionSet: SelectionSetNode; + kind: 'OperationDefinition'; + loc?: Location; + operation: OperationTypeNode; + name?: NameNode; + variableDefinitions?: VariableDefinitionNode[]; + directives?: DirectiveNode[]; + selectionSet: SelectionSetNode; } // Note: subscription is an experimental non-spec addition. export type OperationTypeNode = 'query' | 'mutation' | 'subscription'; export interface VariableDefinitionNode { - kind: 'VariableDefinition'; - loc?: Location; - variable: VariableNode; - type: TypeNode; - defaultValue?: ValueNode; + kind: 'VariableDefinition'; + loc?: Location; + variable: VariableNode; + type: TypeNode; + defaultValue?: ValueNode; } export interface VariableNode { - kind: 'Variable'; - loc?: Location; - name: NameNode; + kind: 'Variable'; + loc?: Location; + name: NameNode; } export interface SelectionSetNode { - kind: 'SelectionSet'; - loc?: Location; - selections: SelectionNode[]; + kind: 'SelectionSet'; + loc?: Location; + selections: SelectionNode[]; } -export type SelectionNode = - | FieldNode - | FragmentSpreadNode - | InlineFragmentNode; +export type SelectionNode = FieldNode | FragmentSpreadNode | InlineFragmentNode; export interface FieldNode { - kind: 'Field'; - loc?: Location; - alias?: NameNode; - name: NameNode; - arguments?: ArgumentNode[]; - directives?: DirectiveNode[]; - selectionSet?: SelectionSetNode; + kind: 'Field'; + loc?: Location; + alias?: NameNode; + name: NameNode; + arguments?: ArgumentNode[]; + directives?: DirectiveNode[]; + selectionSet?: SelectionSetNode; } export interface ArgumentNode { - kind: 'Argument'; - loc?: Location; - name: NameNode; - value: ValueNode; + kind: 'Argument'; + loc?: Location; + name: NameNode; + value: ValueNode; } // Fragments export interface FragmentSpreadNode { - kind: 'FragmentSpread'; - loc?: Location; - name: NameNode; - directives?: DirectiveNode[]; + kind: 'FragmentSpread'; + loc?: Location; + name: NameNode; + directives?: DirectiveNode[]; } export interface InlineFragmentNode { - kind: 'InlineFragment'; - loc?: Location; - typeCondition?: NamedTypeNode; - directives?: DirectiveNode[]; - selectionSet: SelectionSetNode; + kind: 'InlineFragment'; + loc?: Location; + typeCondition?: NamedTypeNode; + directives?: DirectiveNode[]; + selectionSet: SelectionSetNode; } export interface FragmentDefinitionNode { - kind: 'FragmentDefinition'; - loc?: Location; - name: NameNode; - // Note: fragment variable definitions are experimental and may be changed - // or removed in the future. - variableDefinitions?: VariableDefinitionNode[]; - typeCondition: NamedTypeNode; - directives?: DirectiveNode[]; - selectionSet: SelectionSetNode; + kind: 'FragmentDefinition'; + loc?: Location; + name: NameNode; + // Note: fragment variable definitions are experimental and may be changed + // or removed in the future. + variableDefinitions?: VariableDefinitionNode[]; + typeCondition: NamedTypeNode; + directives?: DirectiveNode[]; + selectionSet: SelectionSetNode; } // Values export type ValueNode = - | VariableNode - | IntValueNode - | FloatValueNode - | StringValueNode - | BooleanValueNode - | NullValueNode - | EnumValueNode - | ListValueNode - | ObjectValueNode; + | VariableNode + | IntValueNode + | FloatValueNode + | StringValueNode + | BooleanValueNode + | NullValueNode + | EnumValueNode + | ListValueNode + | ObjectValueNode; export interface IntValueNode { - kind: 'IntValue'; - loc?: Location; - value: string; + kind: 'IntValue'; + loc?: Location; + value: string; } export interface FloatValueNode { - kind: 'FloatValue'; - loc?: Location; - value: string; + kind: 'FloatValue'; + loc?: Location; + value: string; } export interface StringValueNode { - kind: 'StringValue'; - loc?: Location; - value: string; + kind: 'StringValue'; + loc?: Location; + value: string; } export interface BooleanValueNode { - kind: 'BooleanValue'; - loc?: Location; - value: boolean; + kind: 'BooleanValue'; + loc?: Location; + value: boolean; } export interface NullValueNode { - kind: 'NullValue'; - loc?: Location; + kind: 'NullValue'; + loc?: Location; } export interface EnumValueNode { - kind: 'EnumValue'; - loc?: Location; - value: string; + kind: 'EnumValue'; + loc?: Location; + value: string; } export interface ListValueNode { - kind: 'ListValue'; - loc?: Location; - values: ValueNode[]; + kind: 'ListValue'; + loc?: Location; + values: ValueNode[]; } export interface ObjectValueNode { - kind: 'ObjectValue'; - loc?: Location; - fields: ObjectFieldNode[]; + kind: 'ObjectValue'; + loc?: Location; + fields: ObjectFieldNode[]; } export interface ObjectFieldNode { - kind: 'ObjectField'; - loc?: Location; - name: NameNode; - value: ValueNode; + kind: 'ObjectField'; + loc?: Location; + name: NameNode; + value: ValueNode; } // Directives export interface DirectiveNode { - kind: 'Directive'; - loc?: Location; - name: NameNode; - arguments?: ArgumentNode[]; + kind: 'Directive'; + loc?: Location; + name: NameNode; + arguments?: ArgumentNode[]; } // Type Reference -export type TypeNode = - | NamedTypeNode - | ListTypeNode - | NonNullTypeNode; +export type TypeNode = NamedTypeNode | ListTypeNode | NonNullTypeNode; export interface NamedTypeNode { - kind: 'NamedType'; - loc?: Location; - name: NameNode; + kind: 'NamedType'; + loc?: Location; + name: NameNode; } export interface ListTypeNode { - kind: 'ListType'; - loc?: Location; - type: TypeNode; + kind: 'ListType'; + loc?: Location; + type: TypeNode; } export interface NonNullTypeNode { - kind: 'NonNullType'; - loc?: Location; - type: NamedTypeNode | ListTypeNode; + kind: 'NonNullType'; + loc?: Location; + type: NamedTypeNode | ListTypeNode; } // Type System Definition export type TypeSystemDefinitionNode = - | SchemaDefinitionNode - | TypeDefinitionNode - | TypeExtensionNode - | DirectiveDefinitionNode; + | SchemaDefinitionNode + | TypeDefinitionNode + | TypeExtensionNode + | DirectiveDefinitionNode; export interface SchemaDefinitionNode { - kind: 'SchemaDefinition'; - loc?: Location; - directives: DirectiveNode[]; - operationTypes: OperationTypeDefinitionNode[]; + kind: 'SchemaDefinition'; + loc?: Location; + directives: DirectiveNode[]; + operationTypes: OperationTypeDefinitionNode[]; } export interface OperationTypeDefinitionNode { - kind: 'OperationTypeDefinition'; - loc?: Location; - operation: OperationTypeNode; - type: NamedTypeNode; + kind: 'OperationTypeDefinition'; + loc?: Location; + operation: OperationTypeNode; + type: NamedTypeNode; } export type TypeDefinitionNode = - | ScalarTypeDefinitionNode - | ObjectTypeDefinitionNode - | InterfaceTypeDefinitionNode - | UnionTypeDefinitionNode - | EnumTypeDefinitionNode - | InputObjectTypeDefinitionNode; + | ScalarTypeDefinitionNode + | ObjectTypeDefinitionNode + | InterfaceTypeDefinitionNode + | UnionTypeDefinitionNode + | EnumTypeDefinitionNode + | InputObjectTypeDefinitionNode; export interface ScalarTypeDefinitionNode { - kind: 'ScalarTypeDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - directives?: DirectiveNode[]; + kind: 'ScalarTypeDefinition'; + loc?: Location; + description?: StringValueNode; + name: NameNode; + directives?: DirectiveNode[]; } export interface ObjectTypeDefinitionNode { - kind: 'ObjectTypeDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - interfaces?: NamedTypeNode[]; - directives?: DirectiveNode[]; - fields: FieldDefinitionNode[]; + kind: 'ObjectTypeDefinition'; + loc?: Location; + description?: StringValueNode; + name: NameNode; + interfaces?: NamedTypeNode[]; + directives?: DirectiveNode[]; + fields: FieldDefinitionNode[]; } export interface FieldDefinitionNode { - kind: 'FieldDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - arguments: InputValueDefinitionNode[]; - type: TypeNode; - directives?: DirectiveNode[]; + kind: 'FieldDefinition'; + loc?: Location; + description?: StringValueNode; + name: NameNode; + arguments: InputValueDefinitionNode[]; + type: TypeNode; + directives?: DirectiveNode[]; } export interface InputValueDefinitionNode { - kind: 'InputValueDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - type: TypeNode; - defaultValue?: ValueNode; - directives?: DirectiveNode[]; + kind: 'InputValueDefinition'; + loc?: Location; + description?: StringValueNode; + name: NameNode; + type: TypeNode; + defaultValue?: ValueNode; + directives?: DirectiveNode[]; } export interface InterfaceTypeDefinitionNode { - kind: 'InterfaceTypeDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - directives?: DirectiveNode[]; - fields: FieldDefinitionNode[]; + kind: 'InterfaceTypeDefinition'; + loc?: Location; + description?: StringValueNode; + name: NameNode; + directives?: DirectiveNode[]; + fields: FieldDefinitionNode[]; } export interface UnionTypeDefinitionNode { - kind: 'UnionTypeDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - directives?: DirectiveNode[]; - types: NamedTypeNode[]; + kind: 'UnionTypeDefinition'; + loc?: Location; + description?: StringValueNode; + name: NameNode; + directives?: DirectiveNode[]; + types: NamedTypeNode[]; } export interface EnumTypeDefinitionNode { - kind: 'EnumTypeDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - directives?: DirectiveNode[]; - values: EnumValueDefinitionNode[]; + kind: 'EnumTypeDefinition'; + loc?: Location; + description?: StringValueNode; + name: NameNode; + directives?: DirectiveNode[]; + values: EnumValueDefinitionNode[]; } export interface EnumValueDefinitionNode { - kind: 'EnumValueDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - directives?: DirectiveNode[]; + kind: 'EnumValueDefinition'; + loc?: Location; + description?: StringValueNode; + name: NameNode; + directives?: DirectiveNode[]; } export interface InputObjectTypeDefinitionNode { - kind: 'InputObjectTypeDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - directives?: DirectiveNode[]; - fields: InputValueDefinitionNode[]; + kind: 'InputObjectTypeDefinition'; + loc?: Location; + description?: StringValueNode; + name: NameNode; + directives?: DirectiveNode[]; + fields: InputValueDefinitionNode[]; } export type TypeExtensionNode = @@ -528,60 +522,60 @@ export type TypeExtensionNode = | InputObjectTypeExtensionNode; export type ScalarTypeExtensionNode = { - kind: 'ScalarTypeExtension', - loc?: Location, - name: NameNode, - directives?: DirectiveNode[], + kind: 'ScalarTypeExtension'; + loc?: Location; + name: NameNode; + directives?: DirectiveNode[]; }; export type ObjectTypeExtensionNode = { - kind: 'ObjectTypeExtension', - loc?: Location, - name: NameNode, - interfaces?: NamedTypeNode[], - directives?: DirectiveNode[], - fields?: FieldDefinitionNode[], + kind: 'ObjectTypeExtension'; + loc?: Location; + name: NameNode; + interfaces?: NamedTypeNode[]; + directives?: DirectiveNode[]; + fields?: FieldDefinitionNode[]; }; export type InterfaceTypeExtensionNode = { - kind: 'InterfaceTypeExtension', - loc?: Location, - name: NameNode, - directives?: DirectiveNode[], - fields?: FieldDefinitionNode[], + kind: 'InterfaceTypeExtension'; + loc?: Location; + name: NameNode; + directives?: DirectiveNode[]; + fields?: FieldDefinitionNode[]; }; export type UnionTypeExtensionNode = { - kind: 'UnionTypeExtension', - loc?: Location, - name: NameNode, - directives?: DirectiveNode[], - types?: NamedTypeNode[], + kind: 'UnionTypeExtension'; + loc?: Location; + name: NameNode; + directives?: DirectiveNode[]; + types?: NamedTypeNode[]; }; export type EnumTypeExtensionNode = { - kind: 'EnumTypeExtension', - loc?: Location, - name: NameNode, - directives?: DirectiveNode[], - values?: EnumValueDefinitionNode[], + kind: 'EnumTypeExtension'; + loc?: Location; + name: NameNode; + directives?: DirectiveNode[]; + values?: EnumValueDefinitionNode[]; }; export type InputObjectTypeExtensionNode = { - kind: 'InputObjectTypeExtension', - loc?: Location, - name: NameNode, - directives?: DirectiveNode[], - fields?: InputValueDefinitionNode[], + kind: 'InputObjectTypeExtension'; + loc?: Location; + name: NameNode; + directives?: DirectiveNode[]; + fields?: InputValueDefinitionNode[]; }; // Directive Definitions export interface DirectiveDefinitionNode { - kind: 'DirectiveDefinition'; - loc?: Location; - description?: StringValueNode; - name: NameNode; - arguments?: InputValueDefinitionNode[]; - locations: NameNode[]; + kind: 'DirectiveDefinition'; + loc?: Location; + description?: StringValueNode; + name: NameNode; + arguments?: InputValueDefinitionNode[]; + locations: NameNode[]; } diff --git a/types/graphql/language/index.d.ts b/types/graphql/language/index.d.ts index bc00bb243d..c8fe4b13ec 100644 --- a/types/graphql/language/index.d.ts +++ b/types/graphql/language/index.d.ts @@ -7,9 +7,9 @@ export { parse, parseValue, parseType, ParseOptions } from './parser'; export { print } from './printer'; export { Source } from './source'; export { - visit, - visitInParallel, - visitWithTypeInfo, - getVisitFn, - BREAK + visit, + visitInParallel, + visitWithTypeInfo, + getVisitFn, + BREAK, } from './visitor'; diff --git a/types/graphql/language/lexer.d.ts b/types/graphql/language/lexer.d.ts index 4a55f03dc2..0db85434e2 100644 --- a/types/graphql/language/lexer.d.ts +++ b/types/graphql/language/lexer.d.ts @@ -11,41 +11,41 @@ import { syntaxError } from '../error'; * whenever called. */ export function createLexer( - source: Source, - options: TOptions + source: Source, + options: TOptions, ): Lexer; /** * The return type of createLexer. */ export interface Lexer { - source: Source; - options: TOptions; + source: Source; + options: TOptions; - /** - * The previously focused non-ignored token. - */ - lastToken: Token; + /** + * The previously focused non-ignored token. + */ + lastToken: Token; - /** - * The currently focused non-ignored token. - */ - token: Token; + /** + * The currently focused non-ignored token. + */ + token: Token; - /** - * The (1-indexed) line containing the current token. - */ - line: number; + /** + * The (1-indexed) line containing the current token. + */ + line: number; - /** - * The character offset at which the current line begins. - */ - lineStart: number; + /** + * The character offset at which the current line begins. + */ + lineStart: number; - /** - * Advances the token stream to the next non-ignored token. - */ - advance(): Token; + /** + * Advances the token stream to the next non-ignored token. + */ + advance(): Token; } /** @@ -53,26 +53,26 @@ export interface Lexer { * lexer emits. */ export const TokenKind: { - SOF: '' - EOF: '' - BANG: '!' - DOLLAR: '$' - PAREN_L: '(' - PAREN_R: ')' - SPREAD: '...' - COLON: ':' - EQUALS: '=' - AT: '@' - BRACKET_L: '[' - BRACKET_R: ']' - BRACE_L: '{' - PIPE: '|' - BRACE_R: '}' - NAME: 'Name' - INT: 'Int' - FLOAT: 'Float' - STRING: 'String' - COMMENT: 'Comment' + SOF: ''; + EOF: ''; + BANG: '!'; + DOLLAR: '$'; + PAREN_L: '('; + PAREN_R: ')'; + SPREAD: '...'; + COLON: ':'; + EQUALS: '='; + AT: '@'; + BRACKET_L: '['; + BRACKET_R: ']'; + BRACE_L: '{'; + PIPE: '|'; + BRACE_R: '}'; + NAME: 'Name'; + INT: 'Int'; + FLOAT: 'Float'; + STRING: 'String'; + COMMENT: 'Comment'; }; /** diff --git a/types/graphql/language/location.d.ts b/types/graphql/language/location.d.ts index 4d7a13e314..cb9744e0d5 100644 --- a/types/graphql/language/location.d.ts +++ b/types/graphql/language/location.d.ts @@ -1,8 +1,8 @@ -import { Source } from "./source"; +import { Source } from './source'; export interface SourceLocation { - line: number; - column: number; + line: number; + column: number; } export function getLocation(source: Source, position: number): SourceLocation; diff --git a/types/graphql/language/parser.d.ts b/types/graphql/language/parser.d.ts index 5aa195ddd4..a0b8a0c7a4 100644 --- a/types/graphql/language/parser.d.ts +++ b/types/graphql/language/parser.d.ts @@ -1,17 +1,17 @@ -import { NamedTypeNode, TypeNode, ValueNode, DocumentNode } from "./ast"; -import { Source } from "./source"; -import { Lexer } from "./lexer"; +import { NamedTypeNode, TypeNode, ValueNode, DocumentNode } from './ast'; +import { Source } from './source'; +import { Lexer } from './lexer'; /** * Configuration options to control parser behavior */ export interface ParseOptions { - /** - * By default, the parser creates AST nodes that know the location - * in the source that they correspond to. This configuration flag - * disables that behavior for performance or testing. - */ - noLocation?: boolean; + /** + * By default, the parser creates AST nodes that know the location + * in the source that they correspond to. This configuration flag + * disables that behavior for performance or testing. + */ + noLocation?: boolean; } /** @@ -19,8 +19,8 @@ export interface ParseOptions { * Throws GraphQLError if a syntax error is encountered. */ export function parse( - source: string | Source, - options?: ParseOptions + source: string | Source, + options?: ParseOptions, ): DocumentNode; /** @@ -31,8 +31,8 @@ export function parse( * in isolation of complete GraphQL documents. */ export function parseValue( - source: Source | string, - options?: ParseOptions + source: Source | string, + options?: ParseOptions, ): ValueNode; export function parseConstValue(lexer: Lexer): ValueNode; diff --git a/types/graphql/language/source.d.ts b/types/graphql/language/source.d.ts index 80e68f5557..236028b7df 100644 --- a/types/graphql/language/source.d.ts +++ b/types/graphql/language/source.d.ts @@ -1,5 +1,5 @@ export class Source { - body: string; - name: string; - constructor(body: string, name?: string); + body: string; + name: string; + constructor(body: string, name?: string); } diff --git a/types/graphql/language/visitor.d.ts b/types/graphql/language/visitor.d.ts index dc8bcc2692..e7e9d67da0 100644 --- a/types/graphql/language/visitor.d.ts +++ b/types/graphql/language/visitor.d.ts @@ -1,43 +1,43 @@ export const QueryDocumentKeys: { - Name: any[]; - Document: string[]; - OperationDefinition: string[]; - VariableDefinition: string[]; - Variable: string[]; - SelectionSet: string[]; - Field: string[]; - Argument: string[]; + Name: any[]; + Document: string[]; + OperationDefinition: string[]; + VariableDefinition: string[]; + Variable: string[]; + SelectionSet: string[]; + Field: string[]; + Argument: string[]; - FragmentSpread: string[]; - InlineFragment: string[]; - FragmentDefinition: string[]; + FragmentSpread: string[]; + InlineFragment: string[]; + FragmentDefinition: string[]; - IntValue: number[]; - FloatValue: number[]; - StringValue: string[]; - BooleanValue: boolean[]; - NullValue: null[], - EnumValue: any[]; - ListValue: string[]; - ObjectValue: string[]; - ObjectField: string[]; + IntValue: number[]; + FloatValue: number[]; + StringValue: string[]; + BooleanValue: boolean[]; + NullValue: null[]; + EnumValue: any[]; + ListValue: string[]; + ObjectValue: string[]; + ObjectField: string[]; - Directive: string[]; + Directive: string[]; - NamedType: string[]; - ListType: string[]; - NonNullType: string[]; + NamedType: string[]; + ListType: string[]; + NonNullType: string[]; - ObjectTypeDefinition: string[]; - FieldDefinition: string[]; - InputValueDefinition: string[]; - InterfaceTypeDefinition: string[]; - UnionTypeDefinition: string[]; - ScalarTypeDefinition: string[]; - EnumTypeDefinition: string[]; - EnumValueDefinition: string[]; - InputObjectTypeDefinition: string[]; - TypeExtensionDefinition: string[]; + ObjectTypeDefinition: string[]; + FieldDefinition: string[]; + InputValueDefinition: string[]; + InterfaceTypeDefinition: string[]; + UnionTypeDefinition: string[]; + ScalarTypeDefinition: string[]; + EnumTypeDefinition: string[]; + EnumValueDefinition: string[]; + InputObjectTypeDefinition: string[]; + TypeExtensionDefinition: string[]; }; export const BREAK: any; diff --git a/types/graphql/subscription/subscribe.d.ts b/types/graphql/subscription/subscribe.d.ts index 30efc010ec..dc2c096b86 100644 --- a/types/graphql/subscription/subscribe.d.ts +++ b/types/graphql/subscription/subscribe.d.ts @@ -4,26 +4,26 @@ import { GraphQLFieldResolver } from '../type/definition'; import { ExecutionResult } from '../execution/execute'; export function subscribe( - schema: GraphQLSchema, - document: DocumentNode, - rootValue?: any, - contextValue?: any, - variableValues?: { - [key: string]: any; - }, - operationName?: string, - fieldResolver?: GraphQLFieldResolver, - subscribeFieldResolver?: GraphQLFieldResolver + schema: GraphQLSchema, + document: DocumentNode, + rootValue?: any, + contextValue?: any, + variableValues?: { + [key: string]: any; + }, + operationName?: string, + fieldResolver?: GraphQLFieldResolver, + subscribeFieldResolver?: GraphQLFieldResolver, ): Promise | ExecutionResult>; export function createSourceEventStream( - schema: GraphQLSchema, - document: DocumentNode, - rootValue?: any, - contextValue?: any, - variableValues?: { - [key: string]: any; - }, - operationName?: string, - fieldResolver?: GraphQLFieldResolver + schema: GraphQLSchema, + document: DocumentNode, + rootValue?: any, + contextValue?: any, + variableValues?: { + [key: string]: any; + }, + operationName?: string, + fieldResolver?: GraphQLFieldResolver, ): Promise>; diff --git a/types/graphql/type/definition.d.ts b/types/graphql/type/definition.d.ts index ed39a51db6..098f7376ef 100644 --- a/types/graphql/type/definition.d.ts +++ b/types/graphql/type/definition.d.ts @@ -1,18 +1,18 @@ import { - ScalarTypeDefinitionNode, - ObjectTypeDefinitionNode, - FieldDefinitionNode, - InputValueDefinitionNode, - InterfaceTypeDefinitionNode, - UnionTypeDefinitionNode, - EnumTypeDefinitionNode, - EnumValueDefinitionNode, - InputObjectTypeDefinitionNode, - TypeExtensionNode, - OperationDefinitionNode, - FieldNode, - FragmentDefinitionNode, - ValueNode, + ScalarTypeDefinitionNode, + ObjectTypeDefinitionNode, + FieldDefinitionNode, + InputValueDefinitionNode, + InterfaceTypeDefinitionNode, + UnionTypeDefinitionNode, + EnumTypeDefinitionNode, + EnumValueDefinitionNode, + InputObjectTypeDefinitionNode, + TypeExtensionNode, + OperationDefinitionNode, + FieldNode, + FragmentDefinitionNode, + ValueNode, } from '../language/ast'; import { GraphQLSchema } from './schema'; @@ -20,14 +20,14 @@ import { GraphQLSchema } from './schema'; * These are all of the possible kinds of types. */ export type GraphQLType = - | GraphQLScalarType - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType - | GraphQLEnumType - | GraphQLInputObjectType - | GraphQLList - | GraphQLNonNull; + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList + | GraphQLNonNull; export function isType(type: any): type is GraphQLType; @@ -37,15 +37,16 @@ export function assertType(type: any): GraphQLType; * These types may be used as input types for arguments and directives. */ export type GraphQLInputType = - | GraphQLScalarType - | GraphQLEnumType - | GraphQLInputObjectType - | GraphQLList - | GraphQLNonNull< - | GraphQLScalarType - | GraphQLEnumType - | GraphQLInputObjectType - | GraphQLList>; + | GraphQLScalarType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList + | GraphQLNonNull< + | GraphQLScalarType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList + >; export function isInputType(type: GraphQLType): type is GraphQLInputType; @@ -55,19 +56,20 @@ export function assertInputType(type: GraphQLType): GraphQLInputType; * These types may be used as output types as the result of fields. */ export type GraphQLOutputType = - | GraphQLScalarType - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType - | GraphQLEnumType - | GraphQLList - | GraphQLNonNull< - | GraphQLScalarType - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType - | GraphQLEnumType - | GraphQLList>; + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLList + | GraphQLNonNull< + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLList + >; export function isOutputType(type: GraphQLType): type is GraphQLOutputType; @@ -76,9 +78,7 @@ export function assertOutputType(type: GraphQLType): GraphQLOutputType; /** * These types may describe types which may be leaf values. */ -export type GraphQLLeafType = - | GraphQLScalarType - | GraphQLEnumType; +export type GraphQLLeafType = GraphQLScalarType | GraphQLEnumType; export function isLeafType(type: GraphQLType): type is GraphQLLeafType; @@ -88,20 +88,20 @@ export function assertLeafType(type: GraphQLType): GraphQLLeafType; * These types may describe the parent context of a selection set. */ export type GraphQLCompositeType = - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType; + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType; -export function isCompositeType(type: GraphQLType): type is GraphQLCompositeType; +export function isCompositeType( + type: GraphQLType, +): type is GraphQLCompositeType; export function assertCompositeType(type: GraphQLType): GraphQLCompositeType; /** * These types may describe the parent context of a selection set. */ -export type GraphQLAbstractType = - | GraphQLInterfaceType - | GraphQLUnionType; +export type GraphQLAbstractType = GraphQLInterfaceType | GraphQLUnionType; export function isAbstractType(type: GraphQLType): type is GraphQLAbstractType; @@ -111,28 +111,28 @@ export function assertAbstractType(type: GraphQLType): GraphQLAbstractType; * These types can all accept null as a value. */ export type GraphQLNullableType = - | GraphQLScalarType - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType - | GraphQLEnumType - | GraphQLInputObjectType - | GraphQLList; + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList; export function getNullableType( - type: T -): (T & GraphQLNullableType); + type: T, +): T & GraphQLNullableType; /** * These named types do not include modifiers like List or NonNull. */ export type GraphQLNamedType = - | GraphQLScalarType - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType - | GraphQLEnumType - | GraphQLInputObjectType; + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLInputObjectType; export function isNamedType(type: GraphQLType): boolean; @@ -164,30 +164,30 @@ export type Thunk = (() => T) | T; * */ export class GraphQLScalarType { - name: string; - description: string; - astNode?: ScalarTypeDefinitionNode; - constructor(config: GraphQLScalarTypeConfig); + name: string; + description: string; + astNode?: ScalarTypeDefinitionNode; + constructor(config: GraphQLScalarTypeConfig); - // Serializes an internal value to include in a response. - serialize(value: any): any; + // Serializes an internal value to include in a response. + serialize(value: any): any; - // Parses an externally provided value to use as an input. - parseValue(value: any): any; + // Parses an externally provided value to use as an input. + parseValue(value: any): any; - // Parses an externally provided literal value to use as an input. - parseLiteral(valueNode: ValueNode): any; + // Parses an externally provided literal value to use as an input. + parseLiteral(valueNode: ValueNode): any; - toString(): string; + toString(): string; } export interface GraphQLScalarTypeConfig { - name: string; - description?: string; - astNode?: ScalarTypeDefinitionNode; - serialize(value: any): TExternal | null | undefined; - parseValue?(value: any): TInternal | null | undefined; - parseLiteral?(valueNode: ValueNode): TInternal | null | undefined; + name: string; + description?: string; + astNode?: ScalarTypeDefinitionNode; + serialize(value: any): TExternal | null | undefined; + parseValue?(value: any): TInternal | null | undefined; + parseLiteral?(valueNode: ValueNode): TInternal | null | undefined; } /** @@ -228,109 +228,123 @@ export interface GraphQLScalarTypeConfig { * */ export class GraphQLObjectType { - name: string; - description: string; - astNode?: ObjectTypeDefinitionNode; - extensionASTNodes: Array; - isTypeOf: GraphQLIsTypeOfFn; + name: string; + description: string; + astNode?: ObjectTypeDefinitionNode; + extensionASTNodes: Array; + isTypeOf: GraphQLIsTypeOfFn; - constructor(config: GraphQLObjectTypeConfig); - getFields(): GraphQLFieldMap; - getInterfaces(): GraphQLInterfaceType[]; - toString(): string; + constructor(config: GraphQLObjectTypeConfig); + getFields(): GraphQLFieldMap; + getInterfaces(): GraphQLInterfaceType[]; + toString(): string; } export interface GraphQLObjectTypeConfig { - name: string; - interfaces?: Thunk; - fields: Thunk>; - isTypeOf?: GraphQLIsTypeOfFn; - description?: string; - astNode?: ObjectTypeDefinitionNode; - extensionASTNodes?: Array; + name: string; + interfaces?: Thunk; + fields: Thunk>; + isTypeOf?: GraphQLIsTypeOfFn; + description?: string; + astNode?: ObjectTypeDefinitionNode; + extensionASTNodes?: Array; } export type GraphQLTypeResolver = ( - value: TSource, - context: TContext, - info: GraphQLResolveInfo + value: TSource, + context: TContext, + info: GraphQLResolveInfo, ) => GraphQLObjectType | string | Promise; export type GraphQLIsTypeOfFn = ( - source: TSource, - context: TContext, - info: GraphQLResolveInfo + source: TSource, + context: TContext, + info: GraphQLResolveInfo, ) => boolean | Promise; -export type GraphQLFieldResolver = ( - source: TSource, - args: TArgs, - context: TContext, - info: GraphQLResolveInfo +export type GraphQLFieldResolver< + TSource, + TContext, + TArgs = { [argName: string]: any } +> = ( + source: TSource, + args: TArgs, + context: TContext, + info: GraphQLResolveInfo, ) => any; export interface GraphQLResolveInfo { - fieldName: string; - fieldNodes: FieldNode[]; - returnType: GraphQLOutputType; - parentType: GraphQLCompositeType; - path: ResponsePath; - schema: GraphQLSchema; - fragments: { [fragmentName: string]: FragmentDefinitionNode }; - rootValue: any; - operation: OperationDefinitionNode; - variableValues: { [variableName: string]: any }; + fieldName: string; + fieldNodes: FieldNode[]; + returnType: GraphQLOutputType; + parentType: GraphQLCompositeType; + path: ResponsePath; + schema: GraphQLSchema; + fragments: { [fragmentName: string]: FragmentDefinitionNode }; + rootValue: any; + operation: OperationDefinitionNode; + variableValues: { [variableName: string]: any }; } -export type ResponsePath = { prev: ResponsePath, key: string | number } | undefined; +export type ResponsePath = + | { prev: ResponsePath; key: string | number } + | undefined; -export interface GraphQLFieldConfig { - type: GraphQLOutputType; - args?: GraphQLFieldConfigArgumentMap; - resolve?: GraphQLFieldResolver; - subscribe?: GraphQLFieldResolver; - deprecationReason?: string; - description?: string; - astNode?: FieldDefinitionNode; +export interface GraphQLFieldConfig< + TSource, + TContext, + TArgs = { [argName: string]: any } +> { + type: GraphQLOutputType; + args?: GraphQLFieldConfigArgumentMap; + resolve?: GraphQLFieldResolver; + subscribe?: GraphQLFieldResolver; + deprecationReason?: string; + description?: string; + astNode?: FieldDefinitionNode; } export interface GraphQLFieldConfigArgumentMap { - [argName: string]: GraphQLArgumentConfig; + [argName: string]: GraphQLArgumentConfig; } export interface GraphQLArgumentConfig { - type: GraphQLInputType; - defaultValue?: any; - description?: string; - astNode?: InputValueDefinitionNode; + type: GraphQLInputType; + defaultValue?: any; + description?: string; + astNode?: InputValueDefinitionNode; } export interface GraphQLFieldConfigMap { - [fieldName: string]: GraphQLFieldConfig; + [fieldName: string]: GraphQLFieldConfig; } -export interface GraphQLField { - name: string; - description: string; - type: GraphQLOutputType; - args: GraphQLArgument[]; - resolve?: GraphQLFieldResolver; - subscribe?: GraphQLFieldResolver; - isDeprecated?: boolean; - deprecationReason?: string; - astNode?: FieldDefinitionNode; +export interface GraphQLField< + TSource, + TContext, + TArgs = { [argName: string]: any } +> { + name: string; + description: string; + type: GraphQLOutputType; + args: GraphQLArgument[]; + resolve?: GraphQLFieldResolver; + subscribe?: GraphQLFieldResolver; + isDeprecated?: boolean; + deprecationReason?: string; + astNode?: FieldDefinitionNode; } export interface GraphQLArgument { - name: string; - type: GraphQLInputType; - defaultValue?: any; - description?: string; - astNode?: InputValueDefinitionNode; + name: string; + type: GraphQLInputType; + defaultValue?: any; + description?: string; + astNode?: InputValueDefinitionNode; } export interface GraphQLFieldMap { - [fieldName: string]: GraphQLField; + [fieldName: string]: GraphQLField; } /** @@ -352,29 +366,29 @@ export interface GraphQLFieldMap { * */ export class GraphQLInterfaceType { - name: string; - description: string; - astNode?: InterfaceTypeDefinitionNode; - resolveType: GraphQLTypeResolver; + name: string; + description: string; + astNode?: InterfaceTypeDefinitionNode; + resolveType: GraphQLTypeResolver; - constructor(config: GraphQLInterfaceTypeConfig); + constructor(config: GraphQLInterfaceTypeConfig); - getFields(): GraphQLFieldMap; + getFields(): GraphQLFieldMap; - toString(): string; + toString(): string; } export interface GraphQLInterfaceTypeConfig { - name: string; - fields: Thunk>; - /** - * Optionally provide a custom type resolver function. If one is not provided, - * the default implementation will call `isTypeOf` on each implementing - * Object type. - */ - resolveType?: GraphQLTypeResolver; - description?: string; - astNode?: InterfaceTypeDefinitionNode; + name: string; + fields: Thunk>; + /** + * Optionally provide a custom type resolver function. If one is not provided, + * the default implementation will call `isTypeOf` on each implementing + * Object type. + */ + resolveType?: GraphQLTypeResolver; + description?: string; + astNode?: InterfaceTypeDefinitionNode; } /** @@ -401,29 +415,29 @@ export interface GraphQLInterfaceTypeConfig { * */ export class GraphQLUnionType { - name: string; - description: string; - astNode?: UnionTypeDefinitionNode; - resolveType: GraphQLTypeResolver; + name: string; + description: string; + astNode?: UnionTypeDefinitionNode; + resolveType: GraphQLTypeResolver; - constructor(config: GraphQLUnionTypeConfig); + constructor(config: GraphQLUnionTypeConfig); - getTypes(): GraphQLObjectType[]; + getTypes(): GraphQLObjectType[]; - toString(): string; + toString(): string; } export interface GraphQLUnionTypeConfig { - name: string; - types: Thunk; - /** - * Optionally provide a custom type resolver function. If one is not provided, - * the default implementation will call `isTypeOf` on each implementing - * Object type. - */ - resolveType?: GraphQLTypeResolver; - description?: string; - astNode?: UnionTypeDefinitionNode; + name: string; + types: Thunk; + /** + * Optionally provide a custom type resolver function. If one is not provided, + * the default implementation will call `isTypeOf` on each implementing + * Object type. + */ + resolveType?: GraphQLTypeResolver; + description?: string; + astNode?: UnionTypeDefinitionNode; } /** @@ -448,45 +462,45 @@ export interface GraphQLUnionTypeConfig { * will be used as its internal value. */ export class GraphQLEnumType { - name: string; - description: string; - astNode?: EnumTypeDefinitionNode; + name: string; + description: string; + astNode?: EnumTypeDefinitionNode; - constructor(config: GraphQLEnumTypeConfig); - getValues(): GraphQLEnumValue[]; - getValue(name: string): GraphQLEnumValue; - isValidValue(value: any): boolean; - serialize(value: any): string; - parseValue(value: any): any; - parseLiteral(valueNode: ValueNode): any; - toString(): string; + constructor(config: GraphQLEnumTypeConfig); + getValues(): GraphQLEnumValue[]; + getValue(name: string): GraphQLEnumValue; + isValidValue(value: any): boolean; + serialize(value: any): string; + parseValue(value: any): any; + parseLiteral(valueNode: ValueNode): any; + toString(): string; } export interface GraphQLEnumTypeConfig { - name: string; - values: GraphQLEnumValueConfigMap; - description?: string; - astNode?: EnumTypeDefinitionNode; + name: string; + values: GraphQLEnumValueConfigMap; + description?: string; + astNode?: EnumTypeDefinitionNode; } export interface GraphQLEnumValueConfigMap { - [valueName: string]: GraphQLEnumValueConfig; + [valueName: string]: GraphQLEnumValueConfig; } export interface GraphQLEnumValueConfig { - value?: any; - deprecationReason?: string; - description?: string; - astNode?: EnumValueDefinitionNode; + value?: any; + deprecationReason?: string; + description?: string; + astNode?: EnumValueDefinitionNode; } export interface GraphQLEnumValue { - name: string; - description: string; - isDeprecated?: boolean; - deprecationReason: string; - astNode?: EnumValueDefinitionNode; - value: any; + name: string; + description: string; + isDeprecated?: boolean; + deprecationReason: string; + astNode?: EnumValueDefinitionNode; + value: any; } /** @@ -510,42 +524,42 @@ export interface GraphQLEnumValue { * */ export class GraphQLInputObjectType { - name: string; - description: string; - astNode?: InputObjectTypeDefinitionNode; - constructor(config: GraphQLInputObjectTypeConfig); - getFields(): GraphQLInputFieldMap; - toString(): string; + name: string; + description: string; + astNode?: InputObjectTypeDefinitionNode; + constructor(config: GraphQLInputObjectTypeConfig); + getFields(): GraphQLInputFieldMap; + toString(): string; } export interface GraphQLInputObjectTypeConfig { - name: string; - fields: Thunk; - description?: string; - astNode?: InputObjectTypeDefinitionNode; + name: string; + fields: Thunk; + description?: string; + astNode?: InputObjectTypeDefinitionNode; } export interface GraphQLInputFieldConfig { - type: GraphQLInputType; - defaultValue?: any; - description?: string; - astNode?: InputValueDefinitionNode; + type: GraphQLInputType; + defaultValue?: any; + description?: string; + astNode?: InputValueDefinitionNode; } export interface GraphQLInputFieldConfigMap { - [fieldName: string]: GraphQLInputFieldConfig; + [fieldName: string]: GraphQLInputFieldConfig; } export interface GraphQLInputField { - name: string; - type: GraphQLInputType; - defaultValue?: any; - description?: string; - astNode?: InputValueDefinitionNode; + name: string; + type: GraphQLInputType; + defaultValue?: any; + description?: string; + astNode?: InputValueDefinitionNode; } export interface GraphQLInputFieldMap { - [fieldName: string]: GraphQLInputField; + [fieldName: string]: GraphQLInputField; } /** @@ -567,9 +581,9 @@ export interface GraphQLInputFieldMap { * */ export class GraphQLList { - ofType: T; - constructor(type: T); - toString(): string; + ofType: T; + constructor(type: T); + toString(): string; } /** @@ -593,9 +607,9 @@ export class GraphQLList { * Note: the enforcement of non-nullability occurs within the executor. */ export class GraphQLNonNull { - ofType: T; + ofType: T; - constructor(type: T); + constructor(type: T); - toString(): string; + toString(): string; } diff --git a/types/graphql/type/directives.d.ts b/types/graphql/type/directives.d.ts index 81befa9eba..b6962bc4ae 100644 --- a/types/graphql/type/directives.d.ts +++ b/types/graphql/type/directives.d.ts @@ -1,30 +1,27 @@ -import { - GraphQLFieldConfigArgumentMap, - GraphQLArgument -} from './definition'; +import { GraphQLFieldConfigArgumentMap, GraphQLArgument } from './definition'; import { DirectiveDefinitionNode } from '../language/ast'; export const DirectiveLocation: { - // Operations - QUERY: 'QUERY', - MUTATION: 'MUTATION', - SUBSCRIPTION: 'SUBSCRIPTION', - FIELD: 'FIELD', - FRAGMENT_DEFINITION: 'FRAGMENT_DEFINITION', - FRAGMENT_SPREAD: 'FRAGMENT_SPREAD', - INLINE_FRAGMENT: 'INLINE_FRAGMENT', - // Schema Definitions - SCHEMA: 'SCHEMA', - SCALAR: 'SCALAR', - OBJECT: 'OBJECT', - FIELD_DEFINITION: 'FIELD_DEFINITION', - ARGUMENT_DEFINITION: 'ARGUMENT_DEFINITION', - INTERFACE: 'INTERFACE', - UNION: 'UNION', - ENUM: 'ENUM', - ENUM_VALUE: 'ENUM_VALUE', - INPUT_OBJECT: 'INPUT_OBJECT', - INPUT_FIELD_DEFINITION: 'INPUT_FIELD_DEFINITION', + // Operations + QUERY: 'QUERY'; + MUTATION: 'MUTATION'; + SUBSCRIPTION: 'SUBSCRIPTION'; + FIELD: 'FIELD'; + FRAGMENT_DEFINITION: 'FRAGMENT_DEFINITION'; + FRAGMENT_SPREAD: 'FRAGMENT_SPREAD'; + INLINE_FRAGMENT: 'INLINE_FRAGMENT'; + // Schema Definitions + SCHEMA: 'SCHEMA'; + SCALAR: 'SCALAR'; + OBJECT: 'OBJECT'; + FIELD_DEFINITION: 'FIELD_DEFINITION'; + ARGUMENT_DEFINITION: 'ARGUMENT_DEFINITION'; + INTERFACE: 'INTERFACE'; + UNION: 'UNION'; + ENUM: 'ENUM'; + ENUM_VALUE: 'ENUM_VALUE'; + INPUT_OBJECT: 'INPUT_OBJECT'; + INPUT_FIELD_DEFINITION: 'INPUT_FIELD_DEFINITION'; }; export type DirectiveLocationEnum = keyof typeof DirectiveLocation; @@ -34,21 +31,21 @@ export type DirectiveLocationEnum = keyof typeof DirectiveLocation; * behavior. Type system creators will usually not create these directly. */ export class GraphQLDirective { - name: string; - description?: string; - locations: DirectiveLocationEnum[]; - args: GraphQLArgument[]; - astNode?: DirectiveDefinitionNode; + name: string; + description?: string; + locations: DirectiveLocationEnum[]; + args: GraphQLArgument[]; + astNode?: DirectiveDefinitionNode; - constructor(config: GraphQLDirectiveConfig); + constructor(config: GraphQLDirectiveConfig); } export interface GraphQLDirectiveConfig { - name: string; - description?: string; - locations: DirectiveLocationEnum[]; - args?: GraphQLFieldConfigArgumentMap; - astNode?: DirectiveDefinitionNode; + name: string; + description?: string; + locations: DirectiveLocationEnum[]; + args?: GraphQLFieldConfigArgumentMap; + astNode?: DirectiveDefinitionNode; } /** diff --git a/types/graphql/type/index.d.ts b/types/graphql/type/index.d.ts index ae7a81e621..5fdfb1190a 100644 --- a/types/graphql/type/index.d.ts +++ b/types/graphql/type/index.d.ts @@ -4,49 +4,44 @@ export { GraphQLSchema } from './schema'; export * from './definition'; export { - // "Enum" of Directive Locations - DirectiveLocation, - - // Directives Definition - GraphQLDirective, - - // Built-in Directives defined by the Spec - specifiedDirectives, - GraphQLIncludeDirective, - GraphQLSkipDirective, - GraphQLDeprecatedDirective, - - // Constant Deprecation Reason - DEFAULT_DEPRECATION_REASON, + // "Enum" of Directive Locations + DirectiveLocation, + // Directives Definition + GraphQLDirective, + // Built-in Directives defined by the Spec + specifiedDirectives, + GraphQLIncludeDirective, + GraphQLSkipDirective, + GraphQLDeprecatedDirective, + // Constant Deprecation Reason + DEFAULT_DEPRECATION_REASON, } from './directives'; // Common built-in scalar instances. export { - GraphQLInt, - GraphQLFloat, - GraphQLString, - GraphQLBoolean, - GraphQLID, + GraphQLInt, + GraphQLFloat, + GraphQLString, + GraphQLBoolean, + GraphQLID, } from './scalars'; export { - // "Enum" of Type Kinds - TypeKind, - - // GraphQL Types for introspection. - __Schema, - __Directive, - __DirectiveLocation, - __Type, - __Field, - __InputValue, - __EnumValue, - __TypeKind, - - // Meta-field definitions. - SchemaMetaFieldDef, - TypeMetaFieldDef, - TypeNameMetaFieldDef, + // "Enum" of Type Kinds + TypeKind, + // GraphQL Types for introspection. + __Schema, + __Directive, + __DirectiveLocation, + __Type, + __Field, + __InputValue, + __EnumValue, + __TypeKind, + // Meta-field definitions. + SchemaMetaFieldDef, + TypeMetaFieldDef, + TypeNameMetaFieldDef, } from './introspection'; export { DirectiveLocationEnum } from './directives'; diff --git a/types/graphql/type/introspection.d.ts b/types/graphql/type/introspection.d.ts index 989e34a882..48ac468ed0 100644 --- a/types/graphql/type/introspection.d.ts +++ b/types/graphql/type/introspection.d.ts @@ -1,12 +1,12 @@ import { - GraphQLScalarType, - GraphQLObjectType, - GraphQLInterfaceType, - GraphQLUnionType, - GraphQLEnumType, - GraphQLInputObjectType, - GraphQLList, - GraphQLNonNull, + GraphQLScalarType, + GraphQLObjectType, + GraphQLInterfaceType, + GraphQLUnionType, + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLList, + GraphQLNonNull, } from './definition'; import { GraphQLField } from './definition'; @@ -19,14 +19,14 @@ export const __InputValue: GraphQLObjectType; export const __EnumValue: GraphQLObjectType; export const TypeKind: { - SCALAR: 'SCALAR', - OBJECT: 'OBJECT', - INTERFACE: 'INTERFACE', - UNION: 'UNION', - ENUM: 'ENUM', - INPUT_OBJECT: 'INPUT_OBJECT', - LIST: 'LIST', - NON_NULL: 'NON_NULL', + SCALAR: 'SCALAR'; + OBJECT: 'OBJECT'; + INTERFACE: 'INTERFACE'; + UNION: 'UNION'; + ENUM: 'ENUM'; + INPUT_OBJECT: 'INPUT_OBJECT'; + LIST: 'LIST'; + NON_NULL: 'NON_NULL'; }; export const __TypeKind: GraphQLEnumType; diff --git a/types/graphql/type/schema.d.ts b/types/graphql/type/schema.d.ts index a7f4d394f4..3263274dd9 100644 --- a/types/graphql/type/schema.d.ts +++ b/types/graphql/type/schema.d.ts @@ -1,17 +1,11 @@ +import { GraphQLObjectType } from './definition'; import { - GraphQLObjectType, + GraphQLType, + GraphQLNamedType, + GraphQLAbstractType, } from './definition'; -import { - GraphQLType, - GraphQLNamedType, - GraphQLAbstractType -} from './definition'; -import { - SchemaDefinitionNode -} from '../language/ast'; -import { - GraphQLDirective, -} from './directives'; +import { SchemaDefinitionNode } from '../language/ast'; +import { GraphQLDirective } from './directives'; /** * Schema Definition @@ -40,38 +34,38 @@ import { * */ export class GraphQLSchema { - astNode?: SchemaDefinitionNode; - // private _queryType: GraphQLObjectType; - // private _mutationType: GraphQLObjectType; - // private _subscriptionType: GraphQLObjectType; - // private _directives: Array; - // private _typeMap: TypeMap; - // private _implementations: { [interfaceName: string]: Array }; - // private _possibleTypeMap: { [abstractName: string]: { [possibleName: string]: boolean } }; + astNode?: SchemaDefinitionNode; + // private _queryType: GraphQLObjectType; + // private _mutationType: GraphQLObjectType; + // private _subscriptionType: GraphQLObjectType; + // private _directives: Array; + // private _typeMap: TypeMap; + // private _implementations: { [interfaceName: string]: Array }; + // private _possibleTypeMap: { [abstractName: string]: { [possibleName: string]: boolean } }; - constructor(config: GraphQLSchemaConfig) + constructor(config: GraphQLSchemaConfig); - getQueryType(): GraphQLObjectType; - getMutationType(): GraphQLObjectType|null|undefined; - getSubscriptionType(): GraphQLObjectType|null|undefined; - getTypeMap(): { [typeName: string]: GraphQLNamedType }; - getType(name: string): GraphQLNamedType; - getPossibleTypes(abstractType: GraphQLAbstractType): GraphQLObjectType[]; + getQueryType(): GraphQLObjectType; + getMutationType(): GraphQLObjectType | null | undefined; + getSubscriptionType(): GraphQLObjectType | null | undefined; + getTypeMap(): { [typeName: string]: GraphQLNamedType }; + getType(name: string): GraphQLNamedType; + getPossibleTypes(abstractType: GraphQLAbstractType): GraphQLObjectType[]; - isPossibleType( - abstractType: GraphQLAbstractType, - possibleType: GraphQLObjectType - ): boolean; + isPossibleType( + abstractType: GraphQLAbstractType, + possibleType: GraphQLObjectType, + ): boolean; - getDirectives(): GraphQLDirective[]; - getDirective(name: string): GraphQLDirective; + getDirectives(): GraphQLDirective[]; + getDirective(name: string): GraphQLDirective; } export interface GraphQLSchemaConfig { - query: GraphQLObjectType; - mutation?: GraphQLObjectType; - subscription?: GraphQLObjectType; - types?: GraphQLNamedType[]; - directives?: GraphQLDirective[]; - astNode?: SchemaDefinitionNode; + query: GraphQLObjectType; + mutation?: GraphQLObjectType; + subscription?: GraphQLObjectType; + types?: GraphQLNamedType[]; + directives?: GraphQLDirective[]; + astNode?: SchemaDefinitionNode; } diff --git a/types/graphql/utilities/TypeInfo.d.ts b/types/graphql/utilities/TypeInfo.d.ts index 98a53d37ef..a04a24a1a7 100644 --- a/types/graphql/utilities/TypeInfo.d.ts +++ b/types/graphql/utilities/TypeInfo.d.ts @@ -1,12 +1,12 @@ import { GraphQLSchema } from '../type/schema'; import { - GraphQLOutputType, - GraphQLCompositeType, - GraphQLInputType, - GraphQLField, - GraphQLArgument, - GraphQLEnumValue, - GraphQLType, + GraphQLOutputType, + GraphQLCompositeType, + GraphQLInputType, + GraphQLField, + GraphQLArgument, + GraphQLEnumValue, + GraphQLType, } from '../type/definition'; import { GraphQLDirective } from '../type/directives'; import { ASTNode, FieldNode } from '../language/ast'; @@ -17,27 +17,27 @@ import { ASTNode, FieldNode } from '../language/ast'; * AST during a recursive descent by calling `enter(node)` and `leave(node)`. */ export class TypeInfo { - constructor( - schema: GraphQLSchema, - // NOTE: this experimental optional second parameter is only needed in order - // to support non-spec-compliant codebases. You should never need to use it. - // It may disappear in the future. - getFieldDefFn?: getFieldDef - ); + constructor( + schema: GraphQLSchema, + // NOTE: this experimental optional second parameter is only needed in order + // to support non-spec-compliant codebases. You should never need to use it. + // It may disappear in the future. + getFieldDefFn?: getFieldDef, + ); - getType(): GraphQLOutputType; - getParentType(): GraphQLCompositeType; - getInputType(): GraphQLInputType; - getFieldDef(): GraphQLField; - getDirective(): GraphQLDirective; - getArgument(): GraphQLArgument; - getEnumValue(): GraphQLEnumValue; - enter(node: ASTNode): any; - leave(node: ASTNode): any; + getType(): GraphQLOutputType; + getParentType(): GraphQLCompositeType; + getInputType(): GraphQLInputType; + getFieldDef(): GraphQLField; + getDirective(): GraphQLDirective; + getArgument(): GraphQLArgument; + getEnumValue(): GraphQLEnumValue; + enter(node: ASTNode): any; + leave(node: ASTNode): any; } export type getFieldDef = ( - schema: GraphQLSchema, - parentType: GraphQLType, - fieldNode: FieldNode, + schema: GraphQLSchema, + parentType: GraphQLType, + fieldNode: FieldNode, ) => GraphQLField; diff --git a/types/graphql/utilities/astFromValue.d.ts b/types/graphql/utilities/astFromValue.d.ts index 44745c5e6c..557a07dd9d 100644 --- a/types/graphql/utilities/astFromValue.d.ts +++ b/types/graphql/utilities/astFromValue.d.ts @@ -1,6 +1,6 @@ import { - ValueNode, - /* + ValueNode, + /* TODO: IntValueNode, FloatValueNode, @@ -30,7 +30,4 @@ import { GraphQLInputType } from '../type/definition'; * */ // TODO: this should set overloads according to above the table -export function astFromValue( - value: any, - type: GraphQLInputType -): ValueNode; // Warning: there is a code in bottom: throw new TypeError +export function astFromValue(value: any, type: GraphQLInputType): ValueNode; // Warning: there is a code in bottom: throw new TypeError diff --git a/types/graphql/utilities/buildClientSchema.d.ts b/types/graphql/utilities/buildClientSchema.d.ts index 166ec43cf7..bdf898bc2b 100644 --- a/types/graphql/utilities/buildClientSchema.d.ts +++ b/types/graphql/utilities/buildClientSchema.d.ts @@ -11,5 +11,5 @@ import { GraphQLSchema } from '../type/schema'; * server-internal mechanisms. */ export function buildClientSchema( - introspection: IntrospectionQuery + introspection: IntrospectionQuery, ): GraphQLSchema; diff --git a/types/graphql/utilities/extendSchema.d.ts b/types/graphql/utilities/extendSchema.d.ts index f7d00b2fee..389bd02d8b 100644 --- a/types/graphql/utilities/extendSchema.d.ts +++ b/types/graphql/utilities/extendSchema.d.ts @@ -14,6 +14,6 @@ import { GraphQLSchema } from '../type/schema'; * producing the copy. The original schema remains unaltered. */ export function extendSchema( - schema: GraphQLSchema, - documentAST: DocumentNode + schema: GraphQLSchema, + documentAST: DocumentNode, ): GraphQLSchema; diff --git a/types/graphql/utilities/findBreakingChanges.d.ts b/types/graphql/utilities/findBreakingChanges.d.ts index 78d5a5a95b..0d5fc0041a 100644 --- a/types/graphql/utilities/findBreakingChanges.d.ts +++ b/types/graphql/utilities/findBreakingChanges.d.ts @@ -1,35 +1,35 @@ import { - getNamedType, - GraphQLScalarType, - GraphQLEnumType, - GraphQLInputObjectType, - GraphQLInterfaceType, - GraphQLObjectType, - GraphQLUnionType, - GraphQLNamedType, + getNamedType, + GraphQLScalarType, + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLInterfaceType, + GraphQLObjectType, + GraphQLUnionType, + GraphQLNamedType, } from '../type/definition'; import { GraphQLSchema } from '../type/schema'; export const BreakingChangeType: { - FIELD_CHANGED_KIND: 'FIELD_CHANGED_KIND', - FIELD_REMOVED: 'FIELD_REMOVED', - TYPE_CHANGED_KIND: 'TYPE_CHANGED_KIND', - TYPE_REMOVED: 'TYPE_REMOVED', - TYPE_REMOVED_FROM_UNION: 'TYPE_REMOVED_FROM_UNION', - VALUE_REMOVED_FROM_ENUM: 'VALUE_REMOVED_FROM_ENUM', + FIELD_CHANGED_KIND: 'FIELD_CHANGED_KIND'; + FIELD_REMOVED: 'FIELD_REMOVED'; + TYPE_CHANGED_KIND: 'TYPE_CHANGED_KIND'; + TYPE_REMOVED: 'TYPE_REMOVED'; + TYPE_REMOVED_FROM_UNION: 'TYPE_REMOVED_FROM_UNION'; + VALUE_REMOVED_FROM_ENUM: 'VALUE_REMOVED_FROM_ENUM'; }; export type BreakingChangeKey = - | 'FIELD_CHANGED_KIND' - | 'FIELD_REMOVED' - | 'TYPE_CHANGED_KIND' - | 'TYPE_REMOVED' - | 'TYPE_REMOVED_FROM_UNION' - | 'VALUE_REMOVED_FROM_ENUM'; + | 'FIELD_CHANGED_KIND' + | 'FIELD_REMOVED' + | 'TYPE_CHANGED_KIND' + | 'TYPE_REMOVED' + | 'TYPE_REMOVED_FROM_UNION' + | 'VALUE_REMOVED_FROM_ENUM'; export interface BreakingChange { - type: BreakingChangeKey; - description: string; + type: BreakingChangeKey; + description: string; } /** @@ -37,8 +37,8 @@ export interface BreakingChange { * of breaking changes covered by the other functions down below. */ export function findBreakingChanges( - oldSchema: GraphQLSchema, - newSchema: GraphQLSchema + oldSchema: GraphQLSchema, + newSchema: GraphQLSchema, ): BreakingChange[]; /** @@ -46,8 +46,8 @@ export function findBreakingChanges( * changes in the newSchema related to removing an entire type. */ export function findRemovedTypes( - oldSchema: GraphQLSchema, - newSchema: GraphQLSchema + oldSchema: GraphQLSchema, + newSchema: GraphQLSchema, ): BreakingChange[]; /** @@ -55,8 +55,8 @@ export function findRemovedTypes( * changes in the newSchema related to changing the type of a type. */ export function findTypesThatChangedKind( - oldSchema: GraphQLSchema, - newSchema: GraphQLSchema + oldSchema: GraphQLSchema, + newSchema: GraphQLSchema, ): BreakingChange[]; /** @@ -65,8 +65,8 @@ export function findTypesThatChangedKind( * a field has been removed from a type or if a field has changed type. */ export function findFieldsThatChangedType( - oldSchema: GraphQLSchema, - newSchema: GraphQLSchema + oldSchema: GraphQLSchema, + newSchema: GraphQLSchema, ): BreakingChange[]; /** @@ -74,8 +74,8 @@ export function findFieldsThatChangedType( * changes in the newSchema related to removing types from a union type. */ export function findTypesRemovedFromUnions( - oldSchema: GraphQLSchema, - newSchema: GraphQLSchema + oldSchema: GraphQLSchema, + newSchema: GraphQLSchema, ): BreakingChange[]; /** @@ -83,6 +83,6 @@ export function findTypesRemovedFromUnions( * changes in the newSchema related to removing values from an enum type. */ export function findValuesRemovedFromEnums( - oldSchema: GraphQLSchema, - newSchema: GraphQLSchema + oldSchema: GraphQLSchema, + newSchema: GraphQLSchema, ): BreakingChange[]; diff --git a/types/graphql/utilities/findDeprecatedUsages.d.ts b/types/graphql/utilities/findDeprecatedUsages.d.ts index 8f6ff48239..8cd844e15f 100644 --- a/types/graphql/utilities/findDeprecatedUsages.d.ts +++ b/types/graphql/utilities/findDeprecatedUsages.d.ts @@ -8,6 +8,6 @@ import { GraphQLError } from '../error/GraphQLError'; * Returns a list of GraphQLError instances describing each deprecated use. */ export function findDeprecatedUsages( - schema: GraphQLSchema, - ast: DocumentNode + schema: GraphQLSchema, + ast: DocumentNode, ): GraphQLError[]; diff --git a/types/graphql/utilities/getOperationAST.d.ts b/types/graphql/utilities/getOperationAST.d.ts index ce99d39b2b..0d5064d48d 100644 --- a/types/graphql/utilities/getOperationAST.d.ts +++ b/types/graphql/utilities/getOperationAST.d.ts @@ -6,6 +6,6 @@ import { DocumentNode, OperationDefinitionNode } from '../language/ast'; * provided in the document. */ export function getOperationAST( - documentAST: DocumentNode, - operationName?: string + documentAST: DocumentNode, + operationName?: string, ): OperationDefinitionNode; diff --git a/types/graphql/utilities/index.d.ts b/types/graphql/utilities/index.d.ts index 8815046735..cd0e23948f 100644 --- a/types/graphql/utilities/index.d.ts +++ b/types/graphql/utilities/index.d.ts @@ -1,23 +1,23 @@ // The GraphQL query recommended for a full schema introspection. export { introspectionQuery } from './introspectionQuery'; export { - IntrospectionQuery, - IntrospectionSchema, - IntrospectionType, - IntrospectionScalarType, - IntrospectionObjectType, - IntrospectionInterfaceType, - IntrospectionUnionType, - IntrospectionEnumType, - IntrospectionInputObjectType, - IntrospectionTypeRef, - IntrospectionNamedTypeRef, - IntrospectionListTypeRef, - IntrospectionNonNullTypeRef, - IntrospectionField, - IntrospectionInputValue, - IntrospectionEnumValue, - IntrospectionDirective, + IntrospectionQuery, + IntrospectionSchema, + IntrospectionType, + IntrospectionScalarType, + IntrospectionObjectType, + IntrospectionInterfaceType, + IntrospectionUnionType, + IntrospectionEnumType, + IntrospectionInputObjectType, + IntrospectionTypeRef, + IntrospectionNamedTypeRef, + IntrospectionListTypeRef, + IntrospectionNonNullTypeRef, + IntrospectionField, + IntrospectionInputValue, + IntrospectionEnumValue, + IntrospectionDirective, } from './introspectionQuery'; // Gets the target Operation from a Document @@ -33,7 +33,11 @@ export { buildASTSchema, buildSchema } from './buildASTSchema'; export { extendSchema } from './extendSchema'; // Print a GraphQLSchema to GraphQL Schema language. -export { printSchema, printType, printIntrospectionSchema } from './schemaPrinter'; +export { + printSchema, + printType, + printIntrospectionSchema, +} from './schemaPrinter'; // Create a GraphQLType from a GraphQL language AST. export { typeFromAST } from './typeFromAST'; @@ -62,9 +66,9 @@ export { separateOperations } from './separateOperations'; // Comparators for types export { - isEqualType, - isTypeSubTypeOf, - doTypesOverlap + isEqualType, + isTypeSubTypeOf, + doTypesOverlap, } from './typeComparators'; // Asserts that a string is a valid GraphQL name diff --git a/types/graphql/utilities/introspectionQuery.d.ts b/types/graphql/utilities/introspectionQuery.d.ts index a89c5c1fec..f16b873a3a 100644 --- a/types/graphql/utilities/introspectionQuery.d.ts +++ b/types/graphql/utilities/introspectionQuery.d.ts @@ -96,114 +96,114 @@ fragment TypeRef on __Type { export const introspectionQuery: string; export interface IntrospectionQuery { - __schema: IntrospectionSchema; + __schema: IntrospectionSchema; } export interface IntrospectionSchema { - queryType: IntrospectionNamedTypeRef; - mutationType?: IntrospectionNamedTypeRef; - subscriptionType?: IntrospectionNamedTypeRef; - types: IntrospectionType[]; - directives: IntrospectionDirective[]; + queryType: IntrospectionNamedTypeRef; + mutationType?: IntrospectionNamedTypeRef; + subscriptionType?: IntrospectionNamedTypeRef; + types: IntrospectionType[]; + directives: IntrospectionDirective[]; } export type IntrospectionType = - | IntrospectionScalarType - | IntrospectionObjectType - | IntrospectionInterfaceType - | IntrospectionUnionType - | IntrospectionEnumType - | IntrospectionInputObjectType; + | IntrospectionScalarType + | IntrospectionObjectType + | IntrospectionInterfaceType + | IntrospectionUnionType + | IntrospectionEnumType + | IntrospectionInputObjectType; export interface IntrospectionScalarType { - kind: 'SCALAR'; - name: string; - description?: string; + kind: 'SCALAR'; + name: string; + description?: string; } export interface IntrospectionObjectType { - kind: 'OBJECT'; - name: string; - description?: string; - fields: IntrospectionField[]; - interfaces: IntrospectionNamedTypeRef[]; + kind: 'OBJECT'; + name: string; + description?: string; + fields: IntrospectionField[]; + interfaces: IntrospectionNamedTypeRef[]; } export interface IntrospectionInterfaceType { - kind: 'INTERFACE'; - name: string; - description?: string; - fields: IntrospectionField[]; - possibleTypes: IntrospectionNamedTypeRef[]; + kind: 'INTERFACE'; + name: string; + description?: string; + fields: IntrospectionField[]; + possibleTypes: IntrospectionNamedTypeRef[]; } export interface IntrospectionUnionType { - kind: 'UNION'; - name: string; - description?: string; - possibleTypes: IntrospectionNamedTypeRef[]; + kind: 'UNION'; + name: string; + description?: string; + possibleTypes: IntrospectionNamedTypeRef[]; } export interface IntrospectionEnumType { - kind: 'ENUM'; - name: string; - description?: string; - enumValues: IntrospectionEnumValue[]; + kind: 'ENUM'; + name: string; + description?: string; + enumValues: IntrospectionEnumValue[]; } export interface IntrospectionInputObjectType { - kind: 'INPUT_OBJECT'; - name: string; - description?: string; - inputFields: IntrospectionInputValue[]; + kind: 'INPUT_OBJECT'; + name: string; + description?: string; + inputFields: IntrospectionInputValue[]; } export type IntrospectionTypeRef = - | IntrospectionNamedTypeRef - | IntrospectionListTypeRef - | IntrospectionNonNullTypeRef; + | IntrospectionNamedTypeRef + | IntrospectionListTypeRef + | IntrospectionNonNullTypeRef; export interface IntrospectionNamedTypeRef { - kind: string; - name: string; + kind: string; + name: string; } export interface IntrospectionListTypeRef { - kind: 'LIST'; - ofType?: IntrospectionTypeRef; + kind: 'LIST'; + ofType?: IntrospectionTypeRef; } export interface IntrospectionNonNullTypeRef { - kind: 'NON_NULL'; - ofType?: IntrospectionTypeRef; + kind: 'NON_NULL'; + ofType?: IntrospectionTypeRef; } export interface IntrospectionField { - name: string; - description?: string; - args: IntrospectionInputValue[]; - type: IntrospectionTypeRef; - isDeprecated: boolean; - deprecationReason?: string; + name: string; + description?: string; + args: IntrospectionInputValue[]; + type: IntrospectionTypeRef; + isDeprecated: boolean; + deprecationReason?: string; } export interface IntrospectionInputValue { - name: string; - description?: string; - type: IntrospectionTypeRef; - defaultValue?: string; + name: string; + description?: string; + type: IntrospectionTypeRef; + defaultValue?: string; } export interface IntrospectionEnumValue { - name: string; - description?: string; - isDeprecated: boolean; - deprecationReason?: string; + name: string; + description?: string; + isDeprecated: boolean; + deprecationReason?: string; } export interface IntrospectionDirective { - name: string; - description?: string; - locations: DirectiveLocationEnum[]; - args: IntrospectionInputValue[]; + name: string; + description?: string; + locations: DirectiveLocationEnum[]; + args: IntrospectionInputValue[]; } diff --git a/types/graphql/utilities/isValidJSValue.d.ts b/types/graphql/utilities/isValidJSValue.d.ts index cd11014579..911d8fea67 100644 --- a/types/graphql/utilities/isValidJSValue.d.ts +++ b/types/graphql/utilities/isValidJSValue.d.ts @@ -5,7 +5,4 @@ import { GraphQLInputType } from '../type/definition'; * accepted for that type. This is primarily useful for validating the * runtime values of query variables. */ -export function isValidJSValue( - value: any, - type: GraphQLInputType -): string[]; +export function isValidJSValue(value: any, type: GraphQLInputType): string[]; diff --git a/types/graphql/utilities/isValidLiteralValue.d.ts b/types/graphql/utilities/isValidLiteralValue.d.ts index 697c8eb97e..4ad03d1013 100644 --- a/types/graphql/utilities/isValidLiteralValue.d.ts +++ b/types/graphql/utilities/isValidLiteralValue.d.ts @@ -9,6 +9,6 @@ import { GraphQLInputType } from '../type/definition'; * provide values of the correct type. */ export function isValidLiteralValue( - type: GraphQLInputType, - valueNode: ValueNode + type: GraphQLInputType, + valueNode: ValueNode, ): string[]; diff --git a/types/graphql/utilities/separateOperations.d.ts b/types/graphql/utilities/separateOperations.d.ts index 4b4106df53..a10ad0a29e 100644 --- a/types/graphql/utilities/separateOperations.d.ts +++ b/types/graphql/utilities/separateOperations.d.ts @@ -1,8 +1,5 @@ -import { - DocumentNode, - OperationDefinitionNode, -} from '../language/ast'; +import { DocumentNode, OperationDefinitionNode } from '../language/ast'; export function separateOperations( - documentAST: DocumentNode + documentAST: DocumentNode, ): { [operationName: string]: DocumentNode }; diff --git a/types/graphql/utilities/typeComparators.d.ts b/types/graphql/utilities/typeComparators.d.ts index 16e6acd680..ca0cdaf6c2 100644 --- a/types/graphql/utilities/typeComparators.d.ts +++ b/types/graphql/utilities/typeComparators.d.ts @@ -1,11 +1,9 @@ import { - GraphQLType, - GraphQLCompositeType, - GraphQLAbstractType + GraphQLType, + GraphQLCompositeType, + GraphQLAbstractType, } from '../type/definition'; -import { - GraphQLSchema -} from '../type/schema'; +import { GraphQLSchema } from '../type/schema'; /** * Provided two types, return true if the types are equal (invariant). @@ -17,9 +15,9 @@ export function isEqualType(typeA: GraphQLType, typeB: GraphQLType): boolean; * equal or a subset of the second super type (covariant). */ export function isTypeSubTypeOf( - schema: GraphQLSchema, - maybeSubType: GraphQLType, - superType: GraphQLType + schema: GraphQLSchema, + maybeSubType: GraphQLType, + superType: GraphQLType, ): boolean; /** @@ -32,7 +30,7 @@ export function isTypeSubTypeOf( * This function is commutative. */ export function doTypesOverlap( - schema: GraphQLSchema, - typeA: GraphQLCompositeType, - typeB: GraphQLCompositeType + schema: GraphQLSchema, + typeA: GraphQLCompositeType, + typeB: GraphQLCompositeType, ): boolean; diff --git a/types/graphql/utilities/typeFromAST.d.ts b/types/graphql/utilities/typeFromAST.d.ts index c3cacf90df..415cbd2636 100644 --- a/types/graphql/utilities/typeFromAST.d.ts +++ b/types/graphql/utilities/typeFromAST.d.ts @@ -3,6 +3,6 @@ import { GraphQLType, GraphQLNullableType } from '../type/definition'; import { GraphQLSchema } from '../type/schema'; export function typeFromAST( - schema: GraphQLSchema, - typeNode: TypeNode + schema: GraphQLSchema, + typeNode: TypeNode, ): GraphQLType; diff --git a/types/graphql/utilities/valueFromAST.d.ts b/types/graphql/utilities/valueFromAST.d.ts index 24dd435448..0bfbf04981 100644 --- a/types/graphql/utilities/valueFromAST.d.ts +++ b/types/graphql/utilities/valueFromAST.d.ts @@ -1,15 +1,15 @@ import { GraphQLInputType } from '../type/definition'; import { - ValueNode, - VariableNode, - ListValueNode, - ObjectValueNode + ValueNode, + VariableNode, + ListValueNode, + ObjectValueNode, } from '../language/ast'; export function valueFromAST( - valueNode: ValueNode, - type: GraphQLInputType, - variables?: { - [key: string]: any - } + valueNode: ValueNode, + type: GraphQLInputType, + variables?: { + [key: string]: any; + }, ): any; diff --git a/types/graphql/validation/index.d.ts b/types/graphql/validation/index.d.ts index 7f897fe78d..b8cb9ddd00 100644 --- a/types/graphql/validation/index.d.ts +++ b/types/graphql/validation/index.d.ts @@ -3,130 +3,126 @@ export { specifiedRules } from './specifiedRules'; // Spec Section: "Argument Values Type Correctness" export { - ArgumentsOfCorrectType as ArgumentsOfCorrectTypeRule + ArgumentsOfCorrectType as ArgumentsOfCorrectTypeRule, } from './rules/ArgumentsOfCorrectType'; // Spec Section: "Variable Default Values Are Correctly Typed" export { - DefaultValuesOfCorrectType as DefaultValuesOfCorrectTypeRule + DefaultValuesOfCorrectType as DefaultValuesOfCorrectTypeRule, } from './rules/DefaultValuesOfCorrectType'; // Spec Section: "Field Selections on Objects, Interfaces, and Unions Types" export { - FieldsOnCorrectType as FieldsOnCorrectTypeRule + FieldsOnCorrectType as FieldsOnCorrectTypeRule, } from './rules/FieldsOnCorrectType'; // Spec Section: "Fragments on Composite Types" export { - FragmentsOnCompositeTypes as FragmentsOnCompositeTypesRule + FragmentsOnCompositeTypes as FragmentsOnCompositeTypesRule, } from './rules/FragmentsOnCompositeTypes'; // Spec Section: "Argument Names" export { - KnownArgumentNames as KnownArgumentNamesRule + KnownArgumentNames as KnownArgumentNamesRule, } from './rules/KnownArgumentNames'; // Spec Section: "Directives Are Defined" export { - KnownDirectives as KnownDirectivesRule + KnownDirectives as KnownDirectivesRule, } from './rules/KnownDirectives'; // Spec Section: "Fragment spread target defined" export { - KnownFragmentNames as KnownFragmentNamesRule + KnownFragmentNames as KnownFragmentNamesRule, } from './rules/KnownFragmentNames'; // Spec Section: "Fragment Spread Type Existence" -export { - KnownTypeNames as KnownTypeNamesRule -} from './rules/KnownTypeNames'; +export { KnownTypeNames as KnownTypeNamesRule } from './rules/KnownTypeNames'; // Spec Section: "Lone Anonymous Operation" export { - LoneAnonymousOperation as LoneAnonymousOperationRule + LoneAnonymousOperation as LoneAnonymousOperationRule, } from './rules/LoneAnonymousOperation'; // Spec Section: "Fragments must not form cycles" export { - NoFragmentCycles as NoFragmentCyclesRule + NoFragmentCycles as NoFragmentCyclesRule, } from './rules/NoFragmentCycles'; // Spec Section: "All Variable Used Defined" export { - NoUndefinedVariables as NoUndefinedVariablesRule + NoUndefinedVariables as NoUndefinedVariablesRule, } from './rules/NoUndefinedVariables'; // Spec Section: "Fragments must be used" export { - NoUnusedFragments as NoUnusedFragmentsRule + NoUnusedFragments as NoUnusedFragmentsRule, } from './rules/NoUnusedFragments'; // Spec Section: "All Variables Used" export { - NoUnusedVariables as NoUnusedVariablesRule + NoUnusedVariables as NoUnusedVariablesRule, } from './rules/NoUnusedVariables'; // Spec Section: "Field Selection Merging" export { - OverlappingFieldsCanBeMerged as OverlappingFieldsCanBeMergedRule + OverlappingFieldsCanBeMerged as OverlappingFieldsCanBeMergedRule, } from './rules/OverlappingFieldsCanBeMerged'; // Spec Section: "Fragment spread is possible" export { - PossibleFragmentSpreads as PossibleFragmentSpreadsRule + PossibleFragmentSpreads as PossibleFragmentSpreadsRule, } from './rules/PossibleFragmentSpreads'; // Spec Section: "Argument Optionality" export { - ProvidedNonNullArguments as ProvidedNonNullArgumentsRule + ProvidedNonNullArguments as ProvidedNonNullArgumentsRule, } from './rules/ProvidedNonNullArguments'; // Spec Section: "Leaf Field Selections" -export { - ScalarLeafs as ScalarLeafsRule -} from './rules/ScalarLeafs'; +export { ScalarLeafs as ScalarLeafsRule } from './rules/ScalarLeafs'; // Spec Section: "Subscriptions with Single Root Field" export { - SingleFieldSubscriptions as SingleFieldSubscriptionsRule + SingleFieldSubscriptions as SingleFieldSubscriptionsRule, } from './rules/SingleFieldSubscriptions'; // Spec Section: "Argument Uniqueness" export { - UniqueArgumentNames as UniqueArgumentNamesRule + UniqueArgumentNames as UniqueArgumentNamesRule, } from './rules/UniqueArgumentNames'; // Spec Section: "Directives Are Unique Per Location" export { - UniqueDirectivesPerLocation as UniqueDirectivesPerLocationRule + UniqueDirectivesPerLocation as UniqueDirectivesPerLocationRule, } from './rules/UniqueDirectivesPerLocation'; // Spec Section: "Fragment Name Uniqueness" export { - UniqueFragmentNames as UniqueFragmentNamesRule + UniqueFragmentNames as UniqueFragmentNamesRule, } from './rules/UniqueFragmentNames'; // Spec Section: "Input Object Field Uniqueness" export { - UniqueInputFieldNames as UniqueInputFieldNamesRule + UniqueInputFieldNames as UniqueInputFieldNamesRule, } from './rules/UniqueInputFieldNames'; // Spec Section: "Operation Name Uniqueness" export { - UniqueOperationNames as UniqueOperationNamesRule + UniqueOperationNames as UniqueOperationNamesRule, } from './rules/UniqueOperationNames'; // Spec Section: "Variable Uniqueness" export { - UniqueVariableNames as UniqueVariableNamesRule + UniqueVariableNames as UniqueVariableNamesRule, } from './rules/UniqueVariableNames'; // Spec Section: "Variables are Input Types" export { - VariablesAreInputTypes as VariablesAreInputTypesRule + VariablesAreInputTypes as VariablesAreInputTypesRule, } from './rules/VariablesAreInputTypes'; // Spec Section: "All Variable Usages Are Allowed" export { - VariablesInAllowedPosition as VariablesInAllowedPositionRule + VariablesInAllowedPosition as VariablesInAllowedPositionRule, } from './rules/VariablesInAllowedPosition'; diff --git a/types/graphql/validation/validate.d.ts b/types/graphql/validation/validate.d.ts index a4b628777e..9e2fd479f1 100644 --- a/types/graphql/validation/validate.d.ts +++ b/types/graphql/validation/validate.d.ts @@ -1,19 +1,19 @@ import { GraphQLError } from '../error'; import { - DocumentNode, - OperationDefinitionNode, - VariableNode, - SelectionSetNode, - FragmentSpreadNode, - FragmentDefinitionNode, + DocumentNode, + OperationDefinitionNode, + VariableNode, + SelectionSetNode, + FragmentSpreadNode, + FragmentDefinitionNode, } from '../language/ast'; import { GraphQLSchema } from '../type/schema'; import { - GraphQLInputType, - GraphQLOutputType, - GraphQLCompositeType, - GraphQLField, - GraphQLArgument + GraphQLInputType, + GraphQLOutputType, + GraphQLCompositeType, + GraphQLField, + GraphQLArgument, } from '../type/definition'; import { GraphQLDirective } from '../type/directives'; import { TypeInfo } from '../utilities/TypeInfo'; @@ -33,9 +33,9 @@ import { specifiedRules } from './specifiedRules'; * GraphQLErrors, or Arrays of GraphQLErrors when invalid. */ export function validate( - schema: GraphQLSchema, - ast: DocumentNode, - rules?: any[] + schema: GraphQLSchema, + ast: DocumentNode, + rules?: any[], ): GraphQLError[]; /** @@ -45,16 +45,18 @@ export function validate( * @internal */ export function visitUsingRules( - schema: GraphQLSchema, - typeInfo: TypeInfo, - documentAST: DocumentNode, - rules: any[] + schema: GraphQLSchema, + typeInfo: TypeInfo, + documentAST: DocumentNode, + rules: any[], ): GraphQLError[]; -export type NodeWithSelectionSet = OperationDefinitionNode | FragmentDefinitionNode; +export type NodeWithSelectionSet = + | OperationDefinitionNode + | FragmentDefinitionNode; export interface VariableUsage { - node: VariableNode; - type: GraphQLInputType; + node: VariableNode; + type: GraphQLInputType; } /** @@ -63,38 +65,38 @@ export interface VariableUsage { * validation rule. */ export class ValidationContext { - constructor(schema: GraphQLSchema, ast: DocumentNode, typeInfo: TypeInfo); - reportError(error: GraphQLError): void; + constructor(schema: GraphQLSchema, ast: DocumentNode, typeInfo: TypeInfo); + reportError(error: GraphQLError): void; - getErrors(): GraphQLError[]; + getErrors(): GraphQLError[]; - getSchema(): GraphQLSchema; + getSchema(): GraphQLSchema; - getDocument(): DocumentNode; + getDocument(): DocumentNode; - getFragment(name: string): FragmentDefinitionNode; + getFragment(name: string): FragmentDefinitionNode; - getFragmentSpreads(node: SelectionSetNode): FragmentSpreadNode[]; + getFragmentSpreads(node: SelectionSetNode): FragmentSpreadNode[]; - getRecursivelyReferencedFragments( - operation: OperationDefinitionNode - ): FragmentDefinitionNode[]; + getRecursivelyReferencedFragments( + operation: OperationDefinitionNode, + ): FragmentDefinitionNode[]; - getVariableUsages(node: NodeWithSelectionSet): VariableUsage[]; + getVariableUsages(node: NodeWithSelectionSet): VariableUsage[]; - getRecursiveVariableUsages( - operation: OperationDefinitionNode - ): VariableUsage[]; + getRecursiveVariableUsages( + operation: OperationDefinitionNode, + ): VariableUsage[]; - getType(): GraphQLOutputType; + getType(): GraphQLOutputType; - getParentType(): GraphQLCompositeType; + getParentType(): GraphQLCompositeType; - getInputType(): GraphQLInputType; + getInputType(): GraphQLInputType; - getFieldDef(): GraphQLField; + getFieldDef(): GraphQLField; - getDirective(): GraphQLDirective; + getDirective(): GraphQLDirective; - getArgument(): GraphQLArgument; + getArgument(): GraphQLArgument; } From 76a6216365d41dceedb922d5db613b39beac4af2 Mon Sep 17 00:00:00 2001 From: Anton Myzenkov Date: Wed, 24 Jan 2018 20:00:34 +0300 Subject: [PATCH 031/150] [mongodb] Updated Logger class constructor. (#23140) Changed parameter "options" of Logger class to optional. --- types/mongodb/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index 08aeceb5d8..dd4f44f38a 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -1457,8 +1457,8 @@ export interface ChangeStreamOptions { type GridFSBucketWriteStreamId = string | number | Object | ObjectID; export interface LoggerOptions { - loggerLevel: string // Custom logger function - logger: log // Override default global log level. + loggerLevel?: string // Custom logger function + logger?: log // Override default global log level. } export type log = (message?: string, state?: LoggerState) => void @@ -1473,7 +1473,7 @@ export interface LoggerState { /** http://mongodb.github.io/node-mongodb-native/3.0/api/Logger.html */ export class Logger{ - constructor(className: string,options: LoggerOptions) + constructor(className: string, options?: LoggerOptions) // Log a message at the debug level debug(message: string, state: LoggerState):void // Log a message at the warn level @@ -1497,7 +1497,7 @@ export class Logger{ //Set the current logger function static setCurrentLogger(log: log):void // Set what classes to log. - static filter(type: string,values: string[]):void + static filter(type: string, values: string[]):void // Set the current log level static setLevel(level: string):void } From 021cf2a985ff11b7885f3c0cc97ae9894e176785 Mon Sep 17 00:00:00 2001 From: Andrew Pinkham Date: Wed, 24 Jan 2018 12:01:32 -0500 Subject: [PATCH 032/150] Fix Leaflet.Draw.DrawEvents.Created.layer type (#23137) The DrawEvents.Created layer variable is not of type Layer. As noted by the in-code documentation, the Leaflet.Draw.DrawEvents.Created.layer variable is one of Leaflet's vector shapes or a markers. https://github.com/Leaflet/Leaflet.draw/blob/c6af99b761c5d9900bf5a3e2e1d8827bbde29542/src/Leaflet.Draw.Event.js#L31 The L.Draw.Event.CREATED event is only fired by Draw.Feature in the _fireCreatedEvent method. Draw.Feature bequeaths _fireCreatedEvent to it's subclasses Draw.Marker, Draw.Polyline, and Draw.SimpleShape, which in turn bequeath the method to Draw.Circle, Draw.Rectangle (both from Draw.SimpleShape), Draw.CircleMarker (from Draw.Marker), and Draw.Polygon (from Draw.Polyline). Draw.Circle, Draw.CircleMarker, Draw.Marker, Draw.Rectangle and Draw.Polyline override the _fireCreatedEvent to pass instances of their respective vector classes to _fireCreatedEvent, meaning that the layer variable is not of type Layer, but instead one of the vector or marker classes. For example, Draw.Circle passes L.Circle to L.Draw.Feature.prototype._fireCreatedEvent as the argument to the `layer` parameter. Note that Draw.Polygon inherits Draw.Polyline's behavior without changes, but changes the vector class via the Poly class variable. --- types/leaflet-draw/index.d.ts | 2 +- types/leaflet-draw/leaflet-draw-tests.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/types/leaflet-draw/index.d.ts b/types/leaflet-draw/index.d.ts index 35d014b699..7fd33f2152 100644 --- a/types/leaflet-draw/index.d.ts +++ b/types/leaflet-draw/index.d.ts @@ -387,7 +387,7 @@ declare module 'leaflet' { /** * Layer that was just created. */ - layer: Layer; + layer: Circle | CircleMarker | Marker | Polygon | Polyline | Rectangle; /** * The type of layer this is. One of: polyline, polygon, rectangle, circle, marker. diff --git a/types/leaflet-draw/leaflet-draw-tests.ts b/types/leaflet-draw/leaflet-draw-tests.ts index e63006edce..54015fa404 100644 --- a/types/leaflet-draw/leaflet-draw-tests.ts +++ b/types/leaflet-draw/leaflet-draw-tests.ts @@ -41,6 +41,7 @@ map.addControl(drawControl); map.on(L.Draw.Event.CREATED, (e: L.DrawEvents.Created) => { const type = e.layerType; const layer = e.layer; + const geojson = e.layer.toGeoJSON(); drawnItems.addLayer(layer); }); From a0d0b93d94e00ee208bcfa25aa88d4c4a9952906 Mon Sep 17 00:00:00 2001 From: Andy Date: Wed, 24 Jan 2018 09:53:35 -0800 Subject: [PATCH 033/150] aws-lambda: Lint (#23167) --- types/aws-lambda/aws-lambda-tests.ts | 204 +++++++++++++-------------- types/aws-lambda/index.d.ts | 185 +++++++++++++----------- types/aws-lambda/tslint.json | 76 +--------- 3 files changed, 205 insertions(+), 260 deletions(-) diff --git a/types/aws-lambda/aws-lambda-tests.ts b/types/aws-lambda/aws-lambda-tests.ts index 06f3fdb40c..6d0d83b210 100644 --- a/types/aws-lambda/aws-lambda-tests.ts +++ b/types/aws-lambda/aws-lambda-tests.ts @@ -1,29 +1,29 @@ -var str: string = "any string"; -var date: Date = new Date(); -var anyObj: any = { abc: 123 }; -var num: number = 5; -var error: Error = new Error(); -var b: boolean = true; -var apiGwEvtReqCtx: AWSLambda.APIGatewayEventRequestContext; -var apiGwEvt: AWSLambda.APIGatewayEvent; -var customAuthorizerEvt: AWSLambda.CustomAuthorizerEvent; -var clientCtx: AWSLambda.ClientContext; -var clientContextEnv: AWSLambda.ClientContextEnv; -var clientContextClient: AWSLambda.ClientContextClient; -var context: AWSLambda.Context; -var identity: AWSLambda.CognitoIdentity; -var proxyResult: AWSLambda.ProxyResult; -var authResponse: AWSLambda.AuthResponse; -var policyDocument: AWSLambda.PolicyDocument; -var statement: AWSLambda.Statement; -var authResponseContext: AWSLambda.AuthResponseContext; -var snsEvt: AWSLambda.SNSEvent; -var snsEvtRecs: AWSLambda.SNSEventRecord[]; -var snsEvtRec: AWSLambda.SNSEventRecord; -var snsMsg: AWSLambda.SNSMessage; -var snsMsgAttr: AWSLambda.SNSMessageAttribute; -var snsMsgAttrs: AWSLambda.SNSMessageAttributes; -var S3EvtRec: AWSLambda.S3EventRecord = { +let str: string; +let date: Date; +let anyObj: any; +let num: number; +let error: Error; +let b: boolean; +let apiGwEvtReqCtx: AWSLambda.APIGatewayEventRequestContext; +let apiGwEvt: AWSLambda.APIGatewayEvent; +let customAuthorizerEvt: AWSLambda.CustomAuthorizerEvent; +let clientCtx: AWSLambda.ClientContext; +let clientContextEnv: AWSLambda.ClientContextEnv; +let clientContextClient: AWSLambda.ClientContextClient; +let context: AWSLambda.Context; +let identity: AWSLambda.CognitoIdentity; +let proxyResult: AWSLambda.ProxyResult; +let authResponse: AWSLambda.AuthResponse; +let policyDocument: AWSLambda.PolicyDocument; +let statement: AWSLambda.Statement; +let authResponseContext: AWSLambda.AuthResponseContext; +let snsEvt: AWSLambda.SNSEvent; +let snsEvtRecs: AWSLambda.SNSEventRecord[]; +let snsEvtRec: AWSLambda.SNSEventRecord; +let snsMsg: AWSLambda.SNSMessage; +let snsMsgAttr: AWSLambda.SNSMessageAttribute; +let snsMsgAttrs: AWSLambda.SNSMessageAttributes; +const S3EvtRec: AWSLambda.S3EventRecord = { eventVersion: '2.0', eventSource: 'aws:s3', awsRegion: 'us-east-1', @@ -32,7 +32,7 @@ var S3EvtRec: AWSLambda.S3EventRecord = { userIdentity: { principalId: 'AIDAJDPLRKLG7UEXAMPLE' }, - requestParameters:{ + requestParameters: { sourceIPAddress: '127.0.0.1' }, responseElements: { @@ -59,15 +59,15 @@ var S3EvtRec: AWSLambda.S3EventRecord = { } }; -var S3CreateEvent: AWSLambda.S3CreateEvent = { +const S3CreateEvent: AWSLambda.S3CreateEvent = { Records: [S3EvtRec] }; -var cognitoUserPoolEvent: AWSLambda.CognitoUserPoolEvent; -var cloudformationCustomResourceEvent: AWSLambda.CloudFormationCustomResourceEvent; -var cloudformationCustomResourceResponse: AWSLambda.CloudFormationCustomResourceResponse; -var cloudwatchLogsEvent: AWSLambda.CloudWatchLogsEvent; -var cloudwatchLogsDecodedData: AWSLambda.CloudWatchLogsDecodedData; -var scheduledEvent: AWSLambda.ScheduledEvent; +declare const cognitoUserPoolEvent: AWSLambda.CognitoUserPoolEvent; +declare const cloudformationCustomResourceEvent: AWSLambda.CloudFormationCustomResourceEvent; +declare const cloudformationCustomResourceResponse: AWSLambda.CloudFormationCustomResourceResponse; +declare const cloudwatchLogsEvent: AWSLambda.CloudWatchLogsEvent; +declare const cloudwatchLogsDecodedData: AWSLambda.CloudWatchLogsDecodedData; +declare const scheduledEvent: AWSLambda.ScheduledEvent; /* API Gateway Event request context */ str = apiGwEvtReqCtx.accountId; @@ -113,7 +113,7 @@ str = apiGwEvt.stageVariables["example"]; apiGwEvtReqCtx = apiGwEvt.requestContext; /* DynamoDB Stream Event */ -var dynamoDBStreamEvent: AWSLambda.DynamoDBStreamEvent = { +const dynamoDBStreamEvent: AWSLambda.DynamoDBStreamEvent = { Records: [ { eventID: '1', @@ -266,13 +266,13 @@ policyDocument = { authResponse = { principalId: str, - policyDocument: policyDocument, + policyDocument, context: authResponseContext }; authResponse = { principalId: str, - policyDocument: policyDocument + policyDocument, }; // CognitoUserPoolEvent @@ -442,67 +442,67 @@ function customAuthorizerCallback(cb: AWSLambda.CustomAuthorizerCallback) { } /* CloudFront events, see http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html */ -var CloudFrontRequestEvent: AWSLambda.CloudFrontRequestEvent = { - "Records": [ +const CloudFrontRequestEvent: AWSLambda.CloudFrontRequestEvent = { + Records: [ { - "cf": { - "config": { - "distributionId": "EDFDVBD6EXAMPLE", - "requestId": "MRVMF7KydIvxMWfJIglgwHQwZsbG2IhRJ07sn9AkKUFSHS9EXAMPLE==" + cf: { + config: { + distributionId: "EDFDVBD6EXAMPLE", + requestId: "MRVMF7KydIvxMWfJIglgwHQwZsbG2IhRJ07sn9AkKUFSHS9EXAMPLE==" }, - "request": { - "clientIp": "2001:0db8:85a3:0:0:8a2e:0370:7334", - "method": "GET", - "uri": "/picture.jpg", - "querystring": "size=large", - "headers": { - "host": [ + request: { + clientIp: "2001:0db8:85a3:0:0:8a2e:0370:7334", + method: "GET", + uri: "/picture.jpg", + querystring: "size=large", + headers: { + host: [ { - "key": "Host", - "value": "d111111abcdef8.cloudfront.net" + key: "Host", + value: "d111111abcdef8.cloudfront.net" } ], "user-agent": [ { - "key": "User-Agent", - "value": "curl/7.51.0" + key: "User-Agent", + value: "curl/7.51.0" } ] }, - "origin": { - "custom": { - "customHeaders": { + origin: { + custom: { + customHeaders: { "my-origin-custom-header": [ { - "key": "My-Origin-Custom-Header", - "value": "Test" + key: "My-Origin-Custom-Header", + value: "Test" } ] }, - "domainName": "example.com", - "keepaliveTimeout": 5, - "path": "/custom_path", - "port": 443, - "protocol": "https", - "readTimeout": 5, - "sslProtocols": [ + domainName: "example.com", + keepaliveTimeout: 5, + path: "/custom_path", + port: 443, + protocol: "https", + readTimeout: 5, + sslProtocols: [ "TLSv1", "TLSv1.1" ] }, - "s3": { - "authMethod": "origin-access-identity", - "customHeaders": { + s3: { + authMethod: "origin-access-identity", + customHeaders: { "my-origin-custom-header": [ { - "key": "My-Origin-Custom-Header", - "value": "Test" + key: "My-Origin-Custom-Header", + value: "Test" } ] }, - "domainName": "my-bucket.s3.amazonaws.com", - "path": "/s3_path", - "region": "us-east-1" + domainName: "my-bucket.s3.amazonaws.com", + path: "/s3_path", + region: "us-east-1" } } } @@ -511,52 +511,52 @@ var CloudFrontRequestEvent: AWSLambda.CloudFrontRequestEvent = { ] }; -var CloudFrontResponseEvent: AWSLambda.CloudFrontResponseEvent = { - "Records": [ +const CloudFrontResponseEvent: AWSLambda.CloudFrontResponseEvent = { + Records: [ { - "cf": { - "config": { - "distributionId": "EDFDVBD6EXAMPLE", - "requestId": "xGN7KWpVEmB9Dp7ctcVFQC4E-nrcOcEKS3QyAez--06dV7TEXAMPLE==" + cf: { + config: { + distributionId: "EDFDVBD6EXAMPLE", + requestId: "xGN7KWpVEmB9Dp7ctcVFQC4E-nrcOcEKS3QyAez--06dV7TEXAMPLE==" }, - "request": { - "clientIp": "2001:0db8:85a3:0:0:8a2e:0370:7334", - "method": "GET", - "uri": "/picture.jpg", - "querystring": "size=large", - "headers": { - "host": [ + request: { + clientIp: "2001:0db8:85a3:0:0:8a2e:0370:7334", + method: "GET", + uri: "/picture.jpg", + querystring: "size=large", + headers: { + host: [ { - "key": "Host", - "value": "d111111abcdef8.cloudfront.net" + key: "Host", + value: "d111111abcdef8.cloudfront.net" } ], "user-agent": [ { - "key": "User-Agent", - "value": "curl/7.18.1" + key: "User-Agent", + value: "curl/7.18.1" } ] } }, - "response": { - "status": "200", - "statusDescription": "OK", - "headers": { - "server": [ + response: { + status: "200", + statusDescription: "OK", + headers: { + server: [ { - "key": "Server", - "value": "MyCustomOrigin" + key: "Server", + value: "MyCustomOrigin" } ], "set-cookie": [ { - "key": "Set-Cookie", - "value": "theme=light" + key: "Set-Cookie", + value: "theme=light" }, { - "key": "Set-Cookie", - "value": "sessionToken=abc123; Expires=Wed, 09 Jun 2021 10:18:14 GMT" + key: "Set-Cookie", + value: "sessionToken=abc123; Expires=Wed, 09 Jun 2021 10:18:14 GMT" } ] } diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts index 1e153228c0..8c95011f87 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -18,10 +18,10 @@ // TypeScript Version: 2.2 // API Gateway "event" request context -interface APIGatewayEventRequestContext { +export interface APIGatewayEventRequestContext { accountId: string; apiId: string; - authorizer?: AuthResponseContext | null | undefined; + authorizer?: AuthResponseContext | null; httpMethod: string; identity: { accessKey: string | null; @@ -36,7 +36,7 @@ interface APIGatewayEventRequestContext { user: string | null; userAgent: string | null; userArn: string | null; - }, + }; stage: string; requestId: string; requestTimeEpoch: number; @@ -45,7 +45,7 @@ interface APIGatewayEventRequestContext { } // API Gateway "event" -interface APIGatewayEvent { +export interface APIGatewayEvent { body: string | null; headers: { [name: string]: string }; httpMethod: string; @@ -59,7 +59,7 @@ interface APIGatewayEvent { } // API Gateway CustomAuthorizer "event" -interface CustomAuthorizerEvent { +export interface CustomAuthorizerEvent { type: string; methodArn: string; authorizationToken?: string; @@ -71,22 +71,22 @@ interface CustomAuthorizerEvent { // Context // http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_AttributeValue.html -interface AttributeValue { +export interface AttributeValue { B?: string; - BS?: Array; + BS?: string[]; BOOL?: boolean; - L?: Array; + L?: AttributeValue[]; M?: { [id: string]: AttributeValue }; N?: string; - NS?: Array; + NS?: string[]; NULL?: boolean; S?: string; - SS?: Array; + SS?: string[]; } // Context // http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_StreamRecord.html -interface StreamRecord { +export interface StreamRecord { ApproximateCreationTime?: number; Keys?: { [key: string]: AttributeValue }; NewImage?: { [key: string]: AttributeValue }; @@ -98,7 +98,7 @@ interface StreamRecord { // Context // http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_Record.html -interface DynamoDBRecord { +export interface DynamoDBRecord { awsRegion?: string; dynamodb?: StreamRecord; eventID?: string; @@ -112,21 +112,21 @@ interface DynamoDBRecord { // AWS Lambda Stream event // Context // http://docs.aws.amazon.com/lambda/latest/dg/eventsources.html#eventsources-ddb-update -interface DynamoDBStreamEvent { - Records: Array; +export interface DynamoDBStreamEvent { + Records: DynamoDBRecord[]; } // SNS "event" -interface SNSMessageAttribute { +export interface SNSMessageAttribute { Type: string; Value: string; } -interface SNSMessageAttributes { +export interface SNSMessageAttributes { [name: string]: SNSMessageAttribute; } -interface SNSMessage { +export interface SNSMessage { SignatureVersion: string; Timestamp: string; Signature: string; @@ -140,37 +140,37 @@ interface SNSMessage { Subject: string; } -interface SNSEventRecord { +export interface SNSEventRecord { EventVersion: string; EventSubscriptionArn: string; EventSource: string; Sns: SNSMessage; } -interface SNSEvent { - Records: Array; +export interface SNSEvent { + Records: SNSEventRecord[]; } /** * S3Create event * https://docs.aws.amazon.com/AmazonS3/latest/dev/notification-content-structure.html */ -interface S3EventRecord { +export interface S3EventRecord { eventVersion: string; eventSource: string; - awsRegion: string + awsRegion: string; eventTime: string; eventName: string; userIdentity: { principalId: string; - }, + }; requestParameters: { sourceIPAddress: string; - }, + }; responseElements: { 'x-amz-request-id': string; 'x-amz-id-2': string; - }, + }; s3: { s3SchemaVersion: string; configurationId: string; @@ -188,20 +188,41 @@ interface S3EventRecord { versionId: string; sequencer: string; } - } + }; } -interface S3CreateEvent { - Records: Array; +export interface S3CreateEvent { + Records: S3EventRecord[]; } /** * Cognito User Pool event * http://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html */ -interface CognitoUserPoolEvent { +export interface CognitoUserPoolEvent { version: number; - triggerSource: "PreSignUp_SignUp" | "PostConfirmation_ConfirmSignUp" | "PreAuthentication_Authentication" | "PostAuthentication_Authentication" | "CustomMessage_SignUp" | "CustomMessage_AdminCreateUser" | "CustomMessage_ResendCode" | "CustomMessage_ForgotPassword" | "CustomMessage_UpdateUserAttribute" | "CustomMessage_VerifyUserAttribute" | "CustomMessage_Authentication" | "DefineAuthChallenge_Authentication" | "CreateAuthChallenge_Authentication" | "VerifyAuthChallengeResponse_Authentication" | "PreSignUp_AdminCreateUser" | "PostConfirmation_ConfirmForgotPassword" | "TokenGeneration_HostedAuth" | "TokenGeneration_Authentication" | "TokenGeneration_NewPasswordChallenge" | "TokenGeneration_AuthenticateDevice" | "TokenGeneration_RefreshTokens"; + triggerSource: + | "PreSignUp_SignUp" + | "PostConfirmation_ConfirmSignUp" + | "PreAuthentication_Authentication" + | "PostAuthentication_Authentication" + | "CustomMessage_SignUp" + | "CustomMessage_AdminCreateUser" + | "CustomMessage_ResendCode" + | "CustomMessage_ForgotPassword" + | "CustomMessage_UpdateUserAttribute" + | "CustomMessage_VerifyUserAttribute" + | "CustomMessage_Authentication" + | "DefineAuthChallenge_Authentication" + | "CreateAuthChallenge_Authentication" + | "VerifyAuthChallengeResponse_Authentication" + | "PreSignUp_AdminCreateUser" + | "PostConfirmation_ConfirmForgotPassword" + | "TokenGeneration_HostedAuth" + | "TokenGeneration_Authentication" + | "TokenGeneration_NewPasswordChallenge" + | "TokenGeneration_AuthenticateDevice" + | "TokenGeneration_RefreshTokens"; region: string; userPoolId: string; userName?: string; @@ -215,11 +236,11 @@ interface CognitoUserPoolEvent { codeParameter?: string; usernameParameter?: string; newDeviceUsed?: boolean; - session?: { + session?: Array<{ challengeName: "CUSTOM_CHALLENGE" | "PASSWORD_VERIFIER" | "SMS_MFA" | "DEVICE_SRP_AUTH" | "DEVICE_PASSWORD_VERIFIER" | "ADMIN_NO_SRP_AUTH"; challengeResult: boolean; challengeMetaData?: string; - }[]; + }>; challengeName?: string; privateChallengeParameters?: {[key: string]: string}; challengeAnswer?: {[key: string]: string}; @@ -243,7 +264,7 @@ interface CognitoUserPoolEvent { * CloudFormation Custom Resource event and response * http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/crpg-ref.html */ -type CloudFormationCustomResourceEventCommon = { +export interface CloudFormationCustomResourceEventCommon { ServiceToken: string; ResponseURL: string; StackId: string; @@ -253,14 +274,14 @@ type CloudFormationCustomResourceEventCommon = { ResourceProperties: { ServiceToken: string; [Key: string]: any; - } + }; } -type CloudFormationCustomResourceCreateEvent = CloudFormationCustomResourceEventCommon & { +export interface CloudFormationCustomResourceCreateEvent extends CloudFormationCustomResourceEventCommon { RequestType: "Create"; } -type CloudFormationCustomResourceUpdateEvent = CloudFormationCustomResourceEventCommon & { +export interface CloudFormationCustomResourceUpdateEvent extends CloudFormationCustomResourceEventCommon { RequestType: "Update"; PhysicalResourceId: string; OldResourceProperties: { @@ -268,29 +289,29 @@ type CloudFormationCustomResourceUpdateEvent = CloudFormationCustomResourceEvent }; } -type CloudFormationCustomResourceDeleteEvent = CloudFormationCustomResourceEventCommon & { +export interface CloudFormationCustomResourceDeleteEvent extends CloudFormationCustomResourceEventCommon { RequestType: "Delete"; PhysicalResourceId: string; } export type CloudFormationCustomResourceEvent = CloudFormationCustomResourceCreateEvent | CloudFormationCustomResourceUpdateEvent | CloudFormationCustomResourceDeleteEvent; -type CloudFormationCustomResourceResponseCommon = { +export interface CloudFormationCustomResourceResponseCommon { PhysicalResourceId: string; StackId: string; RequestId: string; LogicalResourceId: string; Data?: { [Key: string]: any; - } + }; } -type CloudFormationCustomResourceSuccessResponse = CloudFormationCustomResourceResponseCommon & { +export interface CloudFormationCustomResourceSuccessResponse extends CloudFormationCustomResourceResponseCommon { Status: "SUCCESS"; Reason?: string; } -type CloudFormationCustomResourceFailedResponse = CloudFormationCustomResourceResponseCommon & { +export interface CloudFormationCustomResourceFailedResponse extends CloudFormationCustomResourceResponseCommon { Status: "FAILED"; Reason: string; } @@ -300,7 +321,7 @@ export type CloudFormationCustomResourceResponse = CloudFormationCustomResourceS /** * See https://docs.aws.amazon.com/lambda/latest/dg/eventsources.html#eventsources-scheduled-event */ -interface ScheduledEvent { +export interface ScheduledEvent { account: string; region: string; detail: any; @@ -308,21 +329,21 @@ interface ScheduledEvent { source: string; time: string; id: string; - resources: string[] + resources: string[]; } /** * See http://docs.aws.amazon.com/lambda/latest/dg/eventsources.html#eventsources-cloudwatch-logs */ -interface CloudWatchLogsEvent { +export interface CloudWatchLogsEvent { awslogs: CloudWatchLogsEventData; } -interface CloudWatchLogsEventData { +export interface CloudWatchLogsEventData { data: string; } -interface CloudWatchLogsDecodedData { +export interface CloudWatchLogsDecodedData { owner: string; logGroup: string; logStream: string; @@ -334,17 +355,15 @@ interface CloudWatchLogsDecodedData { /** * See http://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/SubscriptionFilters.html#LambdaFunctionExample */ -interface CloudWatchLogsLogEvent { +export interface CloudWatchLogsLogEvent { id: string; timestamp: number; message: string; } - - // Context // http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html -interface Context { +export interface Context { // Properties callbackWaitsForEmptyEventLoop: boolean; functionName: string; @@ -363,25 +382,23 @@ interface Context { // Functions for compatibility with earlier Node.js Runtime v0.10.42 // For more details see http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-using-old-runtime.html#nodejs-prog-model-oldruntime-context-methods done(error?: Error, result?: any): void; - fail(error: Error): void; - fail(message: string): void; - succeed(message: string): void; - succeed(object: any): void; + fail(error: Error | string): void; + succeed(messageOrObject: any): void; succeed(message: string, object: any): void; } -interface CognitoIdentity { +export interface CognitoIdentity { cognitoIdentityId: string; cognitoIdentityPoolId: string; } -interface ClientContext { +export interface ClientContext { client: ClientContextClient; Custom?: any; env: ClientContextEnv; } -interface ClientContextClient { +export interface ClientContextClient { installationId: string; appTitle: string; appVersionName: string; @@ -389,7 +406,7 @@ interface ClientContextClient { appPackageName: string; } -interface ClientContextEnv { +export interface ClientContextEnv { platformVersion: string; platform: string; make: string; @@ -397,11 +414,11 @@ interface ClientContextEnv { locale: string; } -interface ProxyResult { +export interface ProxyResult { statusCode: number; headers?: { [header: string]: boolean | number | string; - }, + }; body: string; isBase64Encoded?: boolean; } @@ -410,7 +427,7 @@ interface ProxyResult { * API Gateway CustomAuthorizer AuthResponse. * http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output */ -interface AuthResponse { +export interface AuthResponse { principalId: string; policyDocument: PolicyDocument; context?: AuthResponseContext; @@ -420,7 +437,7 @@ interface AuthResponse { * API Gateway CustomAuthorizer AuthResponse.PolicyDocument. * http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output */ -interface PolicyDocument { +export interface PolicyDocument { Version: string; Statement: [Statement]; } @@ -429,7 +446,7 @@ interface PolicyDocument { * API Gateway CustomAuthorizer AuthResponse.PolicyDocument.Statement. * http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output */ -interface Statement { +export interface Statement { Action: string | string[]; Effect: string; Resource: string | string[]; @@ -439,7 +456,7 @@ interface Statement { * API Gateway CustomAuthorizer AuthResponse.PolicyDocument.Statement. * http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output */ -interface AuthResponseContext { +export interface AuthResponseContext { [name: string]: string | number | boolean; } @@ -447,50 +464,50 @@ interface AuthResponseContext { * CloudFront events * http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html */ -type CloudFrontHeaders = { - [name: string]: { - key: string; - value: string; - }[] -}; +export interface CloudFrontHeaders { + [name: string]: Array<{ + key: string; + value: string; + }>; +} -type CloudFrontResponse = { +export interface CloudFrontResponse { status: string; statusDescription: string; headers: CloudFrontHeaders; -}; +} -type CloudFrontRequest = { +export interface CloudFrontRequest { clientIp: string; method: string; uri: string; querystring: string; headers: CloudFrontHeaders; -}; +} -type CloudFrontEvent = { +export interface CloudFrontEvent { config: { distributionId: string; requestId: string; - } + }; } -export type CloudFrontResponseEvent = { - Records: { +export interface CloudFrontResponseEvent { + Records: Array<{ cf: CloudFrontEvent & { request: CloudFrontRequest; response: CloudFrontResponse; } - }[] -}; + }>; +} -export type CloudFrontRequestEvent = { - Records: { +export interface CloudFrontRequestEvent { + Records: Array<{ cf: CloudFrontEvent & { request: CloudFrontRequest; } - }[] -}; + }>; +} /** * AWS Lambda handler function. diff --git a/types/aws-lambda/tslint.json b/types/aws-lambda/tslint.json index a41bf5d19a..bafaae7817 100644 --- a/types/aws-lambda/tslint.json +++ b/types/aws-lambda/tslint.json @@ -1,79 +1,7 @@ { "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 + // TODO + "dt-header": false } } From ba31e6b551988f89dcdc3ddbe4d6724cb1ce7b85 Mon Sep 17 00:00:00 2001 From: maixiu Date: Wed, 24 Jan 2018 19:16:00 +0100 Subject: [PATCH 034/150] add package jquery-sticky (#23162) * add package jquery-sticky * enabled tsconfig options --- types/jquery-sticky/index.d.ts | 82 ++++++++++++++++++++++ types/jquery-sticky/jquery-sticky-tests.ts | 18 +++++ types/jquery-sticky/tsconfig.json | 24 +++++++ types/jquery-sticky/tslint.json | 1 + 4 files changed, 125 insertions(+) create mode 100644 types/jquery-sticky/index.d.ts create mode 100644 types/jquery-sticky/jquery-sticky-tests.ts create mode 100644 types/jquery-sticky/tsconfig.json create mode 100644 types/jquery-sticky/tslint.json diff --git a/types/jquery-sticky/index.d.ts b/types/jquery-sticky/index.d.ts new file mode 100644 index 0000000000..469ebde7a1 --- /dev/null +++ b/types/jquery-sticky/index.d.ts @@ -0,0 +1,82 @@ +// Type definitions for jquery-sticky 1.0 +// Project: https://github.com/garand/sticky +// Definitions by: Matthieu Tabuteau +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +interface JQueryStickyOptions { + /** + * Pixels between the page top and the element's top. + * @default 0 + */ + topSpacing?: number; + + /** + * Pixels between the page bottom and the element's bottom. + * @default 0 + */ + bottomSpacing?: number; + + /** + * CSS class added to the element's wrapper when "sticked". + * @default is-sticky + */ + className?: string; + + /** + * CSS class added to the wrapper. + * @default 'sticky-wrapper' + */ + wrapperClassName?: string; + + /** + * Boolean determining whether the sticky element should be horizontally centered in the page. + * @default false + */ + center?: boolean; + + /** + * Selector of element referenced to set fixed width of "sticky" element. + * @default '' + */ + getWidthFrom?: string; + + /** + * Boolean determining whether width of the "sticky" element should be updated to match the wrapper's width. + * Wrapper is a placeholder for "sticky" element while it is fixed (out of static elements flow), and its width depends on the context and CSS rules. + * Works only as long getWidthForm isn't set. + * @default true + */ + widthFromWrapper?: boolean; + + /** + * Boolean determining whether widths will be recalculated on window resize (using getWidthfrom). + * @default false + */ + responsiveWidth?: boolean; + + /** + * Controls z-index of the sticked element. + * @default inherit + */ + zIndex?: string; +} + +interface JQuery { + /** + * Initializer. options is optional. + */ + sticky(options?: JQueryStickyOptions): JQuery; + + /** + * Recalculates the element's position. + */ + sticky(method: 'update'): JQuery; + + /** + * To unstick an object. + */ + unstick(): JQuery; +} diff --git a/types/jquery-sticky/jquery-sticky-tests.ts b/types/jquery-sticky/jquery-sticky-tests.ts new file mode 100644 index 0000000000..e0e6e69d9c --- /dev/null +++ b/types/jquery-sticky/jquery-sticky-tests.ts @@ -0,0 +1,18 @@ +// initialization +$('#sticker').sticky({ + topSpacing: 12, + bottomSpacing: 12, + className: 'class-name', + wrapperClassName: 'wrapper-class-name', + center: true, + getWidthFrom: '#container', + widthFromWrapper: false, + responsiveWidth: true, + zIndex: '2' +}); + +// update element position +$('#sticker').sticky('update'); + +// unstick +$("#sticker").unstick(); diff --git a/types/jquery-sticky/tsconfig.json b/types/jquery-sticky/tsconfig.json new file mode 100644 index 0000000000..1981e2e74c --- /dev/null +++ b/types/jquery-sticky/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", + "jquery-sticky-tests.ts" + ] +} \ No newline at end of file diff --git a/types/jquery-sticky/tslint.json b/types/jquery-sticky/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/jquery-sticky/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From fa958d347580566fc2831faf1559a9e1d9d8bcef Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Wed, 24 Jan 2018 11:31:27 -0700 Subject: [PATCH 035/150] Ember: delegate `Enumerable` method types to `Array`. (#23130) * Ember: delegate `Enumerable` method types to `Array`. * Ember: drop `NativeArray` overrides. --- types/ember/index.d.ts | 49 ++++++------------------------------------ 1 file changed, 6 insertions(+), 43 deletions(-) diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index 61bdcb9828..5f041b9df6 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -1111,7 +1111,7 @@ declare module 'ember' { * item. This method corresponds to the `forEach()` method defined in * JavaScript 1.6. */ - forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; + forEach: GlobalArray['forEach']; /** * Alias for `mapBy` */ @@ -1127,7 +1127,7 @@ declare module 'ember' { * Maps all of the items in the enumeration to another value, returning * a new array. This method corresponds to `map()` defined in JavaScript 1.6. */ - map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; + map: GlobalArray['map']; /** * Similar to map, this specialized function returns the value of the named * property on all items in the enumeration. @@ -1138,11 +1138,7 @@ declare module 'ember' { * function returns true for. This method corresponds to `filter()` defined in * JavaScript 1.6. */ - filter( - callbackfn: (value: T, index: number, array: T[]) => value is S, - thisArg?: any - ): S[]; - filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): NativeArray; + filter: GlobalArray['filter']; /** * Returns an array with all of the items in the enumeration where the passed * function returns false. This method is the inverse of filter(). @@ -1165,10 +1161,7 @@ declare module 'ember' { * This method works similar to the `filter()` method defined in JavaScript 1.6 * except that it will stop working on the array once a match is found. */ - find( - predicate: (value: T, index: number, obj: T[]) => boolean, - thisArg?: any - ): T | undefined; + find: GlobalArray['find']; /** * Returns the first item with a property matching the passed value. You * can pass an optional second argument with the target value. Otherwise @@ -1179,10 +1172,7 @@ declare module 'ember' { * Returns `true` if the passed function returns true for every item in the * enumeration. This corresponds with the `every()` method in JavaScript 1.6. */ - every( - callbackfn: (value: T, index: number, array: T[]) => boolean, - thisArg?: any - ): boolean; + every: GlobalArray['every']; /** * Returns `true` if the passed property resolves to the value of the second * argument for all items in the enumerable. This method is often simpler/faster @@ -1205,8 +1195,7 @@ declare module 'ember' { * is a useful way to collect a summary value from an enumeration. This * corresponds to the `reduce()` method defined in JavaScript 1.8. */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + reduce: GlobalArray['reduce']; /** * Invokes the named method on every object in the receiver that * implements it. This method corresponds to the implementation in @@ -1616,32 +1605,6 @@ declare module 'ember' { * __Required.__ You must implement this method to apply this mixin. */ length: number; - - // NOTE: some array polyfill methods are re-declared here because their signatures - // differ between typescript versions 2.4 and 2.6. Since we need to compile against - // both, pick the more recent signature and re-declare it here as a tie-breaker. - - /** - * Returns the first item in the array for which the callback returns true. - * This method works similar to the `filter()` method defined in JavaScript 1.6 - * except that it will stop working on the array once a match is found. - */ - find( - predicate: (value: T, index: number, obj: T[]) => boolean, - thisArg?: any - ): T | undefined; - /** - * This will combine the values of the enumerator into a single value. It - * is a useful way to collect a summary value from an enumeration. This - * corresponds to the `reduce()` method defined in JavaScript 1.8. - */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - filter( - callbackfn: (value: T, index: number, array: T[]) => value is S, - thisArg?: any - ): S[]; - filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): Enumerable; } const NativeArray: Mixin>; /** From c531c6fa14b3f71051cfb6e099cd0e9b90fcd754 Mon Sep 17 00:00:00 2001 From: Retsam Date: Wed, 24 Jan 2018 13:32:18 -0500 Subject: [PATCH 036/150] [bluebird] chore: reduce some boilerplate on catch filters (#23152) * Minor spelling fixes * Use CatchFilter util with variant methods of catch --- types/bluebird/index.d.ts | 110 +++++++++++++++++++------------------- 1 file changed, 56 insertions(+), 54 deletions(-) diff --git a/types/bluebird/index.d.ts b/types/bluebird/index.d.ts index b28f821e12..8ad57050f6 100644 --- a/types/bluebird/index.d.ts +++ b/types/bluebird/index.d.ts @@ -47,7 +47,7 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { /** * Promises/A+ `.then()`. Returns a new promise chained from this promise. * - * The new promise will be rejected or resolved dedefer on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise. + * The new promise will be rejected or resolved depending on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise. */ // Based on PromiseLike.then, but returns a Bluebird instance. then(onFulfill?: (value: R) => U | PromiseLike, onReject?: (error: any) => U | PromiseLike): Bluebird; // For simpler signature help. @@ -192,34 +192,34 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { */ tapCatch(onReject: (error?: any) => U | PromiseLike): Bluebird; - tapCatch( - filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | object, - filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | object, - filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | object, - filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | object, - filter5: (new (...args: any[]) => E5) | ((error: any) => boolean) | object, + tapCatch( + filter1: CatchFilter, + filter2: CatchFilter, + filter3: CatchFilter, + filter4: CatchFilter, + filter5: CatchFilter, onReject: (error: E1 | E2 | E3 | E4 | E5) => U | PromiseLike, ): Bluebird; - tapCatch( - filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | object, - filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | object, - filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | object, - filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | object, + tapCatch( + filter1: CatchFilter, + filter2: CatchFilter, + filter3: CatchFilter, + filter4: CatchFilter, onReject: (error: E1 | E2 | E3 | E4) => U | PromiseLike, ): Bluebird; - tapCatch( - filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | object, - filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | object, - filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | object, + tapCatch( + filter1: CatchFilter, + filter2: CatchFilter, + filter3: CatchFilter, onReject: (error: E1 | E2 | E3) => U | PromiseLike, ): Bluebird; - tapCatch( - filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | object, - filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | object, + tapCatch( + filter1: CatchFilter, + filter2: CatchFilter, onReject: (error: E1 | E2) => U | PromiseLike, ): Bluebird; - tapCatch( - filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | object, + tapCatch( + filter1: CatchFilter, onReject: (error: E1) => U | PromiseLike, ): Bluebird; @@ -364,34 +364,35 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { */ catchReturn(value: U): Bluebird; + // No need to be specific about Error types in these overrides, since there's no handler function catchReturn( - filter1: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, - filter2: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, - filter3: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, - filter4: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, - filter5: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, + filter1: CatchFilter, + filter2: CatchFilter, + filter3: CatchFilter, + filter4: CatchFilter, + filter5: CatchFilter, value: U, ): Bluebird; catchReturn( - filter1: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, - filter2: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, - filter3: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, - filter4: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, + filter1: CatchFilter, + filter2: CatchFilter, + filter3: CatchFilter, + filter4: CatchFilter, value: U, ): Bluebird; catchReturn( - filter1: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, - filter2: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, - filter3: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, + filter1: CatchFilter, + filter2: CatchFilter, + filter3: CatchFilter, value: U, ): Bluebird; catchReturn( - filter1: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, - filter2: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, + filter1: CatchFilter, + filter2: CatchFilter, value: U, ): Bluebird; catchReturn( - filter1: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, + filter1: CatchFilter, value: U, ): Bluebird; @@ -407,34 +408,35 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { */ catchThrow(reason: Error): Bluebird; + // No need to be specific about Error types in these overrides, since there's no handler function catchThrow( - filter1: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, - filter2: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, - filter3: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, - filter4: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, - filter5: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, + filter1: CatchFilter, + filter2: CatchFilter, + filter3: CatchFilter, + filter4: CatchFilter, + filter5: CatchFilter, reason: Error, ): Bluebird; catchThrow( - filter1: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, - filter2: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, - filter3: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, - filter4: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, + filter1: CatchFilter, + filter2: CatchFilter, + filter3: CatchFilter, + filter4: CatchFilter, reason: Error, ): Bluebird; catchThrow( - filter1: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, - filter2: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, - filter3: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, + filter1: CatchFilter, + filter2: CatchFilter, + filter3: CatchFilter, reason: Error, ): Bluebird; catchThrow( - filter1: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, - filter2: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, + filter1: CatchFilter, + filter2: CatchFilter, reason: Error, ): Bluebird; catchThrow( - filter1: (new (...args: any[]) => Error) | ((error: any) => boolean) | object, + filter1: CatchFilter, reason: Error, ): Bluebird; @@ -761,7 +763,7 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { static race(values: PromiseLike | R>> | Iterable | R>): Bluebird; /** - * Initiate a competetive race between multiple promises or values (values will become immediately fulfilled promises). + * Initiate a competitive race between multiple promises or values (values will become immediately fulfilled promises). * When `count` amount of promises have been fulfilled, the returned promise is fulfilled with an array that contains the fulfillment values of the winners in order of resolution. * * If too many promises are rejected so that the promise can never become fulfilled, it will be immediately rejected with an array of rejection reasons in the order they were thrown in. @@ -835,7 +837,7 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { * * If the reducer function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration. * - * *The original array is not modified. If no `intialValue` is given and the array doesn't contain at least 2 items, the callback will not be called and `undefined` is returned. + * *The original array is not modified. If no `initialValue` is given and the array doesn't contain at least 2 items, the callback will not be called and `undefined` is returned. * If `initialValue` is given and the array doesn't have at least 1 item, `initialValue` is returned.* */ static reduce( @@ -1053,7 +1055,7 @@ declare namespace Bluebird { * Gives you a callback representation of the `PromiseResolver`. Note that this is not a method but a property. * The callback accepts error object in first argument and success values on the 2nd parameter and the rest, I.E. node js conventions. * - * If the the callback is called with multiple success values, the resolver fullfills its promise with an array of the values. + * If the the callback is called with multiple success values, the resolver fulfills its promise with an array of the values. */ // TODO specify resolver callback callback(err: any, value: R, ...values: R[]): void; From 03859a9372f4d479959b8b736c5d7e9d3d07f2d5 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 24 Jan 2018 10:37:24 -0800 Subject: [PATCH 037/150] Provide options type --- types/paper/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/paper/index.d.ts b/types/paper/index.d.ts index d9582572b4..5bd4315bfd 100644 --- a/types/paper/index.d.ts +++ b/types/paper/index.d.ts @@ -1357,7 +1357,7 @@ declare module paper { * insert: specifies whether the copy should be inserted into the DOM. When set to true, it is inserted above the original. default: true * deep: specifies whether the item’s children should also be cloned — default: true */ - clone(options?: any): Item; + clone(options?: { insert?: boolean, deep?: boolean }): Item; /** * When passed a project, copies the item to the project, or duplicates it within the same project. When passed an item, copies the item into the specified item. From e9a1ce46d011dea86d477a27e16e6694af5955cf Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 24 Jan 2018 10:44:25 -0800 Subject: [PATCH 038/150] Fix tests --- types/rc-tree/rc-tree-tests.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/types/rc-tree/rc-tree-tests.tsx b/types/rc-tree/rc-tree-tests.tsx index 2d5f0426ed..571465978d 100644 --- a/types/rc-tree/rc-tree-tests.tsx +++ b/types/rc-tree/rc-tree-tests.tsx @@ -1,6 +1,5 @@ import * as React from 'react'; import Tree, { TreeNode, SelectData, CheckData } from 'rc-tree'; -import { TreeNode as TreeNodeInterface } from './index'; interface Props { keys: string[]; @@ -45,11 +44,11 @@ export class Demo extends React.Component { console.log('onCheck', checkedKeys, info); } - onDragStart(params: {event: Event, node: TreeNodeInterface}) { + onDragStart(params: {event: Event, node: TreeNode}) { console.log('onDragStart', params.event, params.node); } - OnDragEnterData(params: {event: Event, node: TreeNodeInterface, expandedKeys: string[]}) { + OnDragEnterData(params: {event: Event, node: TreeNode, expandedKeys: string[]}) { console.log('OnDragEnterData', params.event, params.node, params.expandedKeys); } @@ -86,8 +85,8 @@ export class Demo extends React.Component { defaultSelectedKeys={this.state.defaultSelectedKeys} defaultCheckedKeys={this.state.defaultCheckedKeys} onSelect={this.onSelect} onCheck={this.onCheck} - onDragStart={this.onDragStart} OnDragEnter={this.OnDragEnterData} - OnDropData={this.OnDropData} + onDragStart={this.onDragStart} onDragEnter={this.OnDragEnterData} + onDrop={this.OnDropData} > From fb0f306a96639432ccd47534969063ab3e56b426 Mon Sep 17 00:00:00 2001 From: Athenkosi <34708073+Athenkosi-Mase@users.noreply.github.com> Date: Wed, 24 Jan 2018 20:45:42 +0200 Subject: [PATCH 039/150] added :aqb type definitions (#22995) * added :aqb type definitions * added : Type definitions tests changed : Operation interfaces to classes changed : export QB to function and class union * completed : test cases changed : operations classes changed to interfaces added : with return method in replace and update alias added : complete tslints changed : tsconfig strict compilers * 0.0.2 * Considered @weswigham comments changed : package.json version back to 0.01 changed : removed "{}" type for ObjectLiteral to Typescript 2.2 "object" changed : tsconfig comma formatting to standard formatting updated : bumped up Typescript Version number from 2.1 to 2.2 updated : converted "functions" interface to "AQLfunctions" interface updated : changed export to align with the shape the library actually exports. fixed : inconsistent argument names to documentation fixed : enabled all lint rules fixed : toArray function args and return types fixed : all lint issues * fixed : dtslint source url. Capitilized the "M" in microsoft fixed : castString function types to return the correct definitions updated : a few interface class parameters and returns * BinaryOperation * UnaryOperation class extension and parameters * SimpleReference returns * ListLiterals * NAryOperations * RangeExpression * PropertyAccess * Keyword * Identifier * FunctionCall * Definitions * LetExpression * CollectionExpression * CollectWithCountIntoExpression * SortExpression * LimitExpression fixed : castNumber function return fixed : autoCastToken function return * fixed : formatted file to pass linting * changed : used standard comma formatting in tsconfig * changed : removed redundant documentation removed : tsconfig typescript compiler version changed : tsconfig all values to true changed : tsconfig leading comma instead of trailling * formated : tsconfig * removed : @param & @ return documentation --- types/aqb/aqb-tests.ts | 151 ++++++ types/aqb/index.d.ts | 1105 +++++++++++++++++++++++++++++++++++++++ types/aqb/tsconfig.json | 24 + types/aqb/tslint.json | 3 + 4 files changed, 1283 insertions(+) create mode 100644 types/aqb/aqb-tests.ts create mode 100644 types/aqb/index.d.ts create mode 100644 types/aqb/tsconfig.json create mode 100644 types/aqb/tslint.json diff --git a/types/aqb/aqb-tests.ts b/types/aqb/aqb-tests.ts new file mode 100644 index 0000000000..5e186126fe --- /dev/null +++ b/types/aqb/aqb-tests.ts @@ -0,0 +1,151 @@ +import QB = require("aqb"); + +/* + * Most of these tests are taken directly from the examples + * in the aqbjs Github documentation. + * + * https://github.com/arangodb/aqbjs + */ + +/* + * section aqb.js + * https://github.com/arangodb/aqbjs#auto-casting-raw-data + */ +const doc = { + aString: "hello", + aDate: new Date(), + aNumber: 23, + anArray: [1, 2, 3, "potato"] +}; + +QB(doc); +QB.for('x').in('1..5').return('x'); +QB.insert(QB(doc)).into('my_collection'); + +/* + * section aqb.js + * https://github.com/arangodb/aqbjs#aql-types + */ +QB.bool(true); +QB.num("12"); +QB.int("1"); +QB.str(23); +QB.list([ 1 , 2 , 3 , 4 , 5]); +QB.obj({'some.name': 'value'}); +QB.ref("users"); + +/* + * section aqb.js + * https://github.com/arangodb/aqbjs#aql-expressions + */ +QB.range(1 , 5); +QB.get("property"); +QB.ref("user").get("property"); +QB.expr(QB.for('x').in('1..5').return('x').toAQL()); + +/* + * section aqb.js + * https://github.com/arangodb/aqbjs#aql-operations + */ +QB.and("a", "b"); +QB.ref("a").and("b"); +QB.or("a" , "b"); +QB.ref("a").or("b"); +QB.add("a" , "b"); +QB.ref("a").add("b"); +QB.plus("a" , "b"); +QB.ref("a").plus("b"); +QB.sub("a" , "b"); +QB.ref("a").sub("b"); +QB.minus("a" , "b"); +QB.ref("a").minus("b"); +QB.mul("a" , "b"); +QB.ref("a").mul("b"); +QB.times("a" , "b"); +QB.ref("a").times("b"); +QB.div("a" , "b"); +QB.ref("a").div("b"); +QB.mod("a", "b"); +QB.ref("a").mod("b"); +QB.eq("a" , "b"); +QB.ref("a").eq("b"); +QB.neq("a", "b"); +QB.ref("a").neq("b"); +QB.gt("a" , "b"); +QB.ref("a").gt("b"); +QB.gte("a" , "b"); +QB.ref("a").gte("b"); +QB.lt("a" , "b"); +QB.ref("a").lt("b"); +QB.lte("a" , "b"); +QB.ref("a").lte("b"); +QB.in("a" , "b"); +QB.ref("a").in("b"); +QB.not("a"); +QB.ref("a").not(); +QB.notIn("a" , "b"); +QB.ref("a").notIn("b"); +QB.neg("a"); +QB.ref("a").neg(); +QB.if("x" , "y" , "z"); +QB.ref("x").then("y").else("z"); +QB.fn('MY::USER::FUNC')(1, 2, 3); +QB.fn('hello')(); + +/* + * section aqb.js + * https://github.com/arangodb/aqbjs#aql-statements + */ +QB.for('doc').in('my_collection'); +QB.for('doc').in('my_collection').let('foo' , 23); +QB.for('doc').in('my_collection').let('foo' , 23); +// QB.for('doc').in('my_collection').let({a: 1, b: 2, c: 3}); +QB.for('doc').in('my_collection').return('x'); +QB.for('doc').in('my_collection').return({x: 'x'}); +QB.for('doc').in('my_collection').returnDistinct('x'); +QB.for('doc').in('my_collection').filter(QB.eq('a', 'b')); +QB.for('doc').in('my_collection').collectWithCountInto('x'); +QB.for('doc').in('my_collection').collect('x', 'y'); +// QB.for('doc').in('my_collection').collect({x: 'a', y: 'b'}); +QB.for('doc').in('my_collection').collect('x' , 'y').withCountInto('z'); +QB.for('doc').in('my_collection').collect('x' , 'y').into('z').keep('a' , 'b'); +QB.for('doc').in('my_collection').collect('x' , 'y').into('z' , 'Z'); +QB.for('doc').in('my_collection').collect('x' , 'y').into('z'); +QB.for('doc').in('my_collection').collect('x' , 'y').into('z').options('opts'); +QB.for('doc').in('my_collection').collect('x' , 'y').options('opts'); +QB.for('doc').in('my_collection').collect('x' , 'y').keep('a' , 'b'); +QB.for('doc').in('my_collection').collect('x' , 'y').sort('x', 'DESC', 'y', 'ASC'); +QB.for('doc').in('my_collection').collect('x' , 'y').limit(20); +QB.for('doc').in('my_collection').collect('x' , 'y').limit(20 , 20); +QB.for('doc').in('my_collection').remove('x'); +QB.for('doc').in('my_collection').remove('x').in('y'); +QB.for('doc').in('my_collection').remove('x').in('y').returnOld('a'); +QB.for('doc').in('my_collection').remove('x').in('y').options('opts'); +QB.upsert('x').insert('y').replace('z').in('c'); +QB.upsert('x').insert('y').replace('z').in('c').options('opts'); +QB.upsert('x').insert('y').update('z').in('c'); +QB.upsert('x').insert('y').update('z').in('c').options('opts'); +QB.insert('x').into('y'); +QB.insert('x').into('y').options('opts'); +QB.insert('x').into('y').returnNew('z'); +QB.update('x').in('y'); +QB.update('x').into('y'); +QB.update('x').with('y').in('z'); +QB.update('x').with('y').into('z'); +QB.update('x').with('y').into('z').options('opts'); +QB.update('x').in('y').options('opts'); +QB.update('x').with('y').into('z').returnNew('v'); +QB.update('x').with('y').into('z').returnOld('v'); +QB.update('x').in('y').options('opts').returnNew('v'); +QB.update('x').in('y').options('opts').returnOld('v'); + +QB.replace('x').in('y'); +QB.replace('x').into('y'); +QB.replace('x').with('y').in('z'); +QB.replace('x').with('y').into('z'); +QB.replace('x').with('y').into('z').options('opts'); +QB.replace('x').in('y').options('opts'); +QB.replace('x').with('y').into('z').returnNew('v'); +QB.replace('x').with('y').into('z').returnOld('v'); +QB.replace('x').in('y').options('opts').returnNew('v'); +QB.replace('x').in('y').options('opts').returnOld('v'); diff --git a/types/aqb/index.d.ts b/types/aqb/index.d.ts new file mode 100644 index 0000000000..eb529e9c97 --- /dev/null +++ b/types/aqb/index.d.ts @@ -0,0 +1,1105 @@ +// Type definitions for aqbjs 2.1 +// Project: https://github.com/arangodb/aqbjs +// Definitions by: Athenkosi Mase +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 +interface AqlError extends Error { + new(message: string): Error; + name: string; +} +interface Operation extends Expression { + new(): Expression; +} +interface BinaryOperation extends Operation { + new(operator: string, value1: any, value2: any): Operation; + toAQL(): string; + _operator: string; +} +interface UnaryOperation extends Expression { + new(operator: string, value: any): Expression; + toAQL(): string; + _operator: string; +} +interface SimpleReference extends Expression { + new(value: string): Expression; + toAQL(): string; + re: RegExp; + _value: string; +} +interface RawExpression extends Expression { + new(value: any): Expression; + toAQL(): string; +} +interface BooleanLiteral extends Expression { + new(value: any): Expression; + toAQL(): string; + _value: boolean; +} +interface NumberLiteral extends Expression { + new(value: any): Expression; + toAQL(): string; + re: RegExp; +} +interface IntegerLiteral extends Expression { + new(value: any): Expression; + toAQL(): string; + _value: number; +} +interface StringLiteral extends Expression { + new(value: any): Expression; + toAQL(): string; +} +interface ListLiteral extends Expression { + new(...value: any[]): Expression; + toAQL(): string; +} +interface ObjectLiteral extends Expression { + new(value: any): Expression; + toAQL(): string; + _value: object; +} +interface NAryOperation extends Operation { + new(operator: string, values: any[]): Operation; + toAQL(): string; + _operator: string; + _values: Expression[]; +} +interface RangeExpression extends Expression { + new(start: any, end?: any): Expression; + toAQL(): string; + _start: number; + _end: number; + re: RegExp; +} +interface PropertyAccess extends Expression { + new(obj: any, keys: any[]): Expression; + toAQL(): string; + _obj: Expression; + _keys: Expression[]; +} +interface TernaryOperation extends Operation { + new(operator1: string, operator2: string, value1: Expression, value2: any, value3: any): Operation; + toAQL(): string; + _operator1: string; + _operator2: string; +} +interface NullLiteral extends Expression { + new(value: any): Expression; + toAQL(): string; +} +interface Keyword extends Expression { + new(value: any): Expression; + toAQL(): string; + _value: string; + re: RegExp; +} +interface Identifier extends Expression { + new(value: any): Expression; + toAQL(): string; + _value: string; +} +interface FunctionCall extends Expression { + new(functionName: string, ...args: any[]): Expression; + toAQL(): string; + _re: RegExp; + _functionName: string; + _args: any[]; +} +interface ForExpression extends PartialStatement { + new(prev: PartialStatement, varname: any, expr: any): PartialStatement; + toAQL(): string; + _varname: Identifier; +} +interface FilterExpression extends PartialStatement { + new(prev: PartialStatement, expr: any): PartialStatement; + toAQL(): string; +} +interface Definitions { + new(...dfns: any[]): any; + toAQL(): string; + _dfns: any[]; +} +interface LetExpression extends PartialStatement { + new(prev: PartialStatement, ...dfns: any[]): PartialStatement; + toAQL(): string; + _prev: PartialStatement; + _dfns: Definitions; +} +interface CollectExpression extends PartialStatement { + new(prev: PartialStatement, dfns: any[], varname: any, intoExpr: any, keepNames: any[], options: any): PartialStatement; + toAQL(): string; + into(...newVarname: any[]): CollectExpression; + keep(...x: any[]): any; + _keep: Identifier[]; + options(newOpts: any): any; + _options: ObjectLiteral; + withCountInto(newVarname: any): CollectWithCountIntoExpression; +} +interface CollectWithCountIntoExpression extends PartialStatement { + new(prev: PartialStatement, dfns: any[], varname: any, options: any): PartialStatement; + toAQL(): string; + options(newOpts: any): any; +} +interface SortExpression extends PartialStatement { + new(prev: PartialStatement, ...args: any[]): PartialStatement; + toAQL(): string; + keywords: string[]; + _args: Keyword[]; +} +interface LimitExpression extends PartialStatement { + new(prev: PartialStatement, offset: any, count?: any): PartialStatement; + toAQL(): string; +} +interface ReturnExpression extends Expression { + new(prev: LetExpression, value: any, distinct: boolean): Expression; + toAQL(): string; + _prev: LetExpression; + _distinct: boolean; +} +interface RemoveExpression extends PartialStatement { + new(prev: PartialStatement, expr: any, collection: any, options: any): PartialStatement; + returnOld(x: any): ReturnExpression; + toAQL(): string; + options(newOpts: any): RemoveExpression; +} +interface UpsertExpression extends PartialStatement { + new(prev: PartialStatement, upsertExpr: any, insertExpr: any, replace: boolean, updateOrReplaceExpr: any, collection: any, options: any): PartialStatement; + returnNew(x: any): ReturnExpression; + returnOld(x: any): ReturnExpression; + toAQL(): string; + _updateOrReplace: string; + options(newOpts: any): UpsertExpression; +} +interface InsertExpression extends PartialStatement { + new(prev: PartialStatement, expr: any, collection: any, options: any): PartialStatement; + returnNew(x: any): ReturnExpression; + toAQL(): string; + options(newOpts: any): InsertExpression; +} +interface UpdateExpression extends PartialStatement { + new(prev: PartialStatement, expr: any, withExpr: any, collection: any, options: any): PartialStatement; + returnNew(x: any): ReturnExpression; + returnOld(x: any): ReturnExpression; + toAQL(): string; + options(newOpts: any): UpdateExpression; +} +interface ReplaceExpression extends PartialStatement { + new(prev: PartialStatement, expr: any, withExpr: any, collection: any, options: any): PartialStatement; + returnNew(x: any): ReturnExpression; + returnOld(x: any): ReturnExpression; + toAQL(): string; + options(newOpts: any): ReplaceExpression; +} +interface Expression extends PartialStatement { + /** + * Equality + * + * Creates an equality comparison from the given values. + * + * qb.eq(a, b): (a == b) + * OR: + * qbValue.eq(b): (a == b) + * + * If the values are not already values, they will be converted automatically. + * + * Examples + * + * qb.ref('x').eq('y'): (x == y) + * + * + */ + eq(x: any, y?: any): BinaryOperation; + /** + * Inequality + * + * Creates an inequality comparison from the given values. + * + * qb.neq(a, b): (a != b) + * OR: + * qbValue.neq(b): (a != b) + * + * If the values are not already values, they will be converted automatically. + * + * Examples + * + * qb.ref('x').neq('y'): (x != y) + * + */ + neq(x: any, y?: any): BinaryOperation; + /** + * Greater Than + * + * Creates a greater-than comparison from the given values. + * + * qb.gt(a, b): (a > b) + * OR + * qbValue.gt(b): (a > b) + * + * If the values are not already values, they will be converted automatically. + * + * Examples + * + * qb.ref('x').gt('y'): (x > y) + * + * + */ + gt(x: any, y?: any): BinaryOperation; + /** + * Greater Than Or Equal To + * + * Creates a greater-than-or-equal-to comparison from the given values. + * + * qb.gte(a, b): (a >= b) + * OR + * qbValue.gte(b): (a >= b) + * + * If the values are not already values, they will be converted automatically. + * + * Examples + * + * qb.ref('x').gte('y'): (x >= y) + * + * + */ + gte(x: any, y?: any): BinaryOperation; + /** + * Less Than + * + * Creates a less-than comparison from the given values. + * + * qb.lt(a, b): (a < b) + * OR + * qbValue.lt(b): (a < b) + * + * If the values are not already values, they will be converted automatically. + * + * Examples + * + * qb.ref('x').lt('y'): (x < y) + * + */ + lt(x: any, y?: any): BinaryOperation; + /** + * Less Than Or Equal To + * + * Creates a less-than-or-equal-to comparison from the given values. + * + * qb.lte(a, b): (a <= b) + * OR + * qbValue.lte(b): (a <= b) + * + * If the values are not already values, they will be converted automatically. + * + * Examples + * + * qb.ref('x').lte('y'): (x <= y) + * + */ + lte(x: any, y?: any): BinaryOperation; + /** + * Contains + * + * Creates an "in" comparison from the given values. + * + * qb.in(a, b): (a in b) + * OR: + * qbValue.in(b): (a in b) + * + * If the values are not already values, they will be converted automatically. + * + * Examples + * qb.ref('x').in('y'): (x in y) + */ + in(...x: any[]): BinaryOperation; + /** + * Negation + * + * Creates a negation from the given value. + * + * qb.not(a) => !(a) + * OR: + * qbValue.not() => !(a) + * + * If the value is not already an value, it will be converted automatically. + * + * Examples + * + * qb.not('x') => !(x) + */ + not(x?: any): UnaryOperation; + /** + * Negative Value + * + * Creates a negative value expression from the given value. + * + * qb.neg(a) => -(a) + * OR: + * qbValue.neg() => -(a) + * + * If the value is not already an AQL value, it will be converted automatically. + * + * Examples + * + * qb.neg('x') => -(x) + */ + neg(x?: any): UnaryOperation; + /** + * Negated Contains + * + * Creates a "not in" comparison from the given values. + * + * qb.notIn(a, b): (a not in b) + * OR: + * qbValue.notIn(b): (a not in b) + * + * If the values are not already values, they will be converted automatically. + * + * Examples + * + * qb.ref('x').notIn('y'): (x not in y) + */ + notIn(...x: any[]): BinaryOperation; + /** + * Boolean And + * + * Creates an "and" operation from the given values. + * + * qb.and(a, b) =>(a && b) + * OR: + * aqlValue.and(b) =>(a && b) + * + * If the values are not already AQL values, they will be converted automatically. + * This declare function can take any number of arguments. + * + * Examples + * + * qb.ref('x').and('y') =>(x && y) + */ + and(...x: any[]): NAryOperation; + /** + * Boolean Or + * + * Creates an "or" operation from the given values. + * + * qb.or(a, b): (a || b) + * OR: + * Value.or(b): (a || b) + * + * If the values are not already values, they will be converted automatically. + * + * This declare function can take any number of arguments. + */ + or(...x: any[]): NAryOperation; + /** + * Addition + * + * Creates an addition operation from the given values. + * + * qb.add(a, b): (a + b) + * OR: + * Value.add(b): (a + b) + * + * If the values are not already values, they will be converted automatically. + * This declare function can take any number of arguments. + * + * Alias: qb.plus(a, b) + * + * Examples + * + * qb.ref('x').plus('y'): (x + y) + */ + add(...x: any[]): NAryOperation; + plus(...x: any[]): NAryOperation; + /** + * Subtraction + * + * Creates a subtraction operation from the given values. + * + * qb.sub(a, b): (a - b) + * OR: + * Value.sub(b): (a - b) + * + * If the values are not already values, they will be converted automatically. + * This declare function can take any number of arguments. + * + * Alias: qb.minus(a, b) + * + * Examples + * + * qb.ref('x').minus('y'): (x - y) + */ + sub(...x: any[]): NAryOperation; + minus(...x: any[]): NAryOperation; + /** + * Multiplication + * + * Creates a multiplication operation from the given values. + * + * qb.mul(a, b): (a * b) + * OR: + * Value.mul(b): (a * b) + * + * If the values are not already values, they will be converted automatically. + * This declare function can take any number of arguments. + * + * Alias: qb.times(a, b) + * + * Examples + * + * qb.ref('x').times('y'): (x * y) + */ + mul(...x: any[]): NAryOperation; + times(...x: any[]): NAryOperation; + /** + * Division + * + * Creates a division operation from the given values. + * + * qb.div(a, b): (a / b) + * OR: + * Value.div(b): (a / b) + * + * If the values are not already values, they will be converted automatically. + * This declare function can take any number of arguments. + * + * Examples + * qb.ref('x').div('y'): (x / y) + */ + div(...x: any[]): NAryOperation; + /** + * Modulus + * + * Creates a modulus operation from the given values. + * + * qb.mod(a, b): (a % b) + * OR: + * Value.mod(b): (a % b) + * + * If the values are not already values, they will be converted automatically. + * This declare function can take any number of arguments. + * + * Examples + * qb.ref('x').mod('y'): (x % y) + */ + mod(...x: any[]): NAryOperation; + /** + * Range + * + * Creates a range expression from the given values. + * + * qb.range(value1, value2): value1..value2 + * + * OR: + * + * Value.range(value2): value1..value2 + * + * If the values are not already values, they will be converted automatically. + * Alias: qb.to(value1, value2) + * + * Examples + * + * qb(2).to(5): 2..5 + * + */ + range(...value: number[]): RangeExpression; + /** + * Property Access + * + * Creates a property access expression from the given values. + * + * qb.get(obj, key): obj[key] + * OR: + * Obj.get(key): obj[key] + * + * If the values are not already values, they will be converted automatically. + * + * Examples + * qb.ref('x').get('y'): x[y]` + * + */ + get(value: any): PropertyAccess; + /** + * Ternary(if / else) + * + * Creates a ternary expression from the given values. + * + * qb.if(condition, thenDo, elseDo): (condition ? thenDo: elseDo) + * OR: + * qbValue.then(thenDo).else(elseDo): (condition ? thenDo: elseDo) + * + * If the values are not already values, they will be converted automatically. + * + * Alias: qbValue.then(thenDo).otherwise(elseDo) + * + * Examples + * qb.ref('x').then('y').else('z'): (x ? y: z) + * + */ + then(value: any): ThenRet; +} +interface ThenRet { + else(y: any): TernaryOperation; + else_: TernaryOperation; + otherwise(y: any): TernaryOperation; +} +interface ForRet { + in(expr: any): ForExpression; + in_: ForRet["in"]; +} +/** + * PartialStatement + * + * In addition to the methods documented above, the query builder provides all methods of PartialStatement objects. + * Statement objects have a method toAQL() which returns their representation as a JavaScript string. + * + * Examples + * + * qb.for('doc').in('my_collection').return('doc._key').toAQL() + * // => FOR doc IN my_collection RETURN doc._key + */ +interface PartialStatement { + /** + * FOR expression IN collection + * + * PartialStatement::for(expression).in(collection): PartialStatement + * + * Examples + * + * _.for('doc').in('my_collection'): FOR doc IN my_collection + * + */ + for(varname: any): ForRet; + /** + * FILTER expression + * + * PartialStatement::filter(expression): PartialStatement + * + * Examples + * + * _.filter(qb.eq('a', 'b')): FILTER a == b + * + */ + filter(varname: any): FilterExpression; + /** + * LET varname = expression + * + * PartialStatement::let(varname, expression): PartialStatement + * + * Examples + * + * _.let('foo', 23): LET foo = 23 + * + * LET var1 = expr1, var2 = expr2, …, varn = exprn + * + * PartialStatement::let(definitions): PartialStatement + * + */ + let(varname: {}, expr: any): LetExpression; + /** + * COLLECT + * + * COLLECT WITH COUNT INTO varname + * PartialStatement::collectWithCountInto(varname): CollectExpression + * + * Examples + * + * _.collectWithCountInto('x'): COLLECT WITH COUNT INTO x COLLECT varname = expression + * PartialStatement::collect(varname, expression): CollectExpression + * + * _.collect('x', 'y'): COLLECT x = y COLLECT var1 = expr1, var2 = expr2, …, varn = exprn + * PartialStatement::collect(definitions): CollectExpression + * + * _.collect({x: 'a', y: 'b'}): COLLECT x = a, y = b WITH COUNT INTO varname + * CollectExpression::withCountInto(varname): CollectExpression + * + * _.withCountInto('x'): WITH COUNT INTO x INTO varname + * CollectExpression::into(varname): CollectExpression + * + * _.into('z'): INTO z KEEP ...vars + * CollectExpression::keep(...vars): CollectExpression + * + * _.into('z').keep('a', 'b'): INTO z KEEP a, b INTO varname = expression + * CollectExpression::into(varname, expression): CollectExpression + * + * _.into('x', 'y'): INTO x = y OPTIONS options + * CollectExpression::options(options): CollectExpression + * + * _.options('opts'): OPTIONS opts + * + */ + collect(varname: any, expr: any): CollectExpression; + /** + * COLLECT + * + * COLLECT WITH COUNT INTO varname + * PartialStatement::collectWithCountInto(varname): CollectExpression + * + * Examples + * + * _.collectWithCountInto('x'): COLLECT WITH COUNT INTO x COLLECT varname = expression + * PartialStatement::collect(varname, expression): CollectExpression + * + * _.collect('x', 'y'): COLLECT x = y COLLECT var1 = expr1, var2 = expr2, …, varn = exprn + * PartialStatement::collect(definitions): CollectExpression + * + * _.collect({x: 'a', y: 'b'}): COLLECT x = a, y = b WITH COUNT INTO varname + * CollectExpression::withCountInto(varname): CollectExpression + * + * _.withCountInto('x'): WITH COUNT INTO x INTO varname + * CollectExpression::into(varname): CollectExpression + * + * _.into('z'): INTO z KEEP ...vars + * CollectExpression::keep(...vars): CollectExpression + * + * _.into('z').keep('a', 'b'): INTO z KEEP a, b INTO varname = expression + * CollectExpression::into(varname, expression): CollectExpression + * + * _.into('x', 'y'): INTO x = y OPTIONS options + * CollectExpression::options(options): CollectExpression + * + * _.options('opts'): OPTIONS opts + * + */ + collectWithCountInto(varname: any): CollectWithCountIntoExpression; + /** + * SORT ...args + * + * PartialStatement::sort(...args): PartialStatement + * + * Examples + * + * _.sort('x', 'DESC', 'y', 'ASC'): SORT x DESC, y ASC + * + */ + sort(...args: any[]): SortExpression; + /** + * LIMIT offset, count + * + * PartialStatement::limit([offset,] count): PartialStatement + * + * Examples + * + * _.limit(20): LIMIT 20 + * + * _.limit(20, 20): LIMIT 20, 20 + * + */ + limit(offset: any, count?: any): LimitExpression; + /** + * RETURN expression + * + * PartialStatement::return(expression): ReturnExpression + * + * Examples + * + * _.return('x'): RETURN x + * _.return({x: 'x'}): RETURN {x: x} + * + */ + return(x: any): ReturnExpression; + /** + * RETURN DISTINCT expression + * + * PartialStatement::returnDistinct(expression): ReturnExpression + * + * Examples + * + * _.returnDistinct('x'): RETURN DISTINCT x + * + */ + returnDistinct(x: any): ReturnExpression; + /** + * REMOVE + * + * REMOVE expression IN collection + * PartialStatement::remove(expression).in(collection): RemoveExpression + * + * Alias: remove(expression).into(collection) + * + * Examples + * + * _.remove('x').in('y'): REMOVE x IN y LET varname = OLD RETURN varname + * RemoveExpression::returnOld(varname): ReturnExpression + * + * _.returnOld('z'): LET z = OLD RETURN z OPTIONS options + * RemoveExpression::options(options): RemoveExpression + * + * _.options('opts'): OPTIONS opts + * + */ + remove(expr: any): RemoveRet; + /** + * UPSERT + * + * UPSERT expression1 INSERT expression2 REPLACE expression3 IN collection + * PartialStatement::upsert(expression1).insert(expression2).replace(expression3).in(collection): UpsertExpression + * + * Alias: ….into(collection) + * + * Examples + * + * _.upsert('x').insert('y').replace('z').in('c'): UPSERT x INSERT y REPLACE z IN c + * + * UPSERT expression1 INSERT expression2 UPDATE expression3 IN collection + * PartialStatement::upsert(expression1).insert(expression2).update(expression3).in(collection): UpsertExpression + * + * Alias: ….into(collection) + * + * _.upsert('x').insert('y').update('z').in('c'): UPSERT x INSERT y UPDATE z IN c OPTIONS options + * UpsertExpression::options(options): UpsertExpression + * + * _.options('opts'): OPTIONS opts + * + */ + upsert(expr: any): UpsertRet; + /** + * INSERT + * + * INSERT expression INTO collection + * PartialStatement::insert(expression).into(collection): InsertExpression + * + * Alias: insert(expression).in(collection) + * + * Examples + * + * _.insert('x').into('y'): INSERT x INTO y OPTIONS options + * InsertExpression::options(options): InsertExpression + * + * _.options('opts'): OPTIONS opts LET varname = NEW RETURN varname + * InsertExpression::returnNew(varname): ReturnExpression + * + * _.returnNew('z'): LET z = NEW RETURN z + * + */ + insert(expr: any): InsertRet; + /** + * UPDATE + * + * UPDATE expression IN collection + * PartialStatement::update(expression).in(collection): UpdateExpression + * + * Alias: update(expression).into(collection) + * + * Examples + * + * _.update('x').in('y'): UPDATE x IN y + * + * UPDATE expression1 WITH expression2 IN collection + * PartialStatement::update(expression1).with(expression2).in(collection): UpdateExpression + * + * Alias: update(expression1).with(expression2).into(collection) + * + * _.update('x').with('y').in('z'): UPDATE x WITH y IN z OPTIONS options + * UpdateExpression::options(options): UpdateExpression + * + * _.options('opts'): OPTIONS opts LET varname = NEW RETURN varname + * UpdateExpression::returnNew(varname): ReturnExpression + * + * _.returnNew('z'): LET z = NEW RETURN z LET varname = OLD RETURN varname + * UpdateExpression::returnOld(varname): ReturnExpression + * + * _.returnOld('z'): LET z = OLD RETURN z + * + */ + update(expr: any): UpdateRetWithRet; + /** + * REPLACE + * + * REPLACE expression IN collection + * PartialStatement::replace(expression).in(collection): ReplaceExpression + * + * Alias: replace(expression).into(collection) + * + * Examples + * + * _.replace('x').in('y'): REPLACE x IN y REPLACE expression1 WITH expression2 IN collection + * PartialStatement::replace(expression1).with(expression2).in(collection): ReplaceExpression + * + * Alias: replace(expression1).with(expression2).into(collection) + * + * _.replace('x').with('y').in('z'): REPLACE x WITH y IN z OPTIONS options + * ReplaceExpression::options(options): ReplaceExpression + * + * _.options('opts'): OPTIONS opts LET varname = NEW RETURN varname + * ReplaceExpression::returnOld(varname): ReturnExpression + * + * _.returnNew('z'): LET z = NEW RETURN z LET varname = OLD RETURN varname + * ReplaceExpression::returnNew(varname): ReturnExpression + * + * _.returnOld('z'): LET z = OLD RETURN z + * + */ + replace(expr: any): ReplaceRetWithRet; +} +interface RemoveRet { + into(collection: any): RemoveExpression; + in: RemoveRet["into"]; + in_: RemoveRet["into"]; +} +interface UpsertRet { + insert(insertExpr: any): UpsertRetInsertRet; +} +interface UpsertRetInsertRet { + update(updateOrReplaceExpr: any): UpsertRetInsertRetUpdateRet; + replace: UpsertRetInsertRet["update"]; +} +interface UpsertRetInsertRetUpdateRet { + into(inCollection: any): UpsertExpression; + in: UpsertRetInsertRetUpdateRet["into"]; + in_: UpsertRetInsertRetUpdateRet["into"]; +} +interface InsertRet { + into(collection: any): InsertExpression; + in: InsertRet["into"]; + in_: InsertRet["into"]; +} +interface UpdateRetWithRet { + into(collection: any): UpdateExpression; + in: UpdateRetWithRet["into"]; + in_: UpdateRetWithRet["into"]; +} +interface ReplaceRetWithRet { + into(collection: any): ReplaceExpression; + in: ReplaceRetWithRet["into"]; + in_: ReplaceRetWithRet["into"]; +} +interface RemoveRet { + into(collection: any): RemoveExpression; + in: RemoveRet["into"]; + in_: RemoveRet["into"]; +} +interface UpsertRet { + insert(insertExpr: any): UpsertRetInsertRet; +} +interface UpsertRetInsertRet { + update(updateOrReplaceExpr: any): UpsertRetInsertRetUpdateRet; + replace: UpsertRetInsertRet["update"]; +} +interface UpsertRetInsertRetUpdateRet { + into(inCollection: any): UpsertExpression; + in: UpsertRetInsertRetUpdateRet["into"]; + in_: UpsertRetInsertRetUpdateRet["into"]; +} +interface InsertRet { + into(collection: any): InsertExpression; + in: InsertRet["into"]; + in_: InsertRet["into"]; +} +interface UpdateRetWithRet { + into(collection: any): UpdateExpression; + with(collection: any): UpdateRetWithRet; + in: UpdateRetWithRet["into"]; + in_: UpdateRetWithRet["into"]; +} +interface ReplaceRetWithRet { + into(collection: any): ReplaceExpression; + with(collection: any): ReplaceRetWithRet; + in: ReplaceRetWithRet["into"]; + in_: ReplaceRetWithRet["into"]; +} +declare function toArray(self: Expression, ...args: any[]): any[]; +declare function isQuotedString(str: string): boolean; +declare function wrapAQL(expr: Keyword): string; +declare function isValidNumber(number: number): boolean; +declare function castNumber(number: any): NumberLiteral; +declare function castBoolean(bool: any): BooleanLiteral; +declare function castString(str: any): SimpleReference | Identifier | RangeExpression | StringLiteral | Expression | PartialStatement | NullLiteral; +declare function castObject(obj: any): ObjectLiteral | ListLiteral | Identifier; +declare function autoCastToken(token: any): Expression | PartialStatement | NullLiteral; +/** + * AQLfunctions + * + * If raw JavaScript values are passed to statements, they will be wrapped in a matching declare function automatically. + * JavaScript strings wrapped in quotation marks will be wrapped in strings, all other JavaScript strings will be wrapped as simple references(see ref) + * and throw an Error if they are not well-formed. + */ +interface AQLfunctions extends Expression { + /** + * Boolean + * + * Wraps the given value as an Boolean literal. + * + * qb.bool(value) + * + * If the value is truthy, it will be converted to the Boolean true, otherwise it will be converted to the Boolean false. + * If the value is already an Boolean, its own value will be wrapped instead. + * + */ + bool(value: any): BooleanLiteral; + /** + * Number + * + * Wraps the given value as an Number literal. + * + * qb.num(value) + * + * If the value is not a JavaScript Number, it will be converted first. + * If the value does not represent a finite number, an Error will be thrown. + * If the value is already an Number or Integer, its own value will be wrapped instead. + * + */ + num(value: any): NumberLiteral; + /** + * Integer + * + * Wraps the given value as an Integer literal. + * + * qb.int(value) + * + * If the value is not a JavaScript Number, it will be converted first. + * If the value does not represent a finite integer, an Error will be thrown. + * If the value is already an Number or Integer, its own value will be wrapped instead. + * + */ + int(value: any): IntegerLiteral; + /** + * String + * + * Wraps the given value as an String literal. + * + * qb.str(value) + * + * If the value is not a JavaScript String, it will be converted first. + * If the value is a quoted string, it will be treated as a string literal. + * If the value is an object with a toAQL method, the result of calling that method will be wrapped instead. + * + * Examples + * + * 23 => "23" + * + * "some string" => "some string" + * + * '"some string"' => "\"some string\"" + * + */ + str(value: any): StringLiteral; + /** + * List + * + * Wraps the given value as an List(Array) literal. + * + * qb.list(value) + * + * If the value is not a JavaScript Array, an Error will be thrown. + * If the value is already an List, its own value will be wrapped instead. + * Any list elements that are not already values will be converted automatically. + * + */ + list(value: any[]): ListLiteral; + /** + * Object + * + * Wraps the given value as an Object literal. + * + * qb.obj(value) + * + * If the value is not a JavaScript Object, an Error will be thrown. + * If the value is already an Object, its own value will be wrapped instead. + * Any property values that are not already values will be converted automatically. + * Any keys that are quoted strings will be treated as string literals. + * Any keys that start with the character ":" will be treated as dynamic properties and must be well-formed simple references. + * Any other keys that need escaping will be quoted if necessary. + * If you need to pass in raw JavaScript objects that shouldn't be converted according to these rules, you can use the qb declare function directly instead. + * + * Examples + * + * qb.obj({'some.name': 'value'}): {"some.name": value} + * + * qb.obj({hello: world}): {hello: world} + * + * qb.obj({'"hello"': world}): {"hello": world} + * + * qb.obj({':dynamic': 'props'}): {[dynamic]: props} + * + * qb.obj({': invalid': 'key'}): throws an error(invalid is not a well-formed reference) + * + */ + obj(obj: object): ObjectLiteral; + /** + * Simple Reference + * + * Wraps a given value in an Simple Reference. + * + * qb.ref(value) + * + * If the value is not a JavaScript string or not a well-formed simple reference, an Error will be thrown. + * If the value is an ArangoCollection, its name property will be used instead. + * If the value is already an Simple Reference, its value is wrapped instead. + * + * Examples + * + * Valid values: + * + * foo + * + * foo.bar + * + * foo[*].bar + * + * foo.bar.QUX + * + * _foo._bar._qux + * + * foo1.bar2 + * + * `foo`.bar + * + * foo.`bar` + * + * Invalid values: + * + * 1foo + * + * föö + * + * foo bar + * + * foo[bar] + * + */ + ref(value: string): SimpleReference; + expr(value: any): RawExpression; + /** + * Ternary(if / else) + * + * Creates a ternary expression from the given values. + * + * qb.if(condition, thenDo, elseDo): (condition ? thenDo: elseDo) + * OR: + * qbValue.then(thenDo).else(elseDo): (condition ? thenDo: elseDo) + * + * If the values are not already values, they will be converted automatically. + * + * Alias: qbValue.then(thenDo).otherwise(elseDo) + * + * Examples + * qb.ref('x').then('y').else('z'): (x ? y: z) + * + */ + if(cond: any, then: any, otherwise: any): Expression | number; + /** + * declare Function Call + * + * Creates a functon call for the given name and arguments. + * + * qb.fn(name)(...args) + * + * If the values are not already values, they will be converted automatically. + * For built-in AQLfunctions, methods with the relevant declare function name are already provided by the query builder. + * + * Examples + * + * qb.fn('MY::USER::FUNC')(1, 2, 3): MY::USER::FUNC(1, 2, 3) + * + * qb.fn('hello')(): hello() + * + * qb.RANDOM(): RANDOM() + * + * qb.FLOOR(qb.div(5, 2)): FLOOR((5 / 2)) + * + */ + fn(functionName: string): (...arity: any[]) => FunctionCall; +} +type QBfunc = (obj: any) => AQLfunctions; +declare const QB: AQLfunctions & QBfunc; +export = QB; diff --git a/types/aqb/tsconfig.json b/types/aqb/tsconfig.json new file mode 100644 index 0000000000..44cb0d912f --- /dev/null +++ b/types/aqb/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "es6", + "module": "commonjs", + "lib": [ + "es2015" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "aqb-tests.ts" + ] +} \ No newline at end of file diff --git a/types/aqb/tslint.json b/types/aqb/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/aqb/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From 3460f253290e519e9f8d29a1623f32a453daca3b Mon Sep 17 00:00:00 2001 From: craigkovatch Date: Wed, 24 Jan 2018 11:00:17 -0800 Subject: [PATCH 040/150] Add all WAI-ARIA 1.1 attributes to React HTMLAttributes (#22582) * Add WAI-ARIA 1.1 attributes to React typings * Fix linting errors * Add 'true' and 'false' options to boolean attributes, remove incorrect 'undefined' options * Add tests * Revert incorrect use of $ExpectError --- types/react/index.d.ts | 183 ++++++++++++++++++++++++++++++++++ types/react/test/index.ts | 6 +- types/react/test/tsx.tsx | 10 ++ types/react/v15/index.d.ts | 183 ++++++++++++++++++++++++++++++++++ types/react/v15/test/index.ts | 6 +- types/react/v15/test/tsx.tsx | 10 ++ 6 files changed, 396 insertions(+), 2 deletions(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index 42abd8d45c..d7ea8d2b8b 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -2498,6 +2498,189 @@ declare namespace React { unselectable?: boolean; } + // All the WAI-ARIA 1.1 attributes from https://www.w3.org/TR/wai-aria-1.1/ + interface HTMLAttributes extends DOMAttributes { + /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */ + 'aria-activedescendant'?: string; + /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute. */ + 'aria-atomic'?: boolean | 'false' | 'true'; + /** + * Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be + * presented if they are made. + */ + 'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both'; + /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user. */ + 'aria-busy'?: boolean | 'false' | 'true'; + /** + * Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. + * @see aria-pressed @see aria-selected. + */ + 'aria-checked'?: boolean | 'false' | 'mixed' | 'true'; + /** + * Defines the total number of columns in a table, grid, or treegrid. + * @see aria-colindex. + */ + 'aria-colcount'?: number; + /** + * Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid. + * @see aria-colcount @see aria-colspan. + */ + 'aria-colindex'?: number; + /** + * Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid. + * @see aria-colindex @see aria-rowspan. + */ + 'aria-colspan'?: number; + /** Indicates the element that represents the current item within a container or set of related elements. */ + 'aria-current'?: boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time'; + /** + * Identifies the element (or elements) that describes the object. + * @see aria-labelledby + */ + 'aria-describedby'?: string; + /** + * Identifies the element that provides a detailed, extended description for the object. + * @see aria-describedby. + */ + 'aria-details'?: string; + /** + * Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. + * @see aria-hidden @see aria-readonly. + */ + 'aria-disabled'?: boolean | 'false' | 'true'; + /** + * Indicates what functions can be performed when a dragged object is released on the drop target. + * @deprecated in ARIA 1.1 + */ + 'aria-dropeffect'?: 'none' | 'copy' | 'execute' | 'link' | 'move' | 'popup'; + /** + * Identifies the element that provides an error message for the object. + * @see aria-invalid @see aria-describedby. + */ + 'aria-errormessage'?: string; + /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */ + 'aria-expanded'?: boolean | 'false' | 'true'; + /** + * Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, + * allows assistive technology to override the general default of reading in document source order. + */ + 'aria-flowto'?: string; + /** + * Indicates an element's "grabbed" state in a drag-and-drop operation. + * @deprecated in ARIA 1.1 + */ + 'aria-grabbed'?: boolean | 'false' | 'true'; + /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. */ + 'aria-haspopup'?: boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'; + /** + * Indicates whether the element is exposed to an accessibility API. + * @see aria-disabled. + */ + 'aria-hidden'?: boolean | 'false' | 'true'; + /** + * Indicates the entered value does not conform to the format expected by the application. + * @see aria-errormessage. + */ + 'aria-invalid'?: boolean | 'false' | 'true' | 'grammar' | 'spelling'; + /** Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. */ + 'aria-keyshortcuts'?: string; + /** + * Defines a string value that labels the current element. + * @see aria-labelledby. + */ + 'aria-label'?: string; + /** + * Identifies the element (or elements) that labels the current element. + * @see aria-describedby. + */ + 'aria-labelledby'?: string; + /** Defines the hierarchical level of an element within a structure. */ + 'aria-level'?: number; + /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region. */ + 'aria-live'?: 'off' | 'assertive' | 'polite'; + /** Indicates whether an element is modal when displayed. */ + 'aria-modal'?: boolean | 'false' | 'true'; + /** Indicates whether a text box accepts multiple lines of input or only a single line. */ + 'aria-multiline'?: boolean | 'false' | 'true'; + /** Indicates that the user may select more than one item from the current selectable descendants. */ + 'aria-multiselectable'?: boolean | 'false' | 'true'; + /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */ + 'aria-orientation'?: 'horizontal' | 'vertical'; + /** + * Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship + * between DOM elements where the DOM hierarchy cannot be used to represent the relationship. + * @see aria-controls. + */ + 'aria-owns'?: string; + /** + * Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. + * A hint could be a sample value or a brief description of the expected format. + */ + 'aria-placeholder'?: string; + /** + * Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. + * @see aria-setsize. + */ + 'aria-posinset'?: number; + /** + * Indicates the current "pressed" state of toggle buttons. + * @see aria-checked @see aria-selected. + */ + 'aria-pressed'?: boolean | 'false' | 'mixed' | 'true'; + /** + * Indicates that the element is not editable, but is otherwise operable. + * @see aria-disabled. + */ + 'aria-readonly'?: boolean | 'false' | 'true'; + /** + * Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. + * @see aria-atomic. + */ + 'aria-relevant'?: 'additions' | 'additions text' | 'all' | 'removals' | 'text'; + /** Indicates that user input is required on the element before a form may be submitted. */ + 'aria-required'?: boolean | 'false' | 'true'; + /** Defines a human-readable, author-localized description for the role of an element. */ + 'aria-roledescription'?: string; + /** + * Defines the total number of rows in a table, grid, or treegrid. + * @see aria-rowindex. + */ + 'aria-rowcount'?: number; + /** + * Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid. + * @see aria-rowcount @see aria-rowspan. + */ + 'aria-rowindex'?: number; + /** + * Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid. + * @see aria-rowindex @see aria-colspan. + */ + 'aria-rowspan'?: number; + /** + * Indicates the current "selected" state of various widgets. + * @see aria-checked @see aria-pressed. + */ + 'aria-selected'?: boolean | 'false' | 'true'; + /** + * Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. + * @see aria-posinset. + */ + 'aria-setsize'?: number; + /** Indicates if items in a table or grid are sorted in ascending or descending order. */ + 'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other'; + /** Defines the maximum allowed value for a range widget. */ + 'aria-valuemax'?: number; + /** Defines the minimum allowed value for a range widget. */ + 'aria-valuemin'?: number; + /** + * Defines the current value for a range widget. + * @see aria-valuetext. + */ + 'aria-valuenow'?: number; + /** Defines the human readable text alternative of aria-valuenow for a range widget. */ + 'aria-valuetext'?: string; + } + interface AllHTMLAttributes extends HTMLAttributes { // Standard HTML Attributes accept?: string; diff --git a/types/react/test/index.ts b/types/react/test/index.ts index 16141fabb4..d767de4487 100644 --- a/types/react/test/index.ts +++ b/types/react/test/index.ts @@ -307,7 +307,11 @@ const htmlAttr: React.HTMLProps = { }, dangerouslySetInnerHTML: { __html: "STRONG" - } + }, + 'aria-atomic': false, + 'aria-checked': 'true', + 'aria-colcount': 7, + 'aria-label': 'test' }; DOM.div(htmlAttr); DOM.span(htmlAttr); diff --git a/types/react/test/tsx.tsx b/types/react/test/tsx.tsx index 38d902c387..bc48add9a4 100644 --- a/types/react/test/tsx.tsx +++ b/types/react/test/tsx.tsx @@ -41,6 +41,16 @@ StatelessComponent2.defaultProps = { foo
; +// WAI-ARIA 1.1 Attributes +
+ bar +
; + interface Props { hello: string; } diff --git a/types/react/v15/index.d.ts b/types/react/v15/index.d.ts index 753ae4550e..96c0b3af7e 100644 --- a/types/react/v15/index.d.ts +++ b/types/react/v15/index.d.ts @@ -2448,6 +2448,189 @@ declare namespace React { unselectable?: boolean; } + // All the WAI-ARIA 1.1 attributes from https://www.w3.org/TR/wai-aria-1.1/ + interface HTMLAttributes extends DOMAttributes { + /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */ + 'aria-activedescendant'?: string; + /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute. */ + 'aria-atomic'?: boolean | 'false' | 'true'; + /** + * Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be + * presented if they are made. + */ + 'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both'; + /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user. */ + 'aria-busy'?: boolean | 'false' | 'true'; + /** + * Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. + * @see aria-pressed @see aria-selected. + */ + 'aria-checked'?: boolean | 'false' | 'mixed' | 'true'; + /** + * Defines the total number of columns in a table, grid, or treegrid. + * @see aria-colindex. + */ + 'aria-colcount'?: number; + /** + * Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid. + * @see aria-colcount @see aria-colspan. + */ + 'aria-colindex'?: number; + /** + * Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid. + * @see aria-colindex @see aria-rowspan. + */ + 'aria-colspan'?: number; + /** Indicates the element that represents the current item within a container or set of related elements. */ + 'aria-current'?: boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time'; + /** + * Identifies the element (or elements) that describes the object. + * @see aria-labelledby + */ + 'aria-describedby'?: string; + /** + * Identifies the element that provides a detailed, extended description for the object. + * @see aria-describedby. + */ + 'aria-details'?: string; + /** + * Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. + * @see aria-hidden @see aria-readonly. + */ + 'aria-disabled'?: boolean | 'false' | 'true'; + /** + * Indicates what functions can be performed when a dragged object is released on the drop target. + * @deprecated in ARIA 1.1 + */ + 'aria-dropeffect'?: 'none' | 'copy' | 'execute' | 'link' | 'move' | 'popup'; + /** + * Identifies the element that provides an error message for the object. + * @see aria-invalid @see aria-describedby. + */ + 'aria-errormessage'?: string; + /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */ + 'aria-expanded'?: boolean | 'false' | 'true'; + /** + * Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, + * allows assistive technology to override the general default of reading in document source order. + */ + 'aria-flowto'?: string; + /** + * Indicates an element's "grabbed" state in a drag-and-drop operation. + * @deprecated in ARIA 1.1 + */ + 'aria-grabbed'?: boolean | 'false' | 'true'; + /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. */ + 'aria-haspopup'?: boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'; + /** + * Indicates whether the element is exposed to an accessibility API. + * @see aria-disabled. + */ + 'aria-hidden'?: boolean | 'false' | 'true'; + /** + * Indicates the entered value does not conform to the format expected by the application. + * @see aria-errormessage. + */ + 'aria-invalid'?: boolean | 'false' | 'true' | 'grammar' | 'spelling'; + /** Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. */ + 'aria-keyshortcuts'?: string; + /** + * Defines a string value that labels the current element. + * @see aria-labelledby. + */ + 'aria-label'?: string; + /** + * Identifies the element (or elements) that labels the current element. + * @see aria-describedby. + */ + 'aria-labelledby'?: string; + /** Defines the hierarchical level of an element within a structure. */ + 'aria-level'?: number; + /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region. */ + 'aria-live'?: 'off' | 'assertive' | 'polite'; + /** Indicates whether an element is modal when displayed. */ + 'aria-modal'?: boolean | 'false' | 'true'; + /** Indicates whether a text box accepts multiple lines of input or only a single line. */ + 'aria-multiline'?: boolean | 'false' | 'true'; + /** Indicates that the user may select more than one item from the current selectable descendants. */ + 'aria-multiselectable'?: boolean | 'false' | 'true'; + /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */ + 'aria-orientation'?: 'horizontal' | 'vertical'; + /** + * Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship + * between DOM elements where the DOM hierarchy cannot be used to represent the relationship. + * @see aria-controls. + */ + 'aria-owns'?: string; + /** + * Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. + * A hint could be a sample value or a brief description of the expected format. + */ + 'aria-placeholder'?: string; + /** + * Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. + * @see aria-setsize. + */ + 'aria-posinset'?: number; + /** + * Indicates the current "pressed" state of toggle buttons. + * @see aria-checked @see aria-selected. + */ + 'aria-pressed'?: boolean | 'false' | 'mixed' | 'true'; + /** + * Indicates that the element is not editable, but is otherwise operable. + * @see aria-disabled. + */ + 'aria-readonly'?: boolean | 'false' | 'true'; + /** + * Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. + * @see aria-atomic. + */ + 'aria-relevant'?: 'additions' | 'additions text' | 'all' | 'removals' | 'text'; + /** Indicates that user input is required on the element before a form may be submitted. */ + 'aria-required'?: boolean | 'false' | 'true'; + /** Defines a human-readable, author-localized description for the role of an element. */ + 'aria-roledescription'?: string; + /** + * Defines the total number of rows in a table, grid, or treegrid. + * @see aria-rowindex. + */ + 'aria-rowcount'?: number; + /** + * Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid. + * @see aria-rowcount @see aria-rowspan. + */ + 'aria-rowindex'?: number; + /** + * Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid. + * @see aria-rowindex @see aria-colspan. + */ + 'aria-rowspan'?: number; + /** + * Indicates the current "selected" state of various widgets. + * @see aria-checked @see aria-pressed. + */ + 'aria-selected'?: boolean | 'false' | 'true'; + /** + * Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. + * @see aria-posinset. + */ + 'aria-setsize'?: number; + /** Indicates if items in a table or grid are sorted in ascending or descending order. */ + 'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other'; + /** Defines the maximum allowed value for a range widget. */ + 'aria-valuemax'?: number; + /** Defines the minimum allowed value for a range widget. */ + 'aria-valuemin'?: number; + /** + * Defines the current value for a range widget. + * @see aria-valuetext. + */ + 'aria-valuenow'?: number; + /** Defines the human readable text alternative of aria-valuenow for a range widget. */ + 'aria-valuetext'?: string; + } + interface AllHTMLAttributes extends HTMLAttributes { // Standard HTML Attributes accept?: string; diff --git a/types/react/v15/test/index.ts b/types/react/v15/test/index.ts index be6d27b659..b0c358b011 100644 --- a/types/react/v15/test/index.ts +++ b/types/react/v15/test/index.ts @@ -346,7 +346,11 @@ const htmlAttr: React.HTMLProps = { }, dangerouslySetInnerHTML: { __html: "STRONG" - } + }, + 'aria-atomic': false, + 'aria-checked': 'true', + 'aria-colcount': 7, + 'aria-label': 'test' }; React.DOM.div(htmlAttr); React.DOM.span(htmlAttr); diff --git a/types/react/v15/test/tsx.tsx b/types/react/v15/test/tsx.tsx index 8afb75d9a8..289a912a3f 100644 --- a/types/react/v15/test/tsx.tsx +++ b/types/react/v15/test/tsx.tsx @@ -41,6 +41,16 @@ StatelessComponent2.defaultProps = { foo ; +// WAI-ARIA 1.1 Attributes +
+ bar +
; + interface Props { hello: string; } From 072552cfab1312aaa7bb122123573d6b0d591a65 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 24 Jan 2018 11:01:32 -0800 Subject: [PATCH 041/150] Fix lint --- types/leaflet.locatecontrol/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/leaflet.locatecontrol/index.d.ts b/types/leaflet.locatecontrol/index.d.ts index 3ed9c7968a..542461cec7 100644 --- a/types/leaflet.locatecontrol/index.d.ts +++ b/types/leaflet.locatecontrol/index.d.ts @@ -12,7 +12,7 @@ declare module 'leaflet' { onAdd(map: Map): HTMLElement; start(): void; stop(): void; - setView():void; + setView(): void; } interface LocateOptions { position?: string; From 0f4014dbf9fc47a372e3471964d12f374772bcfd Mon Sep 17 00:00:00 2001 From: Andy Date: Wed, 24 Jan 2018 11:17:18 -0800 Subject: [PATCH 042/150] lodash: Use module augmentation instead of namespace augmentation to avoid declaring `_` as a global variable (#23164) --- types/lodash/array/chunk.d.ts | 3 ++- types/lodash/array/compact.d.ts | 3 ++- types/lodash/array/concat.d.ts | 3 ++- types/lodash/array/difference.d.ts | 3 ++- types/lodash/array/differenceBy.d.ts | 3 ++- types/lodash/array/differenceWith.d.ts | 3 ++- types/lodash/array/drop.d.ts | 3 ++- types/lodash/array/dropRight.d.ts | 3 ++- types/lodash/array/dropRightWhile.d.ts | 3 ++- types/lodash/array/dropWhile.d.ts | 3 ++- types/lodash/array/fill.d.ts | 3 ++- types/lodash/array/findIndex.d.ts | 3 ++- types/lodash/array/findLastIndex.d.ts | 3 ++- types/lodash/array/first.d.ts | 3 ++- types/lodash/array/flatten.d.ts | 3 ++- types/lodash/array/flattenDeep.d.ts | 3 ++- types/lodash/array/flattenDepth.d.ts | 3 ++- types/lodash/array/fromPairs.d.ts | 3 ++- types/lodash/array/head.d.ts | 3 ++- types/lodash/array/indexOf.d.ts | 3 ++- types/lodash/array/initial.d.ts | 3 ++- types/lodash/array/intersection.d.ts | 3 ++- types/lodash/array/intersectionBy.d.ts | 3 ++- types/lodash/array/intersectionWith.d.ts | 3 ++- types/lodash/array/join.d.ts | 3 ++- types/lodash/array/last.d.ts | 3 ++- types/lodash/array/lastIndexOf.d.ts | 3 ++- types/lodash/array/nth.d.ts | 3 ++- types/lodash/array/pull.d.ts | 3 ++- types/lodash/array/pullAll.d.ts | 3 ++- types/lodash/array/pullAllBy.d.ts | 3 ++- types/lodash/array/pullAllWith.d.ts | 3 ++- types/lodash/array/pullAt.d.ts | 3 ++- types/lodash/array/remove.d.ts | 3 ++- types/lodash/array/reverse.d.ts | 3 ++- types/lodash/array/slice.d.ts | 3 ++- types/lodash/array/sortedIndex.d.ts | 3 ++- types/lodash/array/sortedIndexBy.d.ts | 3 ++- types/lodash/array/sortedIndexOf.d.ts | 3 ++- types/lodash/array/sortedLastIndex.d.ts | 3 ++- types/lodash/array/sortedLastIndexBy.d.ts | 3 ++- types/lodash/array/sortedLastIndexOf.d.ts | 3 ++- types/lodash/array/sortedUniq.d.ts | 3 ++- types/lodash/array/sortedUniqBy.d.ts | 3 ++- types/lodash/array/tail.d.ts | 3 ++- types/lodash/array/take.d.ts | 3 ++- types/lodash/array/takeRight.d.ts | 3 ++- types/lodash/array/takeRightWhile.d.ts | 3 ++- types/lodash/array/takeWhile.d.ts | 3 ++- types/lodash/array/union.d.ts | 3 ++- types/lodash/array/unionBy.d.ts | 3 ++- types/lodash/array/unionWith.d.ts | 3 ++- types/lodash/array/uniq.d.ts | 3 ++- types/lodash/array/uniqBy.d.ts | 3 ++- types/lodash/array/uniqWith.d.ts | 3 ++- types/lodash/array/unzip.d.ts | 3 ++- types/lodash/array/unzipWith.d.ts | 3 ++- types/lodash/array/without.d.ts | 3 ++- types/lodash/array/xor.d.ts | 3 ++- types/lodash/array/xorBy.d.ts | 3 ++- types/lodash/array/xorWith.d.ts | 3 ++- types/lodash/array/zip.d.ts | 3 ++- types/lodash/array/zipObject.d.ts | 3 ++- types/lodash/array/zipObjectDeep.d.ts | 3 ++- types/lodash/array/zipWith.d.ts | 3 ++- types/lodash/collection/countBy.d.ts | 3 ++- types/lodash/collection/each.d.ts | 3 ++- types/lodash/collection/eachRight.d.ts | 3 ++- types/lodash/collection/every.d.ts | 3 ++- types/lodash/collection/filter.d.ts | 3 ++- types/lodash/collection/find.d.ts | 3 ++- types/lodash/collection/findLast.d.ts | 3 ++- types/lodash/collection/flatMap.d.ts | 3 ++- types/lodash/collection/flatMapDeep.d.ts | 3 ++- types/lodash/collection/flatMapDepth.d.ts | 3 ++- types/lodash/collection/forEach.d.ts | 3 ++- types/lodash/collection/forEachRight.d.ts | 3 ++- types/lodash/collection/groupBy.d.ts | 3 ++- types/lodash/collection/includes.d.ts | 3 ++- types/lodash/collection/invokeMap.d.ts | 3 ++- types/lodash/collection/keyBy.d.ts | 3 ++- types/lodash/collection/map.d.ts | 3 ++- types/lodash/collection/orderBy.d.ts | 3 ++- types/lodash/collection/partition.d.ts | 3 ++- types/lodash/collection/reduce.d.ts | 3 ++- types/lodash/collection/reduceRight.d.ts | 3 ++- types/lodash/collection/reject.d.ts | 3 ++- types/lodash/collection/sample.d.ts | 3 ++- types/lodash/collection/sampleSize.d.ts | 3 ++- types/lodash/collection/shuffle.d.ts | 3 ++- types/lodash/collection/size.d.ts | 3 ++- types/lodash/collection/some.d.ts | 3 ++- types/lodash/collection/sortBy.d.ts | 3 ++- types/lodash/common/common.d.ts | 7 ++++--- types/lodash/date/now.d.ts | 3 ++- types/lodash/function/after.d.ts | 3 ++- types/lodash/function/ary.d.ts | 3 ++- types/lodash/function/before.d.ts | 3 ++- types/lodash/function/bind.d.ts | 3 ++- types/lodash/function/bindKey.d.ts | 3 ++- types/lodash/function/curry.d.ts | 3 ++- types/lodash/function/curryRight.d.ts | 3 ++- types/lodash/function/debounce.d.ts | 3 ++- types/lodash/function/defer.d.ts | 3 ++- types/lodash/function/delay.d.ts | 3 ++- types/lodash/function/flip.d.ts | 3 ++- types/lodash/function/memoize.d.ts | 3 ++- types/lodash/function/negate.d.ts | 3 ++- types/lodash/function/once.d.ts | 3 ++- types/lodash/function/overArgs.d.ts | 3 ++- types/lodash/function/partial.d.ts | 3 ++- types/lodash/function/partialRight.d.ts | 3 ++- types/lodash/function/rearg.d.ts | 3 ++- types/lodash/function/rest.d.ts | 3 ++- types/lodash/function/spread.d.ts | 3 ++- types/lodash/function/throttle.d.ts | 3 ++- types/lodash/function/unary.d.ts | 3 ++- types/lodash/function/wrap.d.ts | 3 ++- types/lodash/index.d.ts | 6 ++++++ types/lodash/lang/castArray.d.ts | 3 ++- types/lodash/lang/clone.d.ts | 3 ++- types/lodash/lang/cloneDeep.d.ts | 3 ++- types/lodash/lang/cloneDeepWith.d.ts | 3 ++- types/lodash/lang/cloneWith.d.ts | 3 ++- types/lodash/lang/conformsTo.d.ts | 3 ++- types/lodash/lang/eq.d.ts | 3 ++- types/lodash/lang/gt.d.ts | 3 ++- types/lodash/lang/gte.d.ts | 3 ++- types/lodash/lang/isArguments.d.ts | 3 ++- types/lodash/lang/isArray.d.ts | 3 ++- types/lodash/lang/isArrayBuffer.d.ts | 3 ++- types/lodash/lang/isArrayLike.d.ts | 3 ++- types/lodash/lang/isArrayLikeObject.d.ts | 3 ++- types/lodash/lang/isBoolean.d.ts | 3 ++- types/lodash/lang/isBuffer.d.ts | 3 ++- types/lodash/lang/isDate.d.ts | 3 ++- types/lodash/lang/isElement.d.ts | 3 ++- types/lodash/lang/isEmpty.d.ts | 3 ++- types/lodash/lang/isEqual.d.ts | 3 ++- types/lodash/lang/isEqualWith.d.ts | 3 ++- types/lodash/lang/isError.d.ts | 3 ++- types/lodash/lang/isFinite.d.ts | 3 ++- types/lodash/lang/isFunction.d.ts | 3 ++- types/lodash/lang/isInteger.d.ts | 3 ++- types/lodash/lang/isLength.d.ts | 3 ++- types/lodash/lang/isMap.d.ts | 3 ++- types/lodash/lang/isMatch.d.ts | 3 ++- types/lodash/lang/isMatchWith.d.ts | 3 ++- types/lodash/lang/isNaN.d.ts | 3 ++- types/lodash/lang/isNative.d.ts | 3 ++- types/lodash/lang/isNil.d.ts | 3 ++- types/lodash/lang/isNull.d.ts | 3 ++- types/lodash/lang/isNumber.d.ts | 3 ++- types/lodash/lang/isObject.d.ts | 3 ++- types/lodash/lang/isObjectLike.d.ts | 3 ++- types/lodash/lang/isPlainObject.d.ts | 3 ++- types/lodash/lang/isRegExp.d.ts | 3 ++- types/lodash/lang/isSafeInteger.d.ts | 3 ++- types/lodash/lang/isSet.d.ts | 3 ++- types/lodash/lang/isString.d.ts | 3 ++- types/lodash/lang/isSymbol.d.ts | 3 ++- types/lodash/lang/isTypedArray.d.ts | 3 ++- types/lodash/lang/isUndefined.d.ts | 3 ++- types/lodash/lang/isWeakMap.d.ts | 3 ++- types/lodash/lang/isWeakSet.d.ts | 3 ++- types/lodash/lang/lt.d.ts | 3 ++- types/lodash/lang/lte.d.ts | 3 ++- types/lodash/lang/toArray.d.ts | 3 ++- types/lodash/lang/toFinite.d.ts | 3 ++- types/lodash/lang/toInteger.d.ts | 3 ++- types/lodash/lang/toLength.d.ts | 3 ++- types/lodash/lang/toNumber.d.ts | 3 ++- types/lodash/lang/toPlainObject.d.ts | 3 ++- types/lodash/lang/toSafeInteger.d.ts | 3 ++- types/lodash/lang/toString.d.ts | 3 ++- types/lodash/math/add.d.ts | 3 ++- types/lodash/math/ceil.d.ts | 3 ++- types/lodash/math/divide.d.ts | 3 ++- types/lodash/math/floor.d.ts | 3 ++- types/lodash/math/max.d.ts | 3 ++- types/lodash/math/maxBy.d.ts | 3 ++- types/lodash/math/mean.d.ts | 3 ++- types/lodash/math/meanBy.d.ts | 3 ++- types/lodash/math/min.d.ts | 3 ++- types/lodash/math/minBy.d.ts | 3 ++- types/lodash/math/multiply.d.ts | 3 ++- types/lodash/math/round.d.ts | 3 ++- types/lodash/math/subtract.d.ts | 3 ++- types/lodash/math/sum.d.ts | 3 ++- types/lodash/math/sumBy.d.ts | 3 ++- types/lodash/number/clamp.d.ts | 3 ++- types/lodash/number/inRange.d.ts | 3 ++- types/lodash/number/random.d.ts | 3 ++- types/lodash/object/assign.d.ts | 3 ++- types/lodash/object/assignIn.d.ts | 3 ++- types/lodash/object/assignInWith.d.ts | 3 ++- types/lodash/object/assignWith.d.ts | 3 ++- types/lodash/object/at.d.ts | 3 ++- types/lodash/object/create.d.ts | 3 ++- types/lodash/object/defaults.d.ts | 3 ++- types/lodash/object/defaultsDeep.d.ts | 3 ++- types/lodash/object/entries.d.ts | 3 ++- types/lodash/object/entriesIn.d.ts | 3 ++- types/lodash/object/extend.d.ts | 3 ++- types/lodash/object/extendWith.d.ts | 3 ++- types/lodash/object/findKey.d.ts | 3 ++- types/lodash/object/findLastKey.d.ts | 3 ++- types/lodash/object/forIn.d.ts | 3 ++- types/lodash/object/forInRight.d.ts | 3 ++- types/lodash/object/forOwn.d.ts | 3 ++- types/lodash/object/forOwnRight.d.ts | 3 ++- types/lodash/object/functions.d.ts | 3 ++- types/lodash/object/functionsIn.d.ts | 3 ++- types/lodash/object/get.d.ts | 3 ++- types/lodash/object/has.d.ts | 3 ++- types/lodash/object/hasIn.d.ts | 3 ++- types/lodash/object/invert.d.ts | 3 ++- types/lodash/object/invertBy.d.ts | 3 ++- types/lodash/object/invoke.d.ts | 3 ++- types/lodash/object/keys.d.ts | 3 ++- types/lodash/object/keysIn.d.ts | 3 ++- types/lodash/object/mapKeys.d.ts | 3 ++- types/lodash/object/mapValues.d.ts | 3 ++- types/lodash/object/merge.d.ts | 3 ++- types/lodash/object/mergeWith.d.ts | 3 ++- types/lodash/object/omit.d.ts | 3 ++- types/lodash/object/omitBy.d.ts | 3 ++- types/lodash/object/pick.d.ts | 3 ++- types/lodash/object/pickBy.d.ts | 3 ++- types/lodash/object/result.d.ts | 3 ++- types/lodash/object/set.d.ts | 3 ++- types/lodash/object/setWith.d.ts | 3 ++- types/lodash/object/toPairs.d.ts | 3 ++- types/lodash/object/toPairsIn.d.ts | 3 ++- types/lodash/object/transform.d.ts | 3 ++- types/lodash/object/unset.d.ts | 3 ++- types/lodash/object/update.d.ts | 3 ++- types/lodash/object/updateWith.d.ts | 3 ++- types/lodash/object/values.d.ts | 3 ++- types/lodash/object/valuesIn.d.ts | 3 ++- types/lodash/seq/chain.d.ts | 3 ++- types/lodash/seq/prototype.at.d.ts | 3 ++- types/lodash/seq/prototype.chain.d.ts | 3 ++- types/lodash/seq/prototype.commit.d.ts | 3 ++- types/lodash/seq/prototype.plant.d.ts | 3 ++- types/lodash/seq/prototype.reverse.d.ts | 3 ++- types/lodash/seq/prototype.toJSON.d.ts | 3 ++- types/lodash/seq/prototype.toString.d.ts | 3 ++- types/lodash/seq/prototype.value.d.ts | 3 ++- types/lodash/seq/prototype.valueOf.d.ts | 3 ++- types/lodash/seq/tap.d.ts | 3 ++- types/lodash/seq/thru.d.ts | 3 ++- types/lodash/string/camelCase.d.ts | 3 ++- types/lodash/string/capitalize.d.ts | 3 ++- types/lodash/string/deburr.d.ts | 3 ++- types/lodash/string/endsWith.d.ts | 3 ++- types/lodash/string/escape.d.ts | 3 ++- types/lodash/string/escapeRegExp.d.ts | 3 ++- types/lodash/string/kebabCase.d.ts | 3 ++- types/lodash/string/lowerCase.d.ts | 3 ++- types/lodash/string/lowerFirst.d.ts | 3 ++- types/lodash/string/pad.d.ts | 3 ++- types/lodash/string/padEnd.d.ts | 3 ++- types/lodash/string/padStart.d.ts | 3 ++- types/lodash/string/parseInt.d.ts | 3 ++- types/lodash/string/repeat.d.ts | 3 ++- types/lodash/string/replace.d.ts | 3 ++- types/lodash/string/snakeCase.d.ts | 3 ++- types/lodash/string/split.d.ts | 3 ++- types/lodash/string/startCase.d.ts | 3 ++- types/lodash/string/startsWith.d.ts | 3 ++- types/lodash/string/template.d.ts | 3 ++- types/lodash/string/toLower.d.ts | 3 ++- types/lodash/string/toUpper.d.ts | 3 ++- types/lodash/string/trim.d.ts | 3 ++- types/lodash/string/trimEnd.d.ts | 3 ++- types/lodash/string/trimStart.d.ts | 3 ++- types/lodash/string/truncate.d.ts | 3 ++- types/lodash/string/unescape.d.ts | 3 ++- types/lodash/string/upperCase.d.ts | 3 ++- types/lodash/string/upperFirst.d.ts | 3 ++- types/lodash/string/words.d.ts | 3 ++- types/lodash/util/attempt.d.ts | 3 ++- types/lodash/util/bindAll.d.ts | 3 ++- types/lodash/util/cond.d.ts | 3 ++- types/lodash/util/conforms.d.ts | 3 ++- types/lodash/util/constant.d.ts | 3 ++- types/lodash/util/defaultTo.d.ts | 3 ++- types/lodash/util/flow.d.ts | 3 ++- types/lodash/util/flowRight.d.ts | 3 ++- types/lodash/util/identity.d.ts | 3 ++- types/lodash/util/iteratee.d.ts | 3 ++- types/lodash/util/matches.d.ts | 3 ++- types/lodash/util/matchesProperty.d.ts | 3 ++- types/lodash/util/method.d.ts | 3 ++- types/lodash/util/methodOf.d.ts | 3 ++- types/lodash/util/mixin.d.ts | 3 ++- types/lodash/util/noConflict.d.ts | 3 ++- types/lodash/util/noop.d.ts | 3 ++- types/lodash/util/nthArg.d.ts | 3 ++- types/lodash/util/over.d.ts | 3 ++- types/lodash/util/overEvery.d.ts | 3 ++- types/lodash/util/overSome.d.ts | 3 ++- types/lodash/util/property.d.ts | 3 ++- types/lodash/util/propertyOf.d.ts | 3 ++- types/lodash/util/range.d.ts | 3 ++- types/lodash/util/rangeRight.d.ts | 3 ++- types/lodash/util/runInContext.d.ts | 3 ++- types/lodash/util/stubArray.d.ts | 3 ++- types/lodash/util/stubFalse.d.ts | 3 ++- types/lodash/util/stubObject.d.ts | 3 ++- types/lodash/util/stubString.d.ts | 3 ++- types/lodash/util/stubTrue.d.ts | 3 ++- types/lodash/util/times.d.ts | 3 ++- types/lodash/util/toPath.d.ts | 3 ++- types/lodash/util/uniqueId.d.ts | 3 ++- 316 files changed, 638 insertions(+), 317 deletions(-) diff --git a/types/lodash/array/chunk.d.ts b/types/lodash/array/chunk.d.ts index de40df8673..bb869b77ad 100644 --- a/types/lodash/array/chunk.d.ts +++ b/types/lodash/array/chunk.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an array of elements split into groups the length of size. If collection can’t be split evenly, the diff --git a/types/lodash/array/compact.d.ts b/types/lodash/array/compact.d.ts index 1de3bbae4c..8a0f18e179 100644 --- a/types/lodash/array/compact.d.ts +++ b/types/lodash/array/compact.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an array with all falsey values removed. The values false, null, 0, "", undefined, and NaN are diff --git a/types/lodash/array/concat.d.ts b/types/lodash/array/concat.d.ts index 977a086525..06e756ec42 100644 --- a/types/lodash/array/concat.d.ts +++ b/types/lodash/array/concat.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a new array concatenating `array` with any additional arrays diff --git a/types/lodash/array/difference.d.ts b/types/lodash/array/difference.d.ts index c6d1797192..8b5570ea59 100644 --- a/types/lodash/array/difference.d.ts +++ b/types/lodash/array/difference.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an array of unique array values not included in the other provided arrays using SameValueZero for diff --git a/types/lodash/array/differenceBy.d.ts b/types/lodash/array/differenceBy.d.ts index 6b291ac272..3ec03a1489 100644 --- a/types/lodash/array/differenceBy.d.ts +++ b/types/lodash/array/differenceBy.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like _.difference except that it accepts iteratee which is invoked for each element of array diff --git a/types/lodash/array/differenceWith.d.ts b/types/lodash/array/differenceWith.d.ts index c238f54b06..ce51f26b2a 100644 --- a/types/lodash/array/differenceWith.d.ts +++ b/types/lodash/array/differenceWith.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an array of unique `array` values not included in the other diff --git a/types/lodash/array/drop.d.ts b/types/lodash/array/drop.d.ts index 89e5b68b9b..8573d243b2 100644 --- a/types/lodash/array/drop.d.ts +++ b/types/lodash/array/drop.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a slice of array with n elements dropped from the beginning. diff --git a/types/lodash/array/dropRight.d.ts b/types/lodash/array/dropRight.d.ts index 518080db8b..bb968873b3 100644 --- a/types/lodash/array/dropRight.d.ts +++ b/types/lodash/array/dropRight.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a slice of array with n elements dropped from the end. diff --git a/types/lodash/array/dropRightWhile.d.ts b/types/lodash/array/dropRightWhile.d.ts index 26aeba29eb..f12c868ef9 100644 --- a/types/lodash/array/dropRightWhile.d.ts +++ b/types/lodash/array/dropRightWhile.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a slice of array excluding elements dropped from the end. Elements are dropped until predicate diff --git a/types/lodash/array/dropWhile.d.ts b/types/lodash/array/dropWhile.d.ts index 6335cec6b6..a24cad0852 100644 --- a/types/lodash/array/dropWhile.d.ts +++ b/types/lodash/array/dropWhile.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a slice of array excluding elements dropped from the beginning. Elements are dropped until predicate diff --git a/types/lodash/array/fill.d.ts b/types/lodash/array/fill.d.ts index de22051cc8..579648b7bd 100644 --- a/types/lodash/array/fill.d.ts +++ b/types/lodash/array/fill.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Fills elements of array with value from start up to, but not including, end. diff --git a/types/lodash/array/findIndex.d.ts b/types/lodash/array/findIndex.d.ts index eb0d6ae1a1..eeba389c04 100644 --- a/types/lodash/array/findIndex.d.ts +++ b/types/lodash/array/findIndex.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like _.find except that it returns the index of the first element predicate returns truthy diff --git a/types/lodash/array/findLastIndex.d.ts b/types/lodash/array/findLastIndex.d.ts index 04088a7ea2..17e3728e9d 100644 --- a/types/lodash/array/findLastIndex.d.ts +++ b/types/lodash/array/findLastIndex.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like _.findIndex except that it iterates over elements of collection from right to left. diff --git a/types/lodash/array/first.d.ts b/types/lodash/array/first.d.ts index 13c28fbce0..97778fff3c 100644 --- a/types/lodash/array/first.d.ts +++ b/types/lodash/array/first.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { first: typeof _.head; // tslint:disable-line:no-unnecessary-qualifier } diff --git a/types/lodash/array/flatten.d.ts b/types/lodash/array/flatten.d.ts index cce7ded984..d94e9ded23 100644 --- a/types/lodash/array/flatten.d.ts +++ b/types/lodash/array/flatten.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Flattens a nested array. If isDeep is true the array is recursively flattened, otherwise it’s only diff --git a/types/lodash/array/flattenDeep.d.ts b/types/lodash/array/flattenDeep.d.ts index f25386327a..532263859f 100644 --- a/types/lodash/array/flattenDeep.d.ts +++ b/types/lodash/array/flattenDeep.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Recursively flattens a nested array. diff --git a/types/lodash/array/flattenDepth.d.ts b/types/lodash/array/flattenDepth.d.ts index 807e925308..43dbb1bb62 100644 --- a/types/lodash/array/flattenDepth.d.ts +++ b/types/lodash/array/flattenDepth.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Recursively flatten array up to depth times. diff --git a/types/lodash/array/fromPairs.d.ts b/types/lodash/array/fromPairs.d.ts index 08af96f8e2..1ec15da823 100644 --- a/types/lodash/array/fromPairs.d.ts +++ b/types/lodash/array/fromPairs.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * The inverse of `_.toPairs`; this method returns an object composed diff --git a/types/lodash/array/head.d.ts b/types/lodash/array/head.d.ts index 19c2d2df77..39d56b77e1 100644 --- a/types/lodash/array/head.d.ts +++ b/types/lodash/array/head.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Gets the first element of array. diff --git a/types/lodash/array/indexOf.d.ts b/types/lodash/array/indexOf.d.ts index da5d91e0d3..b176b746d6 100644 --- a/types/lodash/array/indexOf.d.ts +++ b/types/lodash/array/indexOf.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Gets the index at which the first occurrence of `value` is found in `array` diff --git a/types/lodash/array/initial.d.ts b/types/lodash/array/initial.d.ts index d011a0998f..ca8847cedb 100644 --- a/types/lodash/array/initial.d.ts +++ b/types/lodash/array/initial.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Gets all but the last element of array. diff --git a/types/lodash/array/intersection.d.ts b/types/lodash/array/intersection.d.ts index 71a7c06abc..426b8c824c 100644 --- a/types/lodash/array/intersection.d.ts +++ b/types/lodash/array/intersection.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an array of unique values that are included in all of the provided arrays using SameValueZero for diff --git a/types/lodash/array/intersectionBy.d.ts b/types/lodash/array/intersectionBy.d.ts index 251dbd78f7..1d8842ae8d 100644 --- a/types/lodash/array/intersectionBy.d.ts +++ b/types/lodash/array/intersectionBy.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.intersection` except that it accepts `iteratee` diff --git a/types/lodash/array/intersectionWith.d.ts b/types/lodash/array/intersectionWith.d.ts index 5dce77beab..e12513a332 100644 --- a/types/lodash/array/intersectionWith.d.ts +++ b/types/lodash/array/intersectionWith.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an array of unique `array` values not included in the other diff --git a/types/lodash/array/join.d.ts b/types/lodash/array/join.d.ts index 27d62caaff..6882226487 100644 --- a/types/lodash/array/join.d.ts +++ b/types/lodash/array/join.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Converts all elements in `array` into a string separated by `separator`. diff --git a/types/lodash/array/last.d.ts b/types/lodash/array/last.d.ts index 1c6d435eff..6c045643c7 100644 --- a/types/lodash/array/last.d.ts +++ b/types/lodash/array/last.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Gets the last element of array. diff --git a/types/lodash/array/lastIndexOf.d.ts b/types/lodash/array/lastIndexOf.d.ts index 454b8b2676..ce12ca3448 100644 --- a/types/lodash/array/lastIndexOf.d.ts +++ b/types/lodash/array/lastIndexOf.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like _.indexOf except that it iterates over elements of array from right to left. diff --git a/types/lodash/array/nth.d.ts b/types/lodash/array/nth.d.ts index e6ebe7834d..7047172409 100644 --- a/types/lodash/array/nth.d.ts +++ b/types/lodash/array/nth.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Gets the element at index `n` of `array`. If `n` is negative, the nth element from the end is returned. diff --git a/types/lodash/array/pull.d.ts b/types/lodash/array/pull.d.ts index b604bc9ff7..55887abac1 100644 --- a/types/lodash/array/pull.d.ts +++ b/types/lodash/array/pull.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Removes all provided values from array using SameValueZero for equality comparisons. diff --git a/types/lodash/array/pullAll.d.ts b/types/lodash/array/pullAll.d.ts index 33e663c8be..a3bb93d45e 100644 --- a/types/lodash/array/pullAll.d.ts +++ b/types/lodash/array/pullAll.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.pull` except that it accepts an array of values to remove. diff --git a/types/lodash/array/pullAllBy.d.ts b/types/lodash/array/pullAllBy.d.ts index e2261a7d8b..aeada231e9 100644 --- a/types/lodash/array/pullAllBy.d.ts +++ b/types/lodash/array/pullAllBy.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.pullAll` except that it accepts `iteratee` which is diff --git a/types/lodash/array/pullAllWith.d.ts b/types/lodash/array/pullAllWith.d.ts index aefdf90981..0f9f176d5d 100644 --- a/types/lodash/array/pullAllWith.d.ts +++ b/types/lodash/array/pullAllWith.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.pullAll` except that it accepts `comparator` which is diff --git a/types/lodash/array/pullAt.d.ts b/types/lodash/array/pullAt.d.ts index 8a161cfd97..5104b9bc62 100644 --- a/types/lodash/array/pullAt.d.ts +++ b/types/lodash/array/pullAt.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Removes elements from array corresponding to the given indexes and returns an array of the removed elements. diff --git a/types/lodash/array/remove.d.ts b/types/lodash/array/remove.d.ts index cc8ed55a3c..ccc9ea1e2d 100644 --- a/types/lodash/array/remove.d.ts +++ b/types/lodash/array/remove.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Removes all elements from array that predicate returns truthy for and returns an array of the removed diff --git a/types/lodash/array/reverse.d.ts b/types/lodash/array/reverse.d.ts index a5a4c61b2a..5e8f08ccbf 100644 --- a/types/lodash/array/reverse.d.ts +++ b/types/lodash/array/reverse.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Reverses `array` so that the first element becomes the last, the second diff --git a/types/lodash/array/slice.d.ts b/types/lodash/array/slice.d.ts index 4161cf25de..eb2399694a 100644 --- a/types/lodash/array/slice.d.ts +++ b/types/lodash/array/slice.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a slice of array from start up to, but not including, end. diff --git a/types/lodash/array/sortedIndex.d.ts b/types/lodash/array/sortedIndex.d.ts index 2390a19e66..dc9ac781f0 100644 --- a/types/lodash/array/sortedIndex.d.ts +++ b/types/lodash/array/sortedIndex.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Uses a binary search to determine the lowest index at which `value` should diff --git a/types/lodash/array/sortedIndexBy.d.ts b/types/lodash/array/sortedIndexBy.d.ts index b71ae3b859..2068250211 100644 --- a/types/lodash/array/sortedIndexBy.d.ts +++ b/types/lodash/array/sortedIndexBy.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Uses a binary search to determine the lowest index at which `value` should diff --git a/types/lodash/array/sortedIndexOf.d.ts b/types/lodash/array/sortedIndexOf.d.ts index f3e7143074..a46af74a94 100644 --- a/types/lodash/array/sortedIndexOf.d.ts +++ b/types/lodash/array/sortedIndexOf.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.indexOf` except that it performs a binary diff --git a/types/lodash/array/sortedLastIndex.d.ts b/types/lodash/array/sortedLastIndex.d.ts index af4cc1663b..3e6d662797 100644 --- a/types/lodash/array/sortedLastIndex.d.ts +++ b/types/lodash/array/sortedLastIndex.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.sortedIndex` except that it returns the highest diff --git a/types/lodash/array/sortedLastIndexBy.d.ts b/types/lodash/array/sortedLastIndexBy.d.ts index 5a691a6b28..8ee5b4a94a 100644 --- a/types/lodash/array/sortedLastIndexBy.d.ts +++ b/types/lodash/array/sortedLastIndexBy.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.sortedLastIndex` except that it accepts `iteratee` diff --git a/types/lodash/array/sortedLastIndexOf.d.ts b/types/lodash/array/sortedLastIndexOf.d.ts index 6230ec6c44..e26f728084 100644 --- a/types/lodash/array/sortedLastIndexOf.d.ts +++ b/types/lodash/array/sortedLastIndexOf.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.lastIndexOf` except that it performs a binary diff --git a/types/lodash/array/sortedUniq.d.ts b/types/lodash/array/sortedUniq.d.ts index 74e7e79f0f..92feeab841 100644 --- a/types/lodash/array/sortedUniq.d.ts +++ b/types/lodash/array/sortedUniq.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.uniq` except that it's designed and optimized diff --git a/types/lodash/array/sortedUniqBy.d.ts b/types/lodash/array/sortedUniqBy.d.ts index 6cad3ad107..f9c93652e5 100644 --- a/types/lodash/array/sortedUniqBy.d.ts +++ b/types/lodash/array/sortedUniqBy.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.uniqBy` except that it's designed and optimized diff --git a/types/lodash/array/tail.d.ts b/types/lodash/array/tail.d.ts index ed73ef0fbe..d4bb3090fa 100644 --- a/types/lodash/array/tail.d.ts +++ b/types/lodash/array/tail.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Gets all but the first element of array. diff --git a/types/lodash/array/take.d.ts b/types/lodash/array/take.d.ts index 5044113e2d..57cb4e437d 100644 --- a/types/lodash/array/take.d.ts +++ b/types/lodash/array/take.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a slice of array with n elements taken from the beginning. diff --git a/types/lodash/array/takeRight.d.ts b/types/lodash/array/takeRight.d.ts index 4620ac6e4d..46cbc4d89c 100644 --- a/types/lodash/array/takeRight.d.ts +++ b/types/lodash/array/takeRight.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a slice of array with n elements taken from the end. diff --git a/types/lodash/array/takeRightWhile.d.ts b/types/lodash/array/takeRightWhile.d.ts index aa9822bbfb..569774626f 100644 --- a/types/lodash/array/takeRightWhile.d.ts +++ b/types/lodash/array/takeRightWhile.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a slice of array with elements taken from the end. Elements are taken until predicate returns diff --git a/types/lodash/array/takeWhile.d.ts b/types/lodash/array/takeWhile.d.ts index e9d28e076a..ca091fc38a 100644 --- a/types/lodash/array/takeWhile.d.ts +++ b/types/lodash/array/takeWhile.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a slice of array with elements taken from the beginning. Elements are taken until predicate returns diff --git a/types/lodash/array/union.d.ts b/types/lodash/array/union.d.ts index 4e977dc4f5..0fff31fb35 100644 --- a/types/lodash/array/union.d.ts +++ b/types/lodash/array/union.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an array of unique values, in order, from all of the provided arrays using SameValueZero for diff --git a/types/lodash/array/unionBy.d.ts b/types/lodash/array/unionBy.d.ts index bafedc0b14..0465f88f89 100644 --- a/types/lodash/array/unionBy.d.ts +++ b/types/lodash/array/unionBy.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.union` except that it accepts `iteratee` which is diff --git a/types/lodash/array/unionWith.d.ts b/types/lodash/array/unionWith.d.ts index 9e427abdbf..8a458b035b 100644 --- a/types/lodash/array/unionWith.d.ts +++ b/types/lodash/array/unionWith.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.union` except that it accepts `comparator` which diff --git a/types/lodash/array/uniq.d.ts b/types/lodash/array/uniq.d.ts index 670000bfb7..27989f1ced 100644 --- a/types/lodash/array/uniq.d.ts +++ b/types/lodash/array/uniq.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a duplicate-free version of an array, using diff --git a/types/lodash/array/uniqBy.d.ts b/types/lodash/array/uniqBy.d.ts index 61345382c1..293c78bd77 100644 --- a/types/lodash/array/uniqBy.d.ts +++ b/types/lodash/array/uniqBy.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.uniq` except that it accepts `iteratee` which is diff --git a/types/lodash/array/uniqWith.d.ts b/types/lodash/array/uniqWith.d.ts index e5c28bb2d3..a3c41f3ebd 100644 --- a/types/lodash/array/uniqWith.d.ts +++ b/types/lodash/array/uniqWith.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.uniq` except that it accepts `comparator` which diff --git a/types/lodash/array/unzip.d.ts b/types/lodash/array/unzip.d.ts index c374a2369b..3985fe4904 100644 --- a/types/lodash/array/unzip.d.ts +++ b/types/lodash/array/unzip.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like _.zip except that it accepts an array of grouped elements and creates an array diff --git a/types/lodash/array/unzipWith.d.ts b/types/lodash/array/unzipWith.d.ts index 2b0c0bf119..10740c24be 100644 --- a/types/lodash/array/unzipWith.d.ts +++ b/types/lodash/array/unzipWith.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like _.unzip except that it accepts an iteratee to specify how regrouped values should be diff --git a/types/lodash/array/without.d.ts b/types/lodash/array/without.d.ts index d722342d89..0cb20cfb49 100644 --- a/types/lodash/array/without.d.ts +++ b/types/lodash/array/without.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an array excluding all provided values using SameValueZero for equality comparisons. diff --git a/types/lodash/array/xor.d.ts b/types/lodash/array/xor.d.ts index 04eaa051e7..af6d8abeb8 100644 --- a/types/lodash/array/xor.d.ts +++ b/types/lodash/array/xor.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an array of unique values that is the symmetric difference of the provided arrays. diff --git a/types/lodash/array/xorBy.d.ts b/types/lodash/array/xorBy.d.ts index 6728c569dc..1badb50d3e 100644 --- a/types/lodash/array/xorBy.d.ts +++ b/types/lodash/array/xorBy.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.xor` except that it accepts `iteratee` which is diff --git a/types/lodash/array/xorWith.d.ts b/types/lodash/array/xorWith.d.ts index cec73890d3..60f1198672 100644 --- a/types/lodash/array/xorWith.d.ts +++ b/types/lodash/array/xorWith.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.xor` except that it accepts `comparator` which is diff --git a/types/lodash/array/zip.d.ts b/types/lodash/array/zip.d.ts index 612899b87e..022b32a855 100644 --- a/types/lodash/array/zip.d.ts +++ b/types/lodash/array/zip.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, diff --git a/types/lodash/array/zipObject.d.ts b/types/lodash/array/zipObject.d.ts index 49b34166c2..93eef34818 100644 --- a/types/lodash/array/zipObject.d.ts +++ b/types/lodash/array/zipObject.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like _.fromPairs except that it accepts two arrays, one of property diff --git a/types/lodash/array/zipObjectDeep.d.ts b/types/lodash/array/zipObjectDeep.d.ts index e68c5d1292..e178df291c 100644 --- a/types/lodash/array/zipObjectDeep.d.ts +++ b/types/lodash/array/zipObjectDeep.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like _.zipObject except that it supports property paths. diff --git a/types/lodash/array/zipWith.d.ts b/types/lodash/array/zipWith.d.ts index f0cef3776a..5a4b599c97 100644 --- a/types/lodash/array/zipWith.d.ts +++ b/types/lodash/array/zipWith.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import _ = require(".."); +declare module ".." { interface LoDashStatic { /** * This method is like _.zip except that it accepts an iteratee to specify how grouped values should be diff --git a/types/lodash/collection/countBy.d.ts b/types/lodash/collection/countBy.d.ts index 0a6a819c5f..32e87b1c1e 100644 --- a/types/lodash/collection/countBy.d.ts +++ b/types/lodash/collection/countBy.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an object composed of keys generated from the results of running each element of collection through diff --git a/types/lodash/collection/each.d.ts b/types/lodash/collection/each.d.ts index a12df91b30..7b1c3072a1 100644 --- a/types/lodash/collection/each.d.ts +++ b/types/lodash/collection/each.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { each: typeof _.forEach; // tslint:disable-line:no-unnecessary-qualifier } diff --git a/types/lodash/collection/eachRight.d.ts b/types/lodash/collection/eachRight.d.ts index d8e448a486..29f42a1e8a 100644 --- a/types/lodash/collection/eachRight.d.ts +++ b/types/lodash/collection/eachRight.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { eachRight: typeof _.forEachRight; // tslint:disable-line:no-unnecessary-qualifier } diff --git a/types/lodash/collection/every.d.ts b/types/lodash/collection/every.d.ts index 76e6e659d7..2189631b82 100644 --- a/types/lodash/collection/every.d.ts +++ b/types/lodash/collection/every.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if predicate returns truthy for all elements of collection. Iteration is stopped once predicate diff --git a/types/lodash/collection/filter.d.ts b/types/lodash/collection/filter.d.ts index adfe9a22c7..1fb819882d 100644 --- a/types/lodash/collection/filter.d.ts +++ b/types/lodash/collection/filter.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Iterates over elements of collection, returning an array of all elements predicate returns truthy for. The diff --git a/types/lodash/collection/find.d.ts b/types/lodash/collection/find.d.ts index d4593ac9d3..30e0666418 100644 --- a/types/lodash/collection/find.d.ts +++ b/types/lodash/collection/find.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Iterates over elements of collection, returning the first element predicate returns truthy for. diff --git a/types/lodash/collection/findLast.d.ts b/types/lodash/collection/findLast.d.ts index 43b3dfbd28..b7e5fa6c63 100644 --- a/types/lodash/collection/findLast.d.ts +++ b/types/lodash/collection/findLast.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like _.find except that it iterates over elements of a collection from diff --git a/types/lodash/collection/flatMap.d.ts b/types/lodash/collection/flatMap.d.ts index 8eec7ddea1..8e0bdc9f3d 100644 --- a/types/lodash/collection/flatMap.d.ts +++ b/types/lodash/collection/flatMap.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an array of flattened values by running each element in collection through iteratee diff --git a/types/lodash/collection/flatMapDeep.d.ts b/types/lodash/collection/flatMapDeep.d.ts index d15ce69070..c22c03767b 100644 --- a/types/lodash/collection/flatMapDeep.d.ts +++ b/types/lodash/collection/flatMapDeep.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.flatMap` except that it recursively flattens the diff --git a/types/lodash/collection/flatMapDepth.d.ts b/types/lodash/collection/flatMapDepth.d.ts index fd8004dc1a..42644f58dd 100644 --- a/types/lodash/collection/flatMapDepth.d.ts +++ b/types/lodash/collection/flatMapDepth.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.flatMap` except that it recursively flattens the diff --git a/types/lodash/collection/forEach.d.ts b/types/lodash/collection/forEach.d.ts index 8ede8dfc15..72847f15d1 100644 --- a/types/lodash/collection/forEach.d.ts +++ b/types/lodash/collection/forEach.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Iterates over elements of collection invoking iteratee for each element. The iteratee is bound to thisArg diff --git a/types/lodash/collection/forEachRight.d.ts b/types/lodash/collection/forEachRight.d.ts index 67c3ec3b8b..aa75a72cd4 100644 --- a/types/lodash/collection/forEachRight.d.ts +++ b/types/lodash/collection/forEachRight.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like _.forEach except that it iterates over elements of collection from right to left. diff --git a/types/lodash/collection/groupBy.d.ts b/types/lodash/collection/groupBy.d.ts index 192154de0a..47b2dc49e4 100644 --- a/types/lodash/collection/groupBy.d.ts +++ b/types/lodash/collection/groupBy.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an object composed of keys generated from the results of running each element of collection through diff --git a/types/lodash/collection/includes.d.ts b/types/lodash/collection/includes.d.ts index 76fcd79a6f..0f1989eba1 100644 --- a/types/lodash/collection/includes.d.ts +++ b/types/lodash/collection/includes.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if target is in collection using SameValueZero for equality comparisons. If fromIndex is negative, diff --git a/types/lodash/collection/invokeMap.d.ts b/types/lodash/collection/invokeMap.d.ts index 73c283fbde..9c025d23ee 100644 --- a/types/lodash/collection/invokeMap.d.ts +++ b/types/lodash/collection/invokeMap.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Invokes the method named by methodName on each element in the collection returning diff --git a/types/lodash/collection/keyBy.d.ts b/types/lodash/collection/keyBy.d.ts index 47f2c35cc5..793caa6fa6 100644 --- a/types/lodash/collection/keyBy.d.ts +++ b/types/lodash/collection/keyBy.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an object composed of keys generated from the results of running each element of collection through diff --git a/types/lodash/collection/map.d.ts b/types/lodash/collection/map.d.ts index 493f6300b6..cf6131c3cd 100644 --- a/types/lodash/collection/map.d.ts +++ b/types/lodash/collection/map.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an array of values by running each element in collection through iteratee. The iteratee is bound to diff --git a/types/lodash/collection/orderBy.d.ts b/types/lodash/collection/orderBy.d.ts index bac15cefa4..3d8e4aa6e0 100644 --- a/types/lodash/collection/orderBy.d.ts +++ b/types/lodash/collection/orderBy.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.sortBy` except that it allows specifying the sort diff --git a/types/lodash/collection/partition.d.ts b/types/lodash/collection/partition.d.ts index e293220770..336ed2d25f 100644 --- a/types/lodash/collection/partition.d.ts +++ b/types/lodash/collection/partition.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for, diff --git a/types/lodash/collection/reduce.d.ts b/types/lodash/collection/reduce.d.ts index f924a149bb..88ec1f772d 100644 --- a/types/lodash/collection/reduce.d.ts +++ b/types/lodash/collection/reduce.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Reduces a collection to a value which is the accumulated result of running each diff --git a/types/lodash/collection/reduceRight.d.ts b/types/lodash/collection/reduceRight.d.ts index d250def9a6..d53bf79ea0 100644 --- a/types/lodash/collection/reduceRight.d.ts +++ b/types/lodash/collection/reduceRight.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like _.reduce except that it iterates over elements of a collection from diff --git a/types/lodash/collection/reject.d.ts b/types/lodash/collection/reject.d.ts index a475baf1ee..4e4e8c5f26 100644 --- a/types/lodash/collection/reject.d.ts +++ b/types/lodash/collection/reject.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * The opposite of _.filter; this method returns the elements of collection that predicate does not return diff --git a/types/lodash/collection/sample.d.ts b/types/lodash/collection/sample.d.ts index f078711033..2bcbf34ff8 100644 --- a/types/lodash/collection/sample.d.ts +++ b/types/lodash/collection/sample.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Gets a random element from collection. diff --git a/types/lodash/collection/sampleSize.d.ts b/types/lodash/collection/sampleSize.d.ts index e21ed6eea4..1a607d9837 100644 --- a/types/lodash/collection/sampleSize.d.ts +++ b/types/lodash/collection/sampleSize.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Gets n random elements at unique keys from collection up to the size of collection. diff --git a/types/lodash/collection/shuffle.d.ts b/types/lodash/collection/shuffle.d.ts index 0c91dc097d..653f080e2f 100644 --- a/types/lodash/collection/shuffle.d.ts +++ b/types/lodash/collection/shuffle.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an array of shuffled values, using a version of the Fisher-Yates shuffle. diff --git a/types/lodash/collection/size.d.ts b/types/lodash/collection/size.d.ts index 6653becb5f..7b036b3e28 100644 --- a/types/lodash/collection/size.d.ts +++ b/types/lodash/collection/size.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Gets the size of collection by returning its length for array-like values or the number of own enumerable diff --git a/types/lodash/collection/some.d.ts b/types/lodash/collection/some.d.ts index b6393023ec..ca40a0b5a0 100644 --- a/types/lodash/collection/some.d.ts +++ b/types/lodash/collection/some.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if predicate returns truthy for any element of collection. Iteration is stopped once predicate diff --git a/types/lodash/collection/sortBy.d.ts b/types/lodash/collection/sortBy.d.ts index c2bcdcf9e8..61f0827151 100644 --- a/types/lodash/collection/sortBy.d.ts +++ b/types/lodash/collection/sortBy.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an array of elements, sorted in ascending order by the results of diff --git a/types/lodash/common/common.d.ts b/types/lodash/common/common.d.ts index 930525f1f0..90a902e40c 100644 --- a/types/lodash/common/common.d.ts +++ b/types/lodash/common/common.d.ts @@ -1,6 +1,7 @@ -declare let _: _.LoDashStatic; -type PartialObject = Partial; -declare namespace _ { +import * as _ from ".."; +type GlobalPartial = Partial; +declare module ".." { + type PartialObject = GlobalPartial; type Many = T | T[]; interface LoDashStatic { /** diff --git a/types/lodash/date/now.d.ts b/types/lodash/date/now.d.ts index 1213cc0ea1..ec447f382c 100644 --- a/types/lodash/date/now.d.ts +++ b/types/lodash/date/now.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Gets the number of milliseconds that have elapsed since the Unix epoch (1 January 1970 00:00:00 UTC). diff --git a/types/lodash/function/after.d.ts b/types/lodash/function/after.d.ts index 4585a1a87d..e82a63a6ff 100644 --- a/types/lodash/function/after.d.ts +++ b/types/lodash/function/after.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * The opposite of _.before; this method creates a function that invokes func once it’s called n or more times. diff --git a/types/lodash/function/ary.d.ts b/types/lodash/function/ary.d.ts index 3e81a1b72c..899a636c83 100644 --- a/types/lodash/function/ary.d.ts +++ b/types/lodash/function/ary.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a function that accepts up to n arguments ignoring any additional arguments. diff --git a/types/lodash/function/before.d.ts b/types/lodash/function/before.d.ts index 3d2df831da..2132287ba3 100644 --- a/types/lodash/function/before.d.ts +++ b/types/lodash/function/before.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a function that invokes func, with the this binding and arguments of the created function, while diff --git a/types/lodash/function/bind.d.ts b/types/lodash/function/bind.d.ts index 73311a37b7..e53a6b093f 100644 --- a/types/lodash/function/bind.d.ts +++ b/types/lodash/function/bind.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface FunctionBind { placeholder: any; diff --git a/types/lodash/function/bindKey.d.ts b/types/lodash/function/bindKey.d.ts index 8cf23ae4a1..8e31d388be 100644 --- a/types/lodash/function/bindKey.d.ts +++ b/types/lodash/function/bindKey.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface FunctionBindKey { placeholder: any; diff --git a/types/lodash/function/curry.d.ts b/types/lodash/function/curry.d.ts index 5810d89a9b..d8ef45cef1 100644 --- a/types/lodash/function/curry.d.ts +++ b/types/lodash/function/curry.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a function that accepts one or more arguments of func that when called either invokes func returning diff --git a/types/lodash/function/curryRight.d.ts b/types/lodash/function/curryRight.d.ts index 73249d8fe8..ae61d5088c 100644 --- a/types/lodash/function/curryRight.d.ts +++ b/types/lodash/function/curryRight.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight diff --git a/types/lodash/function/debounce.d.ts b/types/lodash/function/debounce.d.ts index ef3adff643..45f700f49d 100644 --- a/types/lodash/function/debounce.d.ts +++ b/types/lodash/function/debounce.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface DebounceSettings { /** * Specify invoking on the leading edge of the timeout. diff --git a/types/lodash/function/defer.d.ts b/types/lodash/function/defer.d.ts index 15488207c9..43f0f3907f 100644 --- a/types/lodash/function/defer.d.ts +++ b/types/lodash/function/defer.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Defers invoking the func until the current call stack has cleared. Any additional arguments are provided to diff --git a/types/lodash/function/delay.d.ts b/types/lodash/function/delay.d.ts index 4273689166..2590af45f1 100644 --- a/types/lodash/function/delay.d.ts +++ b/types/lodash/function/delay.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Invokes func after wait milliseconds. Any additional arguments are provided to func when it’s invoked. diff --git a/types/lodash/function/flip.d.ts b/types/lodash/function/flip.d.ts index 428dcf774d..744874cbcc 100644 --- a/types/lodash/function/flip.d.ts +++ b/types/lodash/function/flip.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a function that invokes `func` with arguments reversed. diff --git a/types/lodash/function/memoize.d.ts b/types/lodash/function/memoize.d.ts index 88257bd8ce..fd5d6e0481 100644 --- a/types/lodash/function/memoize.d.ts +++ b/types/lodash/function/memoize.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface MemoizedFunction { cache: MapCache; } diff --git a/types/lodash/function/negate.d.ts b/types/lodash/function/negate.d.ts index b42e395cf6..56ece2d62a 100644 --- a/types/lodash/function/negate.d.ts +++ b/types/lodash/function/negate.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a function that negates the result of the predicate func. The func predicate is invoked with diff --git a/types/lodash/function/once.d.ts b/types/lodash/function/once.d.ts index a49423171f..6fd5b51806 100644 --- a/types/lodash/function/once.d.ts +++ b/types/lodash/function/once.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a function that is restricted to invoking func once. Repeat calls to the function return the value diff --git a/types/lodash/function/overArgs.d.ts b/types/lodash/function/overArgs.d.ts index 6cc5cf6c41..3b73beed35 100644 --- a/types/lodash/function/overArgs.d.ts +++ b/types/lodash/function/overArgs.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a function that runs each argument through a corresponding transform function. diff --git a/types/lodash/function/partial.d.ts b/types/lodash/function/partial.d.ts index 1d15995cea..cf9d1a647f 100644 --- a/types/lodash/function/partial.d.ts +++ b/types/lodash/function/partial.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a function that, when called, invokes func with any additional partial arguments diff --git a/types/lodash/function/partialRight.d.ts b/types/lodash/function/partialRight.d.ts index e0280262e8..09aee9dad5 100644 --- a/types/lodash/function/partialRight.d.ts +++ b/types/lodash/function/partialRight.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like _.partial except that partial arguments are appended to those provided diff --git a/types/lodash/function/rearg.d.ts b/types/lodash/function/rearg.d.ts index bcabbbb62b..edd0c9a1f7 100644 --- a/types/lodash/function/rearg.d.ts +++ b/types/lodash/function/rearg.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a function that invokes func with arguments arranged according to the specified indexes where the diff --git a/types/lodash/function/rest.d.ts b/types/lodash/function/rest.d.ts index 738f206967..eb00588fdf 100644 --- a/types/lodash/function/rest.d.ts +++ b/types/lodash/function/rest.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a function that invokes func with the this binding of the created function and arguments from start diff --git a/types/lodash/function/spread.d.ts b/types/lodash/function/spread.d.ts index 36aab5fe33..9a1a573c84 100644 --- a/types/lodash/function/spread.d.ts +++ b/types/lodash/function/spread.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a function that invokes func with the this binding of the created function and an array of arguments diff --git a/types/lodash/function/throttle.d.ts b/types/lodash/function/throttle.d.ts index 37a1c60bec..782e5a88d5 100644 --- a/types/lodash/function/throttle.d.ts +++ b/types/lodash/function/throttle.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface ThrottleSettings { /** * If you'd like to disable the leading-edge call, pass this as false. diff --git a/types/lodash/function/unary.d.ts b/types/lodash/function/unary.d.ts index 810f359a6c..f04fd11599 100644 --- a/types/lodash/function/unary.d.ts +++ b/types/lodash/function/unary.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a function that accepts up to one argument, ignoring any diff --git a/types/lodash/function/wrap.d.ts b/types/lodash/function/wrap.d.ts index f00a27fc74..91623cf894 100644 --- a/types/lodash/function/wrap.d.ts +++ b/types/lodash/function/wrap.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a function that provides value to the wrapper function as its first argument. Any additional diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index aeebd3b5c2..fd421681c1 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -355,6 +355,12 @@ export = _; export as namespace _; +declare const _: _.LoDashStatic; +declare namespace _ { + // tslint:disable-next-line no-empty-interface (This will be augmented) + interface LoDashStatic {} +} + // Backward compatibility with --target es5 declare global { // tslint:disable-next-line:no-empty-interface diff --git a/types/lodash/lang/castArray.d.ts b/types/lodash/lang/castArray.d.ts index 33b7d83771..8601d00aa0 100644 --- a/types/lodash/lang/castArray.d.ts +++ b/types/lodash/lang/castArray.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Casts value as an array if it’s not one. diff --git a/types/lodash/lang/clone.d.ts b/types/lodash/lang/clone.d.ts index 5e3405e68a..48a416f1c0 100644 --- a/types/lodash/lang/clone.d.ts +++ b/types/lodash/lang/clone.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a shallow clone of value. diff --git a/types/lodash/lang/cloneDeep.d.ts b/types/lodash/lang/cloneDeep.d.ts index 73099ff92a..4200339178 100644 --- a/types/lodash/lang/cloneDeep.d.ts +++ b/types/lodash/lang/cloneDeep.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like _.clone except that it recursively clones value. diff --git a/types/lodash/lang/cloneDeepWith.d.ts b/types/lodash/lang/cloneDeepWith.d.ts index 7805a598f0..07d8498945 100644 --- a/types/lodash/lang/cloneDeepWith.d.ts +++ b/types/lodash/lang/cloneDeepWith.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { type CloneDeepWithCustomizer = (value: any, key: number | string | undefined, object: TObject | undefined, stack: any) => any; interface LoDashStatic { diff --git a/types/lodash/lang/cloneWith.d.ts b/types/lodash/lang/cloneWith.d.ts index 2135d0ed53..0c9ee9ad36 100644 --- a/types/lodash/lang/cloneWith.d.ts +++ b/types/lodash/lang/cloneWith.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { type CloneWithCustomizer = (value: TValue, key: number | string | undefined, object: any, stack: any) => TResult; interface LoDashStatic { diff --git a/types/lodash/lang/conformsTo.d.ts b/types/lodash/lang/conformsTo.d.ts index 859186f97c..dd83a54964 100644 --- a/types/lodash/lang/conformsTo.d.ts +++ b/types/lodash/lang/conformsTo.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** diff --git a/types/lodash/lang/eq.d.ts b/types/lodash/lang/eq.d.ts index 08d4fb9497..0d1bf0e6ee 100644 --- a/types/lodash/lang/eq.d.ts +++ b/types/lodash/lang/eq.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) diff --git a/types/lodash/lang/gt.d.ts b/types/lodash/lang/gt.d.ts index 6d63801d1e..048600fb52 100644 --- a/types/lodash/lang/gt.d.ts +++ b/types/lodash/lang/gt.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is greater than other. diff --git a/types/lodash/lang/gte.d.ts b/types/lodash/lang/gte.d.ts index 43887befcd..20084cba0b 100644 --- a/types/lodash/lang/gte.d.ts +++ b/types/lodash/lang/gte.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is greater than or equal to other. diff --git a/types/lodash/lang/isArguments.d.ts b/types/lodash/lang/isArguments.d.ts index e2549b24f6..824eec3539 100644 --- a/types/lodash/lang/isArguments.d.ts +++ b/types/lodash/lang/isArguments.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is classified as an arguments object. diff --git a/types/lodash/lang/isArray.d.ts b/types/lodash/lang/isArray.d.ts index 0218c836d8..99a358a7ad 100644 --- a/types/lodash/lang/isArray.d.ts +++ b/types/lodash/lang/isArray.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is classified as an Array object. diff --git a/types/lodash/lang/isArrayBuffer.d.ts b/types/lodash/lang/isArrayBuffer.d.ts index c6e9d8cd05..e647ed90a1 100644 --- a/types/lodash/lang/isArrayBuffer.d.ts +++ b/types/lodash/lang/isArrayBuffer.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is classified as an ArrayBuffer object. diff --git a/types/lodash/lang/isArrayLike.d.ts b/types/lodash/lang/isArrayLike.d.ts index edf5e419bd..ee1a12fa2a 100644 --- a/types/lodash/lang/isArrayLike.d.ts +++ b/types/lodash/lang/isArrayLike.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if `value` is array-like. A value is considered array-like if it's diff --git a/types/lodash/lang/isArrayLikeObject.d.ts b/types/lodash/lang/isArrayLikeObject.d.ts index acdc7b9a50..876f626d0d 100644 --- a/types/lodash/lang/isArrayLikeObject.d.ts +++ b/types/lodash/lang/isArrayLikeObject.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.isArrayLike` except that it also checks if `value` diff --git a/types/lodash/lang/isBoolean.d.ts b/types/lodash/lang/isBoolean.d.ts index fea535c696..4b3d4265b7 100644 --- a/types/lodash/lang/isBoolean.d.ts +++ b/types/lodash/lang/isBoolean.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is classified as a boolean primitive or object. diff --git a/types/lodash/lang/isBuffer.d.ts b/types/lodash/lang/isBuffer.d.ts index 333fef2a20..c5f30f41c2 100644 --- a/types/lodash/lang/isBuffer.d.ts +++ b/types/lodash/lang/isBuffer.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is a buffer. diff --git a/types/lodash/lang/isDate.d.ts b/types/lodash/lang/isDate.d.ts index f220b1fa66..32503f88b5 100644 --- a/types/lodash/lang/isDate.d.ts +++ b/types/lodash/lang/isDate.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is classified as a Date object. diff --git a/types/lodash/lang/isElement.d.ts b/types/lodash/lang/isElement.d.ts index 2e0bafd105..65606eba0c 100644 --- a/types/lodash/lang/isElement.d.ts +++ b/types/lodash/lang/isElement.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is a DOM element. diff --git a/types/lodash/lang/isEmpty.d.ts b/types/lodash/lang/isEmpty.d.ts index c19139b8d3..3bb2e6c5b5 100644 --- a/types/lodash/lang/isEmpty.d.ts +++ b/types/lodash/lang/isEmpty.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is empty. A value is considered empty unless it’s an arguments object, array, string, or diff --git a/types/lodash/lang/isEqual.d.ts b/types/lodash/lang/isEqual.d.ts index c8d9449d45..756bb6f2a7 100644 --- a/types/lodash/lang/isEqual.d.ts +++ b/types/lodash/lang/isEqual.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Performs a deep comparison between two values to determine if they are diff --git a/types/lodash/lang/isEqualWith.d.ts b/types/lodash/lang/isEqualWith.d.ts index 8e0e41a52c..7a30842963 100644 --- a/types/lodash/lang/isEqualWith.d.ts +++ b/types/lodash/lang/isEqualWith.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { type IsEqualCustomizer = (value: any, other: any, indexOrKey: PropertyName | undefined, parent: any, otherParent: any, stack: any) => boolean|undefined; interface LoDashStatic { diff --git a/types/lodash/lang/isError.d.ts b/types/lodash/lang/isError.d.ts index a33c934906..83b8f50d68 100644 --- a/types/lodash/lang/isError.d.ts +++ b/types/lodash/lang/isError.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is an Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, or URIError diff --git a/types/lodash/lang/isFinite.d.ts b/types/lodash/lang/isFinite.d.ts index 8fb984b178..60029ad66a 100644 --- a/types/lodash/lang/isFinite.d.ts +++ b/types/lodash/lang/isFinite.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is a finite primitive number. diff --git a/types/lodash/lang/isFunction.d.ts b/types/lodash/lang/isFunction.d.ts index 067da708b3..ef6ccfd491 100644 --- a/types/lodash/lang/isFunction.d.ts +++ b/types/lodash/lang/isFunction.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is a callable function. diff --git a/types/lodash/lang/isInteger.d.ts b/types/lodash/lang/isInteger.d.ts index 125575c051..e733314032 100644 --- a/types/lodash/lang/isInteger.d.ts +++ b/types/lodash/lang/isInteger.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if `value` is an integer. diff --git a/types/lodash/lang/isLength.d.ts b/types/lodash/lang/isLength.d.ts index a0449ef93c..e931991029 100644 --- a/types/lodash/lang/isLength.d.ts +++ b/types/lodash/lang/isLength.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if `value` is a valid array-like length. diff --git a/types/lodash/lang/isMap.d.ts b/types/lodash/lang/isMap.d.ts index 9ce44582a1..6ce1749472 100644 --- a/types/lodash/lang/isMap.d.ts +++ b/types/lodash/lang/isMap.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is classified as a Map object. diff --git a/types/lodash/lang/isMatch.d.ts b/types/lodash/lang/isMatch.d.ts index 199a64c2cd..e2692b12f9 100644 --- a/types/lodash/lang/isMatch.d.ts +++ b/types/lodash/lang/isMatch.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { type isMatchCustomizer = (value: any, other: any, indexOrKey?: PropertyName) => boolean; interface LoDashStatic { diff --git a/types/lodash/lang/isMatchWith.d.ts b/types/lodash/lang/isMatchWith.d.ts index 516b9b9947..336d77835f 100644 --- a/types/lodash/lang/isMatchWith.d.ts +++ b/types/lodash/lang/isMatchWith.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { type isMatchWithCustomizer = (value: any, other: any, indexOrKey: PropertyName) => boolean; interface LoDashStatic { diff --git a/types/lodash/lang/isNaN.d.ts b/types/lodash/lang/isNaN.d.ts index 7ac79bc794..1b4e5a87c4 100644 --- a/types/lodash/lang/isNaN.d.ts +++ b/types/lodash/lang/isNaN.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is NaN. diff --git a/types/lodash/lang/isNative.d.ts b/types/lodash/lang/isNative.d.ts index a1c0e2ff30..eaac7f0a07 100644 --- a/types/lodash/lang/isNative.d.ts +++ b/types/lodash/lang/isNative.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is a native function. diff --git a/types/lodash/lang/isNil.d.ts b/types/lodash/lang/isNil.d.ts index d44c1f3893..bd52380c19 100644 --- a/types/lodash/lang/isNil.d.ts +++ b/types/lodash/lang/isNil.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if `value` is `null` or `undefined`. diff --git a/types/lodash/lang/isNull.d.ts b/types/lodash/lang/isNull.d.ts index 7978835f2d..c6ff509876 100644 --- a/types/lodash/lang/isNull.d.ts +++ b/types/lodash/lang/isNull.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is null. diff --git a/types/lodash/lang/isNumber.d.ts b/types/lodash/lang/isNumber.d.ts index 1bfd01db46..da06964d79 100644 --- a/types/lodash/lang/isNumber.d.ts +++ b/types/lodash/lang/isNumber.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is classified as a Number primitive or object. diff --git a/types/lodash/lang/isObject.d.ts b/types/lodash/lang/isObject.d.ts index c9b47124a0..035b92473a 100644 --- a/types/lodash/lang/isObject.d.ts +++ b/types/lodash/lang/isObject.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is the language type of Object. (e.g. arrays, functions, objects, regexes, new Number(0), diff --git a/types/lodash/lang/isObjectLike.d.ts b/types/lodash/lang/isObjectLike.d.ts index dfb1d20a1a..52d1f8886c 100644 --- a/types/lodash/lang/isObjectLike.d.ts +++ b/types/lodash/lang/isObjectLike.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if `value` is object-like. A value is object-like if it's not `null` diff --git a/types/lodash/lang/isPlainObject.d.ts b/types/lodash/lang/isPlainObject.d.ts index e9708075ef..3e6abd643f 100644 --- a/types/lodash/lang/isPlainObject.d.ts +++ b/types/lodash/lang/isPlainObject.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is a plain object, that is, an object created by the Object constructor or one with a diff --git a/types/lodash/lang/isRegExp.d.ts b/types/lodash/lang/isRegExp.d.ts index 7e60fc4012..b9bd551d0b 100644 --- a/types/lodash/lang/isRegExp.d.ts +++ b/types/lodash/lang/isRegExp.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is classified as a RegExp object. diff --git a/types/lodash/lang/isSafeInteger.d.ts b/types/lodash/lang/isSafeInteger.d.ts index 3c51308410..772c148e7c 100644 --- a/types/lodash/lang/isSafeInteger.d.ts +++ b/types/lodash/lang/isSafeInteger.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 diff --git a/types/lodash/lang/isSet.d.ts b/types/lodash/lang/isSet.d.ts index ae92840e4e..8982636f94 100644 --- a/types/lodash/lang/isSet.d.ts +++ b/types/lodash/lang/isSet.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is classified as a Set object. diff --git a/types/lodash/lang/isString.d.ts b/types/lodash/lang/isString.d.ts index dff362cde4..daf178024a 100644 --- a/types/lodash/lang/isString.d.ts +++ b/types/lodash/lang/isString.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is classified as a String primitive or object. diff --git a/types/lodash/lang/isSymbol.d.ts b/types/lodash/lang/isSymbol.d.ts index cd6c142ea2..d2f6a47445 100644 --- a/types/lodash/lang/isSymbol.d.ts +++ b/types/lodash/lang/isSymbol.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if `value` is classified as a `Symbol` primitive or object. diff --git a/types/lodash/lang/isTypedArray.d.ts b/types/lodash/lang/isTypedArray.d.ts index 29309c7ced..d825531977 100644 --- a/types/lodash/lang/isTypedArray.d.ts +++ b/types/lodash/lang/isTypedArray.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is classified as a typed array. diff --git a/types/lodash/lang/isUndefined.d.ts b/types/lodash/lang/isUndefined.d.ts index 02a5697b74..37383538e8 100644 --- a/types/lodash/lang/isUndefined.d.ts +++ b/types/lodash/lang/isUndefined.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is undefined. diff --git a/types/lodash/lang/isWeakMap.d.ts b/types/lodash/lang/isWeakMap.d.ts index b6f009c535..9123ba2372 100644 --- a/types/lodash/lang/isWeakMap.d.ts +++ b/types/lodash/lang/isWeakMap.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is classified as a WeakMap object. diff --git a/types/lodash/lang/isWeakSet.d.ts b/types/lodash/lang/isWeakSet.d.ts index cb06d4c9b5..f23639aff9 100644 --- a/types/lodash/lang/isWeakSet.d.ts +++ b/types/lodash/lang/isWeakSet.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is classified as a WeakSet object. diff --git a/types/lodash/lang/lt.d.ts b/types/lodash/lang/lt.d.ts index a9ce5e6c4d..c9fda4ce84 100644 --- a/types/lodash/lang/lt.d.ts +++ b/types/lodash/lang/lt.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is less than other. diff --git a/types/lodash/lang/lte.d.ts b/types/lodash/lang/lte.d.ts index b8fac76627..b8969f444d 100644 --- a/types/lodash/lang/lte.d.ts +++ b/types/lodash/lang/lte.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if value is less than or equal to other. diff --git a/types/lodash/lang/toArray.d.ts b/types/lodash/lang/toArray.d.ts index 6dd5ef8e27..2f491b0d2c 100644 --- a/types/lodash/lang/toArray.d.ts +++ b/types/lodash/lang/toArray.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Converts value to an array. diff --git a/types/lodash/lang/toFinite.d.ts b/types/lodash/lang/toFinite.d.ts index 0d14f49715..5520b0c9d9 100644 --- a/types/lodash/lang/toFinite.d.ts +++ b/types/lodash/lang/toFinite.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Converts `value` to a finite number. diff --git a/types/lodash/lang/toInteger.d.ts b/types/lodash/lang/toInteger.d.ts index 7e0b865078..df40d975e6 100644 --- a/types/lodash/lang/toInteger.d.ts +++ b/types/lodash/lang/toInteger.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Converts `value` to an integer. diff --git a/types/lodash/lang/toLength.d.ts b/types/lodash/lang/toLength.d.ts index dcc84d78ee..3d2193e5b4 100644 --- a/types/lodash/lang/toLength.d.ts +++ b/types/lodash/lang/toLength.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Converts `value` to an integer suitable for use as the length of an diff --git a/types/lodash/lang/toNumber.d.ts b/types/lodash/lang/toNumber.d.ts index 76c0032391..a706711f8f 100644 --- a/types/lodash/lang/toNumber.d.ts +++ b/types/lodash/lang/toNumber.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Converts `value` to a number. diff --git a/types/lodash/lang/toPlainObject.d.ts b/types/lodash/lang/toPlainObject.d.ts index 9ae43dcf62..db930b2aec 100644 --- a/types/lodash/lang/toPlainObject.d.ts +++ b/types/lodash/lang/toPlainObject.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Converts value to a plain object flattening inherited enumerable properties of value to own properties diff --git a/types/lodash/lang/toSafeInteger.d.ts b/types/lodash/lang/toSafeInteger.d.ts index 88e517d42c..5d760d3e05 100644 --- a/types/lodash/lang/toSafeInteger.d.ts +++ b/types/lodash/lang/toSafeInteger.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Converts `value` to a safe integer. A safe integer can be compared and diff --git a/types/lodash/lang/toString.d.ts b/types/lodash/lang/toString.d.ts index 1b461d1217..b06cab7017 100644 --- a/types/lodash/lang/toString.d.ts +++ b/types/lodash/lang/toString.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Converts `value` to a string if it's not one. An empty string is returned diff --git a/types/lodash/math/add.d.ts b/types/lodash/math/add.d.ts index 5e026fc671..a70d9a33de 100644 --- a/types/lodash/math/add.d.ts +++ b/types/lodash/math/add.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Adds two numbers. diff --git a/types/lodash/math/ceil.d.ts b/types/lodash/math/ceil.d.ts index 1977160c4e..e85a9c0afa 100644 --- a/types/lodash/math/ceil.d.ts +++ b/types/lodash/math/ceil.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Calculates n rounded up to precision. diff --git a/types/lodash/math/divide.d.ts b/types/lodash/math/divide.d.ts index 5af529f97f..fbebf388f1 100644 --- a/types/lodash/math/divide.d.ts +++ b/types/lodash/math/divide.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Divide two numbers. diff --git a/types/lodash/math/floor.d.ts b/types/lodash/math/floor.d.ts index db8d35def3..29dc3dcb9e 100644 --- a/types/lodash/math/floor.d.ts +++ b/types/lodash/math/floor.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Calculates n rounded down to precision. diff --git a/types/lodash/math/max.d.ts b/types/lodash/math/max.d.ts index 8a6108ab16..1762b6a6d2 100644 --- a/types/lodash/math/max.d.ts +++ b/types/lodash/math/max.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Computes the maximum value of `array`. If `array` is empty or falsey diff --git a/types/lodash/math/maxBy.d.ts b/types/lodash/math/maxBy.d.ts index 1b57efb78c..e8bf5b46ed 100644 --- a/types/lodash/math/maxBy.d.ts +++ b/types/lodash/math/maxBy.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.max` except that it accepts `iteratee` which is diff --git a/types/lodash/math/mean.d.ts b/types/lodash/math/mean.d.ts index ea2f39a952..add23d7813 100644 --- a/types/lodash/math/mean.d.ts +++ b/types/lodash/math/mean.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Computes the mean of the values in `array`. diff --git a/types/lodash/math/meanBy.d.ts b/types/lodash/math/meanBy.d.ts index c3ff1fded4..2efe301eb2 100644 --- a/types/lodash/math/meanBy.d.ts +++ b/types/lodash/math/meanBy.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Computes the mean of the provided propties of the objects in the `array` diff --git a/types/lodash/math/min.d.ts b/types/lodash/math/min.d.ts index 6d0bc8ab60..6b1b5c19c4 100644 --- a/types/lodash/math/min.d.ts +++ b/types/lodash/math/min.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Computes the minimum value of `array`. If `array` is empty or falsey diff --git a/types/lodash/math/minBy.d.ts b/types/lodash/math/minBy.d.ts index 2e70263af8..64d9298336 100644 --- a/types/lodash/math/minBy.d.ts +++ b/types/lodash/math/minBy.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.min` except that it accepts `iteratee` which is diff --git a/types/lodash/math/multiply.d.ts b/types/lodash/math/multiply.d.ts index 6381b4f2d8..a1bbec12e5 100644 --- a/types/lodash/math/multiply.d.ts +++ b/types/lodash/math/multiply.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Multiply two numbers. diff --git a/types/lodash/math/round.d.ts b/types/lodash/math/round.d.ts index b3bc0dcaa1..3030cb33e6 100644 --- a/types/lodash/math/round.d.ts +++ b/types/lodash/math/round.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Calculates n rounded to precision. diff --git a/types/lodash/math/subtract.d.ts b/types/lodash/math/subtract.d.ts index 0c1ddabcca..68e98cfb85 100644 --- a/types/lodash/math/subtract.d.ts +++ b/types/lodash/math/subtract.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Subtract two numbers. diff --git a/types/lodash/math/sum.d.ts b/types/lodash/math/sum.d.ts index de92ef1f0d..ad20bf0768 100644 --- a/types/lodash/math/sum.d.ts +++ b/types/lodash/math/sum.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Computes the sum of the values in `array`. diff --git a/types/lodash/math/sumBy.d.ts b/types/lodash/math/sumBy.d.ts index 05e836325a..f811b018b9 100644 --- a/types/lodash/math/sumBy.d.ts +++ b/types/lodash/math/sumBy.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.sum` except that it accepts `iteratee` which is diff --git a/types/lodash/number/clamp.d.ts b/types/lodash/number/clamp.d.ts index e7aff8c4ae..6d5926fe9e 100644 --- a/types/lodash/number/clamp.d.ts +++ b/types/lodash/number/clamp.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Clamps `number` within the inclusive `lower` and `upper` bounds. diff --git a/types/lodash/number/inRange.d.ts b/types/lodash/number/inRange.d.ts index 0e3fd3ed8e..26ddbdfb33 100644 --- a/types/lodash/number/inRange.d.ts +++ b/types/lodash/number/inRange.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if n is between start and up to but not including, end. If end is not specified it’s set to start diff --git a/types/lodash/number/random.d.ts b/types/lodash/number/random.d.ts index 112e579896..a33f964b5e 100644 --- a/types/lodash/number/random.d.ts +++ b/types/lodash/number/random.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Produces a random number between min and max (inclusive). If only one argument is provided a number between diff --git a/types/lodash/object/assign.d.ts b/types/lodash/object/assign.d.ts index e329c27ab5..97cb5e24f3 100644 --- a/types/lodash/object/assign.d.ts +++ b/types/lodash/object/assign.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Assigns own enumerable properties of source objects to the destination diff --git a/types/lodash/object/assignIn.d.ts b/types/lodash/object/assignIn.d.ts index a5981e75a0..f8a42562f6 100644 --- a/types/lodash/object/assignIn.d.ts +++ b/types/lodash/object/assignIn.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.assign` except that it iterates over own and diff --git a/types/lodash/object/assignInWith.d.ts b/types/lodash/object/assignInWith.d.ts index 85a6311cda..854c10d71b 100644 --- a/types/lodash/object/assignInWith.d.ts +++ b/types/lodash/object/assignInWith.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { type AssignCustomizer = (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any; interface LoDashStatic { diff --git a/types/lodash/object/assignWith.d.ts b/types/lodash/object/assignWith.d.ts index e31cd8d9bc..9fc432dec2 100644 --- a/types/lodash/object/assignWith.d.ts +++ b/types/lodash/object/assignWith.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.assign` except that it accepts `customizer` which diff --git a/types/lodash/object/at.d.ts b/types/lodash/object/at.d.ts index d6046e597d..a6d0dbb9c2 100644 --- a/types/lodash/object/at.d.ts +++ b/types/lodash/object/at.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an array of elements corresponding to the given keys, or indexes, of collection. Keys may be diff --git a/types/lodash/object/create.d.ts b/types/lodash/object/create.d.ts index 025b4dbe66..de9d3bebb4 100644 --- a/types/lodash/object/create.d.ts +++ b/types/lodash/object/create.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an object that inherits from the given prototype object. If a properties object is provided its own diff --git a/types/lodash/object/defaults.d.ts b/types/lodash/object/defaults.d.ts index ea53dbddc5..6c3f957870 100644 --- a/types/lodash/object/defaults.d.ts +++ b/types/lodash/object/defaults.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Assigns own enumerable properties of source object(s) to the destination object for all destination diff --git a/types/lodash/object/defaultsDeep.d.ts b/types/lodash/object/defaultsDeep.d.ts index 89ba6b9b7e..c7eb226d09 100644 --- a/types/lodash/object/defaultsDeep.d.ts +++ b/types/lodash/object/defaultsDeep.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like _.defaults except that it recursively assigns default properties. diff --git a/types/lodash/object/entries.d.ts b/types/lodash/object/entries.d.ts index fee39417ae..4502486a2c 100644 --- a/types/lodash/object/entries.d.ts +++ b/types/lodash/object/entries.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * @see _.toPairs diff --git a/types/lodash/object/entriesIn.d.ts b/types/lodash/object/entriesIn.d.ts index 8df728058d..3af8c419b9 100644 --- a/types/lodash/object/entriesIn.d.ts +++ b/types/lodash/object/entriesIn.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * @see _.entriesIn diff --git a/types/lodash/object/extend.d.ts b/types/lodash/object/extend.d.ts index 17ce0232fa..d2a2075ee7 100644 --- a/types/lodash/object/extend.d.ts +++ b/types/lodash/object/extend.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * @see _.extend diff --git a/types/lodash/object/extendWith.d.ts b/types/lodash/object/extendWith.d.ts index d02803cf32..49f72f4f8d 100644 --- a/types/lodash/object/extendWith.d.ts +++ b/types/lodash/object/extendWith.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * @see _.extendWith diff --git a/types/lodash/object/findKey.d.ts b/types/lodash/object/findKey.d.ts index 768c8aa3aa..6bba2b2e5c 100644 --- a/types/lodash/object/findKey.d.ts +++ b/types/lodash/object/findKey.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like _.find except that it returns the key of the first element predicate returns truthy for diff --git a/types/lodash/object/findLastKey.d.ts b/types/lodash/object/findLastKey.d.ts index e772dc3f80..8337b89fe3 100644 --- a/types/lodash/object/findLastKey.d.ts +++ b/types/lodash/object/findLastKey.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like _.findKey except that it iterates over elements of a collection in the opposite order. diff --git a/types/lodash/object/forIn.d.ts b/types/lodash/object/forIn.d.ts index a5e700aa22..6c18877b83 100644 --- a/types/lodash/object/forIn.d.ts +++ b/types/lodash/object/forIn.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Iterates over own and inherited enumerable properties of an object invoking iteratee for each property. The diff --git a/types/lodash/object/forInRight.d.ts b/types/lodash/object/forInRight.d.ts index 98506ebc4e..67d11d6a7a 100644 --- a/types/lodash/object/forInRight.d.ts +++ b/types/lodash/object/forInRight.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like _.forIn except that it iterates over properties of object in the opposite order. diff --git a/types/lodash/object/forOwn.d.ts b/types/lodash/object/forOwn.d.ts index 84b389080f..349d7b1125 100644 --- a/types/lodash/object/forOwn.d.ts +++ b/types/lodash/object/forOwn.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Iterates over own enumerable properties of an object invoking iteratee for each property. The iteratee is diff --git a/types/lodash/object/forOwnRight.d.ts b/types/lodash/object/forOwnRight.d.ts index fc8160edff..20a19c4dbe 100644 --- a/types/lodash/object/forOwnRight.d.ts +++ b/types/lodash/object/forOwnRight.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like _.forOwn except that it iterates over properties of object in the opposite order. diff --git a/types/lodash/object/functions.d.ts b/types/lodash/object/functions.d.ts index 9871ffdc81..d0d61b11ce 100644 --- a/types/lodash/object/functions.d.ts +++ b/types/lodash/object/functions.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an array of function property names from own enumerable properties diff --git a/types/lodash/object/functionsIn.d.ts b/types/lodash/object/functionsIn.d.ts index 959f05743b..7c174e97bf 100644 --- a/types/lodash/object/functionsIn.d.ts +++ b/types/lodash/object/functionsIn.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an array of function property names from own and inherited diff --git a/types/lodash/object/get.d.ts b/types/lodash/object/get.d.ts index 957eaf716e..eccc827a1b 100644 --- a/types/lodash/object/get.d.ts +++ b/types/lodash/object/get.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Gets the property value at path of object. If the resolved value is undefined the defaultValue is used diff --git a/types/lodash/object/has.d.ts b/types/lodash/object/has.d.ts index b8dc9ffc4d..ac2bc73200 100644 --- a/types/lodash/object/has.d.ts +++ b/types/lodash/object/has.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if `path` is a direct property of `object`. diff --git a/types/lodash/object/hasIn.d.ts b/types/lodash/object/hasIn.d.ts index 58917bdb19..ca51bf4e38 100644 --- a/types/lodash/object/hasIn.d.ts +++ b/types/lodash/object/hasIn.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if `path` is a direct or inherited property of `object`. diff --git a/types/lodash/object/invert.d.ts b/types/lodash/object/invert.d.ts index 8bb5d784ed..86cc3ff90b 100644 --- a/types/lodash/object/invert.d.ts +++ b/types/lodash/object/invert.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an object composed of the inverted keys and values of object. If object contains duplicate values, diff --git a/types/lodash/object/invertBy.d.ts b/types/lodash/object/invertBy.d.ts index 3feb6ee0b6..41e8f27e41 100644 --- a/types/lodash/object/invertBy.d.ts +++ b/types/lodash/object/invertBy.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like _.invert except that the inverted object is generated from the results of running each diff --git a/types/lodash/object/invoke.d.ts b/types/lodash/object/invoke.d.ts index 2e5f9970c3..1bf2494996 100644 --- a/types/lodash/object/invoke.d.ts +++ b/types/lodash/object/invoke.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Invokes the method at path of object. diff --git a/types/lodash/object/keys.d.ts b/types/lodash/object/keys.d.ts index 14a5f41b94..fa3afc080f 100644 --- a/types/lodash/object/keys.d.ts +++ b/types/lodash/object/keys.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an array of the own enumerable property names of object. diff --git a/types/lodash/object/keysIn.d.ts b/types/lodash/object/keysIn.d.ts index c0c1210c02..b00679e3c9 100644 --- a/types/lodash/object/keysIn.d.ts +++ b/types/lodash/object/keysIn.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an array of the own and inherited enumerable property names of object. diff --git a/types/lodash/object/mapKeys.d.ts b/types/lodash/object/mapKeys.d.ts index 992b0e3026..d2f55d4164 100644 --- a/types/lodash/object/mapKeys.d.ts +++ b/types/lodash/object/mapKeys.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * The opposite of _.mapValues; this method creates an object with the same values as object and keys generated diff --git a/types/lodash/object/mapValues.d.ts b/types/lodash/object/mapValues.d.ts index 94c97417f4..e924d11ed8 100644 --- a/types/lodash/object/mapValues.d.ts +++ b/types/lodash/object/mapValues.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an object with the same keys as object and values generated by running each own diff --git a/types/lodash/object/merge.d.ts b/types/lodash/object/merge.d.ts index 1136f2d9bb..5e9daf0de4 100644 --- a/types/lodash/object/merge.d.ts +++ b/types/lodash/object/merge.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Recursively merges own and inherited enumerable properties of source diff --git a/types/lodash/object/mergeWith.d.ts b/types/lodash/object/mergeWith.d.ts index 2f568e67db..d5aae75b58 100644 --- a/types/lodash/object/mergeWith.d.ts +++ b/types/lodash/object/mergeWith.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { type MergeWithCustomizer = { bivariantHack(value: any, srcValue: any, key: string, object: any, source: any): any; }["bivariantHack"] interface LoDashStatic { diff --git a/types/lodash/object/omit.d.ts b/types/lodash/object/omit.d.ts index ae9890f7d9..f1063681eb 100644 --- a/types/lodash/object/omit.d.ts +++ b/types/lodash/object/omit.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * The opposite of `_.pick`; this method creates an object composed of the diff --git a/types/lodash/object/omitBy.d.ts b/types/lodash/object/omitBy.d.ts index 0f5018e32b..233844f7e9 100644 --- a/types/lodash/object/omitBy.d.ts +++ b/types/lodash/object/omitBy.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * The opposite of `_.pickBy`; this method creates an object composed of the diff --git a/types/lodash/object/pick.d.ts b/types/lodash/object/pick.d.ts index d20f7b9ae4..7b80232757 100644 --- a/types/lodash/object/pick.d.ts +++ b/types/lodash/object/pick.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an object composed of the picked `object` properties. diff --git a/types/lodash/object/pickBy.d.ts b/types/lodash/object/pickBy.d.ts index 7e1edefd77..02a6081a44 100644 --- a/types/lodash/object/pickBy.d.ts +++ b/types/lodash/object/pickBy.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an object composed of the `object` properties `predicate` returns diff --git a/types/lodash/object/result.d.ts b/types/lodash/object/result.d.ts index a8ec08387d..8853524573 100644 --- a/types/lodash/object/result.d.ts +++ b/types/lodash/object/result.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like _.get except that if the resolved value is a function it’s invoked with the this binding diff --git a/types/lodash/object/set.d.ts b/types/lodash/object/set.d.ts index 38a7442807..cafb3ea129 100644 --- a/types/lodash/object/set.d.ts +++ b/types/lodash/object/set.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Sets the value at path of object. If a portion of path doesn’t exist it’s created. Arrays are created for diff --git a/types/lodash/object/setWith.d.ts b/types/lodash/object/setWith.d.ts index b57b8ebcb3..b3cf149179 100644 --- a/types/lodash/object/setWith.d.ts +++ b/types/lodash/object/setWith.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { type SetWithCustomizer = (nsValue: any, key: string, nsObject: T) => any; interface LoDashStatic { diff --git a/types/lodash/object/toPairs.d.ts b/types/lodash/object/toPairs.d.ts index d1b6fe86d4..c78a44787f 100644 --- a/types/lodash/object/toPairs.d.ts +++ b/types/lodash/object/toPairs.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an array of own enumerable key-value pairs for object. diff --git a/types/lodash/object/toPairsIn.d.ts b/types/lodash/object/toPairsIn.d.ts index 832fab7050..da44734c00 100644 --- a/types/lodash/object/toPairsIn.d.ts +++ b/types/lodash/object/toPairsIn.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an array of own and inherited enumerable key-value pairs for object. diff --git a/types/lodash/object/transform.d.ts b/types/lodash/object/transform.d.ts index 1f8f4e9a48..478fedeee0 100644 --- a/types/lodash/object/transform.d.ts +++ b/types/lodash/object/transform.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * An alternative to _.reduce; this method transforms object to a new accumulator object which is the result of diff --git a/types/lodash/object/unset.d.ts b/types/lodash/object/unset.d.ts index 4bbdc0593b..c427702ae8 100644 --- a/types/lodash/object/unset.d.ts +++ b/types/lodash/object/unset.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Removes the property at path of object. diff --git a/types/lodash/object/update.d.ts b/types/lodash/object/update.d.ts index fd612dc970..4baf00bbf3 100644 --- a/types/lodash/object/update.d.ts +++ b/types/lodash/object/update.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like _.set except that accepts updater to produce the value to set. Use _.updateWith to diff --git a/types/lodash/object/updateWith.d.ts b/types/lodash/object/updateWith.d.ts index 5b51ce4554..db5f4ffa2f 100644 --- a/types/lodash/object/updateWith.d.ts +++ b/types/lodash/object/updateWith.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.update` except that it accepts `customizer` which is diff --git a/types/lodash/object/values.d.ts b/types/lodash/object/values.d.ts index 743157cdf0..47be1f0661 100644 --- a/types/lodash/object/values.d.ts +++ b/types/lodash/object/values.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an array of the own enumerable property values of object. diff --git a/types/lodash/object/valuesIn.d.ts b/types/lodash/object/valuesIn.d.ts index a5e2bacc57..17100b8fc8 100644 --- a/types/lodash/object/valuesIn.d.ts +++ b/types/lodash/object/valuesIn.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an array of the own and inherited enumerable property values of object. diff --git a/types/lodash/seq/chain.d.ts b/types/lodash/seq/chain.d.ts index 5c45689b0e..e43c2b8c3d 100644 --- a/types/lodash/seq/chain.d.ts +++ b/types/lodash/seq/chain.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a lodash object that wraps value with explicit method chaining enabled. diff --git a/types/lodash/seq/prototype.at.d.ts b/types/lodash/seq/prototype.at.d.ts index 09b4fd5bc2..680ad3084a 100644 --- a/types/lodash/seq/prototype.at.d.ts +++ b/types/lodash/seq/prototype.at.d.ts @@ -1,4 +1,5 @@ -// declare namespace _ { +// import * as _ from ".."; +// declare module ".." { // interface LoDashWrapper { // /** // * This method is the wrapper version of _.at. diff --git a/types/lodash/seq/prototype.chain.d.ts b/types/lodash/seq/prototype.chain.d.ts index 5c45689b0e..e43c2b8c3d 100644 --- a/types/lodash/seq/prototype.chain.d.ts +++ b/types/lodash/seq/prototype.chain.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a lodash object that wraps value with explicit method chaining enabled. diff --git a/types/lodash/seq/prototype.commit.d.ts b/types/lodash/seq/prototype.commit.d.ts index b8eab97095..ebcc6ba9db 100644 --- a/types/lodash/seq/prototype.commit.d.ts +++ b/types/lodash/seq/prototype.commit.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashWrapper { /** * Executes the chained sequence and returns the wrapped result. diff --git a/types/lodash/seq/prototype.plant.d.ts b/types/lodash/seq/prototype.plant.d.ts index a419a750d9..f46a31cf7f 100644 --- a/types/lodash/seq/prototype.plant.d.ts +++ b/types/lodash/seq/prototype.plant.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashImplicitWrapper { /** * Creates a clone of the chained sequence planting value as the wrapped value. diff --git a/types/lodash/seq/prototype.reverse.d.ts b/types/lodash/seq/prototype.reverse.d.ts index dd72272798..ee50e9e981 100644 --- a/types/lodash/seq/prototype.reverse.d.ts +++ b/types/lodash/seq/prototype.reverse.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashWrapper { /** * Reverses the wrapped array so the first element becomes the last, the second element becomes the second to diff --git a/types/lodash/seq/prototype.toJSON.d.ts b/types/lodash/seq/prototype.toJSON.d.ts index 08e39d5558..444bb0ca42 100644 --- a/types/lodash/seq/prototype.toJSON.d.ts +++ b/types/lodash/seq/prototype.toJSON.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashWrapper { /** * @see _.value diff --git a/types/lodash/seq/prototype.toString.d.ts b/types/lodash/seq/prototype.toString.d.ts index 5672a08667..f13982e66d 100644 --- a/types/lodash/seq/prototype.toString.d.ts +++ b/types/lodash/seq/prototype.toString.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashWrapper { /** * Produces the result of coercing the unwrapped value to a string. diff --git a/types/lodash/seq/prototype.value.d.ts b/types/lodash/seq/prototype.value.d.ts index 87caa46350..1c17d98798 100644 --- a/types/lodash/seq/prototype.value.d.ts +++ b/types/lodash/seq/prototype.value.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashWrapper { /** * Executes the chained sequence to extract the unwrapped value. diff --git a/types/lodash/seq/prototype.valueOf.d.ts b/types/lodash/seq/prototype.valueOf.d.ts index bfb28cbf67..29c4d0800c 100644 --- a/types/lodash/seq/prototype.valueOf.d.ts +++ b/types/lodash/seq/prototype.valueOf.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashWrapper { /** * @see _.value diff --git a/types/lodash/seq/tap.d.ts b/types/lodash/seq/tap.d.ts index 82902562ff..71d673f4a7 100644 --- a/types/lodash/seq/tap.d.ts +++ b/types/lodash/seq/tap.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method invokes interceptor and returns value. The interceptor is bound to thisArg and invoked with one diff --git a/types/lodash/seq/thru.d.ts b/types/lodash/seq/thru.d.ts index 3db6385be9..c7e5f93859 100644 --- a/types/lodash/seq/thru.d.ts +++ b/types/lodash/seq/thru.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like _.tap except that it returns the result of interceptor. diff --git a/types/lodash/string/camelCase.d.ts b/types/lodash/string/camelCase.d.ts index e6ad01c9c9..ab165051c7 100644 --- a/types/lodash/string/camelCase.d.ts +++ b/types/lodash/string/camelCase.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Converts string to camel case. diff --git a/types/lodash/string/capitalize.d.ts b/types/lodash/string/capitalize.d.ts index 41f2a7e935..01beee0dcd 100644 --- a/types/lodash/string/capitalize.d.ts +++ b/types/lodash/string/capitalize.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Converts the first character of string to upper case and the remaining to lower case. diff --git a/types/lodash/string/deburr.d.ts b/types/lodash/string/deburr.d.ts index a0e89c64e7..bba29e403b 100644 --- a/types/lodash/string/deburr.d.ts +++ b/types/lodash/string/deburr.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Deburrs string by converting latin-1 supplementary letters to basic latin letters and removing combining diff --git a/types/lodash/string/endsWith.d.ts b/types/lodash/string/endsWith.d.ts index d8f76a0178..cf6b5c39a7 100644 --- a/types/lodash/string/endsWith.d.ts +++ b/types/lodash/string/endsWith.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if string ends with the given target string. diff --git a/types/lodash/string/escape.d.ts b/types/lodash/string/escape.d.ts index e18f0675be..23201415fb 100644 --- a/types/lodash/string/escape.d.ts +++ b/types/lodash/string/escape.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Converts the characters "&", "<", ">", '"', "'", and "`" in string to their corresponding HTML entities. diff --git a/types/lodash/string/escapeRegExp.d.ts b/types/lodash/string/escapeRegExp.d.ts index f8e3790952..e73c5ad6fc 100644 --- a/types/lodash/string/escapeRegExp.d.ts +++ b/types/lodash/string/escapeRegExp.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Escapes the RegExp special characters "^", "$", "\", ".", "*", "+", "?", "(", ")", "[", "]", diff --git a/types/lodash/string/kebabCase.d.ts b/types/lodash/string/kebabCase.d.ts index 00b9fd8421..485d10a6c4 100644 --- a/types/lodash/string/kebabCase.d.ts +++ b/types/lodash/string/kebabCase.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Converts string to kebab case. diff --git a/types/lodash/string/lowerCase.d.ts b/types/lodash/string/lowerCase.d.ts index f71af2638b..7e25820834 100644 --- a/types/lodash/string/lowerCase.d.ts +++ b/types/lodash/string/lowerCase.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Converts `string`, as space separated words, to lower case. diff --git a/types/lodash/string/lowerFirst.d.ts b/types/lodash/string/lowerFirst.d.ts index 323367c7ef..7c1cdbf8dc 100644 --- a/types/lodash/string/lowerFirst.d.ts +++ b/types/lodash/string/lowerFirst.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Converts the first character of `string` to lower case. diff --git a/types/lodash/string/pad.d.ts b/types/lodash/string/pad.d.ts index 97b2cef838..aedae7bd4e 100644 --- a/types/lodash/string/pad.d.ts +++ b/types/lodash/string/pad.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Pads string on the left and right sides if it’s shorter than length. Padding characters are truncated if diff --git a/types/lodash/string/padEnd.d.ts b/types/lodash/string/padEnd.d.ts index c9072bb59c..cd6458d0a6 100644 --- a/types/lodash/string/padEnd.d.ts +++ b/types/lodash/string/padEnd.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Pads string on the right side if it’s shorter than length. Padding characters are truncated if they exceed diff --git a/types/lodash/string/padStart.d.ts b/types/lodash/string/padStart.d.ts index fff4aaf566..8005047b49 100644 --- a/types/lodash/string/padStart.d.ts +++ b/types/lodash/string/padStart.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Pads string on the left side if it’s shorter than length. Padding characters are truncated if they exceed diff --git a/types/lodash/string/parseInt.d.ts b/types/lodash/string/parseInt.d.ts index d481c1d750..7606d7bf25 100644 --- a/types/lodash/string/parseInt.d.ts +++ b/types/lodash/string/parseInt.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Converts string to an integer of the specified radix. If radix is undefined or 0, a radix of 10 is used diff --git a/types/lodash/string/repeat.d.ts b/types/lodash/string/repeat.d.ts index ae965cf86b..86c5af54db 100644 --- a/types/lodash/string/repeat.d.ts +++ b/types/lodash/string/repeat.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Repeats the given string n times. diff --git a/types/lodash/string/replace.d.ts b/types/lodash/string/replace.d.ts index d980e59b1d..70c75e4bf5 100644 --- a/types/lodash/string/replace.d.ts +++ b/types/lodash/string/replace.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Replaces matches for pattern in string with replacement. diff --git a/types/lodash/string/snakeCase.d.ts b/types/lodash/string/snakeCase.d.ts index a38f964fa0..38004ae356 100644 --- a/types/lodash/string/snakeCase.d.ts +++ b/types/lodash/string/snakeCase.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Converts string to snake case. diff --git a/types/lodash/string/split.d.ts b/types/lodash/string/split.d.ts index 43416dcf87..d8580c3a90 100644 --- a/types/lodash/string/split.d.ts +++ b/types/lodash/string/split.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Splits string by separator. diff --git a/types/lodash/string/startCase.d.ts b/types/lodash/string/startCase.d.ts index 6b053c48bd..7480e3d2e8 100644 --- a/types/lodash/string/startCase.d.ts +++ b/types/lodash/string/startCase.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Converts string to start case. diff --git a/types/lodash/string/startsWith.d.ts b/types/lodash/string/startsWith.d.ts index 8bd9a63d13..754e5d5654 100644 --- a/types/lodash/string/startsWith.d.ts +++ b/types/lodash/string/startsWith.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks if string starts with the given target string. diff --git a/types/lodash/string/template.d.ts b/types/lodash/string/template.d.ts index 5ad7c00921..e0e7130391 100644 --- a/types/lodash/string/template.d.ts +++ b/types/lodash/string/template.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface TemplateOptions extends TemplateSettings { /** * The sourceURL of the template's compiled source. diff --git a/types/lodash/string/toLower.d.ts b/types/lodash/string/toLower.d.ts index 4db3f2f585..b3346378f9 100644 --- a/types/lodash/string/toLower.d.ts +++ b/types/lodash/string/toLower.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Converts `string`, as a whole, to lower case. diff --git a/types/lodash/string/toUpper.d.ts b/types/lodash/string/toUpper.d.ts index 6ebd95081f..f02ba29071 100644 --- a/types/lodash/string/toUpper.d.ts +++ b/types/lodash/string/toUpper.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Converts `string`, as a whole, to upper case. diff --git a/types/lodash/string/trim.d.ts b/types/lodash/string/trim.d.ts index f154162543..308f9f3698 100644 --- a/types/lodash/string/trim.d.ts +++ b/types/lodash/string/trim.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Removes leading and trailing whitespace or specified characters from string. diff --git a/types/lodash/string/trimEnd.d.ts b/types/lodash/string/trimEnd.d.ts index ae83e6641d..a99de64ec6 100644 --- a/types/lodash/string/trimEnd.d.ts +++ b/types/lodash/string/trimEnd.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Removes trailing whitespace or specified characters from string. diff --git a/types/lodash/string/trimStart.d.ts b/types/lodash/string/trimStart.d.ts index 3ce788f055..3856a8c8bd 100644 --- a/types/lodash/string/trimStart.d.ts +++ b/types/lodash/string/trimStart.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Removes leading whitespace or specified characters from string. diff --git a/types/lodash/string/truncate.d.ts b/types/lodash/string/truncate.d.ts index 041ee6223b..87ebb67851 100644 --- a/types/lodash/string/truncate.d.ts +++ b/types/lodash/string/truncate.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface TruncateOptions { /** The maximum string length. */ length?: number; diff --git a/types/lodash/string/unescape.d.ts b/types/lodash/string/unescape.d.ts index f8f77bacd0..041939efd2 100644 --- a/types/lodash/string/unescape.d.ts +++ b/types/lodash/string/unescape.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * The inverse of _.escape; this method converts the HTML entities &, <, >, ", ', and ` diff --git a/types/lodash/string/upperCase.d.ts b/types/lodash/string/upperCase.d.ts index 5377337f0e..ea1f7e51ac 100644 --- a/types/lodash/string/upperCase.d.ts +++ b/types/lodash/string/upperCase.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Converts `string`, as space separated words, to upper case. diff --git a/types/lodash/string/upperFirst.d.ts b/types/lodash/string/upperFirst.d.ts index 38f88a7e94..5a19bce003 100644 --- a/types/lodash/string/upperFirst.d.ts +++ b/types/lodash/string/upperFirst.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Converts the first character of `string` to upper case. diff --git a/types/lodash/string/words.d.ts b/types/lodash/string/words.d.ts index 11fa80ee62..84c10b3a93 100644 --- a/types/lodash/string/words.d.ts +++ b/types/lodash/string/words.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Splits `string` into an array of its words. diff --git a/types/lodash/util/attempt.d.ts b/types/lodash/util/attempt.d.ts index 70651b722d..71550ac30c 100644 --- a/types/lodash/util/attempt.d.ts +++ b/types/lodash/util/attempt.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Attempts to invoke func, returning either the result or the caught error object. Any additional arguments diff --git a/types/lodash/util/bindAll.d.ts b/types/lodash/util/bindAll.d.ts index 78b9726e63..f6824149a5 100644 --- a/types/lodash/util/bindAll.d.ts +++ b/types/lodash/util/bindAll.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Binds methods of an object to the object itself, overwriting the existing method. Method names may be diff --git a/types/lodash/util/cond.d.ts b/types/lodash/util/cond.d.ts index 92f5285d43..42ee3ef37a 100644 --- a/types/lodash/util/cond.d.ts +++ b/types/lodash/util/cond.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a function that iterates over `pairs` and invokes the corresponding diff --git a/types/lodash/util/conforms.d.ts b/types/lodash/util/conforms.d.ts index 60887c45ad..ccaa952c4c 100644 --- a/types/lodash/util/conforms.d.ts +++ b/types/lodash/util/conforms.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { type ConformsPredicateObject = { [P in keyof T]?: (val: T[P]) => boolean; }; diff --git a/types/lodash/util/constant.d.ts b/types/lodash/util/constant.d.ts index 1083d4e460..b9557b21c0 100644 --- a/types/lodash/util/constant.d.ts +++ b/types/lodash/util/constant.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a function that returns value. diff --git a/types/lodash/util/defaultTo.d.ts b/types/lodash/util/defaultTo.d.ts index 3bc4810f1b..26267f8880 100644 --- a/types/lodash/util/defaultTo.d.ts +++ b/types/lodash/util/defaultTo.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Checks `value` to determine whether a default value should be returned in diff --git a/types/lodash/util/flow.d.ts b/types/lodash/util/flow.d.ts index 90837be794..d9845ccb38 100644 --- a/types/lodash/util/flow.d.ts +++ b/types/lodash/util/flow.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a function that returns the result of invoking the provided functions with the this binding of the diff --git a/types/lodash/util/flowRight.d.ts b/types/lodash/util/flowRight.d.ts index d0a2faaa9f..6e7aca9d16 100644 --- a/types/lodash/util/flowRight.d.ts +++ b/types/lodash/util/flowRight.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like _.flow except that it creates a function that invokes the provided functions from right diff --git a/types/lodash/util/identity.d.ts b/types/lodash/util/identity.d.ts index 18ade4c0cf..cd2b0ee673 100644 --- a/types/lodash/util/identity.d.ts +++ b/types/lodash/util/identity.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method returns the first argument provided to it. diff --git a/types/lodash/util/iteratee.d.ts b/types/lodash/util/iteratee.d.ts index 1777690492..86dcdbb643 100644 --- a/types/lodash/util/iteratee.d.ts +++ b/types/lodash/util/iteratee.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a function that invokes `func` with the arguments of the created diff --git a/types/lodash/util/matches.d.ts b/types/lodash/util/matches.d.ts index fb69121a13..f3c99ada39 100644 --- a/types/lodash/util/matches.d.ts +++ b/types/lodash/util/matches.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a function that performs a deep comparison between a given object and source, returning true if the diff --git a/types/lodash/util/matchesProperty.d.ts b/types/lodash/util/matchesProperty.d.ts index 36c64e4d7e..e1d8cdb102 100644 --- a/types/lodash/util/matchesProperty.d.ts +++ b/types/lodash/util/matchesProperty.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a function that compares the property value of path on a given object to value. diff --git a/types/lodash/util/method.d.ts b/types/lodash/util/method.d.ts index 7377b17a60..e0dbafe39f 100644 --- a/types/lodash/util/method.d.ts +++ b/types/lodash/util/method.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a function that invokes the method at path on a given object. Any additional arguments are provided diff --git a/types/lodash/util/methodOf.d.ts b/types/lodash/util/methodOf.d.ts index 52d7343be5..710f15a387 100644 --- a/types/lodash/util/methodOf.d.ts +++ b/types/lodash/util/methodOf.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * The opposite of _.method; this method creates a function that invokes the method at a given path on object. diff --git a/types/lodash/util/mixin.d.ts b/types/lodash/util/mixin.d.ts index 01590b1929..62999a9c87 100644 --- a/types/lodash/util/mixin.d.ts +++ b/types/lodash/util/mixin.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface MixinOptions { chain?: boolean; } diff --git a/types/lodash/util/noConflict.d.ts b/types/lodash/util/noConflict.d.ts index d27b76819d..78fc008a08 100644 --- a/types/lodash/util/noConflict.d.ts +++ b/types/lodash/util/noConflict.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Reverts the _ variable to its previous value and returns a reference to the lodash function. diff --git a/types/lodash/util/noop.d.ts b/types/lodash/util/noop.d.ts index a17e537d98..5b8d99bccb 100644 --- a/types/lodash/util/noop.d.ts +++ b/types/lodash/util/noop.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * A no-operation function that returns undefined regardless of the arguments it receives. diff --git a/types/lodash/util/nthArg.d.ts b/types/lodash/util/nthArg.d.ts index d6b7b5a026..c3f0d3730f 100644 --- a/types/lodash/util/nthArg.d.ts +++ b/types/lodash/util/nthArg.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a function that returns its nth argument. diff --git a/types/lodash/util/over.d.ts b/types/lodash/util/over.d.ts index 87b323c4b4..ca724a3635 100644 --- a/types/lodash/util/over.d.ts +++ b/types/lodash/util/over.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a function that invokes iteratees with the arguments provided to the created function and returns diff --git a/types/lodash/util/overEvery.d.ts b/types/lodash/util/overEvery.d.ts index b0f6275b4e..e973872866 100644 --- a/types/lodash/util/overEvery.d.ts +++ b/types/lodash/util/overEvery.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a function that checks if all of the predicates return truthy when invoked with the arguments diff --git a/types/lodash/util/overSome.d.ts b/types/lodash/util/overSome.d.ts index 8574eb8f49..c14ece136c 100644 --- a/types/lodash/util/overSome.d.ts +++ b/types/lodash/util/overSome.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a function that checks if any of the predicates return truthy when invoked with the arguments diff --git a/types/lodash/util/property.d.ts b/types/lodash/util/property.d.ts index 72d1d8511b..3f83ec02f7 100644 --- a/types/lodash/util/property.d.ts +++ b/types/lodash/util/property.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates a function that returns the property value at path on a given object. diff --git a/types/lodash/util/propertyOf.d.ts b/types/lodash/util/propertyOf.d.ts index a904424d70..52e081a70c 100644 --- a/types/lodash/util/propertyOf.d.ts +++ b/types/lodash/util/propertyOf.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * The opposite of _.property; this method creates a function that returns the property value at a given path diff --git a/types/lodash/util/range.d.ts b/types/lodash/util/range.d.ts index ebd8266e4c..b5617c07c0 100644 --- a/types/lodash/util/range.d.ts +++ b/types/lodash/util/range.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end. diff --git a/types/lodash/util/rangeRight.d.ts b/types/lodash/util/rangeRight.d.ts index 119aa7d7aa..b61e996eab 100644 --- a/types/lodash/util/rangeRight.d.ts +++ b/types/lodash/util/rangeRight.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method is like `_.range` except that it populates values in diff --git a/types/lodash/util/runInContext.d.ts b/types/lodash/util/runInContext.d.ts index 5c8acfb592..8deffaff4e 100644 --- a/types/lodash/util/runInContext.d.ts +++ b/types/lodash/util/runInContext.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Create a new pristine lodash function using the given context object. diff --git a/types/lodash/util/stubArray.d.ts b/types/lodash/util/stubArray.d.ts index ef5f8d32a1..c67fd54766 100644 --- a/types/lodash/util/stubArray.d.ts +++ b/types/lodash/util/stubArray.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method returns a new empty array. diff --git a/types/lodash/util/stubFalse.d.ts b/types/lodash/util/stubFalse.d.ts index eaea1c9a48..84fb6d4de2 100644 --- a/types/lodash/util/stubFalse.d.ts +++ b/types/lodash/util/stubFalse.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method returns `false`. diff --git a/types/lodash/util/stubObject.d.ts b/types/lodash/util/stubObject.d.ts index b8de585c96..23d5f6a9c5 100644 --- a/types/lodash/util/stubObject.d.ts +++ b/types/lodash/util/stubObject.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method returns a new empty object. diff --git a/types/lodash/util/stubString.d.ts b/types/lodash/util/stubString.d.ts index 8b4363f458..50410bb2a5 100644 --- a/types/lodash/util/stubString.d.ts +++ b/types/lodash/util/stubString.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method returns an empty string. diff --git a/types/lodash/util/stubTrue.d.ts b/types/lodash/util/stubTrue.d.ts index 1c008fd0b7..7629e62a7d 100644 --- a/types/lodash/util/stubTrue.d.ts +++ b/types/lodash/util/stubTrue.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * This method returns `true`. diff --git a/types/lodash/util/times.d.ts b/types/lodash/util/times.d.ts index e059c588f4..e9039b7fc2 100644 --- a/types/lodash/util/times.d.ts +++ b/types/lodash/util/times.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Invokes the iteratee function n times, returning an array of the results of each invocation. The iteratee diff --git a/types/lodash/util/toPath.d.ts b/types/lodash/util/toPath.d.ts index 4c5129a461..7d9fd966c4 100644 --- a/types/lodash/util/toPath.d.ts +++ b/types/lodash/util/toPath.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Converts `value` to a property path array. diff --git a/types/lodash/util/uniqueId.d.ts b/types/lodash/util/uniqueId.d.ts index 49691cab85..214b2eed30 100644 --- a/types/lodash/util/uniqueId.d.ts +++ b/types/lodash/util/uniqueId.d.ts @@ -1,4 +1,5 @@ -declare namespace _ { +import * as _ from ".."; +declare module ".." { interface LoDashStatic { /** * Generates a unique ID. If prefix is provided the ID is appended to it. From 641ad23e2bb51a16799970af37303cb0be0be700 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 24 Jan 2018 11:22:49 -0800 Subject: [PATCH 043/150] Fix lint --- types/react-router-navigation/index.d.ts | 49 ++++++++++++----------- types/react-router-navigation/tslint.json | 9 +---- 2 files changed, 27 insertions(+), 31 deletions(-) diff --git a/types/react-router-navigation/index.d.ts b/types/react-router-navigation/index.d.ts index 0053f7ea30..863158cd3f 100644 --- a/types/react-router-navigation/index.d.ts +++ b/types/react-router-navigation/index.d.ts @@ -25,7 +25,7 @@ export type CardSubViewProps = any; // CardsRendererProps & // CardProps -export type NavBarProps = { +export interface NavBarProps { // General hideNavBar?: boolean; renderNavBar?: (props: CardSubViewProps) => ReactNode; @@ -41,9 +41,9 @@ export type NavBarProps = { renderTitle?: (props: CardSubViewProps) => ReactNode; // Right button renderRightButton?: (props: CardSubViewProps) => ReactNode; -}; +} -export type NavigationProps = NavBarProps & { +export interface NavigationProps extends NavBarProps { cardStyle?: StyleProp; configureTransition?: ( transitionProps: NavigationTransitionProps, @@ -51,9 +51,11 @@ export type NavigationProps = NavBarProps & { ) => NavigationTransitionSpec; onTransitionStart?: (...args: any[]) => void; onTransitionEnd?: (...args: any[]) => void; -}; +} -export type Card = CardProps & { key: string }; +export interface Card extends CardProps { + key: string; +} /** * Tabs @@ -65,7 +67,7 @@ export type TabSubViewProps = any; // TabsRendererProps & // TabBarProps -export type TabBarProps = { +export interface TabBarProps { hideTabBar?: boolean; renderTabBar?: (props: TabSubViewProps) => ReactNode; tabBarStyle?: StyleProp; @@ -80,31 +82,32 @@ export type TabBarProps = { // only: tabBarPosition?: "top" | "bottom"; tabBarIndicatorStyle?: StyleProp; -}; +} -export type TabsProps = TabBarProps & { +export interface TabsProps extends TabBarProps { // only: initialLayout?: { width?: number; height?: number }; configureTransition?: ( transitionProps: NavigationTransitionProps, prevTransitionProps?: NavigationTransitionProps ) => NavigationTransitionSpec; -}; +} -export type TabProps = RouteProps & - TabBarProps & { - onReset?: (props: TabBarProps & RouteProps) => void; - onIndexChange?: (index: number) => void; - }; +export interface TabProps extends RouteProps, TabBarProps { + onReset?: (props: TabBarProps & RouteProps) => void; + onIndexChange?: (index: number) => void; +} -export type Tab = TabProps & { key: string }; +export interface Tab extends TabProps { + key: string; +} // High-level wrappers -export type BottomNavigationProps = TabBarProps & { +export interface BottomNavigationProps extends TabBarProps { children?: ReactNode[]; lazy?: boolean; style?: StyleProp; -}; +} export class BottomNavigation extends Component< BottomNavigationProps, @@ -128,7 +131,7 @@ export class BottomNavigation extends Component< renderScene: (sceneProps: TabSubViewProps) => ReactElement; } -export const Card: (props: CardProps) => ReactElement; +export function Card(props: CardProps): ReactElement; export class NavBar extends Component { props: CardSubViewProps; @@ -140,9 +143,9 @@ export class NavBar extends Component { renderRightComponent: (sceneProps: CardSubViewProps) => ReactNode; } -export type NavigationComponentProps = NavigationProps & { +export interface NavigationComponentProps extends NavigationProps { children?: Array>; -}; +} export class Navigation extends Component { props: NavigationComponentProps; @@ -157,11 +160,11 @@ export class Navigation extends Component { ) => ComponentClass | undefined; } -export const Tab: (props: TabProps) => ReactElement<{}>; +export function Tab(props: TabProps): ReactElement<{}>; -export type TabBarComponentProps = TabBarProps & { +export interface TabBarComponentProps extends TabBarProps { children?: Array>; -}; +} export class Tabs extends Component< TabBarComponentProps, diff --git a/types/react-router-navigation/tslint.json b/types/react-router-navigation/tslint.json index 34f6d3563e..3db14f85ea 100644 --- a/types/react-router-navigation/tslint.json +++ b/types/react-router-navigation/tslint.json @@ -1,8 +1 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "interface-over-type-literal": false, - "prefer-method-signature": false, - "prefer-declare-function": false - } -} +{ "extends": "dtslint/dt.json" } From a0898b0a15131b1472d7b250baf50ea275d60384 Mon Sep 17 00:00:00 2001 From: maixiu Date: Wed, 24 Jan 2018 20:26:32 +0100 Subject: [PATCH 044/150] add package datatables.net-rowgroup (#23125) * add package datatables.net-rowgroup * add package jquery-sticky * delete to put in back in a branch --- .../datatables.net-rowgroup-tests.ts | 40 +++++++++ types/datatables.net-rowgroup/index.d.ts | 88 +++++++++++++++++++ types/datatables.net-rowgroup/tsconfig.json | 24 +++++ types/datatables.net-rowgroup/tslint.json | 1 + 4 files changed, 153 insertions(+) create mode 100644 types/datatables.net-rowgroup/datatables.net-rowgroup-tests.ts create mode 100644 types/datatables.net-rowgroup/index.d.ts create mode 100644 types/datatables.net-rowgroup/tsconfig.json create mode 100644 types/datatables.net-rowgroup/tslint.json diff --git a/types/datatables.net-rowgroup/datatables.net-rowgroup-tests.ts b/types/datatables.net-rowgroup/datatables.net-rowgroup-tests.ts new file mode 100644 index 0000000000..d0149faba2 --- /dev/null +++ b/types/datatables.net-rowgroup/datatables.net-rowgroup-tests.ts @@ -0,0 +1,40 @@ +let config_1: DataTables.Settings = { + // RowGroup extension options + rowGroup: { + className: 'className', + enable: true, + dataSrc: 'data', + endClassName: 'endClassName', + endRender: (rows, group) => { + return `${ group } (${ rows.count() } rows)`; + }, + startRender: (rows, group) => { + return `${ group } (${ rows.count() } rows)`; + } + } +}; + +let dt: DataTables.Api = $("selector").DataTable({ + rowGroup: true +}); + +// Statics +let fixed_1 = new $.fn.dataTable.RowGroup(dt, { + enable: true, +}); + +let fixed_2 = new $.fn.dataTable.RowGroup(dt, true); + +let version = $.fn.dataTable.RowGroup.version; + +$.fn.dataTable.RowGroup.defaults.className = 'row-group-class'; + +// API +dt.rowGroup().dataSrc(); +dt.rowGroup().disable(); +dt.rowGroup().enable(true); + +// Chaining +dt.rowGroup().dataSrc(12) + .rowGroup().disable() + .rowGroup().enable(); diff --git a/types/datatables.net-rowgroup/index.d.ts b/types/datatables.net-rowgroup/index.d.ts new file mode 100644 index 0000000000..e2697c7fac --- /dev/null +++ b/types/datatables.net-rowgroup/index.d.ts @@ -0,0 +1,88 @@ +// Type definitions for datatables.net-rowgroup 1.0 +// Project: https://datatables.net/extensions/rowgroup/ +// Definitions by: Matthieu Tabuteau +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +/// +/// + +declare namespace DataTables { + interface Settings { + /** + * RowGroup extension options + */ + rowGroup?: boolean | RowGroupSettings; + } + + interface StaticFunctions { + RowGroup: RowGroupStaticFunctions; + } + + interface RowGroupStaticFunctions { + new (dt: Api, settings: boolean | RowGroupSettings): undefined; + version: string; + defaults: RowGroupSettings; + } + + interface Api { + rowGroup(): RowGroupApi; + } + + interface RowGroupApi { + /** + * Get the data source for the row grouping + */ + dataSrc(): number|string; + + /** + * Set the data source for the row grouping + */ + dataSrc(prop: number|string): Api; + + /** + * Disable RowGroup's interaction with the table + */ + disable(): Api; + + /** + * Enable or disable RowGroup's interaction with the table + */ + enable(enable?: boolean): Api; + } + + /** + * RowGroup extension options + */ + interface RowGroupSettings { + /** + * Set the class name to be used for the grouping rows + */ + className?: string; + + /** + * Set the data point to use as the grouping data source + */ + dataSrc?: number|string; + + /** + * Provides the ability to disable row grouping at initialisation + */ + enable?: boolean; + + /** + * Set the class name to be used for the grouping end rows + */ + endClassName?: string; + + /** + * Provide a function that can be used to control the data shown in the end grouping row + */ + endRender?: (rows: Api, group: string) => string|HTMLElement|JQuery; + + /** + * Provide a function that can be used to control the data shown in the start grouping row + */ + startRender?: (rows: Api, group: string) => string|HTMLElement|JQuery; + } +} diff --git a/types/datatables.net-rowgroup/tsconfig.json b/types/datatables.net-rowgroup/tsconfig.json new file mode 100644 index 0000000000..c4550cded1 --- /dev/null +++ b/types/datatables.net-rowgroup/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-rowgroup-tests.ts" + ] +} \ No newline at end of file diff --git a/types/datatables.net-rowgroup/tslint.json b/types/datatables.net-rowgroup/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/datatables.net-rowgroup/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From c33af47bb2375375cd78d2d2199bb7b937b1af29 Mon Sep 17 00:00:00 2001 From: Andres Kalle Date: Wed, 24 Jan 2018 21:40:08 +0200 Subject: [PATCH 045/150] react: allow null as props for React.createElement() (#22837) --- .../create-react-class-tests.ts | 7 +++++++ types/react/index.d.ts | 16 ++++++++-------- types/react/test/index.ts | 10 ++++++++++ 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/types/create-react-class/create-react-class-tests.ts b/types/create-react-class/create-react-class-tests.ts index c3f7c620ef..ae62233135 100644 --- a/types/create-react-class/create-react-class-tests.ts +++ b/types/create-react-class/create-react-class-tests.ts @@ -73,6 +73,12 @@ const ClassicComponent: React.ClassicComponentClass = createReactClass = React.createFactory(ClassicComponent); @@ -81,6 +87,7 @@ const classicFactoryElement: React.ClassicElement = // React.createElement const classicElement: React.ClassicElement = React.createElement(ClassicComponent, props); +const classicElementNullProps: React.ClassicElement<{}> = React.createElement(ClassicComponentNoProps, null); // React.cloneElement const clonedClassicElement: React.ClassicElement = diff --git a/types/react/index.d.ts b/types/react/index.d.ts index d7ea8d2b8b..83ab445356 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -193,37 +193,37 @@ declare namespace React { // TODO: generalize this to everything in `keyof ReactHTML`, not just "input" function createElement( type: "input", - props?: InputHTMLAttributes & ClassAttributes, + props?: InputHTMLAttributes & ClassAttributes | null, ...children: ReactNode[]): DetailedReactHTMLElement, HTMLInputElement>; function createElement

, T extends HTMLElement>( type: keyof ReactHTML, - props?: ClassAttributes & P, + props?: ClassAttributes & P | null, ...children: ReactNode[]): DetailedReactHTMLElement; function createElement

, T extends SVGElement>( type: keyof ReactSVG, - props?: ClassAttributes & P, + props?: ClassAttributes & P | null, ...children: ReactNode[]): ReactSVGElement; function createElement

, T extends Element>( type: string, - props?: ClassAttributes & P, + props?: ClassAttributes & P | null, ...children: ReactNode[]): DOMElement; // Custom components function createElement

( type: SFC

, - props?: Attributes & P, + props?: Attributes & P | null, ...children: ReactNode[]): SFCElement

; function createElement

( type: ClassType, ClassicComponentClass

>, - props?: ClassAttributes> & P, + props?: ClassAttributes> & P | null, ...children: ReactNode[]): CElement>; function createElement, C extends ComponentClass

>( type: ClassType, - props?: ClassAttributes & P, + props?: ClassAttributes & P | null, ...children: ReactNode[]): CElement; function createElement

( type: SFC

| ComponentClass

| string, - props?: Attributes & P, + props?: Attributes & P | null, ...children: ReactNode[]): ReactElement

; // DOM Elements diff --git a/types/react/test/index.ts b/types/react/test/index.ts index d767de4487..3e2be1605f 100644 --- a/types/react/test/index.ts +++ b/types/react/test/index.ts @@ -141,6 +141,9 @@ const StatelessComponent3: React.SFC = // allows null return props => props.foo ? DOM.div(null, props.foo, props.children) : null; +// allows null as props +const StatelessComponent4: React.SFC = props => null; + // React.createFactory const factory: React.CFactory = React.createFactory(ModernComponent); @@ -160,15 +163,22 @@ const domFactoryElement: React.DOMElement, Element> = // React.createElement const element: React.CElement = React.createElement(ModernComponent, props); const elementNoState: React.CElement = React.createElement(ModernComponentNoState, props); +const elementNullProps: React.CElement<{}, ModernComponentNoPropsAndState> = React.createElement(ModernComponentNoPropsAndState, null); const statelessElement: React.SFCElement = React.createElement(StatelessComponent, props); +const statelessElementNullProps: React.SFCElement = React.createElement(StatelessComponent4, null); const domElement: React.DOMElement, HTMLDivElement> = React.createElement("div"); +const domElementNullProps = React.createElement("div", null); const htmlElement = React.createElement("input", { type: "text" }); +const inputElementNullProps: React.DOMElement, HTMLInputElement> = React.createElement("input", null); const svgElement = React.createElement("svg", { accentHeight: 12 }); +const svgElementNullProps = React.createElement("svg", null); const fragmentElement: React.ReactElement<{}> = React.createElement(React.Fragment, {}, [React.createElement("div"), React.createElement("div")]); +const fragmentElementNullProps: React.ReactElement<{}> = React.createElement(React.Fragment, null, [React.createElement("div"), React.createElement("div")]); const customProps: React.HTMLProps = props; const customDomElement = "my-element"; const nonLiteralElement = React.createElement(customDomElement, customProps); +const customDomElementNullProps = React.createElement(customDomElement, null); // https://github.com/Microsoft/TypeScript/issues/15019 From c2dd2e11e5da36a199a7f1fcb59e6fc50e6520cf Mon Sep 17 00:00:00 2001 From: Jinesh Shah Date: Wed, 24 Jan 2018 14:40:39 -0500 Subject: [PATCH 046/150] fixed more mistypings related to arrays vs tuples (#23172) --- types/algoliasearch/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/algoliasearch/index.d.ts b/types/algoliasearch/index.d.ts index eb1cecf2d6..968fe63151 100644 --- a/types/algoliasearch/index.d.ts +++ b/types/algoliasearch/index.d.ts @@ -701,7 +701,7 @@ declare namespace algoliasearch { * return {Promise} * https://github.com/algolia/algoliasearch-client-js#add-objects---addobjects */ - addObjects(objects: [{}]): Promise; + addObjects(objects: {}[]): Promise; /** * Add or replace a specific object * @param object @@ -729,7 +729,7 @@ declare namespace algoliasearch { * return {Promise} * https://github.com/algolia/algoliasearch-client-js#update-objects---saveobjects */ - partialUpdateObjects(objects: [{}]): Promise; + partialUpdateObjects(objects: {}[]): Promise; /** * Delete a specific object * @param objectID @@ -1602,7 +1602,7 @@ Interface describing options available for gettings the logs * default: [] * https://github.com/algolia/algoliasearch-client-js#altcorrections */ - altCorrections?: [{}]; + altCorrections?: {}[]; /** * Configure the precision of the proximity ranking criterion * default: 1 From 62244dc72bd72ad0ab1bf241afa42dc0a0c398ad Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 24 Jan 2018 11:45:53 -0800 Subject: [PATCH 047/150] @kant2002 code review --- types/snapsvg/index.d.ts | 3 +-- types/snapsvg/test/3.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/types/snapsvg/index.d.ts b/types/snapsvg/index.d.ts index 539036b36c..a3397cedaa 100644 --- a/types/snapsvg/index.d.ts +++ b/types/snapsvg/index.d.ts @@ -278,8 +278,7 @@ declare namespace Snap { ellipse(x:number,y:number,rx:number,ry:number):Snap.Element; image(src:string,x:number,y:number,width:number,height:number):Snap.Element; line(x1:number,y1:number,x2:number,y2:number):Snap.Element; - path(pathString?:string):Snap.Element; - path(pathSpec:(string | number)[][]):Snap.Element; + path(pathSpec: string | (string | number)[][]): Snap.Element; polygon(varargs:any[]):Snap.Element; polyline(varargs:any[]):Snap.Element; rect(x:number,y:number,width:number,height:number,rx?:number,ry?:number):Snap.Element; diff --git a/types/snapsvg/test/3.ts b/types/snapsvg/test/3.ts index 70381001ca..a97caefa45 100644 --- a/types/snapsvg/test/3.ts +++ b/types/snapsvg/test/3.ts @@ -193,9 +193,9 @@ window.onload=()=>{ var myPathString = "M 60 0 L 120 0 L 180 60 L 180 120 L 120 180 L 60 180 L 0 120 L 0 60 Z"; var p = s.path( myPathString ); + s.path([["M", 5, 10], ["l", 15, 2], ["Z"]]); var p2 = s.path( myPathString ).transform("t" + myTranslateX + "," + myTranslateY); - for( var count = 0; count < 500; count++ ) { x = Math.random() * 800; y = Math.random() * 400; From 43f9180f2b5130f53a1a2059db0e707238c6128c Mon Sep 17 00:00:00 2001 From: James Grant Date: Wed, 24 Jan 2018 20:00:15 +0000 Subject: [PATCH 048/150] [react-data-grid] Add getCellActions to GridProps (#23110) * Add getCellActions to GridProps * Change callback type from Function to () => void --- types/react-data-grid/index.d.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/types/react-data-grid/index.d.ts b/types/react-data-grid/index.d.ts index 3e79703242..f712b43e1b 100644 --- a/types/react-data-grid/index.d.ts +++ b/types/react-data-grid/index.d.ts @@ -219,6 +219,22 @@ declare namespace AdazzleReactDataGrid { * @param columnKey the column key that we are looking to pull values from */ getValidFilterValues?: (columnKey: string) => Array + + getCellActions?: (column: Column, row: object) => (ActionButton | ActionMenu)[] + } + + type ActionButton = { + icon: string; + callback: () => void; + } + + type ActionMenu = { + icon: string; + actions: { + icon: string; + text: string; + callback: () => void; + }[]; } /** From 038d712743bd51756b9dfded1e051115d1625578 Mon Sep 17 00:00:00 2001 From: Neil Gentleman Date: Wed, 24 Jan 2018 12:00:46 -0800 Subject: [PATCH 049/150] [p-limit] fix generics (#23066) generated limit functions don't care about types, but preserve the return type of the function that they are passed. --- types/p-limit/index.d.ts | 2 +- types/p-limit/p-limit-tests.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/p-limit/index.d.ts b/types/p-limit/index.d.ts index a10fd05e1e..416622298b 100644 --- a/types/p-limit/index.d.ts +++ b/types/p-limit/index.d.ts @@ -7,4 +7,4 @@ declare namespace pLimit {} export = pLimit; -declare function pLimit(concurrency: number): (fn: () => PromiseLike) => Promise; +declare function pLimit(concurrency: number): (fn: () => PromiseLike) => Promise; diff --git a/types/p-limit/p-limit-tests.ts b/types/p-limit/p-limit-tests.ts index 6e50894802..e04b895e87 100644 --- a/types/p-limit/p-limit-tests.ts +++ b/types/p-limit/p-limit-tests.ts @@ -1,6 +1,6 @@ import pLimit = require('p-limit'); -const limit = pLimit(1); +const limit = pLimit(1); const input = [ limit(() => Promise.resolve('foo')), From bd5a9a9abe00923b889b0a99c047051c39d8c6b5 Mon Sep 17 00:00:00 2001 From: Apurva Ojas Date: Thu, 25 Jan 2018 01:31:34 +0530 Subject: [PATCH 050/150] Enhancement @types/three Added definition for THREE.FilmPass #14042 (#22981) * feat(FilmPass): Added Definition for Three.FilmPass #14042 * fix(THREE.FilmPass): Definition update fixed grayscale type, changed to boolean #14042 * chore(THREE.FilmPass): Added name to efinitions By #14042 * chore(THREE.FilmPass): Definitions added of variables and functions #14042 * feat(THREE.Pass/THREE.FilmPass): Added Definitions for THREE.Pass and Extend it on THREE.FilmPass #14042 * chore(THREE.FilmPass): Removed render function declarartion as it extends from Pass #14042 --- types/three/index.d.ts | 3 ++- types/three/three-effectcomposer.d.ts | 20 ++++++++++++++++++++ types/three/three-filmpass.d.ts | 13 +++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 types/three/three-filmpass.d.ts diff --git a/types/three/index.d.ts b/types/three/index.d.ts index 2cea550034..e553853293 100644 --- a/types/three/index.d.ts +++ b/types/three/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for three.js 0.89 // Project: https://threejs.org -// Definitions by: Kon , Satoru Kimura , Florent Poujol , SereznoKot , HouChunlei , Ivo , David Asmuth , Brandon Roberge, Qinsi ZHU , Toshiya Nakakura , Poul Kjeldager Sørensen , Stefan Profanter , Edmund Fokschaner , Roelof Jooste , Daniel Hritzkiv +// Definitions by: Kon , Satoru Kimura , Florent Poujol , SereznoKot , HouChunlei , Ivo , David Asmuth , Brandon Roberge, Qinsi ZHU , Toshiya Nakakura , Poul Kjeldager Sørensen , Stefan Profanter , Edmund Fokschaner , Roelof Jooste , Daniel Hritzkiv , Apurva Ojas // Definitions: https://github.com//DefinitelyTyped export * from "./three-core"; @@ -27,6 +27,7 @@ export * from "./three-projector"; export * from "./three-renderpass"; export * from "./three-shaderpass"; export * from "./three-smaapass"; +export * from "./three-filmpass"; export * from "./three-trackballcontrols"; export * from "./three-transformcontrols"; export * from "./three-vrcontrols"; diff --git a/types/three/three-effectcomposer.d.ts b/types/three/three-effectcomposer.d.ts index 3680a43658..0f30d45d04 100644 --- a/types/three/three-effectcomposer.d.ts +++ b/types/three/three-effectcomposer.d.ts @@ -23,3 +23,23 @@ export class EffectComposer { setSize(width: number, height: number): void; } + + +export class Pass{ + // if set to true, the pass is processed by the composer + enabled: boolean; + + // if set to true, the pass indicates to swap read and write buffer after rendering + needsSwap: boolean; + + // if set to true, the pass clears its buffer before rendering + clear: boolean; + + // if set to true, the result of the pass is rendered to screen + renderToScreen: boolean; + + setSize(width: number, height:number ): void; + + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget, delta: number, maskActive?: boolean): void; + +} \ No newline at end of file diff --git a/types/three/three-filmpass.d.ts b/types/three/three-filmpass.d.ts new file mode 100644 index 0000000000..0890ac8507 --- /dev/null +++ b/types/three/three-filmpass.d.ts @@ -0,0 +1,13 @@ +import { Camera, Scene, WebGLRenderTarget, WebGLRenderer, Material, Mesh, IUniform } from "./three-core"; +import {Pass} from "./three-effectcomposer"; + +export class FilmPass extends Pass { + constructor(noiseIntensity: number, scanlinesIntensity: number, scanlinesCount: number, grayscale: boolean); + + scene: Scene; + camera: Camera; + uniforms: IUniform; + material: Material; + quad: Mesh; + +} From f51e60a1178b1a3c4765757eb7dd15c5a6e379c4 Mon Sep 17 00:00:00 2001 From: Yoyo Zhou Date: Wed, 24 Jan 2018 12:02:52 -0800 Subject: [PATCH 051/150] kafka-node: Fix type of Message.key to be optional string (#23041) key is not a number, it's a string. See KeyedMessage constructor, above. (However, if `encoding` is specified as "buffer" in ConsumerOptions then `key` and `value` are actually `Buffer` rather than `string`. I'm not sure if it's possible to specify this better than `string|Buffer` since it may not be knowable at compile time.) --- types/kafka-node/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/kafka-node/index.d.ts b/types/kafka-node/index.d.ts index 4f566a8587..e5aa9cf0a8 100644 --- a/types/kafka-node/index.d.ts +++ b/types/kafka-node/index.d.ts @@ -99,7 +99,7 @@ export interface Message { offset?: number; partition?: number; highWaterOffset?: number; - key?: number; + key?: string; } export interface ProducerOptions { From 6d3193f7aa255fffcb56482b418972317efdf895 Mon Sep 17 00:00:00 2001 From: Andy Date: Wed, 24 Jan 2018 12:37:02 -0800 Subject: [PATCH 052/150] oauth2-server: Fix 'express' import (#23173) --- types/oauth2-server/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/oauth2-server/index.d.ts b/types/oauth2-server/index.d.ts index a423f48a58..06b6fbadb0 100644 --- a/types/oauth2-server/index.d.ts +++ b/types/oauth2-server/index.d.ts @@ -5,7 +5,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -import { Request, RequestHandler } from "express"; +import Express = require("express"); /** * Represents an OAuth2 server instance. From c54b691628bbef4c698f6aeb195ef50d18b08295 Mon Sep 17 00:00:00 2001 From: stesix <7610155+stesix@users.noreply.github.com> Date: Thu, 25 Jan 2018 00:13:16 +0100 Subject: [PATCH 053/150] Update scrypt-async types to version 1.3.1 (#23163) * Update scrypt-async types to version 1.3.1 * Change namespace for scrypt-async Changing the declaration of the namespace will merge the interface definitions in the exported object. This allows to use scrypt.Options as a type. * Fix wrongly defined interfaces in test --- types/scrypt-async/index.d.ts | 24 +++++++++-- types/scrypt-async/scrypt-async-tests.ts | 52 ++++++++++++++++++------ 2 files changed, 59 insertions(+), 17 deletions(-) diff --git a/types/scrypt-async/index.d.ts b/types/scrypt-async/index.d.ts index e4a1867a1f..f3176c9e13 100644 --- a/types/scrypt-async/index.d.ts +++ b/types/scrypt-async/index.d.ts @@ -1,15 +1,31 @@ -// Type definitions for scrypt-async v1.2.0 +// Type definitions for scrypt-async v1.3.1 // Project: https://github.com/dchest/scrypt-async-js // Definitions by: Kaur Kuut +// Stefano Sicco // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare namespace ScryptAsync { +declare namespace scrypt { interface CallbackFunc { (key: string): any; (key: number[]): any; } + interface Options { + N?: number; + logN?: number; + r: number; + p: number; + dkLen: number; + encoding?: string; + interruptStep?: number; + } + interface ScryptStatic { + (password: string, salt: string, options: Options, callback: CallbackFunc): void; + (password: number[], salt: string, options: Options, callback: CallbackFunc): void; + (password: string, salt: number[], options: Options, callback: CallbackFunc): void; + (password: number[], salt: number[], options: Options, callback: CallbackFunc): void; + (password: string, salt: string, logN: number, r: number, dkLen: number, interruptStep: number, callback: CallbackFunc, encoding: string): void; (password: string, salt: number[], logN: number, r: number, dkLen: number, interruptStep: number, callback: CallbackFunc, encoding: string): void; (password: number[], salt: string, logN: number, r: number, dkLen: number, interruptStep: number, callback: CallbackFunc, encoding: string): void; @@ -32,6 +48,6 @@ declare namespace ScryptAsync { } } -declare var scrypt: ScryptAsync.ScryptStatic; +declare var scrypt: scrypt.ScryptStatic; -export = scrypt; \ No newline at end of file +export = scrypt; diff --git a/types/scrypt-async/scrypt-async-tests.ts b/types/scrypt-async/scrypt-async-tests.ts index ed12c9a5e5..e2a43fefee 100644 --- a/types/scrypt-async/scrypt-async-tests.ts +++ b/types/scrypt-async/scrypt-async-tests.ts @@ -1,23 +1,49 @@ // Tests by: Kaur Kuut import scrypt = require("scrypt-async"); -var callback = function(key: string | number[]) { }; +var callback: scrypt.CallbackFunc = function(key: string | number[]) { }; scrypt("abc", "def", 10, 8, 32, 1000, callback, "base64"); -scrypt("abc", [4,5,6], 10, 8, 32, 1000, callback, "base64"); -scrypt([1,2,3], "def", 10, 8, 32, 1000, callback, "base64"); -scrypt([1,2,3], [4,5,6], 10, 8, 32, 1000, callback, "base64"); +scrypt("abc", [100, 101, 102], 10, 8, 32, 1000, callback, "base64"); +scrypt([97, 98, 99], "def", 10, 8, 32, 1000, callback, "base64"); +scrypt([97, 98, 99], [100, 101, 102], 10, 8, 32, 1000, callback, "base64"); scrypt("abc", "def", 10, 8, 32, 1000, callback); -scrypt("abc", [4,5,6], 10, 8, 32, 1000, callback); -scrypt([1,2,3], "def", 10, 8, 32, 1000, callback); -scrypt([1,2,3], [4,5,6], 10, 8, 32, 1000, callback); +scrypt("abc", [100, 101, 102], 10, 8, 32, 1000, callback); +scrypt([97, 98, 99], "def", 10, 8, 32, 1000, callback); +scrypt([97, 98, 99], [100, 101, 102], 10, 8, 32, 1000, callback); scrypt("abc", "def", 10, 8, 32, callback, "base64"); -scrypt("abc", [4,5,6], 10, 8, 32, callback, "base64"); -scrypt([1,2,3], "def", 10, 8, 32, callback, "base64"); -scrypt([1,2,3], [4,5,6], 10, 8, 32, callback, "base64"); +scrypt("abc", [100, 101, 102], 10, 8, 32, callback, "base64"); +scrypt([97, 98, 99], "def", 10, 8, 32, callback, "base64"); +scrypt([97, 98, 99], [100, 101, 102], 10, 8, 32, callback, "base64"); scrypt("abc", "def", 10, 8, 32, callback); -scrypt("abc", [4,5,6], 10, 8, 32, callback); -scrypt([1,2,3], "def", 10, 8, 32, callback); -scrypt([1,2,3], [4,5,6], 10, 8, 32, callback); \ No newline at end of file +scrypt("abc", [100, 101, 102], 10, 8, 32, callback); +scrypt([97, 98, 99], "def", 10, 8, 32, callback); +scrypt([97, 98, 99], [100, 101, 102], 10, 8, 32, callback); + +// Tests by: Stefano Sicco +// "abc" === [97, 98, 99] +// "def" === [100, 101, 102] + + + +var opts: scrypt.Options = { + r: 8, + p: 1, + dkLen: 32, + encoding: 'base64', + interruptStep: 1000 +}; +opts.N = 1024; + +scrypt("abc", "def", opts, callback); +scrypt("abc", [100, 101, 102], opts, callback); +scrypt([97, 98, 99], "def", opts, callback); +scrypt([97, 98, 99], [100, 101, 102], opts, callback); + +opts.logN = 10; +scrypt("abc", "def", opts, callback); +scrypt("abc", [100, 101, 102], opts, callback); +scrypt([97, 98, 99], "def", opts, callback); +scrypt([97, 98, 99], [100, 101, 102], opts, callback); From 00ab527933ddabde2e6025f071bf1e79ab6dd706 Mon Sep 17 00:00:00 2001 From: Jan Aagaard Date: Thu, 25 Jan 2018 16:27:28 +0100 Subject: [PATCH 054/150] zapier-platform-core: Add methods related to tests (#23158) * Add methods related to tests * Slightly more specific method signatures * Add missing 'await' * Fix linting issues --- types/zapier-platform-core/index.d.ts | 3 +++ .../zapier-platform-core-tests.ts | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/types/zapier-platform-core/index.d.ts b/types/zapier-platform-core/index.d.ts index 0bea385f05..525421abbf 100644 --- a/types/zapier-platform-core/index.d.ts +++ b/types/zapier-platform-core/index.d.ts @@ -8,6 +8,9 @@ import * as http from "http"; +export function createAppHandler(appRawOrPath: object | string): (event: any, context: any, callback: any) => void; +export function createAppTester(appRawOrPath: object | string): Promise; +export function integrationTestHandler(event: any, context: any, callback: any): any; export const version: string; export interface HttpRequestOptions { diff --git a/types/zapier-platform-core/zapier-platform-core-tests.ts b/types/zapier-platform-core/zapier-platform-core-tests.ts index 76592204ae..6c6c490edd 100644 --- a/types/zapier-platform-core/zapier-platform-core-tests.ts +++ b/types/zapier-platform-core/zapier-platform-core-tests.ts @@ -1,10 +1,10 @@ -import { OAuth2Authentication } from "zapier-platform-core"; +import * as zapier from "zapier-platform-core"; const BASE_URL = "http://example.com"; const OAUTH2_CLIENT_ID = "12345"; const OAUTH2_CLIENT_SECRET = "abcdef"; -const authentication: OAuth2Authentication = { +const authentication: zapier.OAuth2Authentication = { type: "oauth2", connectionLabel: "User account", oauth2Config: { @@ -91,3 +91,10 @@ const authentication: OAuth2Authentication = { return true; } }; + +zapier.version; + +const testCreateAppTester = async () => { + const zapierApp = {}; + const appTester = await zapier.createAppTester(zapierApp); +}; From 19a9b642cf037b8dc7e96727047b3e7a37ae55a1 Mon Sep 17 00:00:00 2001 From: taoqf Date: Thu, 25 Jan 2018 23:32:00 +0800 Subject: [PATCH 055/150] add package jsreport-core (#22913) * add package jsreport-core * add type string as `recipe` and `engine` * improve type definition --- types/jsreport-core/index.d.ts | 96 ++++++++++++++++++++++ types/jsreport-core/jsreport-core-tests.ts | 20 +++++ types/jsreport-core/tsconfig.json | 23 ++++++ types/jsreport-core/tslint.json | 1 + 4 files changed, 140 insertions(+) create mode 100644 types/jsreport-core/index.d.ts create mode 100644 types/jsreport-core/jsreport-core-tests.ts create mode 100644 types/jsreport-core/tsconfig.json create mode 100644 types/jsreport-core/tslint.json diff --git a/types/jsreport-core/index.d.ts b/types/jsreport-core/index.d.ts new file mode 100644 index 0000000000..23413889da --- /dev/null +++ b/types/jsreport-core/index.d.ts @@ -0,0 +1,96 @@ +// Type definitions for jsreport-core 1.5 +// Project: http://jsreport.net +// Definitions by: taoqf +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// +import { Buffer } from 'buffer'; +import { Readable } from 'stream'; + +declare namespace JsReport { + type helpers = string | { [fun: string]: (...args: any[]) => any }; + + interface RenderOptions { + template: { + content: string; + engine: 'jsrender' | 'handlebars' | 'ejs' | 'jade' | string; + helpers?: helpers; + recipe: 'phantom-pdf' | 'electron-pdf' | 'text' | 'xlsx' | 'html-to-xlsx' | 'phantom-image' | 'html-to-text' | 'fop-pdf' | 'client-html' | 'wrapped-html' | 'wkhtmltopdf' | string; + }; + data?: any; + } + + interface Report { + content: Buffer; + stream: Readable; + headers: { + [header: string]: string | number | boolean; + }; + } + + interface Request { + template: { + content: string; + }; + } + + // interface Response { + // // todo + // } + + type Response = any; + + interface Listener { + add(type: string, callback: (req: Request, res: Response, err: any) => void): void; + } + + interface Logger { + add(logger: any, options?: { + level: 'debug' | 'info' | 'log' | 'warn' | 'error'; + }): void; + } + + interface Collection { + find(query: { + [field: string]: any; + }): Promise; + } + + interface DocumentStore { + collection(options: string): Collection; + } + + interface JsReporter { + afterRenderListeners: Listener; + afterTemplatingEnginesExecutedListeners: Listener; + beforeRenderListeners: Listener; + documentStore: DocumentStore; + initializeListeners: Listener; + logger: Logger; + validateRenderListeners: Listener; + init(): Promise; + render(options: RenderOptions): Promise; + use(extension: any): any; + } +} + +declare function JsReport(options?: Partial<{ + autoTempCleanup: boolean; + dataDirectory: string; + extensionsLocationCache: boolean; + loadConfig: boolean; + logger: { + silent: boolean; + }; + rootDirectory: string; + scripts: { + allowedModules: string[]; + }; + tasks: { + [task: string]: any; + }; + tempDirectory: string; +}>): JsReport.JsReporter; + +export = JsReport; diff --git a/types/jsreport-core/jsreport-core-tests.ts b/types/jsreport-core/jsreport-core-tests.ts new file mode 100644 index 0000000000..c7ded76f4d --- /dev/null +++ b/types/jsreport-core/jsreport-core-tests.ts @@ -0,0 +1,20 @@ +import JsReport = require('jsreport-core'); + +const jsreport = JsReport(); +jsreport.init().then(() => { + return jsreport.render({ + template: { + content: '

Hello {{:foo}}

', + engine: 'jsrender', + recipe: 'phantom-pdf' + }, + data: { + foo: "world" + } + }).then((resp) => { + // prints pdf with headline Hello world + console.log(resp.content.toString()); + }); +}).catch((e) => { + console.log(e); +}); diff --git a/types/jsreport-core/tsconfig.json b/types/jsreport-core/tsconfig.json new file mode 100644 index 0000000000..1602790a14 --- /dev/null +++ b/types/jsreport-core/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "esnext" + ], + "strictFunctionTypes": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jsreport-core-tests.ts" + ] +} \ No newline at end of file diff --git a/types/jsreport-core/tslint.json b/types/jsreport-core/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/jsreport-core/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 4fd902f17347526e59ae0b08a37a76d888cffce9 Mon Sep 17 00:00:00 2001 From: albertywu Date: Thu, 25 Jan 2018 07:56:44 -0800 Subject: [PATCH 056/150] adds typings for async-retry npm package (#23175) --- types/async-retry/async-retry-tests.ts | 20 ++++++++++++++++++++ types/async-retry/index.d.ts | 17 +++++++++++++++++ types/async-retry/tsconfig.json | 23 +++++++++++++++++++++++ types/async-retry/tslint.json | 1 + 4 files changed, 61 insertions(+) create mode 100644 types/async-retry/async-retry-tests.ts create mode 100644 types/async-retry/index.d.ts create mode 100644 types/async-retry/tsconfig.json create mode 100644 types/async-retry/tslint.json diff --git a/types/async-retry/async-retry-tests.ts b/types/async-retry/async-retry-tests.ts new file mode 100644 index 0000000000..29c90b36c8 --- /dev/null +++ b/types/async-retry/async-retry-tests.ts @@ -0,0 +1,20 @@ +import { Options, RetryFunction, retry } from 'async-retry'; + +const o: Options = { + retries: 1, + factor: 2, + minTimeout: 3, + maxTimeout: 4, + randomize: true, + onRetry: (e: Error) => 42 +}; + +retry( + bail => 'hello', + { retries: 3 } +); + +retry( + bail => Promise.resolve(42), + { retries: 3 } +); diff --git a/types/async-retry/index.d.ts b/types/async-retry/index.d.ts new file mode 100644 index 0000000000..38d0d8aeec --- /dev/null +++ b/types/async-retry/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for async-retry 1.1 +// Project: https://github.com/zeit/async-retry#readme +// Definitions by: Albert Wu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function retry(fn: RetryFunction, opts: Options): Promise; + +export interface Options { + retries?: number; + factor?: number; + minTimeout?: number; + maxTimeout?: number; + randomize?: boolean; + onRetry?: (e: Error) => any; +} + +export type RetryFunction = (bail: (e: Error) => A, attempt: number) => A|Promise; diff --git a/types/async-retry/tsconfig.json b/types/async-retry/tsconfig.json new file mode 100644 index 0000000000..8bdf98656d --- /dev/null +++ b/types/async-retry/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "async-retry-tests.ts" + ] +} diff --git a/types/async-retry/tslint.json b/types/async-retry/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/async-retry/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 4d1d1b5ecbec8b111457bc9bbbe2ef0a7a3640ed Mon Sep 17 00:00:00 2001 From: Martin Payne Date: Fri, 26 Jan 2018 02:57:02 +1100 Subject: [PATCH 057/150] readline-sync: added 'cancel' property into BasicOptions (#23176) --- types/readline-sync/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/readline-sync/index.d.ts b/types/readline-sync/index.d.ts index 2931f22d90..e3c08c3b52 100644 --- a/types/readline-sync/index.d.ts +++ b/types/readline-sync/index.d.ts @@ -32,6 +32,7 @@ export interface BasicOptions { validate?(path: string): boolean | string; create?: boolean; guide?: boolean; + cancel?: any; } // Basic Functions From 3e9c07fe9ed937955c3ea8dd05cffa017ef56801 Mon Sep 17 00:00:00 2001 From: Egor Shulga Date: Thu, 25 Jan 2018 19:10:44 +0300 Subject: [PATCH 058/150] [react-native-tab-view] SceneMap should support all React.ComponentType's (#23188) --- types/react-native-tab-view/index.d.ts | 4 ++-- .../react-native-tab-view-tests.tsx | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/types/react-native-tab-view/index.d.ts b/types/react-native-tab-view/index.d.ts index 492287a754..ca5a375e74 100644 --- a/types/react-native-tab-view/index.d.ts +++ b/types/react-native-tab-view/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 -import { PureComponent, ReactNode } from 'react' +import { PureComponent, ReactNode, ComponentType } from 'react' import { Animated, StyleProp, @@ -233,5 +233,5 @@ export class TabBar extends PureComponent< > {} export function SceneMap(scenes: { - [key: string]: (props: any) => ReactNode + [key: string]: ComponentType }): (props: { route: Route }) => ReactNode diff --git a/types/react-native-tab-view/react-native-tab-view-tests.tsx b/types/react-native-tab-view/react-native-tab-view-tests.tsx index f57952cbc4..97d8c09257 100644 --- a/types/react-native-tab-view/react-native-tab-view-tests.tsx +++ b/types/react-native-tab-view/react-native-tab-view-tests.tsx @@ -1,4 +1,4 @@ -import { PureComponent } from 'react' +import { PureComponent, Component } from 'react' import { View, StyleSheet } from 'react-native' import { TabViewAnimated, @@ -11,9 +11,14 @@ import { const FirstRoute = () => ( ) -const SecondRoute = () => ( - -) + +class SecondRoute extends Component { + render() { + return ( + + ); + } +} class TabViewExample extends PureComponent { state: { index: number; routes: Array } = { From 4ea855971c3b193c8bd3be83f9417e3d3415dde0 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 25 Jan 2018 11:24:32 -0500 Subject: [PATCH 059/150] Fix trial_end type to allow special value 'now' (#23149) * Fix trial_end type to allow special value 'now' which is mentioned in the docs. * Updated trial_end type to be more specific and added type tests --- types/stripe/index.d.ts | 6 +++--- types/stripe/stripe-tests.ts | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index c2d60ea644..ef2c9971b7 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -1330,7 +1330,7 @@ declare namespace Stripe { * override the default trial period of the plan the customer is being subscribed to. The special value now can be provided to * end the customer's trial immediately. Only applies when the plan parameter is also provided. */ - trial_end?: number; + trial_end?: number | "now"; } interface ICustomerUpdateOptions extends IDataOptionsWithMetadata { @@ -4370,7 +4370,7 @@ declare namespace Stripe { * will override the default trial period of the plan the customer is being subscribed to. The special value now can be provided to end the * customer's trial immediately. */ - trial_end?: number; + trial_end?: number | "now"; /** * List of subscription items, each with an attached plan. @@ -4446,7 +4446,7 @@ declare namespace Stripe { * will override the default trial period of the plan the customer is being subscribed to. The special value now can be provided to end the * customer's trial immediately. */ - trial_end?: number; + trial_end?: number | "now"; /** * Either "charge_automatically", or "send_invoice". When charging automatically, Stripe will attempt to pay this subscription at the end of the diff --git a/types/stripe/stripe-tests.ts b/types/stripe/stripe-tests.ts index 60374b697d..d9ad735f9c 100644 --- a/types/stripe/stripe-tests.ts +++ b/types/stripe/stripe-tests.ts @@ -252,8 +252,12 @@ stripe.customers.create({ customer.cards.del("card_17xMvXBoqMA9o2xkq6W5gamx").then(function (confirmation) {}); customer.subscriptions.create({ plan: "gold" }).then(function (subscription) { }); + customer.subscriptions.create({ plan: "gold", trial_end: "now" }).then(function (subscription) { }); + customer.subscriptions.create({ plan: "gold", trial_end: 1516881177 }).then(function (subscription) { }); customer.subscriptions.retrieve("sub_8Eluur5KoIKxuy").then(function (subscription) { }); customer.subscriptions.update("sub_8Eluur5KoIKxuy", { plan: "silver" }).then(function (subscription) { }); + customer.subscriptions.update("sub_8Eluur5KoIKxuy", { trial_end: "now" }); + customer.subscriptions.update("sub_8Eluur5KoIKxuy", { trial_end: 1516881177 }); customer.subscriptions.list().then(function (subscriptions) { }); customer.subscriptions.del("sub_8Eluur5KoIKxuy").then(function (subscription) { }); customer.subscriptions.deleteDiscount("sub_8Eluur5KoIKxuy").then(function (confirmation) { }); @@ -296,6 +300,22 @@ stripe.customers.create({ }); +// {"now"} for trial_end +stripe.customers.create({ + description: "Customer for test@example.com", + source: "tok_15V2YhEe31JkLCeQy9iUgsJX", // obtained with Stripe.js + plan: "platypi-dev", + trial_end: "now" +}); + +// {number} for trial_end +stripe.customers.create({ + description: "Customer for test@example.com", + source: "tok_15V2YhEe31JkLCeQy9iUgsJX", // obtained with Stripe.js + plan: "platypi-dev", + trial_end: 1516881177 +}); + stripe.customers.retrieve( "cus_5rfJKDJkuxzh5Q", function (err, customer) { From 0a704bbc7b6b6591a962f9e6ef092998bb600339 Mon Sep 17 00:00:00 2001 From: stefdelec Date: Thu, 25 Jan 2018 17:25:07 +0100 Subject: [PATCH 060/150] Update index.d.ts (#23154) Add getCountryCodeForRegion method in PhoneNumberUtil --- types/google-libphonenumber/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/google-libphonenumber/index.d.ts b/types/google-libphonenumber/index.d.ts index 0e410e121c..9a46ac69a6 100644 --- a/types/google-libphonenumber/index.d.ts +++ b/types/google-libphonenumber/index.d.ts @@ -42,7 +42,6 @@ declare namespace libphonenumber { hasCountryCode(): boolean; countryCodeCount(): number; clearCountryCode(): void; - getNationalNumber(): number | undefined; getNationalNumberOrDefault(): number; setNationalNumber(value: number): number; @@ -115,6 +114,7 @@ declare namespace libphonenumber { format(phoneNumber: PhoneNumber, format: PhoneNumberFormat): string; getNddPrefixForRegion(regionCode?: string, stripNonDigits?: boolean): string | undefined; getNumberType(phoneNumber: PhoneNumber): PhoneNumberType; + getCountryCodeForRegion(supportedRegion:string):string; getRegionCodeForCountryCode(countryCallingCode: number): string; getRegionCodeForNumber(phoneNumber: PhoneNumber): string | undefined; getSupportedRegions():string []; From c505a992f7b256335685c8e97687ce6bfda55ca9 Mon Sep 17 00:00:00 2001 From: vdfor <9846146+vdfor@users.noreply.github.com> Date: Fri, 26 Jan 2018 00:27:38 +0800 Subject: [PATCH 061/150] [echarts]Supported when include ECharts charts and components on demand (#23127) --- types/echarts/index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/echarts/index.d.ts b/types/echarts/index.d.ts index 0ea8aa0c6a..2880216e46 100644 --- a/types/echarts/index.d.ts +++ b/types/echarts/index.d.ts @@ -194,3 +194,7 @@ declare namespace echarts { declare module 'echarts' { export = echarts; } + +declare module 'echarts/lib/echarts' { + export = echarts; +} From 67a3798e3365fdd73380608c4bb8ee45ef27fabe Mon Sep 17 00:00:00 2001 From: Jinesh Shah Date: Thu, 25 Jan 2018 11:55:41 -0500 Subject: [PATCH 062/150] added searchableAttributes (#23194) searchableAttributes was missing in AlgoliaIndexSettings --- types/algoliasearch/index.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/algoliasearch/index.d.ts b/types/algoliasearch/index.d.ts index 968fe63151..5c7026d70e 100644 --- a/types/algoliasearch/index.d.ts +++ b/types/algoliasearch/index.d.ts @@ -1387,6 +1387,12 @@ Interface describing options available for gettings the logs * https://github.com/algolia/algoliasearch-client-js#unretrievableattributes */ unretrievableAttributes?: string[]; + /** + * List of attributes you want to use for textual search + * default: [] + * https://github.com/algolia/algoliasearch-client-js#searchableattributes + */ + searchableAttributes?: string[]; /** * A string that contains the list of attributes you want to retrieve in order to minimize the size of the JSON answer * default: * From 3c6fcb55cb2c485c98a842b09a8c632bf30f0b43 Mon Sep 17 00:00:00 2001 From: Antoine Niek Date: Thu, 25 Jan 2018 11:59:54 -0500 Subject: [PATCH 063/150] Fix react-bootstrap DropdownButton title prop (#23059) Don't narrow down DropdownButton title prop type with more restrictive title prop coming from React.HTMLProps. --- types/react-bootstrap/lib/DropdownButton.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-bootstrap/lib/DropdownButton.d.ts b/types/react-bootstrap/lib/DropdownButton.d.ts index e2626e2bb7..b1addd7ace 100644 --- a/types/react-bootstrap/lib/DropdownButton.d.ts +++ b/types/react-bootstrap/lib/DropdownButton.d.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -import { Sizes } from 'react-bootstrap'; +import { Sizes, Omit } from 'react-bootstrap'; import { DropdownBaseProps } from './Dropdown'; declare namespace DropdownButton { @@ -13,7 +13,7 @@ declare namespace DropdownButton { title: React.ReactNode; } - export type DropdownButtonProps = DropdownButtonBaseProps & React.HTMLProps; + export type DropdownButtonProps = DropdownButtonBaseProps & Omit, 'title'>; } declare class DropdownButton extends React.Component { } From 3fb7ee705bed648440d4b0d3d25ef1d913492505 Mon Sep 17 00:00:00 2001 From: Rich B Date: Thu, 25 Jan 2018 10:01:07 -0700 Subject: [PATCH 064/150] Add several missing typings for the recharts Tooltip Component (#23057) * Correct several missing typings * fix linting errors --- types/recharts/index.d.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/types/recharts/index.d.ts b/types/recharts/index.d.ts index 2b7364c38b..3b9afac937 100644 --- a/types/recharts/index.d.ts +++ b/types/recharts/index.d.ts @@ -4,6 +4,7 @@ // Raphael Mueller // Roy Xue // Zheyang Song +// Rich Baird // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -773,7 +774,11 @@ export interface Coordinate { export interface TooltipPayload { name: string; value: string | number | Array; - unit: string; + unit?: string; + color?: string; + fill?: string; + dataKey?: string; + formatter?: TooltipFormatter; } export interface TooltipProps extends Animatable { @@ -794,6 +799,7 @@ export interface TooltipProps extends Animatable { payload?: TooltipPayload[]; itemSorter?: ItemSorter; filterNull?: boolean; + useTranslate3d?: boolean; } export class Tooltip extends React.Component { } From 75b0fc7a78487c5e78dc3c38e40d4987b2a012e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Bendykowski?= Date: Thu, 25 Jan 2018 17:09:21 +0000 Subject: [PATCH 065/150] Update moment-duration-format typings to version 2.2 (#23052) * Update moment-duration-format typings to version 2.2 * Remove omitted trailing whitespace --- types/moment-duration-format/index.d.ts | 83 +++-- .../moment-duration-format-tests.ts | 343 +++++++++++++++++- 2 files changed, 383 insertions(+), 43 deletions(-) diff --git a/types/moment-duration-format/index.d.ts b/types/moment-duration-format/index.d.ts index 402db8a75b..4506311ab6 100644 --- a/types/moment-duration-format/index.d.ts +++ b/types/moment-duration-format/index.d.ts @@ -1,7 +1,11 @@ -// Type definitions for moment-duration-format 1.3 +// Type definitions for moment-duration-format 2.2 // Project: https://github.com/jsmreese/moment-duration-format -// Definitions by: Swint De Coninck , Niklas Walter , Leonard Thieu +// Definitions by: Swint De Coninck +// Niklas Walter +// Leonard Thieu +// Lukasz Bendykowski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as moment from "moment"; @@ -22,33 +26,66 @@ declare module "moment" { (settings?: DurationFormatSettings): string; } + type UnitOfTrimV1 = 'left' | 'right'; + type UnitOfTrim = ( + 'large' | 'small' | 'both' | + 'mid' | 'all' | 'final' + ); + interface DurationFormatSettings { - escape?: RegExp; - years?: RegExp; - months?: RegExp; - weeks?: RegExp; - days?: RegExp; - hours?: RegExp; - minutes?: RegExp; - seconds?: RegExp; - milliseconds?: RegExp; - general?: RegExp; + trim?: false | UnitOfTrimV1 | UnitOfTrim | string | Array; + largest?: number; + trunc?: true; + stopTrim?: string; - types?: string; + minValue?: number; + maxValue?: number; - // "left" - template tokens are trimmed from the left until the first moment token that has a value >= 1 - // "right" - template tokens are trimmed from the right until the first moment token that has a value >= 1 - // (the final moment token is not trimmed, regardless of value) - // `false` - template tokens are not trimmed - trim?: 'left' | 'right' | false; - - // number of decimal digits to include after (to the right of) the decimal point (positive integer) - // or the number of digits to truncate to 0 before (to the left of) the decimal point (negative integer) + useGrouping?: boolean; precision?: number; + decimalSeparator?: string; + groupingSeparator?: string; + grouping?: number[]; - // force first moment token with a value to render at full length even when template is trimmed and first moment token has length of 1 - forceLength?: boolean | null; + useSignificantDigits?: true; + + forceLength?: boolean; template?: string | TemplateFunction; + + userLocale?: string; + usePlural?: boolean; + useLeftUnits?: boolean; + useToLocaleString?: boolean; + } + + type DurationLabelType = "long" | "standard" | "short"; + type DurationTemplate = "HMS" | "HM" | "MS"; + type DurationToken = ( + "S" | "SS" | "SSS" | + "s" | "ss" | "sss" | + "m" | "mm" | "mmm" | + "h" | "hh" | "hhh" | + "d" | "dd" | "ddd" | + "w" | "ww" | "www" | + "M" | "MM" | "MMM" | + "y" | "yy" | "yyy" + ); + + type DurationLabelDef = {[duration in DurationToken]: string}; + type DurationTimeDef = {[template in DurationTemplate]: string}; + + interface DurationLabelTypeDef { + type: DurationLabelType; + string: string; + } + + interface LocaleSpecification { + durationLabelsLong: DurationLabelDef; + durationLabelsStandard: DurationLabelDef; + durationLabelsShort: DurationLabelDef; + durationTimeTemplates: DurationTimeDef; + durationLabelTypes: DurationLabelTypeDef[]; + durationPluralKey: (token: string, integerValue: number, decimalValue: number) => string; } type TemplateFunction = ((this: DurationFormatSettings) => string); diff --git a/types/moment-duration-format/moment-duration-format-tests.ts b/types/moment-duration-format/moment-duration-format-tests.ts index 52f313b9b4..135131ce71 100644 --- a/types/moment-duration-format/moment-duration-format-tests.ts +++ b/types/moment-duration-format/moment-duration-format-tests.ts @@ -43,30 +43,333 @@ moment.duration(123, "seconds").format("hh:mm:ss"); moment.duration(123, "seconds").format("h:mm:ss", { forceLength: true }); // "02:03" -moment.duration.fn.format.defaults.escape = /\((.+?)\)/; -moment.duration(123, "seconds").format("m (minutes)", 2); -// "2.04 minutes" +moment.duration(123, "minutes").format("d[d] h:mm:ss"); +// "2:03:00" -moment.duration.fn.format.defaults.years = /[Aa]+/; -moment.duration(123, "weeks").format("a [años]", 2); -// "2.35 años" +moment.duration(123, "minutes").format("s [seconds], m [minutes], h [hours], d [days]"); +// "0 seconds, 3 minutes, 2 hours" -moment.duration.fn.format.defaults.months = /m+/; -moment.duration(123, "weeks").format("m M", 2); -// "28.36 M" +moment.duration(123, "minutes").format("d[d] h:mm:ss", { + trim: false +}); +// "0d 2:03:00" -moment.duration.fn.format.defaults.weeks = /w+/; -moment.duration(123, "days").format("w W", 2); -// "17.57 W" +moment.duration(123, "minutes").format("d[d] h:mm:ss"); +// "2:03:00" -moment.duration.fn.format.defaults.days = /d+/; -moment.duration(123, "hours").format("d D", 2); -// "5.12 D" +moment.duration(123, "minutes").format("d[d] h:mm:ss", { + trim: "large" +}); +// "2:03:00" -moment.duration.fn.format.defaults.hours = /h+/; -moment.duration(123, "minutes").format("h H", 2); -// "2.04 H" +moment.duration(0, "minutes").format("d[d] h:mm:ss", { + trim: "large" +}); +// "0" -moment.duration.fn.format.defaults.minutes = /n+/; -moment.duration(123, "seconds").format("n:ss"); +moment.duration(123, "minutes").format("d[d] h:mm:ss", { + trim: "small" +}); +// "0d 2:03" + +moment.duration(0, "minutes").format("d[d] h:mm:ss", { + trim: "small" +}); +// "0d" + +moment.duration(123, "minutes").format("d[d] h[h] m[m] s[s]", { + trim: "both" +}); +// "2h 3m" + +moment.duration(0, "minutes").format("d[d] h[h] m[m] s[s]", { + trim: "both" +}); +// "0s" + +moment.duration(1441, "minutes").format("w[w] d[d] h[h] m[m] s[s]", { + trim: "mid" +}); +// "0w 1d 1m 0s" + +moment.duration(1441, "minutes").format("w[w] d[d] h[h] m[m] s[s]", { + trim: "large mid" +}); +// "1d 1m 0s" + +moment.duration(1441, "minutes").format("w[w] d[d] h[h] m[m] s[s]", { + trim: "small mid" +}); +// "0w 1d 1m" + +moment.duration(1441, "minutes").format("w[w] d[d] h[h] m[m] s[s]", { + trim: "both mid" +}); +// "1d 1m" + +moment.duration(0, "minutes").format("w[w] d[d] h[h] m[m] s[s]", { + trim: "both mid" +}); +// "0s" + +moment.duration(0, "minutes").format("d[d] h:mm:ss", { + trim: "large final" +}); +// "" + +moment.duration(0, "minutes").format("d[d] h:mm:ss", { + trim: "small final" +}); +// "" + +moment.duration(0, "minutes").format("d[d] h[h] m[m] s[s]", { + trim: "both final" +}); +// "" + +moment.duration(0, "minutes").format("d[d] h[h] m[m] s[s]", { + trim: "all" +}); +// "" + +moment.duration(7322, "seconds").format("d [days], h [hours], m [minutes], s [seconds]", { + largest: 2 +}); +// "2 hours, 2 minutes" + +moment.duration(1216922, "seconds").format("y [years], w [weeks], d [days], h [hours], m [minutes], s [seconds]", { + largest: 2 +}); +// "2 weeks, 2 hours" + +moment.duration(23, "minutes").format("d[d] h:mm:ss", { + stopTrim: "h" +}); +// "0:23:00" + +moment.duration(23, "minutes").format("d[d] *h:mm:ss"); +// "0:23:00" + +moment.duration(2, "hours").format("y [years], d [days], h [hours], m [minutes], s [seconds]", { + trim: "both", + stopTrim: "d m" +}); +// "0 days, 2 hours, 0 minutes" + +moment.duration(2, "hours").format("y [years], *d [days], h [hours], *m [minutes], s [seconds]", { + trim: "both" +}); +// "0 days, 2 hours, 0 minutes" + +moment.duration(2, "hours").format("y [years], d [days], h [hours], m [minutes], s [seconds]", { + trim: "both", + stopTrim: "d m", + largest: 2 +}); +// "2 hours" + +moment.duration(179, "seconds").format("m [minutes]"); +// "3 minutes" + +moment.duration(3780, "seconds").format("h [hours]", 1); +// "1.1 hours" + +moment.duration(179, "seconds").format("m [minutes]", { + trunc: true +}); +// "2 minutes" + +moment.duration(3780, "seconds").format("h [hours]", 1, { + trunc: true +}); +// "1.0 hours" + +moment.duration(59, "seconds").format("d [days], h [hours], m [minutes]", { + trunc: true, + trim: "both" +}); +// "0 minutes" + +moment.duration(59, "seconds").format("d [days], h [hours], m [minutes]", { + trunc: true, + trim: "all" +}); +// "" + +moment.duration(59, "seconds").format("d [days], h [hours], m [minutes]", { + trunc: true, + largest: 1 +}); +// "" + +moment.duration(59, "seconds").format("h [hours], m [minutes]", { + minValue: 1 +}); +// "< 1 minute" + +moment.duration(59, "seconds").format("h [hours], m [minutes]", { + minValue: 1, + trim: "both" +}); +// "< 1 minute" + +moment.duration(7229, "seconds").format("h [hours], m [minutes]", { + minValue: 1, + trim: "both" +}); +// "2 hours" + +moment.duration(59, "seconds").format("h [hours], m [minutes]", { + minValue: 1, + trunc: true, + trim: "all" +}); +// "" + +moment.duration(-59, "seconds").format("h [hours], m [minutes]", { + minValue: 1 +}); +// "> -1 minute" + +moment.duration(59, "seconds").format("h [hours], m [minutes]", { + minValue: 1, + trim: false, + largest: 2 +}); +// "< 1 minute" + +moment.duration(15, "days").format("w [weeks]", { + maxValue: 2 +}); +// "> 2 weeks" + +moment.duration(-15, "days").format("w [weeks]]", { + maxValue: 2 +}); +// "< -2 weeks" + +moment.duration(15, "days").format("w [weeks], d [days]", { + maxValue: 2, + trim: false, + largest: 2 +}); +// "> 2 weeks" + +moment.duration(123, "seconds").format("h:mm:ss"); // "2:03" + +moment.duration(123, "seconds").format("hh:mm:ss"); +// "02:03" + +moment.duration(123, "seconds").format("h:mm:ss", { + forceLength: true +}); +// "02:03" + +moment.duration(99999, "seconds").format("d [days], h [hours], m [minutes], s [seconds]", { + useSignificantDigits: true, + precision: 3 +}); +// "1 day, 3 hours, 50 minutes" + +moment.duration(99999, "seconds").format("d [days], h [hours], m [minutes], s [seconds]", { + useSignificantDigits: true, + precision: 3, + trunc: true +}); +// "1 day, 3 hours, 40 minutes" + +moment.duration(99999, "seconds").format("d [days], h [hours], m [minutes], s [seconds]", { + useSignificantDigits: true, + precision: 5 +}); +// "1 day, 3 hours, 46 minutes, 40 seconds" + +moment.duration(99999, "seconds").format("d [days], h [hours], m [minutes], s [seconds]", { + useSignificantDigits: true, + trunc: true, + precision: 5 +}); +// "1 day, 3 hours, 46 minutes, 30 seconds" + +moment.duration(99999, "seconds").format("d [days], h [hours], m [minutes], s [seconds]", { + useSignificantDigits: true, + precision: 6 +}); +// "1 day, 3 hours, 46 minutes, 39 seconds" + +moment.duration(1234567, "seconds").format("m [minutes]", 3); +// "20,576.117 minutes" + +moment.duration(1234567, "seconds").format("m [minutes]", 3, { + userLocale: "de-DE" +}); +// "20.576,117 minutes" + +moment.duration(2, "minutes").format("m _"); +// "2 mins" + +moment.duration(2, "minutes").format("m __"); +// "2 minutes" + +moment.duration(3661, "seconds").format("_HMS_"); +// "1:01:01" + +moment.duration(3661, "seconds").format("_HM_"); +// "1:01" + +moment.duration(61, "seconds").format("_MS_"); +// "1:01" + +moment.duration(1, "minutes").format("m [minutes]"); +// "1 minute" + +moment.duration(1, "minutes").format("m [mins]"); +// "1 min" + +moment.duration(2, "minutes").format("m [minute]"); +// "2 minutes" + +moment.duration(2, "minutes").format("m [min]"); +// "2 mins" + +moment.duration(1, "minutes").format("m [minutes]", { + usePlural: false +}); +// "1 minutes" + +moment.duration(1, "minutes").format("m [mins]", { + usePlural: false +}); +// "1 mins" + +moment.duration(2, "minutes").format("m [minute]", { + usePlural: false +}); +// "2 minute" + +moment.duration(2, "minutes").format("m [min]", { + usePlural: false +}); +// "2 min" + +moment.duration(1, "minutes").format("m [minutes]", 2); +// "1.00 minutes" + +moment.duration(7322, "seconds").format("_ h, _ m, _ s", { + useLeftUnits: true +}); +// "hrs 2, mins 2, secs 2" + +moment.duration(1234, "seconds").format("s [seconds]"); +// "1,234 seconds" + +moment.duration(1234, "seconds").format("s [seconds]", { + useGrouping: false +}); +// "1234 seconds" + +moment.duration(1234567, "seconds").format("m [minutes]", 3, { + userLocale: "de-DE" +}); +// "20.576,117 minutes" From 75f317ef3b1239a8753d54240a773b17f8532460 Mon Sep 17 00:00:00 2001 From: Hidde Stokvis Date: Thu, 25 Jan 2018 18:11:57 +0100 Subject: [PATCH 066/150] Add typing to Role.registerResolver function (#23074) --- types/loopback/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/loopback/index.d.ts b/types/loopback/index.d.ts index 99fc4d4ccb..087ce2aadd 100644 --- a/types/loopback/index.d.ts +++ b/types/loopback/index.d.ts @@ -2653,7 +2653,7 @@ declare namespace l { * if a principal is in the specified role. * Should provide a callback or return a promise. */ - static registerResolver(role: string, resolver: () => void): void; + static registerResolver(role: string, resolver: (role: string, ctx: Context, callback?: (err: Error, resolved: boolean) => void) => Promise | void): void; } /** From 21cd9a3ab3bce0a5f84df7581b36b8d77723bd17 Mon Sep 17 00:00:00 2001 From: Rasmus Halland Date: Thu, 25 Jan 2018 18:12:53 +0100 Subject: [PATCH 067/150] ckeditor: Added and modified some definitions. (#23079) --- types/ckeditor/index.d.ts | 95 ++++++++++++++++++++++++++++----------- 1 file changed, 70 insertions(+), 25 deletions(-) diff --git a/types/ckeditor/index.d.ts b/types/ckeditor/index.d.ts index 20882269fd..cf7cd0cc27 100644 --- a/types/ckeditor/index.d.ts +++ b/types/ckeditor/index.d.ts @@ -24,6 +24,8 @@ declare namespace CKEDITOR { var DIALOG_RESIZE_HEIGHT: number; var DIALOG_RESIZE_NONE: number; var DIALOG_RESIZE_WIDTH: number; + var DIALOG_STATE_IDLE: number; + var DIALOG_STATE_BUSY: number; var ELEMENT_MODE_APPENDTO: number; var ELEMENT_MODE_INLINE: number; var ELEMENT_MODE_NONE: number; @@ -42,6 +44,10 @@ declare namespace CKEDITOR { var NODE_DOCUMENT_FRAGMENT: number; var NODE_ELEMENT: number; var NODE_TEXT: number; + var POSITION_BEFORE_START: number; + var POSITION_BEFORE_END: number; + var POSITION_AFTER_START: number; + var POSITION_AFTER_END: number; var SELECTION_ELEMENT: number; var SELECTION_NONE: number; var SELECTION_TEXT: number; @@ -49,6 +55,9 @@ declare namespace CKEDITOR { var SHRINK_ELEMENT: number; var SHRINK_TEXT: number; var START: number; + var STYLE_BLOCK: string; + var STYLE_INLINE: string; + var STYLE_OBJECT: string; var TRISTATE_DISABLED: number; var TRISTATE_OFF: number; var TRISTATE_ON: number; @@ -62,7 +71,7 @@ declare namespace CKEDITOR { var currentInstance: editor; var document: dom.document; var env: environmentConfig; - var instances: editor[]; + var instances: { [id: string]: editor | undefined }; var loadFullCoreTimeout: number; var revision: string; var rnd: number; @@ -92,9 +101,19 @@ declare namespace CKEDITOR { function replaceAll(className?: string): void; function replaceAll(assertionFunction: (textarea: HTMLTextAreaElement, config: config) => boolean): void; + type listenerRegistration = { + removeListener: () => void; + } namespace dom { + interface bookmark { + startNode: dom.node | string; + endNode: dom.node | string; + serializable: boolean; + collapsed: boolean; + } + class comment { // Properties @@ -269,16 +288,17 @@ declare namespace CKEDITOR { class elementPath { constructor(startNode: element, root: element); + constructor(startNode: element); block: element; blockLimit: element; root: element; elements: element[]; compare(otherPath: elementPath): boolean; - contains(query: string, excludeRoot: boolean, fromTop: boolean): element; - contains(query: string[], excludeRoot: boolean, fromTop: boolean): element; - contains(query: (element: element) => boolean, excludeRoot: boolean, fromTop: boolean): element; - contains(query: Object, excludeRoot: boolean, fromTop: boolean): element; - contains(query: element, excludeRoot: boolean, fromTop: boolean): element; + contains(query: string, excludeRoot?: boolean, fromTop?: boolean): element; + contains(query: string[], excludeRoot?: boolean, fromTop?: boolean): element; + contains(query: (element: element) => boolean, excludeRoot?: boolean, fromTop?: boolean): element; + contains(query: Object, excludeRoot?: boolean, fromTop?: boolean): element; + contains(query: element, excludeRoot?: boolean, fromTop?: boolean): element; isContextFor(tag: string): boolean; direction(): string; } @@ -300,7 +320,7 @@ declare namespace CKEDITOR { cloneContents(): documentFragment; deleteContents(mergeThen?: boolean): void; extractContents(mergeThen?: boolean): documentFragment; - createBookmark(serializable: boolean): Object; + createBookmark(serializable?: boolean): bookmark; createBookmark2(normalized: boolean): Object; createIterator(): iterator; moveToBookmark(bookmark: Object): void; @@ -322,6 +342,7 @@ declare namespace CKEDITOR { setStartAt(node: node, position: number): void; setEndAt(node: node, position: number): void; fixBlock(isStart: boolean, blockTag: Object): Object; + select(): selection; splitBlock(blockTag: Object): Object; splitElement(toSplit: element): element; removeEmptyBlocksAtEnd(atEnd: boolean): void; @@ -815,7 +836,7 @@ declare namespace CKEDITOR { templates_files?: Object; templates_replaceContent?: boolean; title?: string | boolean; - toolbar?: string | (string | string[])[]; + toolbar?: string | (string | string[] | { name: string, items?: string[], groups?: string[] })[] | null; toolbarCanCollapse?: boolean; toolbarGroupCycling?: boolean; toolbarGroups?: (toolbarGroups | string)[]; @@ -847,14 +868,20 @@ declare namespace CKEDITOR { bottom?: string | HTMLElement; } + module skin { + var icons: { [name: string]: { path: string } }; + function addIcon(name: string, path: string, offset?: number, bgsize?: string): void; + } - interface style { - - } - - - interface editable { + class style { + constructor(something: { element: string, attributes: { [att: string]: string } }); + applyToRange(range: Range, editor: editor): void; + } + interface editable extends dom.element { + hasFocus: boolean; + attachListener(obj: event | editable, eventName: string, listenerFunction: (ei: eventInfo) => void, + scopeobj?: {}, listenerData?: any, priority?: number): listenerRegistration; } @@ -951,11 +978,14 @@ declare namespace CKEDITOR { destroy(widget: CKEDITOR.plugins.widget, offline?: boolean): void; destroyAll(offline?: boolean): void; finalizeCreation(container: any): void; + focused: widget; fire(eventName: string, data: Object, editor: editor): any; // should be boolean | Object getByElement(element: any, checkWrapperOnly: boolean): CKEDITOR.plugins.widget; hasListeners(eventName: string): boolean; - initOn(element: any, widgetDef?: CKEDITOR.plugins.widget.definition, startupData?: Object): CKEDITOR.plugins.widget; - initOnAll(container?: any): CKEDITOR.plugins.widget[]; + initOn(element: dom.element, widgetDef?: CKEDITOR.plugins.widget.definition, startupData?: Object): CKEDITOR.plugins.widget; + initOn(element: dom.element, widgetDef?: string, startupData?: Object): CKEDITOR.plugins.widget; + initOnAll(container?: dom.element): CKEDITOR.plugins.widget[]; + instances: { [id: string]: widget }; on(eventName: string, listenerFunction: Function, scopeObj?: Object, listenerData?: Object, priority?: number): any; once(): void; parseElementClasses(classes: string): any; @@ -1040,12 +1070,13 @@ declare namespace CKEDITOR { requires?: string | string[]; afterInit?(editor: editor): any; beforeInit?(editor: editor): any; - init?(editor: editor): any; + init?(editor: editor): void; onLoad?(): any; icons?: string; } - function add(name: string, definition?: IPluginDefinition): void; + function add(name: string, definition: IPluginDefinition): void; + function add(name: string): void; function addExternal(name: string, path: string, fileName: string): void; function get(name: string): any; function getFilePath(name: string): string; @@ -1058,6 +1089,7 @@ declare namespace CKEDITOR { interface IMenuItemDefinition { label:string, command:string, + icon: string group:string, order:number } @@ -1110,6 +1142,7 @@ declare namespace CKEDITOR { createFakeParserElement(realElement: Object, className: Object, realElementType: Object, isResizable: Object): void; createRange(): dom.range; destroy(noUpdate?: boolean): void; + editable(): editable | null; editable(elementOrEditable: dom.element): void; editable(elementOrEditable: editable): void; elementPath(startNode?: dom.node): dom.elementPath; @@ -1267,8 +1300,14 @@ declare namespace CKEDITOR { stop(): void; } + module filter { + interface allowedContentRules { + + } + } class filter { + allow(newRules: CKEDITOR.filter.allowedContentRules, featureName?: string, overrideCustom?: boolean): boolean; } @@ -1309,8 +1348,8 @@ declare namespace CKEDITOR { fire(eventName: string, data?: Object, editor?: editor): any; fireOnce(eventName: string, data?: Object, editor?: editor): any; hasListeners(eventName: string): boolean; - on(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: Object, listenerData?: Object, priority?: number): void; - once(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: Object, listenerData?: Object, priority?: number): void; + on(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: Object | null, listenerData?: Object | null, priority?: number): listenerRegistration; + once(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: Object | null, listenerData?: Object | null, priority?: number): listenerRegistration; removeAllListeners(): void; removeListener(eventName: string, listenerFunction: (eventInfo: eventInfo) => void): void; static implementOn(targetObject: Object): void; @@ -1768,6 +1807,7 @@ declare namespace CKEDITOR { constructor(value: string); type: number; filter(filter: filter): boolean; + value: string; writeHtml(writer: basicWriter, filter: filter): void; } @@ -1779,6 +1819,7 @@ declare namespace CKEDITOR { children: any[]; type: number; add(node: node): number; + add(node: node, index: number): void; clone(): element; filter(filter: filter): boolean; filterChildren(filter: filter): void; @@ -1803,10 +1844,12 @@ declare namespace CKEDITOR { children: any[]; parent: any; type: number; - fromHtml(fragmentHtml: string, parent?: element, fixingBlock?: string): void; - fromHtml(fragmentHtml: string, parent?: string, fixingBlock?: string): void; - fromHtml(fragmentHtml: string, parent?: element, fixingBlock?: boolean): void; - fromHtml(fragmentHtml: string, parent?: string, fixingBlock?: boolean): void; + static fromHtml(fragmentHtml: string): fragment; + static fromHtml(fragmentHtml: string, parent?: element, fixingBlock?: string): fragment | element; + static fromHtml(fragmentHtml: string, parent: null, fixingBlock?: string): fragment; + static fromHtml(fragmentHtml: string, parent?: string, fixingBlock?: string): fragment | element; + static fromHtml(fragmentHtml: string, parent?: element, fixingBlock?: boolean): fragment | element; + static fromHtml(fragmentHtml: string, parent?: string, fixingBlock?: boolean): fragment | element; add(node: node, index?: number): void; filter(filter: filter): void; filterChildren(filter: filter, filterRoot?: boolean): void; @@ -1847,7 +1890,9 @@ declare namespace CKEDITOR { namespace tools { var callFunction: Function; - function enableHtml5Elements(doc: Object, withAppend? : Boolean) : void; + function enableHtml5Elements(doc: Object, withAppend?: Boolean): void; + function parseCssText(styleText: string, normalize?: Boolean, nativeNormalize?: Boolean): { [key: string]: string } + function writeCssText(style: { [key: string]: string }, sort?: Boolean): string; } From 4ed51b52ab9b2591a2d41bae52ca8b09375a6bde Mon Sep 17 00:00:00 2001 From: Vito Date: Thu, 25 Jan 2018 12:13:21 -0500 Subject: [PATCH 068/150] improve pubnub typings (#23085) --- types/pubnub/index.d.ts | 180 ++++++++++++++++++++++++++++++++--- types/pubnub/pubnub-tests.ts | 41 +++++++- 2 files changed, 205 insertions(+), 16 deletions(-) diff --git a/types/pubnub/index.d.ts b/types/pubnub/index.d.ts index 3ad70755a0..8337acfbe4 100644 --- a/types/pubnub/index.d.ts +++ b/types/pubnub/index.d.ts @@ -1,12 +1,22 @@ // Type definitions for pubnub 4.0 // Project: https://github.com/pubnub/javascript -// Definitions by: bitbankinc , rollymaduk +// Definitions by: bitbankinc , rollymaduk , vitosamson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // @see https://www.pubnub.com/docs/web-javascript/api-reference-configuration declare class Pubnub { constructor(config: Pubnub.PubnubConfig); + static CATEGORIES: Pubnub.Categories; + + static OPERATIONS: Pubnub.Operations; + + static generateUUID(): string; + + setUUID(uuid: string): void; + + getUUID(): string; + setAuthKey(authKey: string): void; setFilterExpression(filterExpression: string): void; @@ -15,7 +25,7 @@ declare class Pubnub { publish( params: Pubnub.PublishParameters, - callback: (status: any, response: Pubnub.PublishResponse) => void + callback: (status: Pubnub.PublishStatus, response: Pubnub.PublishResponse) => void ): void; publish( @@ -24,7 +34,7 @@ declare class Pubnub { fire( params: Pubnub.FireParameters, - callback: (status: any, response: Pubnub.PublishResponse) => void + callback: (status: Pubnub.PublishStatus, response: Pubnub.PublishResponse) => void ): void; fire( @@ -45,7 +55,7 @@ declare class Pubnub { hereNow( params: Pubnub.HereNowParameters, - callback: (status: any, response: Pubnub.HereNowResponse) => void + callback: (status: Pubnub.HereNowStatus, response: Pubnub.HereNowResponse) => void ): void; hereNow( @@ -53,9 +63,31 @@ declare class Pubnub { ): Promise; whereNow( - params: {uuid: string}, + params: Pubnub.WhereNowParameters, callback: (status: Pubnub.WhereNowStatus, response: Pubnub.WhereNowResponse) => void ): void; + + whereNow( + params: Pubnub.WhereNowParameters + ): Promise; + + getState( + params: Pubnub.GetStateParameters, + callback: (status: Pubnub.GetStateStatus, state: Pubnub.GetStateResponse) => void + ): void; + + getState( + params: Pubnub.GetStateParameters + ): Promise; + + setState( + params: Pubnub.SetStateParameters, + callback: (status: Pubnub.SetStateStatus, state: Pubnub.SetStateResponse) => void + ): void; + + setState( + params: Pubnub.SetStateParameters + ): Promise; } declare namespace Pubnub { @@ -83,15 +115,30 @@ declare namespace Pubnub { secretKey?: string; } - interface PubnubData { - actualChannel: string; + interface MessageEvent { channel: string; + subscription: string; + timetoken: string; message: any; + publisher: string; + + /** + * @deprecated + */ + actualChannel: string; + + /** + * @deprecated + */ + subscribedChannel: string; } + // PubnubData was renamed to MessageEvent, keep old name for backwards compatibility + type PubnubData = MessageEvent; + interface StatusEvent { - category: string; - operation: string; + category: string; // see Pubnub.Categories + operation: string; // see Pubnub.Operations affectedChannels: string[]; subscribedChannels: string[]; affectedChannelGroups: string[]; @@ -99,6 +146,26 @@ declare namespace Pubnub { currentTimetoken: number | string; } + interface PresenceEvent { + action: 'join' | 'leave' | 'state-change' | 'timeout'; + channel: string; + occupancy: number; + state?: any; + subscription: string; + timestamp: number; + timetoken: string; + uuid: string; + + /** + * @deprecated + */ + actualChannel: string; + /** + * @deprecated + */ + subscribedChannel: string; + } + // publish interface PublishParameters { message: any; @@ -113,6 +180,13 @@ declare namespace Pubnub { timetoken: number; } + interface PublishStatus { + operation: string; // see Pubnub.Operations + category: string; // see Pubnub.Categories; + error: boolean; + errorData: Error; + } + // fire interface FireParameters { message: any; @@ -137,9 +211,9 @@ declare namespace Pubnub { // addListener interface ListenerParameters { - status?: (statusEvent: StatusEvent) => void; - message?: (data: PubnubData) => void; - presence?: (presenceEvent: any) => void; + status?(statusEvent: StatusEvent): void; + message?(messageEvent: MessageEvent): void; + presence?(presenceEvent: PresenceEvent): void; } // hereNow @@ -153,10 +227,29 @@ declare namespace Pubnub { interface HereNowResponse { totalChannels: number; totalOccupancy: number; - channels: {[channel: string]: any}; + channels: { + [channel: string]: { + name: string; + occupancy: number; + occupants: Array<{ + uuid: string; + state?: any; + }>; + }; + }; + } + + interface HereNowStatus { + error: boolean; + operation: string; // see Pubnub.Operations; + statusCode: number; } // whereNow + interface WhereNowParameters { + uuid?: string; + } + interface WhereNowStatus { error: boolean; operation: string; @@ -174,12 +267,71 @@ declare namespace Pubnub { state?: any; } + interface SetStateStatus { + error: boolean; + operation: string; + statusCode: number; + } + + interface SetStateResponse { + state: any; + } + // getState interface GetStateParameters { uuid?: string; channels?: string[]; channelGroups?: string[]; } + + interface GetStateStatus { + error: boolean; + operation: string; + statusCode: number; + } + + interface GetStateResponse { + channels: { + [channel: string]: any; + }; + } + + interface Categories { + PNNetworkUpCategory: string; + PNNetworkDownCategory: string; + PNNetworkIssuesCategory: string; + PNTimeoutCategory: string; + PNBadRequestCategory: string; + PNAccessDeniedCategory: string; + PNUnknownCategory: string; + PNReconnectedCategory: string; + PNConnectedCategory: string; + PNRequestMessageCountExceededCategory: string; + } + + interface Operations { + PNTimeOperation: string; + PNHistoryOperation: string; + PNDeleteMessagesOperation: string; + PNFetchMessagesOperation: string; + PNSubscribeOperation: string; + PNUnsubscribeOperation: string; + PNPublishOperation: string; + PNPushNotificationEnabledChannelsOperation: string; + PNRemoveAllPushNotificationsOperation: string; + PNWhereNowOperation: string; + PNSetStateOperation: string; + PNHereNowOperation: string; + PNGetStateOperation: string; + PNHeartbeatOperation: string; + PNChannelGroupsOperation: string; + PNRemoveGroupOperation: string; + PNChannelsForGroupOperation: string; + PNAddChannelsToGroupOperation: string; + PNRemoveChannelsFromGroupOperation: string; + PNAccessManagerGrant: string; + PNAccessManagerAudit: string; + } } -export default Pubnub; +export = Pubnub; diff --git a/types/pubnub/pubnub-tests.ts b/types/pubnub/pubnub-tests.ts index 291fc035fe..63bd206cde 100644 --- a/types/pubnub/pubnub-tests.ts +++ b/types/pubnub/pubnub-tests.ts @@ -1,4 +1,4 @@ -import Pubnub from 'pubnub'; +import * as Pubnub from 'pubnub'; const console = { log: (params: any) => {} @@ -36,8 +36,10 @@ pubnub.subscribe({channels: ['channel-1']}); pubnub.addListener({ status: statusEvent => { - if (statusEvent.category === "PNConnectedCategory") { + if (statusEvent.category === Pubnub.CATEGORIES.PNConnectedCategory) { console.log(statusEvent.category); + } else if (statusEvent.operation === Pubnub.OPERATIONS.PNAccessManagerAudit) { + console.log(statusEvent.operation); } }, message: message => { @@ -49,3 +51,38 @@ pubnub.addListener({ }); pubnub.unsubscribe({channels: ['channel-1']}); + +pubnub.unsubscribeAll(); + +pubnub.setUUID(Pubnub.generateUUID()); +const uuid = pubnub.getUUID(); + +pubnub.whereNow({ uuid: '' }, (status, res) => { + if (!status.error) { + console.log(res.channels[0]); + } +}); + +pubnub.whereNow({ uuid: '' }).then(res => { + console.log(res.channels[1]); +}); + +pubnub.getState({ uuid: '' }, (status, res) => { + if (!status.error) { + console.log(res.channels[0]); + } +}); + +pubnub.getState({ uuid: '' }).then(res => { + console.log(res.channels[1]); +}); + +pubnub.setState({ channels: [] }, (status, res) => { + if (!status.error) { + console.log(res.state); + } +}); + +pubnub.setState({ channels: [] }).then(res => { + console.log(res.state); +}); From d72c2f781ddc967e6fa297e3c90c8cc52377869a Mon Sep 17 00:00:00 2001 From: Sergei Dorogin Date: Thu, 25 Jan 2018 20:13:42 +0300 Subject: [PATCH 069/150] waypoints.jquery: jQuery Adapter of waypoints 4.x (jquery.waypoints) (#23170) * jQuery Adapter of waypoints 4.x (jquery.waypoints) waypoints: refactoring of WaypointOptions to allow waypoint.jquery definition (common options extracted into base interface - WaypointOptionsBase) * waypoints.jquery: set TypeScript version as 2.3 * waypoints.jquery: fixes: context moved to WaypointOptionsJQuery and WaypointOptions; waypoints-jquery-tests.ts renamed to waypoints.jquery-tests.ts * waypoints.jquery: fixes: removed BOM in waypoints.jquery-tests.ts * waypoints: waypoints.jquery has been moved into waypoints (as waypoints/jquery.d.ts) * waypoints: fixes: waypoints-tests.ts: fixed prefer-const Identifier 'waypoint1' is never reassigned; use 'const' instead of 'let'. --- types/waypoints/index.d.ts | 13 +++++---- types/waypoints/jquery.d.ts | 13 +++++++++ types/waypoints/tsconfig.json | 1 + types/waypoints/waypoints-tests.ts | 43 +++++++++++++++++++++++++++--- 4 files changed, 61 insertions(+), 9 deletions(-) create mode 100644 types/waypoints/jquery.d.ts diff --git a/types/waypoints/index.d.ts b/types/waypoints/index.d.ts index 97ad8d3488..0bf0c488d8 100644 --- a/types/waypoints/index.d.ts +++ b/types/waypoints/index.d.ts @@ -1,18 +1,21 @@ // Type definitions for waypoints 4.x // Project: https://github.com/imakewebthings/waypoints -// Definitions by: Dominik Bułaj , Alexey Kolotovchenkov +// Definitions by: Dominik Bułaj , Alexey Kolotovchenkov , Sergei Dorogin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 -interface WaypointOptions { - element: HTMLElement; - handler: (this: Waypoint, direction?: string) => void; +interface WaypointOptionsBase { offset?: string|number|(() => number); - context?: HTMLElement; continuous?: boolean; enabled?: boolean; group?: string; horizontal?: boolean; } +interface WaypointOptions extends WaypointOptionsBase { + element: HTMLElement; + handler: (this: Waypoint, direction?: string) => void; + context?: HTMLElement; +} declare class WaypointGroup { first: () => Waypoint; diff --git a/types/waypoints/jquery.d.ts b/types/waypoints/jquery.d.ts new file mode 100644 index 0000000000..d93b0ac18e --- /dev/null +++ b/types/waypoints/jquery.d.ts @@ -0,0 +1,13 @@ +/* Type definitions for jQuery Adapter for waypoints 4.0 */ + +/// + +interface JQuery { + waypoint(handler: (this: Waypoint, direction?: string) => void, options?: WaypointOptionsJQuery): JQuery; + waypoint(options?: WaypointOptionsJQuery): JQuery; +} + +interface WaypointOptionsJQuery extends WaypointOptionsBase { + handler?: (this: Waypoint, direction?: string) => void; + context?: HTMLElement|string; +} diff --git a/types/waypoints/tsconfig.json b/types/waypoints/tsconfig.json index c457df62f8..4acd5d77b4 100644 --- a/types/waypoints/tsconfig.json +++ b/types/waypoints/tsconfig.json @@ -19,6 +19,7 @@ }, "files": [ "index.d.ts", + "jquery.d.ts", "waypoints-tests.ts" ] } \ No newline at end of file diff --git a/types/waypoints/waypoints-tests.ts b/types/waypoints/waypoints-tests.ts index 658412f953..4ea425fbf8 100644 --- a/types/waypoints/waypoints-tests.ts +++ b/types/waypoints/waypoints-tests.ts @@ -4,7 +4,7 @@ declare function notify(text: string): void; // A Basic Waypoint // -------------------------------------------------------------------------------------------------------------------- -let waypoint1 = new Waypoint({ +const waypoint1 = new Waypoint({ element: document.getElementById('basic-waypoint')!, handler() { notify('Basic waypoint triggered'); @@ -13,7 +13,7 @@ let waypoint1 = new Waypoint({ // Directions // -------------------------------------------------------------------------------------------------------------------- -let waypoint2 = new Waypoint({ +const waypoint2 = new Waypoint({ element: document.getElementById('direction-waypoint')!, handler(direction) { notify('Direction: ' + direction); @@ -22,7 +22,7 @@ let waypoint2 = new Waypoint({ // Offsets // -------------------------------------------------------------------------------------------------------------------- -let waypoint3 = new Waypoint({ +const waypoint3 = new Waypoint({ element: document.getElementById('px-offset-waypoint')!, handler(direction) { notify('I am 20px from the top of the window'); @@ -32,10 +32,45 @@ let waypoint3 = new Waypoint({ // this? // -------------------------------------------------------------------------------------------------------------------- -let waypoint4 = new Waypoint({ +const waypoint4 = new Waypoint({ element: document.getElementById('element-waypoint')!, handler(direction) { notify(`${this.element.id} triggers at ${this.triggerPoint}`); }, offset: '75%' }); + +// JQuery adapter +// All code examples below taken from http://imakewebthings.com/waypoints/guides/jquery-zepto/ + +import $ = require('jquery'); + +// $.fn.waypoint +// -------------------------------------------------------------------------------------------------------------------- + +const waypoints10 = $('#options-only').waypoint({ + handler: function fn(this: Waypoint, direction?: string) { + notify(this.element.id + ' hit'); + } +}); + +const waypoints11 = $('#handler-first').waypoint(function() { + notify(this.element.id + ' hit 25% from top of window'); +}, { + offset: '25%' +}); + +const waypoints12 = $('#handler-only').waypoint(function() { + notify(this.element.id + ' hit'); +}); + +// Context Option +// -------------------------------------------------------------------------------------------------------------------- + +const waypoints13 = $('#context-example-offset').waypoint({ + handler: function fn(this: Waypoint, direction?: string) { + notify('Hit midpoint of my context'); + }, + context: '#overflow-scroll-offset', + offset: '50%' +}); From 4ff3b88cee7098cd82f6c747b2f7e0f30ace8f0e Mon Sep 17 00:00:00 2001 From: vitalibozhko Date: Thu, 25 Jan 2018 09:54:56 -0800 Subject: [PATCH 070/150] storejs incorrect enabled flag type. (#23181) --- types/storejs/index.d.ts | 2 +- types/storejs/storejs-tests.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/types/storejs/index.d.ts b/types/storejs/index.d.ts index bc41120c60..0a677c0ecf 100644 --- a/types/storejs/index.d.ts +++ b/types/storejs/index.d.ts @@ -8,7 +8,7 @@ interface StoreJsAPI { readonly version: string; - readonly enabled: string; + readonly enabled: boolean; get(key: string, optionalDefaultValue?: any): any; set(key: string, value: any): any; remove(key: string): void; diff --git a/types/storejs/storejs-tests.ts b/types/storejs/storejs-tests.ts index 03c3769f9b..802f3dd40e 100644 --- a/types/storejs/storejs-tests.ts +++ b/types/storejs/storejs-tests.ts @@ -2,6 +2,9 @@ import * as store from 'store'; import * as engine from 'store/src/store-engine'; +// https://github.com/marcuswestin/store.js/blob/master/README-More.md#storeenabled-flag +console.log('storage is supported: ', store.enabled === true); + // https://github.com/marcuswestin/store.js/#api // Store current user From 65e61a6d888cad65801da2f9ebbd7c378998370c Mon Sep 17 00:00:00 2001 From: Matthew Leffler Date: Thu, 25 Jan 2018 10:55:38 -0700 Subject: [PATCH 071/150] GraphQL: Add schema printer options (#23180) * Add schema printer options These were added with https://github.com/graphql/graphql-js/pull/927, RFC: Descriptions as strings. * Explicitly define allowed printer options --- types/graphql/utilities/schemaPrinter.d.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/types/graphql/utilities/schemaPrinter.d.ts b/types/graphql/utilities/schemaPrinter.d.ts index 2bd40f1b96..f9cf9ad209 100644 --- a/types/graphql/utilities/schemaPrinter.d.ts +++ b/types/graphql/utilities/schemaPrinter.d.ts @@ -1,8 +1,12 @@ import { GraphQLSchema } from '../type/schema'; import { GraphQLType } from '../type/definition'; -export function printSchema(schema: GraphQLSchema): string; +export interface PrinterOptions { + commentDescriptions?: boolean; +} -export function printIntrospectionSchema(schema: GraphQLSchema): string; +export function printSchema(schema: GraphQLSchema, options?: PrinterOptions): string; -export function printType(type: GraphQLType): string; +export function printIntrospectionSchema(schema: GraphQLSchema, options?: PrinterOptions): string; + +export function printType(type: GraphQLType, options?: PrinterOptions): string; From 6361a8f21955d0882bf3e44fa10a98c81b1194df Mon Sep 17 00:00:00 2001 From: Gilad Gray Date: Thu, 25 Jan 2018 09:56:18 -0800 Subject: [PATCH 072/150] update dom4 types for v2.0 (#23178) * update dom4 types for v2.0 > **New v2:** Both `query` and `queryAll` have been removed, while CSS `:scope` selector has been added. * spelling --- types/dom4/dom4-tests.ts | 6 +++--- types/dom4/index.d.ts | 40 ++++++++++++++++++++++++++++++++++------ 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/types/dom4/dom4-tests.ts b/types/dom4/dom4-tests.ts index 35867f2e43..7dbf8e12f0 100644 --- a/types/dom4/dom4-tests.ts +++ b/types/dom4/dom4-tests.ts @@ -1,7 +1,7 @@ function testDocument() { - document.query(".container-a").classList; - document.queryAll(".container-b")[0].className; - document.queryAll(".container-c").childElementCount; + document.querySelector(".container-a").classList; + document.querySelectorAll(".container-b")[0].className; + document.querySelector(".container-c").append("foo", document.createElement("button")); } function testElement(el: Element) { diff --git a/types/dom4/index.d.ts b/types/dom4/index.d.ts index 95cabbd4d3..90c9c29966 100644 --- a/types/dom4/index.d.ts +++ b/types/dom4/index.d.ts @@ -1,8 +1,11 @@ -// Type definitions for dom4 v1.5 +// Type definitions for dom4 v2.0 // Project: https://github.com/WebReflection/dom4 // Definitions by: Adi Dahiya , Gilad Gray // Definitions: https://github.com/borisyankov/DefinitelyTyped +/** + * https://dom.spec.whatwg.org/#parentnode + */ interface ParentNode { /** * Returns the child elements. @@ -10,21 +13,46 @@ interface ParentNode { readonly children: HTMLCollection; /** - * Returns the first element that is a descendant of node that matches relativeSelectors. + * Inserts `nodes` after the last child of this node, while replacing strings with equivalent `Text` nodes. */ - query(relativeSelectors: string): Element; + append(...nodes: Array): void; /** - * Returns all element descendants of node that match relativeSelectors. + * Inserts `nodes` before the first child of this node, while replacing strings with equivalent `Text` nodes. */ - queryAll(relativeSelectors: string): Elements; + prepend(...nodes: Array): void; +} + +/** + * https://dom.spec.whatwg.org/#childnode + */ +interface ChildNode { + /** + * Inserts `nodes` just after this node, while replacing strings with equivalent `Text` nodes. + */ + after(...nodes: Array): void; + + /** + * Inserts `nodes` just before this node, while replacing strings with equivalent `Text` nodes. + */ + before(...nodes: Array): void; + + /** + * Replaces this node with `nodes`, while replacing strings in nodes with equivalent Text nodes. + */ + replaceWith(...nodes: Array): void; + + /** + * Removes this node. + */ + remove(): void; } interface Element extends ParentNode { /** * Returns the first (starting at element) inclusive ancestor that matches selectors, and null otherwise. */ - closest(selectors: string): Element; + closest(selectors: string): Element | null; /** * Returns true if matching selectors against element’s root yields element, and false otherwise. From 5ec69dfcc87b1e84847084c5a59e220879e2d78f Mon Sep 17 00:00:00 2001 From: dmitryshindin Date: Thu, 25 Jan 2018 21:51:38 +0300 Subject: [PATCH 073/150] Add width property to tick configuration (#23196) --- types/c3/c3-tests.ts | 23 ++++++++++++++++++++++- types/c3/index.d.ts | 5 +++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/types/c3/c3-tests.ts b/types/c3/c3-tests.ts index 3675c6cadf..c449235fba 100644 --- a/types/c3/c3-tests.ts +++ b/types/c3/c3-tests.ts @@ -152,7 +152,8 @@ function axis_examples() { fit: true, values: [1, 2, 4, 8, 16, 32], rotate: 60, - outer: false + outer: false, + width: 100 }, max: 100, min: -100, @@ -940,6 +941,26 @@ function axes_x_tick_fit() { }); } +function axes_x_tick_width() { + const chart = c3.generate({ + data: { + x: "x", + columns: [ + ["x", "2013-10-31", "2013-12-31", "2014-01-31", "2014-02-28"], + ["sample", 30, 100, 400, 150], + ] + }, + axis: { + x: { + type: "bar", + tick: { + width: 100 + } + } + } + }); +} + function axes_x_localtime() { const chart = c3.generate({ data: { diff --git a/types/c3/index.d.ts b/types/c3/index.d.ts index 1b0adce9a1..ccbbab7d7f 100644 --- a/types/c3/index.d.ts +++ b/types/c3/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Marc Climent // Gerin Jacob // Bernd Hacker +// Dzmitry Shyndzin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -585,6 +586,10 @@ export interface XTickConfiguration { * Show x axis outer tick. */ outer?: boolean; + /** + * Set width of x axis tick. + */ + width?: number; multiline?: boolean; // Undocumented } From 9dec8df9643274f62cf4369978edd5bdd229145a Mon Sep 17 00:00:00 2001 From: Jan Lohage Date: Thu, 25 Jan 2018 22:41:41 +0100 Subject: [PATCH 074/150] fix(@feathersjs/various): proper module augmentation, add reexports (#23195) * fix feathersjs__{authentication-client,express,socket-commons} * fix feathersjs__authentication-client --- ...feathersjs__authentication-client-tests.ts | 11 +++++-- .../feathersjs__feathers.d.ts | 14 -------- .../index.d.ts | 12 +++++-- .../feathersjs__express-tests.ts | 9 ++++-- types/feathersjs__express/index.d.ts | 16 ++++++++-- .../feathersjs__socket-commons/feathers.d.ts | 18 ----------- .../feathersjs__socket-commons-tests.ts | 10 +++++- types/feathersjs__socket-commons/index.d.ts | 32 +++++++++++++++++-- .../socket-commons.d.ts | 13 -------- 9 files changed, 78 insertions(+), 57 deletions(-) delete mode 100644 types/feathersjs__authentication-client/feathersjs__feathers.d.ts delete mode 100644 types/feathersjs__socket-commons/feathers.d.ts delete mode 100644 types/feathersjs__socket-commons/socket-commons.d.ts diff --git a/types/feathersjs__authentication-client/feathersjs__authentication-client-tests.ts b/types/feathersjs__authentication-client/feathersjs__authentication-client-tests.ts index 3d4eb36362..2a4ea96f91 100644 --- a/types/feathersjs__authentication-client/feathersjs__authentication-client-tests.ts +++ b/types/feathersjs__authentication-client/feathersjs__authentication-client-tests.ts @@ -1,4 +1,11 @@ +import feathers from '@feathersjs/feathers'; import feathersAuthClient from '@feathersjs/authentication-client'; -// we can't really do much, because the augmentation of @feathersjs/feathers breaks importing it here. -const configureFn = feathersAuthClient({}); +const app = feathers(); +app.configure(feathersAuthClient()); +app.authenticate({strategy : 'abcdef'}).then(() => {}); +app.logout().then(() => {}); + +// check if the non-augmented @feathersjs/feathers typings still work +app.on('asd', () => {}); +app.service('asd').get(0).then(() => {}); diff --git a/types/feathersjs__authentication-client/feathersjs__feathers.d.ts b/types/feathersjs__authentication-client/feathersjs__feathers.d.ts deleted file mode 100644 index 9c0fa2e05e..0000000000 --- a/types/feathersjs__authentication-client/feathersjs__feathers.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -declare module '@feathersjs/feathers' { - import { - FeathersAuthCredentials, - Passport - } from '@feathersjs/authentication-client'; - - interface Application { - authenticate(options?: FeathersAuthCredentials): Promise; - - logout(): Promise; - - passport: Passport; - } -} diff --git a/types/feathersjs__authentication-client/index.d.ts b/types/feathersjs__authentication-client/index.d.ts index a29039aab9..16f4f4a415 100644 --- a/types/feathersjs__authentication-client/index.d.ts +++ b/types/feathersjs__authentication-client/index.d.ts @@ -3,8 +3,6 @@ // Definitions by: Abraao Alves , Jan Lohage // Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript -import './feathersjs__feathers'; - export default function feathersAuthClient(config?: FeathersAuthClientConfig): () => void; export interface FeathersAuthClientConfig { @@ -62,3 +60,13 @@ export interface Passport { getStorage(storage: any): any; } + +declare module '@feathersjs/feathers' { + interface Application { + authenticate(options?: FeathersAuthCredentials): Promise; + + logout(): Promise; + + passport: Passport; + } +} diff --git a/types/feathersjs__express/feathersjs__express-tests.ts b/types/feathersjs__express/feathersjs__express-tests.ts index d7f981eaa0..687191d0c6 100644 --- a/types/feathersjs__express/feathersjs__express-tests.ts +++ b/types/feathersjs__express/feathersjs__express-tests.ts @@ -1,5 +1,8 @@ import feathers, { Application } from '@feathersjs/feathers'; -import feathersExpress from '@feathersjs/express'; -import { Application as ExpressApplication } from 'express'; +import feathersExpress, { original, rest, notFound, errorHandler } from '@feathersjs/express'; -const app: ExpressApplication & Application<{}> = feathersExpress(feathers()); +const app = feathersExpress(feathers()); + +app.configure(rest()); +app.use(notFound()); +app.use(errorHandler()); diff --git a/types/feathersjs__express/index.d.ts b/types/feathersjs__express/index.d.ts index 2bce8b54dd..26e58ae565 100644 --- a/types/feathersjs__express/index.d.ts +++ b/types/feathersjs__express/index.d.ts @@ -5,6 +5,18 @@ // TypeScript Version: 2.2 import { Application as FeathersApplication } from '@feathersjs/feathers'; -import { Application as ExpressApplication } from 'express'; +import * as express from 'express'; -export default function feathersExpress(app: FeathersApplication): ExpressApplication & FeathersApplication; +export default function feathersExpress(app: FeathersApplication): express.Application & FeathersApplication; + +export function errorHandler(options?: any): express.ErrorRequestHandler; +export function notFound(): express.RequestHandler; +export const rest: { + (): () => void; + formatter: express.RequestHandler; +}; + +/* + * Re-export of the express package. Can't be typed properly without just copying everything. + **/ +export const original: any; diff --git a/types/feathersjs__socket-commons/feathers.d.ts b/types/feathersjs__socket-commons/feathers.d.ts deleted file mode 100644 index 08438e4899..0000000000 --- a/types/feathersjs__socket-commons/feathers.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -declare module '@feathersjs/feathers' { - import { Channel } from '@feathersjs/socket-commons'; - import { HookContext } from '@feathersjs/feathers'; - - export interface ServiceAddons { - publish(callback: (data: T, hook: HookContext) => Channel): this - - publish(event: string, callback: (data: T, hook: HookContext) => Channel): this - } - - export interface Application { - channel(...names: string[]): Channel; - - publish(callback: (data: T, hook: HookContext) => Channel | Channel[]): Application; - - publish(event: string, callback: (data: T, hook: HookContext) => Channel | Channel[]): Application; - } -} diff --git a/types/feathersjs__socket-commons/feathersjs__socket-commons-tests.ts b/types/feathersjs__socket-commons/feathersjs__socket-commons-tests.ts index 2b7e49481e..e52fa00d78 100644 --- a/types/feathersjs__socket-commons/feathersjs__socket-commons-tests.ts +++ b/types/feathersjs__socket-commons/feathersjs__socket-commons-tests.ts @@ -1 +1,9 @@ -const dummy: any = null; +import feathers from '@feathersjs/feathers'; + +const app = feathers(); + +app.channel('abc').send({}); + +// check if the non-augmented @feathersjs/feathers typings still work +app.on('asd', () => {}); +app.service('asd').get(0).then(() => {}); diff --git a/types/feathersjs__socket-commons/index.d.ts b/types/feathersjs__socket-commons/index.d.ts index 38d46a0ec5..fca658bf76 100644 --- a/types/feathersjs__socket-commons/index.d.ts +++ b/types/feathersjs__socket-commons/index.d.ts @@ -2,6 +2,34 @@ // Project: http://feathersjs.com/ // Definitions by: Jan Lohage // Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript +// TypeScript Version: 2.3 -import './socket-commons'; -import './feathers'; +import { HookContext } from '@feathersjs/feathers'; + +export type Connection = any; // todo: spec connection + +export interface Channel { + join(...connections: Connection[]): this; + + leave(...connections: Connection[]): this; + + filter(callback: (connection: Connection) => boolean): Channel; + + send(data: any): this; +} + +declare module '@feathersjs/feathers' { + interface ServiceAddons { + publish(callback: (data: T, hook: HookContext) => Channel): this; + + publish(event: string, callback: (data: T, hook: HookContext) => Channel): this; + } + + interface Application { + channel(...names: string[]): Channel; + + publish(callback: (data: T, hook: HookContext) => Channel | Channel[]): Application; + + publish(event: string, callback: (data: T, hook: HookContext) => Channel | Channel[]): Application; + } +} diff --git a/types/feathersjs__socket-commons/socket-commons.d.ts b/types/feathersjs__socket-commons/socket-commons.d.ts deleted file mode 100644 index 2f32f24bd4..0000000000 --- a/types/feathersjs__socket-commons/socket-commons.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -declare module '@feathersjs/socket-commons' { - export type Connection = any; // todo: spec connection - - export interface Channel { - join(...connections: Connection[]): this; - - leave(...connections: Connection[]): this; - - filter(callback: (connection: Connection) => boolean): Channel; - - send(data: any): this; - } -} From 45457bbbc962ffaed9880c9a49c838d56e101103 Mon Sep 17 00:00:00 2001 From: Matthias Dailey Date: Thu, 25 Jan 2018 16:42:33 -0500 Subject: [PATCH 075/150] Add `callback` to `olx.view.FitOptions`. (#23199) * Add `callback` to `olx.view.FitOptions`. See http://openlayers.org/en/latest/apidoc//ol.View.html#fit * Use existing AnimateCallback type --- types/openlayers/index.d.ts | 1 + types/openlayers/openlayers-tests.ts | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/types/openlayers/index.d.ts b/types/openlayers/index.d.ts index 924b66f514..c217a6d873 100644 --- a/types/openlayers/index.d.ts +++ b/types/openlayers/index.d.ts @@ -14618,6 +14618,7 @@ declare module olx { maxZoom?: number; duration?: number; easing?: ((t: number) => number); + callback?: olx.animation.AnimateCallback; } } diff --git a/types/openlayers/openlayers-tests.ts b/types/openlayers/openlayers-tests.ts index 666b7b746f..4353f48960 100644 --- a/types/openlayers/openlayers-tests.ts +++ b/types/openlayers/openlayers-tests.ts @@ -399,6 +399,10 @@ let view: ol.View = new ol.View({ voidValue = view.setMaxZoom(numberValue); voidValue = view.setMinZoom(numberValue); +voidValue = view.fit(simpleGeometry); +voidValue = view.fit(extent); +voidValue = view.fit(extent, {callback: () => {}}); +voidValue = view.fit(extent, {callback: (animationCompleted: boolean) => {}}); // // ol.layer.Base From b66d7c92ce6db1528f26e9d930ed00f5c72d2b60 Mon Sep 17 00:00:00 2001 From: Eugene Rodin Date: Fri, 26 Jan 2018 19:59:01 +0300 Subject: [PATCH 076/150] Added definitions for react-dynamic-number npm package (#23165) * feat(ReactDynamicNumber): added definitions for RDN * feat(ReactDynamicNumber): fix validation and linter * feat(ReactDynamicNumber): PR remarks corrected --- types/react-dynamic-number/index.d.ts | 34 +++++++++++++++++++ .../react-dynamic-number-tests.tsx | 16 +++++++++ types/react-dynamic-number/tsconfig.json | 17 ++++++++++ types/react-dynamic-number/tslint.json | 1 + 4 files changed, 68 insertions(+) create mode 100644 types/react-dynamic-number/index.d.ts create mode 100644 types/react-dynamic-number/react-dynamic-number-tests.tsx create mode 100644 types/react-dynamic-number/tsconfig.json create mode 100644 types/react-dynamic-number/tslint.json diff --git a/types/react-dynamic-number/index.d.ts b/types/react-dynamic-number/index.d.ts new file mode 100644 index 0000000000..c1ffdc229d --- /dev/null +++ b/types/react-dynamic-number/index.d.ts @@ -0,0 +1,34 @@ +// Type definitions for react-dynamic-number 1.7 +// Project: https://github.com/uhlryk/react-dynamic-number +// Definitions by: Eugene Rodin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import * as React from 'react'; + +/** + * remove Diff & Omit when in will be placed in TS from scratch + */ +export type Diff = ({[P in T]: P} & {[P in U]: never} & {[x: string]: never})[T]; +export type Omit = {[P in Diff]: T[P]}; + +export type BaseInputProps = Partial< + Omit< + React.DetailedHTMLProps, HTMLInputElement>, + 'ref' | 'value' | 'onChange' | 'placeholder' + > +>; + +export interface DynamicNumberProps extends BaseInputProps { + value?: number | ''; + separator?: '.' | ','; + thousand?: boolean | ' '; + integer?: number; + fraction?: number; + positive?: boolean; + negative?: boolean; + placeholder?: string; + onChange?: (event: React.ChangeEvent, modelValue: number, viewValue: string) => void; +} + +export default class DynamicNumber extends React.Component {} diff --git a/types/react-dynamic-number/react-dynamic-number-tests.tsx b/types/react-dynamic-number/react-dynamic-number-tests.tsx new file mode 100644 index 0000000000..0dd947b6c7 --- /dev/null +++ b/types/react-dynamic-number/react-dynamic-number-tests.tsx @@ -0,0 +1,16 @@ +import * as React from 'react'; +import DynamicNumber from 'react-dynamic-number'; + +export class Test extends React.Component { + render() { + return ( + + ); + } +} diff --git a/types/react-dynamic-number/tsconfig.json b/types/react-dynamic-number/tsconfig.json new file mode 100644 index 0000000000..ad1a3aee65 --- /dev/null +++ b/types/react-dynamic-number/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6", "dom"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react", + "strictFunctionTypes": true + }, + "files": ["index.d.ts", "react-dynamic-number-tests.tsx"] +} diff --git a/types/react-dynamic-number/tslint.json b/types/react-dynamic-number/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-dynamic-number/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 5011030133772aa1c60c2589eccb8e6eb6bb7f5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=A6n=20Hansen?= Date: Fri, 26 Jan 2018 18:00:34 +0100 Subject: [PATCH 077/150] Renaming Input's size property to bsSize (#23219) See https://github.com/reactstrap/reactstrap/commit/cc2bd1386fbcaf20ad18ab9437a84ced1879d25e --- types/reactstrap/index.d.ts | 1 + types/reactstrap/lib/Input.d.ts | 10 ++-------- types/reactstrap/reactstrap-tests.tsx | 10 +++++----- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/types/reactstrap/index.d.ts b/types/reactstrap/index.d.ts index 59bca2df3d..38c55bc08a 100644 --- a/types/reactstrap/index.d.ts +++ b/types/reactstrap/index.d.ts @@ -6,6 +6,7 @@ // Fábio Paiva // FaithForHumans // Kurt Preston +// Kræn Hansen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/reactstrap/lib/Input.d.ts b/types/reactstrap/lib/Input.d.ts index f5c5ac1d02..c5827f9a75 100644 --- a/types/reactstrap/lib/Input.d.ts +++ b/types/reactstrap/lib/Input.d.ts @@ -27,15 +27,9 @@ type InputType = | 'time' | 'color'; -// Intermediate interface to "redefine" the type of size to string -// size:number => size:any => size:string -interface Intermediate extends React.InputHTMLAttributes { - size?: any; -} - -export interface InputProps extends Intermediate { +export interface InputProps extends React.InputHTMLAttributes { type?: InputType; - size?: string; + bsSize?: 'lg' | 'sm'; state?: string; valid?: boolean; tag?: React.ReactType; diff --git a/types/reactstrap/reactstrap-tests.tsx b/types/reactstrap/reactstrap-tests.tsx index 2a67844f9f..0f0bf7b81d 100644 --- a/types/reactstrap/reactstrap-tests.tsx +++ b/types/reactstrap/reactstrap-tests.tsx @@ -1381,16 +1381,16 @@ class Example50 extends React.Component { render() { return (
- + - - + + - +
@@ -3247,7 +3247,7 @@ function Example104() { - + ); From 20122e28889e0f9625c436742bf4bd57dde3c6b0 Mon Sep 17 00:00:00 2001 From: Liad Idan Date: Fri, 26 Jan 2018 19:00:57 +0200 Subject: [PATCH 078/150] Add missing property to Pickadate (#23217) * Add missing property to Pickadate Add `weekdaysLetter` property to Pickadate.DateOptions https://github.com/Dogfalo/materialize/blob/6da429c5972c90e386e34f14bed3f17c8c40fa95/dist/js/materialize.js#L5905 * Update index.d.ts --- types/materialize-css/v0/index.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/types/materialize-css/v0/index.d.ts b/types/materialize-css/v0/index.d.ts index a457c3ad1a..87629ed699 100644 --- a/types/materialize-css/v0/index.d.ts +++ b/types/materialize-css/v0/index.d.ts @@ -5,6 +5,7 @@ // Sukhdeep Singh // Jean-Francois Cere // Sebastien Cote +// Liad Idan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -475,11 +476,15 @@ declare namespace Materialize { } /** - * Declare Pickadate namespace again in order to add more Materialize specific properties to TimeOptions interface + * Declare Pickadate namespace again in order to add more Materialize specific properties to TimeOptions and DateOptions interfaces * * @see http://www.typescriptlang.org/docs/handbook/declaration-merging.html */ declare namespace Pickadate { + interface DateOptions { + weekdaysLetter?: string[]; + } + interface TimeOptions { /** * Set default time such as : 'now', '1:30AM', '16:30'. From 39150f4ac8cad535ff8d0db6545b85e80a78d62f Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Fri, 26 Jan 2018 17:01:36 +0000 Subject: [PATCH 079/150] webpack: `WatchOptions.ignored` accepts `string[]` (#23214) https://webpack.js.org/configuration/watch/#watchoptions-ignored https://github.com/micromatch/anymatch --- types/webpack/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts index db8bb35c72..ccd809c46b 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -516,7 +516,7 @@ declare namespace webpack { * It is possible to exclude a huge folder like node_modules. * It is also possible to use anymatch patterns. */ - ignored?: string | RegExp; + ignored?: string | string[] | RegExp; /** Turn on polling by passing true, or specifying a poll interval in milliseconds. */ poll?: boolean | number; } From be5cb7d7311d57f4683131c98e251181b2aad8c9 Mon Sep 17 00:00:00 2001 From: David Skx Date: Fri, 26 Jan 2018 18:01:58 +0100 Subject: [PATCH 080/150] feat: add react-select props for v1.2.1 (#23213) * feat: add props for v1.2.1 * fix: linter issues --- types/react-select/index.d.ts | 30 ++++++++++++++++++++++- types/react-select/react-select-tests.tsx | 20 +++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/types/react-select/index.d.ts b/types/react-select/index.d.ts index 8eade27abc..4487ea4093 100644 --- a/types/react-select/index.d.ts +++ b/types/react-select/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-select 1.1 +// Type definitions for react-select 1.2 // Project: https://github.com/JedWatson/react-select // Definitions by: ESQUIBET Hugo // Gilad Gray @@ -10,6 +10,7 @@ // Onat Yigit Mercan // Ian Johnson // Anton Novik +// David Schkalee // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -324,6 +325,18 @@ export interface ReactSelectProps extends React.Props extends React.Props; + /** + * number of options to jump when using page up/down keys + * @default 5 + */ + pageSize?: number; /** * field placeholder, displayed when there's no value * @default "Select..." */ placeholder?: string | JSX.Element; + /** + * whether the selected option is removed from the dropdown on multi selects + * @default true + */ + removeSelected?: boolean; /** * applies HTML5 required attribute when needed * @default false @@ -393,6 +416,11 @@ export interface ReactSelectProps extends React.Props { it("No Results renderer with element", () => { no results} />; }); + + it("onSelectResetsInput", () => { + ; + }); + + it("onCloseResetsInput", () => { + ; + }); + + it("pageSize", () => { + ; + }); + + it("removeSelected", () => { + ; + }); + + it("rtl", () => { + ; + }); }); From 00ae13ffe282f0cb48a00b0d0c44fff317dd7b7f Mon Sep 17 00:00:00 2001 From: Andrew Crites Date: Fri, 26 Jan 2018 12:02:44 -0500 Subject: [PATCH 081/150] blessed: correct some typining issues (#23200) * Screen debug option is a boolean. The class itself also has a method called debug. * Screen spawn arguments and options parameters are optional --- types/blessed/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/blessed/index.d.ts b/types/blessed/index.d.ts index 9098648240..eff4b72d24 100644 --- a/types/blessed/index.d.ts +++ b/types/blessed/index.d.ts @@ -516,7 +516,7 @@ export namespace Widgets { * Debug mode. Enables usage of the debug method. Also creates a debug console which will display when * pressing F12. It will display all log and debug messages. */ - debug?(...msg: string[]): void; + debug?: boolean; /** * Array of keys in their full format (e.g. C-c) to ignore when keys are locked or grabbed. Useful @@ -963,7 +963,7 @@ export namespace Widgets { /** * Spawn a process in the foreground, return to blessed app after exit. */ - spawn(file: string, args: string[], options: NodeChildProcessExecOptions): child_process.ChildProcess; + spawn(file: string, args?: string[], options?: NodeChildProcessExecOptions): child_process.ChildProcess; /** * Spawn a process in the foreground, return to blessed app after exit. Executes callback on error or exit. From 56e39953001edcf28c33613ea9174d6c8c40d61c Mon Sep 17 00:00:00 2001 From: Jason Waldrip Date: Fri, 26 Jan 2018 10:03:21 -0700 Subject: [PATCH 082/150] Add typings for graphql-iso-date (#23202) * Create index.d.ts * Create tsconfig.json * Update index.d.ts * add graphql-iso-date types * fix tests * add strict function types --- .../graphql-iso-date-tests.ts | 5 ++++ types/graphql-iso-date/index.d.ts | 11 +++++++++ types/graphql-iso-date/tsconfig.json | 23 +++++++++++++++++++ types/graphql-iso-date/tslint.json | 1 + 4 files changed, 40 insertions(+) create mode 100644 types/graphql-iso-date/graphql-iso-date-tests.ts create mode 100644 types/graphql-iso-date/index.d.ts create mode 100644 types/graphql-iso-date/tsconfig.json create mode 100644 types/graphql-iso-date/tslint.json diff --git a/types/graphql-iso-date/graphql-iso-date-tests.ts b/types/graphql-iso-date/graphql-iso-date-tests.ts new file mode 100644 index 0000000000..abc417cf5a --- /dev/null +++ b/types/graphql-iso-date/graphql-iso-date-tests.ts @@ -0,0 +1,5 @@ +import { GraphQLDate, GraphQLTime, GraphQLDateTime } from "graphql-iso-date"; + +GraphQLDate.name; +GraphQLTime.name; +GraphQLDateTime.name; diff --git a/types/graphql-iso-date/index.d.ts b/types/graphql-iso-date/index.d.ts new file mode 100644 index 0000000000..7f0731478e --- /dev/null +++ b/types/graphql-iso-date/index.d.ts @@ -0,0 +1,11 @@ +// Type definitions for graphql-iso-date 3.3 +// Project: https://github.com/excitement-engineer/graphql-iso-date +// Definitions by: Jason Waldrip +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { GraphQLScalarType } from "graphql"; + +export const GraphQLDate: GraphQLScalarType; +export const GraphQLTime: GraphQLScalarType; +export const GraphQLDateTime: GraphQLScalarType; diff --git a/types/graphql-iso-date/tsconfig.json b/types/graphql-iso-date/tsconfig.json new file mode 100644 index 0000000000..6feabb1388 --- /dev/null +++ b/types/graphql-iso-date/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", + "graphql-iso-date-tests.ts" + ] +} diff --git a/types/graphql-iso-date/tslint.json b/types/graphql-iso-date/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/graphql-iso-date/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 27d3a88ae38de73f0643e5d5c23e8ec3c125fbc6 Mon Sep 17 00:00:00 2001 From: Matthias Dailey Date: Fri, 26 Jan 2018 12:04:43 -0500 Subject: [PATCH 083/150] Object3D updates (#23203) * Object3D updates * Fix tests referring to old `shading` property. --- .../webgl_interactive_raycasting_points.ts | 4 +- .../test/webgl/webgl_lights_hemisphere.ts | 2 +- types/three/test/webgl/webgl_materials.ts | 8 +-- .../three/test/webgl/webgl_postprocessing.ts | 4 +- types/three/three-core.d.ts | 51 ++++++++----------- 5 files changed, 29 insertions(+), 40 deletions(-) diff --git a/types/three/test/webgl/webgl_interactive_raycasting_points.ts b/types/three/test/webgl/webgl_interactive_raycasting_points.ts index ced8feb6c6..7f6f163a28 100644 --- a/types/three/test/webgl/webgl_interactive_raycasting_points.ts +++ b/types/three/test/webgl/webgl_interactive_raycasting_points.ts @@ -215,7 +215,7 @@ // var sphereGeometry = new THREE.SphereGeometry(0.1, 32, 32); - var sphereMaterial = new THREE.MeshBasicMaterial({color: 0xff0000, shading: THREE.FlatShading}); + var sphereMaterial = new THREE.MeshBasicMaterial({color: 0xff0000, flatShading: true}); for (var i = 0; i < 40; i++) { @@ -313,4 +313,4 @@ renderer.render(scene, camera); } -} \ No newline at end of file +} diff --git a/types/three/test/webgl/webgl_lights_hemisphere.ts b/types/three/test/webgl/webgl_lights_hemisphere.ts index 108419f4ad..c0daf3773f 100644 --- a/types/three/test/webgl/webgl_lights_hemisphere.ts +++ b/types/three/test/webgl/webgl_lights_hemisphere.ts @@ -113,7 +113,7 @@ loader.load( "models/animated/flamingo.js", function( geometry ) { - var material = new THREE.MeshPhongMaterial( { color: 0xffffff, specular: 0xffffff, shininess: 20, morphTargets: true, vertexColors: THREE.FaceColors, shading: THREE.FlatShading } ); + var material = new THREE.MeshPhongMaterial( { color: 0xffffff, specular: 0xffffff, shininess: 20, morphTargets: true, vertexColors: THREE.FaceColors, flatShading: true } ); var mesh = new THREE.Mesh( geometry, material ); var s = 0.35; diff --git a/types/three/test/webgl/webgl_materials.ts b/types/three/test/webgl/webgl_materials.ts index 23d2d98a23..68235c5e5c 100644 --- a/types/three/test/webgl/webgl_materials.ts +++ b/types/three/test/webgl/webgl_materials.ts @@ -56,20 +56,20 @@ materials.push(new THREE.MeshLambertMaterial({ map: texture, transparent: true })); materials.push(new THREE.MeshLambertMaterial({ color: 0xdddddd })); - materials.push(new THREE.MeshPhongMaterial({ color: 0xdddddd, specular: 0x009900, shininess: 30, shading: THREE.FlatShading })); + materials.push(new THREE.MeshPhongMaterial({ color: 0xdddddd, specular: 0x009900, shininess: 30, flatShading: true })); materials.push(new THREE.MeshNormalMaterial()); materials.push(new THREE.MeshBasicMaterial({ color: 0xffaa00, transparent: true, blending: THREE.AdditiveBlending })); //materials.push( new THREE.MeshBasicMaterial( { color: 0xff0000, blending: THREE.SubtractiveBlending } ) ); materials.push(new THREE.MeshLambertMaterial({ color: 0xdddddd })); - materials.push(new THREE.MeshPhongMaterial({ color: 0xdddddd, specular: 0x009900, shininess: 30, shading: THREE.SmoothShading, map: texture, transparent: true })); + materials.push(new THREE.MeshPhongMaterial({ color: 0xdddddd, specular: 0x009900, shininess: 30, flatShading: false, map: texture, transparent: true })); materials.push(new THREE.MeshNormalMaterial({})); materials.push(new THREE.MeshBasicMaterial({ color: 0xffaa00, wireframe: true })); materials.push(new THREE.MeshDepthMaterial()); materials.push(new THREE.MeshLambertMaterial({ color: 0x666666, emissive: 0xff0000 })); - materials.push(new THREE.MeshPhongMaterial({ color: 0x000000, specular: 0x666666, emissive: 0xff0000, shininess: 10, shading: THREE.SmoothShading, opacity: 0.9, transparent: true })); + materials.push(new THREE.MeshPhongMaterial({ color: 0x000000, specular: 0x666666, emissive: 0xff0000, shininess: 10, flatShading: false, opacity: 0.9, transparent: true })); materials.push(new THREE.MeshBasicMaterial({ map: texture, transparent: true })); @@ -100,7 +100,7 @@ let material = materials[i]; geometry = material instanceof THREE.MeshFaceMaterial ? geometry_pieces : - (material.shading == THREE.FlatShading ? geometry_flat : geometry_smooth); + (material.flatShading ? geometry_flat : geometry_smooth); sphere = new THREE.Mesh(geometry, material); diff --git a/types/three/test/webgl/webgl_postprocessing.ts b/types/three/test/webgl/webgl_postprocessing.ts index 0c768eccea..dff5ec5592 100644 --- a/types/three/test/webgl/webgl_postprocessing.ts +++ b/types/three/test/webgl/webgl_postprocessing.ts @@ -26,7 +26,7 @@ scene.add(object); var geometry = new THREE.SphereGeometry(1, 4, 4); - var material = new THREE.MeshPhongMaterial({ color: 0xffffff, shading: THREE.FlatShading }); + var material = new THREE.MeshPhongMaterial({ color: 0xffffff, flatShading: true }); for (var i = 0; i < 100; i++) { @@ -84,4 +84,4 @@ composer.render(); } -} \ No newline at end of file +} diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index c3401a7737..8abbd380a7 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -450,11 +450,6 @@ export class Camera extends Object3D { getWorldDirection(optionalTarget?: Vector3): Vector3; - /** - * This make the camera look at the vector position in local space. - * @param vector point to look at - */ - lookAt(vector: Vector3): void; } export class CubeCamera extends Object3D { @@ -1620,6 +1615,12 @@ export class Object3D extends EventDispatcher { */ userData: any; + /** + * Used to check whether this or derived classes are Object3Ds. Default is true. + * You should not change this, as it is used internally for optimisation. + */ + isObject3D: boolean; + /** * Calls before rendering object */ @@ -1670,6 +1671,13 @@ export class Object3D extends EventDispatcher { */ rotateOnAxis(axis: Vector3, angle: number): Object3D; + /** + * Rotate an object along an axis in world space. The axis is assumed to be normalized. Method Assumes no rotated parent. + * @param axis A normalized vector in object space. + * @param angle The angle in radians. + */ + rotateOnWorldAxis(axis: Vector3, angle: number): Object3D; + /** * * @param angle @@ -1729,6 +1737,7 @@ export class Object3D extends EventDispatcher { * @param vector A world vector to look at. */ lookAt(vector: Vector3): void; + lookAt(x: number, y: number, z: number): void; /** * Adds object as child of this object. @@ -1738,7 +1747,7 @@ export class Object3D extends EventDispatcher { /** * Removes object as child of this object. */ - remove(object: Object3D): void; + remove(...object: Object3D[]): void; /** * Searches through the object's children and returns the first with a matching id, optionally recursive. @@ -1788,13 +1797,6 @@ export class Object3D extends EventDispatcher { * @param recursive */ copy(source: this, recursive?: boolean): this; - - /** - * @deprecated - */ - eulerOrder: string; - getChildByName(name: string): Object3D; - translate(distance: number, axis: Vector3): Object3D; } export interface Intersection { @@ -2364,8 +2366,6 @@ export interface MaterialParameters { transparent?: boolean; vertexColors?: Colors; visible?: boolean; - - shading?: Shading; } /** @@ -2598,15 +2598,6 @@ export class Material extends EventDispatcher { */ update(): void; - /** - * @deprecated - */ - warpRGB: Color; - - /** - * @deprecated Removed, use .flatShading instead. - */ - shading: Shading; } export interface LineBasicMaterialParameters extends MaterialParameters { @@ -2662,7 +2653,6 @@ export interface MeshBasicMaterialParameters extends MaterialParameters { combine?: Combine; reflectivity?: number; refractionRatio?: number; - shading?: Shading; wireframe?: boolean; wireframeLinewidth?: number; wireframeLinecap?: string; @@ -2684,7 +2674,6 @@ export class MeshBasicMaterial extends Material { combine: Combine; reflectivity: number; refractionRatio: number; - shading: Shading; wireframe: boolean; wireframeLinewidth: number; wireframeLinecap: string; @@ -6621,7 +6610,7 @@ export class ConeBufferGeometry extends BufferGeometry { export class ConeGeometry extends CylinderGeometry { constructor(radius?: number, height?: number, radialSegment?: number, heightSegment?: number, openEnded?: boolean, thetaStart?: number, thetaLength?: number); } - + export class DodecahedronBufferGeometry extends PolyhedronBufferGeometry { constructor(radius?: number, detail?: number); } @@ -6681,7 +6670,7 @@ export class LatheGeometry extends Geometry { phiLength: number; }; } - + export class OctahedronBufferGeometry extends PolyhedronBufferGeometry { constructor(radius?: number, detail?: number); } @@ -6721,10 +6710,10 @@ export class PlaneGeometry extends Geometry { heightSegments: number; }; } - + export class PolyhedronBufferGeometry extends BufferGeometry { constructor(vertices: number[], indices: number[], radius: number, detail: number); - + parameters: { vertices: number[]; indices: number[]; @@ -6820,7 +6809,7 @@ export class SphereGeometry extends Geometry { thetaLength: number; }; } - + export class TetrahedronBufferGeometry extends PolyhedronBufferGeometry { constructor(radius?: number, detail?: number); } From 1be865457ae17e009a3e8484e2f5fdea23012c20 Mon Sep 17 00:00:00 2001 From: Resi Respati Date: Sat, 27 Jan 2018 00:05:23 +0700 Subject: [PATCH 084/150] [screeps] update to version 2.2.0 (#23204) --- types/screeps/index.d.ts | 92 +++++++++++++++++++++------------- types/screeps/screeps-tests.ts | 20 +++++--- types/screeps/tsconfig.json | 2 +- 3 files changed, 71 insertions(+), 43 deletions(-) diff --git a/types/screeps/index.d.ts b/types/screeps/index.d.ts index 145c240b39..17155770d5 100644 --- a/types/screeps/index.d.ts +++ b/types/screeps/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Screeps 2.1 +// Type definitions for Screeps 2.2 // Project: https://github.com/screeps/screeps // Definitions by: Marko Sulamägi // Nhan Ho @@ -39,6 +39,7 @@ declare const FIND_MY_CREEPS: 102; declare const FIND_HOSTILE_CREEPS: 103; declare const FIND_SOURCES_ACTIVE: 104; declare const FIND_SOURCES: 105; +/** `FIND_DROPPED_ENERGY` is deprecated the return value is the same as `FIND_DROPPED_RESOURCES` */ declare const FIND_DROPPED_ENERGY: -106; declare const FIND_DROPPED_RESOURCES: 106; declare const FIND_STRUCTURES: 107; @@ -106,6 +107,7 @@ declare const RAMPART_DECAY_AMOUNT: 300; declare const RAMPART_DECAY_TIME: 100; declare const RAMPART_HITS: 1; declare const RAMPART_HITS_MAX: { + [rcl: number]: number 2: 300000, 3: 1000000, 4: 3000000, @@ -128,6 +130,7 @@ declare const WALL_HITS_MAX: 300000000; declare const EXTENSION_HITS: 1000; declare const EXTENSION_ENERGY_CAPACITY: { + [rcl: number]: number 0: 50, 1: 50, 2: 50, @@ -286,6 +289,7 @@ declare const POWER_SPAWN_POWER_CAPACITY: number; declare const POWER_SPAWN_ENERGY_RATIO: number; declare const EXTRACTOR_HITS: number; +declare const EXTRACTOR_COOLDOWN: number; declare const LAB_HITS: number; declare const LAB_MINERAL_CAPACITY: number; @@ -316,17 +320,19 @@ declare const MINERAL_MIN_AMOUNT: Record; declare const MINERAL_RANDOM_FACTOR: number; declare const MINERAL_DENSITY: { - 1: number, - 2: number, - 3: number, - 4: number + [level: number]: number + 1: number, + 2: number, + 3: number, + 4: number }; declare const MINERAL_DENSITY_PROBABILITY: { - 1: number, - 2: number, - 3: number, - 4: number + [level: number]: number + 1: number, + 2: number, + 3: number, + 4: number }; declare const MINERAL_DENSITY_CHANGE: number; @@ -354,12 +360,14 @@ declare const NUKER_GHODIUM_CAPACITY: number; declare const NUKE_LAND_TIME: number; declare const NUKE_RANGE: number; declare const NUKE_DAMAGE: { + [range: number]: number 0: number, 1: number, 4: number }; declare const REACTIONS: { + [resource: string]: {[resource: string]: string} H: { O: "OH", L: "LH", @@ -493,6 +501,7 @@ declare const REACTIONS: { }; declare const BOOSTS: { + [part: string]: {[boost: string]: {[action: string]: number}} work: { UO: { harvest: 3 @@ -621,6 +630,8 @@ declare const LOOK_TERRAIN: "terrain"; declare const ORDER_SELL: "sell"; declare const ORDER_BUY: "buy"; + +declare const SYSTEM_USERNAME: string; /** * A site of a structure which is currently under construction. */ @@ -727,8 +738,10 @@ interface Creep extends RoomObject { saying: string; /** * The remaining amount of game ticks after which the creep will die. + * + * Will be `undefined` if the creep is still spawning. */ - ticksToLive: number; + ticksToLive: number | undefined; /** * Attack another creep or structure in a short-ranged attack. Needs the * ATTACK body part. If the target is inside a rampart, then the rampart is @@ -748,7 +761,7 @@ interface Creep extends RoomObject { * The controller under attack cannot be upgraded for the next 1,000 ticks. * The target has to be at adjacent square to the creep. * - * @returns Result Code: OK, ERR_NOT_OWNER, ERR_BUSY, ERR_INVALID_TARGET, ERR_NOT_IN_RANGE, ERR_NO_BODYPART + * @returns Result Code: OK, ERR_NOT_OWNER, ERR_BUSY, ERR_INVALID_TARGET, ERR_NOT_IN_RANGE, ERR_NO_BODYPART, ERR_TIRED */ attackController(target: StructureController): CreepActionReturnCode; /** @@ -1225,20 +1238,22 @@ type StoreDefinition = Partial> & { // energy: number; // } -interface LookAtTypes { - constructionSite?: ConstructionSite; - creep?: Creep; - energy?: Resource; - exit?: any; // TODO what type is this? - flag?: Flag; - mineral?: Mineral; - nuke?: Nuke; - resource?: Resource; - source?: Source; - structure?: Structure; - terrain?: Terrain; +interface AllLookAtTypes { + constructionSite: ConstructionSite; + creep: Creep; + energy: Resource; + exit: any; // TODO what type is this? + flag: Flag; + mineral: Mineral; + nuke: Nuke; + resource: Resource; + source: Source; + structure: Structure; + terrain: Terrain; } +type LookAtTypes = Partial; + type LookAtResult = Pick & { type: K }; type LookAtResultWithPos = LookAtResult & { @@ -1276,7 +1291,6 @@ interface FindTypes { 103: Creep; // FIND_HOSTILE_CREEPS 104: Source; // FIND_SOURCES_ACTIVE 105: Source; // FIND_SOURCES - "-106": Resource; // FIND_DROPPED_ENERGY 106: Resource; // FIND_DROPPED_RESOURCES 107: AnyStructure; // FIND_STRUCTURES 108: AnyOwnedStructure; // FIND_MY_STRUCTURES @@ -1439,6 +1453,7 @@ type ScreepsReturnCode = ERR_NOT_OWNER | ERR_NO_PATH | ERR_BUSY | + ERR_NAME_EXISTS | ERR_NOT_FOUND | ERR_NOT_ENOUGH_RESOURCES | ERR_NOT_ENOUGH_ENERGY | @@ -1476,7 +1491,8 @@ type CreepActionReturnCode = ERR_BUSY | ERR_INVALID_TARGET | ERR_NOT_IN_RANGE | - ERR_NO_BODYPART; + ERR_NO_BODYPART | + ERR_TIRED; type CreepMoveReturnCode = OK | @@ -1504,7 +1520,6 @@ type FindConstant = FIND_HOSTILE_CREEPS | FIND_SOURCES_ACTIVE | FIND_SOURCES | - FIND_DROPPED_ENERGY | FIND_DROPPED_RESOURCES | FIND_STRUCTURES | FIND_MY_STRUCTURES | @@ -2126,7 +2141,7 @@ interface PathFinder { * @param goal goal A RoomPosition, an object containing a RoomPosition and range or an array of either. * @param opts An object containing additional pathfinding flags. */ - search(origin: RoomPosition, goal: RoomPosition | { pos: RoomPosition, range: number } | RoomPosition[] | Array<{ pos: RoomPosition, range: number }>, opts?: PathFinderOpts): PathFinderPath; + search(origin: RoomPosition, goal: RoomPosition | { pos: RoomPosition, range: number } | Array, opts?: PathFinderOpts): PathFinderPath; /** * Specify whether to use this new experimental pathfinder in game objects methods. * This method should be invoked every tick. It affects the following methods behavior: @@ -2504,6 +2519,13 @@ interface RoomPosition { * @param target Can be a RoomPosition object or any object containing RoomPosition. */ getRangeTo(target: RoomPosition | { pos: RoomPosition }): number; + /** + * Check whether this position is in the given range of another position. + * @param x X position in the room. + * @param y Y position in the room. + * @param range The range distance. + */ + inRangeTo(x: number, y: number, range: number): boolean; /** * Check whether this position is in the given range of another position. * @param toPos The target position. @@ -2540,7 +2562,7 @@ interface RoomPosition { * Get an object with the given type at the specified room position. * @param type One of the following string constants: constructionSite, creep, exit, flag, resource, source, structure, terrain */ - lookFor(type: T): Array; + lookFor(type: T): Array; } interface RoomPositionConstructor extends _Constructor { @@ -2915,14 +2937,14 @@ interface Room { * @param y The Y position. * @returns An array of Creep at the given position. */ - lookForAt(type: T, x: number, y: number): Array; + lookForAt(type: T, x: number, y: number): Array; /** * Get the objects at the given RoomPosition. * @param type One of the LOOK_* constants. * @param target Can be a RoomPosition object or any object containing RoomPosition. * @returns An array of Creeps at the specified position if found. */ - lookForAt(type: T, target: RoomPosition | _HasRoomPosition): Array; + lookForAt(type: T, target: RoomPosition | _HasRoomPosition): Array; /** * Get the given objets in the supplied area. * @param type One of the LOOK_* constants @@ -2933,14 +2955,14 @@ interface Room { * @param asArray Flatten the results into an array? * @returns An object with the sstructure object[X coord][y coord] as an array of found objects. */ - lookForAtArea( + lookForAtArea( type: T, top: number, left: number, bottom: number, right: number, asArray?: false - ): LookForAtAreaResultMatrix; + ): LookForAtAreaResultMatrix; /** * Get the given objets in the supplied area. * @param type One of the LOOK_* constants @@ -2951,14 +2973,14 @@ interface Room { * @param asArray Flatten the results into an array? * @returns An array of found objects with an x & y property for their position */ - lookForAtArea( + lookForAtArea( type: T, top: number, left: number, bottom: number, right: number, asArray: true - ): LookForAtAreaResultArray; + ): LookForAtAreaResultArray; /** * Serialize a path array into a short string representation, which is suitable to store in memory. @@ -3780,6 +3802,7 @@ type AnyOwnedStructure = StructureLink | StructureNuker | StructureObserver | + StructurePowerBank | StructurePowerSpawn | StructureRampart | StructureSpawn | @@ -3794,6 +3817,5 @@ type AnyStructure = AnyOwnedStructure | StructureContainer | StructurePortal | - StructurePowerBank | StructureRoad | StructureWall; diff --git a/types/screeps/screeps-tests.ts b/types/screeps/screeps-tests.ts index 5b518c8336..bbe542b568 100644 --- a/types/screeps/screeps-tests.ts +++ b/types/screeps/screeps-tests.ts @@ -400,9 +400,6 @@ interface CreepMemory { const resources = room.find(FIND_DROPPED_RESOURCES); resources[0].resourceType; - const energy = room.find(FIND_DROPPED_ENERGY); - energy[0].resourceType; - const sites = room.find(FIND_CONSTRUCTION_SITES); sites[0].remove(); @@ -410,7 +407,7 @@ interface CreepMemory { const exits = room.find(FIND_EXIT); const creepsHere = room.lookForAt(LOOK_CREEPS, 10, 10); - creepsHere[0]!.getActiveBodyparts(ATTACK); + creepsHere[0].getActiveBodyparts(ATTACK); const towers = room.find(FIND_MY_STRUCTURES, { filter: (structure) => { @@ -462,20 +459,20 @@ interface CreepMemory { { const nukes = room.lookForAt(LOOK_NUKES, creep.pos); - nukes[0]!.launchRoomName; + nukes[0].launchRoomName; const flags = room.lookForAtArea(LOOK_FLAGS, 10, 10, 20, 20); const x = flags[10]; const y = x[11]; const entry = y[0]; - entry.flag!.remove(); + entry.flag.remove(); const creeps = room.lookForAtArea(LOOK_CREEPS, 10, 10, 20, 20, true); creeps[0].x; creeps[0].y; - creeps[0].creep!.move(TOP); + creeps[0].creep.move(TOP); } // Advanced Structure types @@ -509,3 +506,12 @@ interface CreepMemory { Game.rooms.myRoom.find(FIND_MY_STRUCTURES, (s) => s.structureType === STRUCTURE_RAMPART).forEach((r) => r.notifyWhenAttacked(false)); } + +{ + // Test that you can use signatures + EXTENSION_ENERGY_CAPACITY[Game.rooms.myRoom.controller!.level]; + + REACTIONS[Object.keys(creep.carry)[0]]; + + BOOSTS[creep.body[0].type]; +} diff --git a/types/screeps/tsconfig.json b/types/screeps/tsconfig.json index 0e153958c2..8dcc302c5c 100644 --- a/types/screeps/tsconfig.json +++ b/types/screeps/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "screeps-tests.ts" ] - } +} From 417ea068963b53466c3902b79ec99f39f5b1f2da Mon Sep 17 00:00:00 2001 From: smhxx Date: Fri, 26 Jan 2018 11:06:08 -0600 Subject: [PATCH 085/150] atom: add PackageManager.deactivatePackage() method (#23208) --- types/atom/atom-tests.ts | 8 ++++++++ types/atom/index.d.ts | 3 +++ 2 files changed, 11 insertions(+) diff --git a/types/atom/atom-tests.ts b/types/atom/atom-tests.ts index 5fc92880f4..fbd5f6d0d8 100644 --- a/types/atom/atom-tests.ts +++ b/types/atom/atom-tests.ts @@ -1459,6 +1459,14 @@ function testPackageManager() { bool = atom.packages.isPackageDisabled("Test"); + // Activating and deactivating packages + atom.packages.activatePackage("Test").then((activePack) => { + pack = activePack; + }); + atom.packages.deactivatePackage("Test", true).then(() => { + // package is deactivated + }); + // Accessing active packages packs = atom.packages.getActivePackages(); diff --git a/types/atom/index.d.ts b/types/atom/index.d.ts index a261661144..f83f751657 100644 --- a/types/atom/index.d.ts +++ b/types/atom/index.d.ts @@ -4111,6 +4111,9 @@ export interface PackageManager { /** Activate a single package by name or path. */ activatePackage(nameOrPath: string): Promise; + /** Deactivate a single package by name or path. */ + deactivatePackage(nameOrPath: string, suppressSerialization?: boolean): Promise; + /** Triggers the given package activation hook. */ triggerActivationHook(hook: string): void; From 7470a4310e06eefb0b1ea3bc5069f26c51739dae Mon Sep 17 00:00:00 2001 From: gcottrell1 <30590984+gcottrell1@users.noreply.github.com> Date: Fri, 26 Jan 2018 17:06:59 +0000 Subject: [PATCH 086/150] Update types for React-Native-Video to allow passing of error and data objects to onError and onLoad callbacks respectively (#23209) * Add types for onLoad and onError * Clean up and add tests --- types/react-native-video/index.d.ts | 33 ++++++++++++++++--- .../react-native-video-tests.tsx | 30 +++++++++++++++++ 2 files changed, 58 insertions(+), 5 deletions(-) diff --git a/types/react-native-video/index.d.ts b/types/react-native-video/index.d.ts index b264df6d64..4d9edaa364 100644 --- a/types/react-native-video/index.d.ts +++ b/types/react-native-video/index.d.ts @@ -3,13 +3,36 @@ // Definitions by: HuHuanming // abrahambotros // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.4 import * as React from 'react'; import { ViewProperties } from 'react-native'; +export interface OnLoadData { + canPlayFastForward: boolean; + canPlayReverse: boolean; + canPlaySlowForward: boolean; + canPlaySlowReverse: boolean; + canStepBackward: boolean; + canStepForward: boolean; + currentTime: number; + duration: number; + naturalSize: { + height: number; + width: number; + orientation: 'horizontal' | 'landscape'; + }; +} + +export interface LoadError { + error: { + '': string; + errorString: string; + }; +} + export interface VideoProperties extends ViewProperties { /* Native only */ src?: any; @@ -46,12 +69,12 @@ export interface VideoProperties extends ViewProperties { currentTime?: number; progressUpdateInterval?: number; onLoadStart?(): void; - onLoad?(): void; + onLoad?(data: OnLoadData): void; onBuffer?(): void; - onError?(): void; + onError?(error: LoadError): void; onProgress?(data: { - currentTime: number, - playableDuration: number, + currentTime: number; + playableDuration: number; }): void; onSeek?(): void; onEnd?(): void; diff --git a/types/react-native-video/react-native-video-tests.tsx b/types/react-native-video/react-native-video-tests.tsx index 5b61336e80..0e7990a04e 100644 --- a/types/react-native-video/react-native-video-tests.tsx +++ b/types/react-native-video/react-native-video-tests.tsx @@ -17,10 +17,40 @@ class VideoTest extends React.Component {