From 7a338096583f581a4c2733802110f15e8a19e4a5 Mon Sep 17 00:00:00 2001 From: Brian Lee Date: Sat, 27 May 2017 17:35:56 -0700 Subject: [PATCH 001/180] Allow subclass gm function to accept source types other than path strings --- types/gm/gm-tests.ts | 10 ++++++++++ types/gm/index.d.ts | 3 +++ 2 files changed, 13 insertions(+) diff --git a/types/gm/gm-tests.ts b/types/gm/gm-tests.ts index e8bf5787cd..50c124ffc5 100644 --- a/types/gm/gm-tests.ts +++ b/types/gm/gm-tests.ts @@ -346,3 +346,13 @@ var imageMagick = gm.subClass({ imageMagick: true }); var readStream = imageMagick(src) .adjoin() .stream(); + +var passStream = imageMagick(readStream).stream(); + +var buffers: Buffer[] = []; +var buffer: Buffer; +passStream.on('data', (chunk) => buffers.push(chunk as Buffer)).on('close', () => { + buffer = Buffer.concat(buffers); + var readstream = imageMagick(buffer).stream(); +}) + diff --git a/types/gm/index.d.ts b/types/gm/index.d.ts index 7fd419ede3..a08086e58e 100644 --- a/types/gm/index.d.ts +++ b/types/gm/index.d.ts @@ -615,6 +615,9 @@ declare namespace m { export interface SubClass { (image: string): State; + (stream: NodeJS.ReadableStream, image?: string): State + (buffer: Buffer, image?: string): State + (width: number, height: number, color?: string): State } export function compare(filename1: string, filename2: string, callback: CompareCallback): void; From 803b84709699b305f8a84746c0c73bfb955725dc Mon Sep 17 00:00:00 2001 From: Brian Lee Date: Tue, 30 May 2017 13:19:08 -0700 Subject: [PATCH 002/180] Rewrite overloaded function --- types/gm/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/gm/index.d.ts b/types/gm/index.d.ts index a08086e58e..8da081ffd5 100644 --- a/types/gm/index.d.ts +++ b/types/gm/index.d.ts @@ -615,9 +615,9 @@ declare namespace m { export interface SubClass { (image: string): State; - (stream: NodeJS.ReadableStream, image?: string): State - (buffer: Buffer, image?: string): State - (width: number, height: number, color?: string): State + (stream: NodeJS.ReadableStream, image?: string): State; + (buffer: Buffer, image?: string): State; + (width: number, height: number, color?: string): State; } export function compare(filename1: string, filename2: string, callback: CompareCallback): void; From 4b594ade150a176a5715efd2693130c7c49d9cd8 Mon Sep 17 00:00:00 2001 From: Michel Felipe Date: Mon, 12 Jun 2017 15:33:00 -0300 Subject: [PATCH 003/180] core-js: Added es7 Reflect methods based on reflect-metadata --- types/core-js/index.d.ts | 239 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 237 insertions(+), 2 deletions(-) diff --git a/types/core-js/index.d.ts b/types/core-js/index.d.ts index 9593bc7a76..0a8f506df4 100644 --- a/types/core-js/index.d.ts +++ b/types/core-js/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for core-js 0.9 // Project: https://github.com/zloirock/core-js/ -// Definitions by: Ron Buckton +// Definitions by: Ron Buckton , Michel Felipe // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -50,7 +50,10 @@ declare function $for(iterable: Iterable): $for; // ECMAScript 7 // Modules: es7.array.includes, es7.string.at, es7.string.pad-start, es7.string.pad-end, // es7.object.to-array, es7.object.get-own-property-descriptors, es7.regexp.escape, -// es7.map.to-json, and es7.set.to-json +// es7.map.to-json, es7.set.to-json, es7.reflect.define-metadata, es7.reflect.delete-metadata +// es7.reflect.get-metadata, es7.reflect.get-metadata-keys, es7.reflect.get-own-metadata, +// es7.reflect.get-own-metadata-keys, es7.reflect.has-metadata, es7.reflect.has-own-metadata +// es7.reflect.metadata // ############################################################################################# interface String { @@ -473,6 +476,202 @@ declare namespace core { function preventExtensions(target: any): boolean; function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; function setPrototypeOf(target: any, proto: any): boolean; + /** + * Define a unique metadata entry on the target. + * @param metadataKey A key used to store and retrieve metadata. + * @param metadataValue A value that contains attached metadata. + * @param target The target object on which to define metadata. + * @example + * + * ### Example + * + * ```typescript + * class Example { + * } + * + * // constructor + * Reflect.defineMetadata("custom:annotation", options, Example); + * + * // decorator factory as metadata-producing annotation. + * function MyAnnotation(options): ClassDecorator { + * return target => Reflect.defineMetadata("custom:annotation", options, target); + * } + * ``` + */ + function defineMetadata(metadataKey: any, metadataValue: any, target: Object, targetKey?: string | symbol): void; + /** + * Deletes the metadata entry from the target object with the provided key. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @returns `true` if the metadata entry was found and deleted; otherwise, false. + * @example + * + * ### Example + * + * ```typescript + * class Example { + * } + * + * // constructor + * result = Reflect.deleteMetadata("custom:annotation", Example); + * ``` + */ + function deleteMetadata(metadataKey: any, target: Object, targetKey?: string | symbol): boolean; + /** + * Gets the metadata value for the provided metadata key on the target object or its prototype chain. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * ### Example + * + * ```typescript + * class Example { + * } + * + * // constructor + * result = Reflect.getMetadata("custom:annotation", Example); + * ``` + */ + function getMetadata(metadataKey: any, target: Object, targetKey?: string | symbol): any; + /** + * Gets the metadata keys defined on the target object or its prototype chain. + * @param target The target object on which the metadata is defined. + * @returns An array of unique metadata keys. + * @example + * + * ### Example + * + * ```typescript + * class Example { + * } + * + * // constructor + * result = Reflect.getMetadataKeys(Example); + * ``` + */ + function getMetadataKeys(target: Object, targetKey?: string | symbol): any[]; + /** + * Gets the metadata value for the provided metadata key on the target object. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * ### Example + * + * ```typescript + * class Example { + * } + * + * // constructor + * result = Reflect.getOwnMetadata("custom:annotation", Example); + * ``` + */ + function getOwnMetadata(metadataKey: any, target: Object, targetKey?: string | symbol): any; + + /** + * Gets the unique metadata keys defined on the target object. + * @param target The target object on which the metadata is defined. + * @returns An array of unique metadata keys. + * @example + * + * ### Example + * + * ```typescript + * class Example { + * } + * + * // constructor + * result = Reflect.getOwnMetadataKeys(Example); + * ``` + */ + function getOwnMetadataKeys(target: Object, targetKey?: string | symbol): any[]; + /** + * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`. + * @example + * + * ### Example + * + * ```typescript + * class Example { + * } + * + * // constructor + * result = Reflect.hasMetadata("custom:annotation", Example); + * ``` + */ + function hasMetadata(metadataKey: any, target: Object, targetKey?: string | symbol): boolean; + /** + * Gets a value indicating whether the target object has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @returns `true` if the metadata key was defined on the target object; otherwise, `false`. + * @example + * + * ### Example + * + * ```typescript + * + * class Example { + * } + * + * // constructor + * result = Reflect.hasOwnMetadata("custom:annotation", Example); + * ``` + */ + function hasOwnMetadata(metadataKey: any, target: Object, targetKey?: string | symbol): boolean; + /** + * A default metadata decorator factory that can be used on a class, class member, or parameter. + * @param metadataKey The key for the metadata entry. + * @param metadataValue The value for the metadata entry. + * @returns A decorator function. + * @remarks + * If `metadataKey` is already defined for the target and target key, the + * metadataValue for that key will be overwritten. + * @example + * + * ### Example + * + * ```typescript + * // constructor + * @Reflect.metadata(key, value) + * class Example { + * } + * + * // property (on constructor, TypeScript only) + * class Example { + * @Reflect.metadata(key, value) + * static staticProperty; + * } + * + * // property (on prototype, TypeScript only) + * class Example { + * @Reflect.metadata(key, value) + * property; + * } + * + * // method (on constructor) + * class Example { + * @Reflect.metadata(key, value) + * static staticMethod() { } + * } + * + * // method (on prototype) + * class Example { + * @Reflect.metadata(key, value) + * method() { } + * } + * ``` + */ + function metadata(metadataKey: any, metadataValue: any): { + (target: Function): void; + (target: Object, targetKey: string | symbol): void; + }; } const Object: { @@ -1991,6 +2190,42 @@ declare module "core-js/library/fn/reflect/set-prototype-of" { const setPrototypeOf: typeof core.Reflect.setPrototypeOf; export = setPrototypeOf; } +declare module "core-js/library/fn/reflect/es7/define-metadata" { + const defineMetadata: typeof core.Reflect.defineMetadata; + export = defineMetadata; +} +declare module "core-js/library/fn/reflect/es7/delete-metadata" { + const deleteMetadata: typeof core.Reflect.deleteMetadata; + export = deleteMetadata; +} +declare module "core-js/library/fn/reflect/es7/get-metadata" { + const getMetadata: typeof core.Reflect.getMetadata; + export = getMetadata; +} +declare module "core-js/library/fn/reflect/es7/get-metadata-keys" { + const getMetadataKeys: typeof core.Reflect.getMetadataKeys; + export = getMetadataKeys; +} +declare module "core-js/library/fn/reflect/es7/get-own-metadata" { + const getOwnMetadata: typeof core.Reflect.getOwnMetadata; + export = getOwnMetadata; +} +declare module "core-js/library/fn/reflect/es7/get-own-metadata-keys'" { + const getOwnMetadataKeys: typeof core.Reflect.getOwnMetadataKeys; + export = getOwnMetadataKeys; +} +declare module "core-js/library/fn/reflect/es7/has-metadata'" { + const hasMetadata: typeof core.Reflect.hasMetadata; + export = hasMetadata; +} +declare module "core-js/library/fn/reflect/es7/has-own-metadata'" { + const hasOwnMetadata: typeof core.Reflect.hasOwnMetadata; + export = hasOwnMetadata; +} +declare module "core-js/library/fn/reflect/es7/metadata'" { + const metadata: typeof core.Reflect.metadata; + export = metadata; +} declare module "core-js/library/fn/regexp" { const RegExp: typeof core.RegExp; export = RegExp; From e9da83fdebed0086f5a4d31414d2ae234521436f Mon Sep 17 00:00:00 2001 From: abrahambotros Date: Tue, 13 Jun 2017 23:46:52 -0700 Subject: [PATCH 004/180] [react-navigation] Update with latest flow typings --- types/react-navigation/index.d.ts | 691 +++++++++++------------------- 1 file changed, 256 insertions(+), 435 deletions(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index e343d092c6..ac160a587d 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -1,34 +1,33 @@ // Type definitions for react-navigation 1.0 // Project: https://github.com/react-community/react-navigation -// Definitions by: Huhuanming , mhcgrq +// Definitions by: Huhuanming +// mhcgrq +// abrahambotros // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import * as React from 'react' +import * as React from 'react'; import { - Animated, ViewStyle, - TextStyle -} from 'react-native' +} from 'react-native'; -export type HeaderMode = 'float' | 'screen' | 'none' +// @todo when we split types into common, native and web, +// we can properly change Animated.Value to its real value +type AnimatedValue = any; -export function addNavigationHelpers(params: any): any - -type SubViewProps = NavigationSceneRendererProps & { - onNavigateBack?: () => void, -} - -type SubViewRenderer = (subViewProps: SubViewProps) => React.ReactElement | undefined +export type HeaderMode = 'float' | 'screen' | 'none'; export type HeaderProps = NavigationSceneRendererProps & { mode: HeaderMode, - onNavigateBack?: () => void, - renderLeftComponent: SubViewRenderer, - renderRightComponent: SubViewRenderer, - renderTitleComponent: SubViewRenderer, - tintColor?: string, - router: NavigationRouter, -} + router: NavigationRouter< + NavigationState, + NavigationAction, + NavigationStackScreenOptions + >, + getScreenDetails: (navigationScene: NavigationScene) => NavigationScreenDetails< + NavigationStackScreenOptions + >, + style: Style, +}; /** * NavigationState is a tree of routes for a single navigator, where each child @@ -43,15 +42,17 @@ export type HeaderProps = NavigationSceneRendererProps & { * The state for the root navigator of our app represents the whole navigation * state for the whole app. */ -export interface NavigationState { +export type NavigationState = { /** * Index refers to the active child route in the routes array. */ index: number, - routes: any[], -} + routes: Array, +}; -export interface NavigationRoute

{ +export type NavigationRoute = NavigationLeafRoute | NavigationStateRoute; + +export type NavigationLeafRoute = { /** * React's key used by some navigators. No need to specify these manually, * they will be defined by the router. @@ -70,558 +71,378 @@ export interface NavigationRoute

{ * Params passed to this route when navigating to it, * e.g. `{ car_id: 123 }` in a route that displays a car. */ - params: P, -} + params?: NavigationParams, +}; -export interface NavigationRouter { +export type NavigationStateRoute = NavigationLeafRoute & { + index: number, + routes: Array, +}; + +export type NavigationScreenOptionsGetter = ( + navigation: NavigationScreenProp, + screenProps?: {} +) => Options; + +export type NavigationRouter = { /** * The reducer that outputs the new navigation state for a given action, with * an optional previous state. When the action is considered handled but the * state is unchanged, the output state is null. */ - getStateForAction: ( - action: NavigationAction, - lastState?: NavigationState, - ) => NavigationState | undefined, + getStateForAction: (action: Action, lastState: (State | null)) => (State | null), /** * Maps a URI-like string to an action. This can be mapped to a state * using `getStateForAction`. */ - getActionForPathAndParams: (path: string, params?: NavigationParams) => NavigationAction | undefined, + getActionForPathAndParams: ( + path: string, + params?: NavigationParams + ) => (Action | null), - getPathAndParamsForState: (state: NavigationState) => { path: string, params?: NavigationParams }, + getPathAndParamsForState: ( + state: State + ) => { + path: string, + params?: NavigationParams, + }, getComponentForRouteName: (routeName: string) => NavigationComponent, - getComponentForState: (state: NavigationState) => NavigationComponent, + getComponentForState: (state: State) => NavigationComponent, /** - * Gets the screen config for a given navigation screen prop. + * Gets the screen navigation options for a given screen. * - * For example, we could get the config for a 'Foo' screen when the + * For example, we could get the config for the 'Foo' screen when the * `navigation.state` is: * * {routeName: 'Foo', key: '123'} */ - getScreenConfig: ( - navigation: NavigationScreenProp, - optionName: string, - ) => any, // todo, fix this any type to become a key of NavigationScreenConfig -} + getScreenOptions: NavigationScreenOptionsGetter, +}; -type NavigationFunc = (navigation: NavigationScreenProp, config: E) => E +export type NavigationScreenOption = + | T + | (( + navigation: NavigationScreenProp, + config: T + ) => T); -export type NavigationScreenOption = T | NavigationFunc +export type Style = ViewStyle; -export interface HeaderConfig { - /** - * Title string used by the navigation bar, or a custom component - */ - title?: string | React.ReactElement; +export type NavigationScreenDetails = { + options: T, + state: NavigationRoute, + navigation: NavigationScreenProp, +}; - /** - * Whether the navigation bar is visible. - */ - visible?: boolean; - - /** - * Renders a custom right component - */ - right?: React.ReactElement, - - /** - * Renders a custom left component - */ - left?: React.ReactElement - - /** - * Style passed into navigation bar container - */ - style?: ViewStyle, - - /** - * Style passed into navigation bar title - */ - titleStyle?: TextStyle, - - // // Style of title text - // titleTextStyle?: $NavigationThunk, - // // Tint color of navigation bar contents - // tintColor?: $NavigationThunk, - // // Navigation bar height - // height?: $NavigationThunk, - // // Navigation bar translucentcy - // translucent?: $NavigationThunk, - // // Renders a custom left component - // renderLeft?: React.Element<*> | - // (navigation: NavigationProp<*>, canGoBack: boolean) => React.Element<*>, - // // Renders a custom navigation bar background - // renderBackground?: $NavigationThunk>, -} - -export interface TabBarConfig { - /** - * Icon used by the tab bar. - */ - icon?: (options: { tintColor: string, focused: boolean }) => React.ReactElement | undefined; - /** - * Label text used by the tab bar. - */ - label?: string | React.ReactElement; -} - -export interface DrawerConfig { - /** - * Icon used by the drawer. - */ - icon?: (options: { tintColor: string, focused: boolean }) => React.ReactElement | undefined; - /** - * Label text used by the drawer. - */ - label?: string; -} - -export interface CardStackConfig { - /** - * Whether you can use gestures to dismiss this screen. - * Defaults to true on iOS, false on Android. - */ - gesturesEnabled?: boolean; -} - -export interface NavigationScreenOptions { - /** - * Title is rendered by certain navigators, e.g. the tab navigator, - * or on web as the title of the browser tab. - */ - title?: NavigationScreenOption; - /** - * Options passed to the navigation bar for this screen. - */ - header?: NavigationScreenOption; - /** - * Options passed to the tab bar for this screen. - */ - tabBar?: NavigationScreenOption; - /** - * Options passed to the drawer for this screen. - */ - drawer?: NavigationScreenOption; - /** - * Options passed to the card stack for this screen. - */ - cardStack?: NavigationScreenOption; -} - -export interface NavigationScreenConfig { +export type NavigationScreenOptions = { title?: string, - header?: HeaderConfig, - tabBar?: TabBarConfig, - drawer?: DrawerConfig; -} +}; -export type NavigationComponent = NavigationScreenComponent | NavigationNavigator +export type NavigationScreenConfigProps = { + navigation: NavigationScreenProp, + screenProps: Object, +}; -export type NavigationScreenComponent = React.ComponentClass & { - navigationOptions?: NavigationScreenOptions, -} +export type NavigationScreenConfig = + | Options + | (NavigationScreenConfigProps & + ((navigationOptionsContainer: { + navigationOptions: NavigationScreenProp< + NavigationRoute, + NavigationAction + >, + }) => Options)); -export type NavigationNavigator = React.ComponentClass & { - router?: NavigationRouter, - navigationOptions?: NavigationScreenOptions, -} +export type NavigationComponent = + | NavigationScreenComponent + | NavigationNavigator; -export interface NavigationParams { - [key: string]: any, -} +export type NavigationScreenComponent = React.ComponentClass & { + navigationOptions?: NavigationScreenConfig, +}; -export interface NavigationNavigateAction { - type?: 'Navigation/NAVIGATE', +export type NavigationNavigator = React.ComponentClass & { + router?: NavigationRouter, + navigationOptions?: NavigationScreenConfig, +}; + +export type NavigationParams = { + [key: string]: string, +}; + +export type NavigationNavigateAction = { + type: 'Navigation/NAVIGATE', routeName: string, params?: NavigationParams, // The action to run inside the sub-router action?: NavigationNavigateAction, -} +}; -export interface NavigationBackAction { - type?: 'Navigation/BACK', - key?: string, -} +export type NavigationBackAction = { + type: 'Navigation/BACK', + key?: string | null, +}; -export interface NavigationSetParamsAction { - type?: 'Navigation/SET_PARAMS', +export type NavigationSetParamsAction = { + type: 'Navigation/SET_PARAMS', // The key of the route where the params should be set key: string, // The new params to merge into the existing route params params?: NavigationParams, -} +}; -export interface NavigationInitAction { - type?: 'Navigation/INIT', +export type NavigationInitAction = { + type: 'Navigation/INIT', params?: NavigationParams, -} +}; -export interface NavigationResetAction { - type?: 'Navigation/RESET', +export type NavigationResetAction = { + type: 'Navigation/RESET', index: number, - actions: NavigationNavigateAction[], -} + key?: string | null, + actions: Array, +}; -export interface NavigationUriAction { - type?: 'Navigation/URI', +export type NavigationUriAction = { + type: 'Navigation/URI', uri: string, -} +}; -export interface NavigationContainerOptions { - // This is used to extract the path from the URI passed to the app for a deep link - URIPrefix?: string, -} - -export interface NavigationContainerConfig { - containerOptions?: NavigationContainerOptions, -} - -export interface NavigationStackViewConfig { +export type NavigationStackViewConfig = { mode?: 'card' | 'modal', headerMode?: HeaderMode, - headerComponent?: React.ComponentClass, - cardStyle?: ViewStyle, + cardStyle?: Style, + transitionConfig?: () => TransitionConfig, onTransitionStart?: () => void, onTransitionEnd?: () => void, -} +}; -export interface NavigationStackRouterConfig { +export type NavigationStackScreenOptions = NavigationScreenOptions & { + header?: (React.ReactElement | ((headerProps: HeaderProps) => React.ReactElement)) | null, + headerTitle?: string | React.ReactElement, + headerTitleStyle?: Style, + headerTintColor?: string, + headerLeft?: React.ReactElement, + headerBackTitle?: string, + headerTruncatedBackTitle?: string, + headerBackTitleStyle?: Style, + headerPressColorAndroid?: string, + headerRight?: React.ReactElement, + headerStyle?: Style, + gesturesEnabled?: boolean, +}; + +export type NavigationStackRouterConfig = { initialRouteName?: string, initialRouteParams?: NavigationParams, paths?: NavigationPathsConfig, - navigationOptions?: NavigationScreenOptions, -} + navigationOptions?: NavigationScreenConfig, +}; export type NavigationStackAction = - NavigationInitAction + | NavigationInitAction | NavigationNavigateAction | NavigationBackAction | NavigationSetParamsAction - | NavigationResetAction + | NavigationResetAction; export type NavigationTabAction = - NavigationInitAction + | NavigationInitAction | NavigationNavigateAction - | NavigationBackAction + | NavigationBackAction; export type NavigationAction = - NavigationInitAction + | NavigationInitAction | NavigationStackAction - | NavigationTabAction - -export namespace NavigationActions { - function navigate(options: NavigationNavigateAction): NavigationNavigateAction; - function reset(options: NavigationResetAction): NavigationResetAction; - function back(options?: NavigationBackAction): NavigationBackAction; - function setParams(options: NavigationSetParamsAction): NavigationSetParamsAction; -} + | NavigationTabAction; export type NavigationRouteConfig = T & { - navigationOptions?: NavigationScreenOptions, + navigationOptions?: NavigationScreenConfig, path?: string, -} +}; -export interface NavigationPathsConfig { +export type NavigationScreenRouteConfig = + | { + screen: NavigationComponent, + } + | { + getScreen: () => NavigationComponent, + }; + +export type NavigationPathsConfig = { [routeName: string]: string, -} +}; -export interface NavigationTabRouterConfig { +export type NavigationTabRouterConfig = { initialRouteName?: string, paths?: NavigationPathsConfig, - navigationOptions?: NavigationScreenOptions, - order?: string[], // todo: type these as the real route names rather than 'string' + navigationOptions?: NavigationScreenConfig, + order?: Array, // todo: type these as the real route names rather than 'string' // Does the back button cause the router to switch to the initial tab backBehavior?: 'none' | 'initialRoute', // defaults `initialRoute` -} +}; -export interface NavigationRouteConfigMap { +export type NavigationTabScreenOptions = NavigationScreenOptions & { + tabBarIcon?: + | React.ReactElement + | ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement< + any + > | null)), + tabBarLabel?: + | string + | React.ReactElement + | ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement< + any + > | null)), + tabBarVisible?: boolean, +}; + +export type NavigationDrawerScreenOptions = NavigationScreenOptions & { + drawerIcon?: + | React.ReactElement + | ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement< + any + > | null)), + drawerLabel?: + | React.ReactElement + | ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement< + any + > | null)), +}; + +export type NavigationRouteConfigMap = { [routeName: string]: NavigationRouteConfig, -} +}; -export type NavigationDispatch = (action: A) => boolean +export type NavigationDispatch = (action: A) => boolean; -export interface NavigationProp { +export type NavigationProp = { state: S, dispatch: NavigationDispatch, -} +}; -export type NavigationScreenProp = NavigationProp & { - goBack: (routeKey?: string) => boolean, - navigate: (routeName: string, params?: NavigationParams, action?: NavigationAction) => boolean, +export type NavigationScreenProp = { + state: S, + dispatch: NavigationDispatch, + goBack: (routeKey?: (string | null)) => boolean, + navigate: ( + routeName: string, + params?: NavigationParams, + action?: NavigationAction + ) => boolean, setParams: (newParams: NavigationParams) => boolean, -} +}; -export interface NavigationNavigatorProps

{ - navigation: NavigationProp, NavigationAction>, -} +export type NavigationNavigatorProps = { + navigation: NavigationProp, + screenProps: any, + navigationOptions: any, +}; /** * Gestures, Animations, and Interpolators */ -export type NavigationAnimatedValue = Animated.Value +export type NavigationGestureDirection = 'horizontal' | 'vertical'; -export type NavigationGestureDirection = 'horizontal' | 'vertical' - -export interface NavigationLayout { - height: NavigationAnimatedValue, +export type NavigationLayout = { + height: AnimatedValue, initHeight: number, initWidth: number, isMeasured: boolean, - width: NavigationAnimatedValue, -} + width: AnimatedValue, +}; -export interface NavigationScene { +export type NavigationScene = { index: number, isActive: boolean, isStale: boolean, key: string, - route: any, -} + route: NavigationRoute, +}; -export interface NavigationTransitionProps { - // The layout of the transitioner of the scenes. +export type NavigationTransitionProps = { + // The layout of the screen container layout: NavigationLayout, - // The navigation state of the transitioner. - navigationState: NavigationState, + // The destination navigation state of the transition + navigation: NavigationScreenProp, // The progressive index of the transitioner's navigation state. - position: NavigationAnimatedValue, + position: AnimatedValue, // The value that represents the progress of the transition when navigation // state changes from one to another. Its numberic value will range from 0 // to 1. // progress.__getAnimatedValue() < 1 : transtion is happening. // progress.__getAnimatedValue() == 1 : transtion completes. - progress: NavigationAnimatedValue, + progress: AnimatedValue, // All the scenes of the transitioner. - scenes: NavigationScene[], + scenes: Array, // The active scene, corresponding to the route at - // `navigationState.routes[navigationState.index]`. When rendering + // `navigation.state.routes[navigation.state.index]`. When rendering // NavigationSceneRendererPropsIndex, the scene does not refer to the active // scene, but instead the scene that is being rendered. The index always // is the index of the scene scene: NavigationScene, index: number, - navigation: NavigationScreenProp, - // The gesture distance for `horizontal` and `vertical` transitions - gestureResponseDistance?: number, -} + screenProps?: {}, +}; // The scene renderer props are nearly identical to the props used for rendering // a transition. The exception is that the passed scene is not the active scene // but is instead the scene that the renderer should render content for. -export type NavigationSceneRendererProps = NavigationTransitionProps +export type NavigationSceneRendererProps = NavigationTransitionProps; -export interface NavigationPanHandlers { - onMoveShouldSetResponder: () => void, - onMoveShouldSetResponderCapture: () => void, - onResponderEnd: () => void, - onResponderGrant: () => void, - onResponderMove: () => void, - onResponderReject: () => void, - onResponderRelease: () => void, - onResponderStart: () => void, - onResponderTerminate: () => void, - onResponderTerminationRequest: () => void, - onStartShouldSetResponder: () => void, - onStartShouldSetResponderCapture: () => void, -} - -export interface NavigationTransitionSpec { +export type NavigationTransitionSpec = { duration?: number, // An easing function from `Easing`. - easing?: () => any, + easing?: (t: number) => number, // A timing function such as `Animated.timing`. - timing?: (value: NavigationAnimatedValue, config: any) => any, -} + timing?: (value: AnimatedValue, config: any) => any, +}; + +/** + * Describes a visual transition from one screen to another. + */ +export type TransitionConfig = { + // The basics properties of the animation, such as duration and easing + transitionSpec?: NavigationTransitionSpec, + // How to animate position and opacity of the screen + // based on the value generated by the transitionSpec + screenInterpolator?: (props: NavigationSceneRendererProps) => Object, +}; export type NavigationAnimationSetter = ( - position: NavigationAnimatedValue, + position: AnimatedValue, newState: NavigationState, - lastState: NavigationState, -) => void + lastState: NavigationState +) => void; -export type NavigationSceneRenderer = ( - props: NavigationSceneRendererProps, -) => React.ReactElement +export type NavigationSceneRenderer = () => (React.ReactElement | null); export type NavigationStyleInterpolator = ( - props: NavigationSceneRendererProps, -) => ViewStyle + props: NavigationSceneRendererProps +) => Style; -export interface LayoutEvent { +export type LayoutEvent = { nativeEvent: { layout: { - x: number; - y: number; - width: number; - height: number; + x: number, + y: number, + width: number, + height: number, }, - } -} - -interface NavigationContainerProps { - screenProps?: any - navigation?: NavigationProp - onNavigationStateChange?: ( - preNavigationState: NavigationState, - nextNavigationState: NavigationState, - ) => void -} - -interface NavigationContainerState { - nav?: NavigationState -} - -export interface NavigationContainer extends React.ComponentClass< - NavigationContainerProps -> { - router: NavigationRouter -} - -export type StackNavigatorConfig = - NavigationContainerConfig - & NavigationStackViewConfig - & NavigationStackRouterConfig; - -// Return createNavigationContainer -export function StackNavigator( - routeConfigMap: NavigationRouteConfigMap, - stackConfig?: StackNavigatorConfig, -): NavigationContainer - -/** - * Drawer Navigator - */ -export interface DrawNavigatorConfig { - drawerWidth?: number, - drawerPosition?: 'left'|'right', - contentComponent?: React.ReactElement, - contentOptions?: { - activeTintColor?: string, - activeBackgroundColor?: string, - inactiveTintColor?: string, - inactiveBackgroundColor?: string, - style?: ViewStyle, - labelStyle?: TextStyle - } -} - -export function DrawerNavigator( - routeConfigMap: NavigationRouteConfigMap, - drawConfig?: DrawNavigatorConfig, -): NavigationContainer; - -/** - * Tab Navigator - */ -export interface TabNavigatorConfig { - tabBarComponent?: React.ReactElement, - tabBarPosition?: 'top'|'bottom', - swipeEnabled?: boolean, - animationEnabled?: boolean, - lazy?: boolean, - tabBarOptions?: { - activeTintColor?: string, - activeBackgroundColor?: string, - inactiveTintColor?: string, - inactiveBackgroundColor?: string, - showLabel?: boolean, - style?: ViewStyle, - labelStyle?: TextStyle, - - // Top - showIcon?: boolean, - upperCaseLabel?: boolean, - pressColor?: string, - pressOpacity?: number, - scrollEnabled?: boolean, - tabStyle?: ViewStyle, - indicatorStyle?: ViewStyle - } - initialRouteName?: string, - order?: string[], - paths?: any // TODO: better def - backBehavior?: 'initialRoute'|'none' -} - -export function TabNavigator( - routeConfigMap: NavigationRouteConfigMap, - drawConfig?: TabNavigatorConfig, -): NavigationContainer; -/** - * Screen Options - */ -export interface StackNavigatorScreenOptions { - title?: string; - headerVisible?: boolean; - headerTitle?: string|React.ReactElement; - headerBackTitle?: string; - headerTruncatedBackTitle?: string; - headerRight?: React.ReactElement; - headerLeft?: React.ReactElement; - headerStyle?: ViewStyle; - headerTitleStyle?: ViewStyle; - headerTintColor?: string; - headerPressColorAndroid?: string; - gesturesEnabled?: boolean; -} - -export interface TabNavigatorScreenOptions { - title?: string; - tabBarVisible?: boolean; - tabBarIcon?: React.ReactElement - | ((options: { focused: boolean, tintColor: string }) => React.ReactElement); - tabBarLabel?: string - | React.ReactElement - | ((options: { focused: boolean, tintColor: string }) => React.ReactElement); -} - -export interface DrawerNavigatorScreenOptions { - title?: string; - drawerLabel?: string - |React.ReactElement - | ((options: {focused: boolean, tintColor: string}) => React.ReactElement) - ; - drawerIcon?: React.ReactElement - | ((options: {focused: boolean, tintColor: string}) => React.ReactElement) - ; -} - -export type NavigationNavigateActionCreator = (options: NavigationNavigateAction) => boolean; -export type NavigationResetActionCreator = (options: NavigationResetAction) => boolean; -export type NavigationBackActionCreator = (options?: NavigationBackAction) => boolean; -export type NavigationSetParamsActionCreator = (options: NavigationSetParamsAction) => boolean; - -export interface NavigationComponentProps { - screenProps: any - navigation: { - dispatch: any - goBack: NavigationBackActionCreator - navigate: NavigationNavigateActionCreator - setParams: NavigationSetParamsActionCreator - state: { - key: string - routeName: string, - params: T, - }, - } -} - -export const TabBarTop: React.ReactElement; -export const TabBarBottom: React.ReactElement; + }, +}; From 19d0ec2398c2c29219970e17be5a9d4f941685ab Mon Sep 17 00:00:00 2001 From: abrahambotros Date: Wed, 14 Jun 2017 21:05:01 -0700 Subject: [PATCH 005/180] [react-navigation] Additional fixes and cleanup for defs outside TypeDefinition.js --- types/react-navigation/index.d.ts | 106 ++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index ac160a587d..792a6a5bea 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -5,8 +5,13 @@ // abrahambotros // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/************************************* + * BEGIN FLOW TYPEDEFINITION.JS PORT * + *************************************/ + import * as React from 'react'; import { + TextStyle, ViewStyle, } from 'react-native'; @@ -446,3 +451,104 @@ export type LayoutEvent = { }, }, }; + +/*********************************** + * END FLOW TYPEDEFINITION.JS PORT * + ***********************************/ + +// From createNavigationContainer.js +interface NavigationContainerProps { + uriPrefix?: string | RegExp, + onNavigationStateChange?: ( + prevNav: NavigationState, + nav: NavigationState, + action: NavigationAction, + ) => void, +} + +export interface NavigationContainer extends React.Component< + NavigationContainerProps & NavigationNavigatorProps, + { nav: NavigationState | null } +> { + router: NavigationRouter +} + +export interface StackNavigatorConfig extends NavigationStackViewConfig, NavigationStackRouterConfig { + containerOptions?: any, +} + +// Return createNavigationContainer +export function StackNavigator( + routeConfigMap: NavigationRouteConfigMap, + stackConfig?: StackNavigatorConfig, +): NavigationContainer + +/** + * Drawer Navigator + */ +export interface DrawerViewConfig { + drawerWidth: number, + drawerPosition: 'left' | 'right', + contentComponent: React.ComponentClass, + contentOptions?: any, + style?: ViewStyle, +} +export interface DrawerNavigatorConfig extends NavigationTabRouterConfig, DrawerViewConfig { + containerConfig?: any, + contentOptions?: { + activeTintColor?: string, + activeBackgroundColor?: string, + inactiveTintColor?: string, + inactiveBackgroundColor?: string, + style?: ViewStyle, + labelStyle?: TextStyle, + } +} + +export function DrawerNavigator( + routeConfigMap: NavigationRouteConfigMap, + drawerConfig?: DrawerNavigatorConfig, +): NavigationContainer; + +/** + * Tab Navigator + */ + +// From views/TabView/TabView.js +export interface TabViewConfig { + tabBarComponent?: React.ComponentClass, + tabBarPosition?: 'top' | 'bottom', + tabBarOptions?: { + activeTintColor?: string, + activeBackgroundColor?: string, + inactiveTintColor?: string, + inactiveBackgroundColor?: string, + showLabel?: boolean, + style?: ViewStyle, + labelStyle?: TextStyle, + + // Top + showIcon?: boolean, + upperCaseLabel?: boolean, + pressColor?: string, + pressOpacity?: number, + scrollEnabled?: boolean, + tabStyle?: ViewStyle, + indicatorStyle?: ViewStyle + }, + swipeEnabled?: boolean, + animationEnabled?: boolean, + lazy?: boolean, +} + +// From navigators/TabNavigator.js +export interface TabNavigatorConfig extends NavigationTabRouterConfig, TabViewConfig { } + +// From navigators/TabNavigator.js +export function TabNavigator( + routeConfigMap: NavigationRouteConfigMap, + drawConfig?: TabNavigatorConfig, +): NavigationContainer; + +export const TabBarTop: React.ReactElement; +export const TabBarBottom: React.ReactElement; From 4312a93b457f0a3a12eb539038d93cfe1ef2cb44 Mon Sep 17 00:00:00 2001 From: abrahambotros Date: Wed, 14 Jun 2017 21:17:09 -0700 Subject: [PATCH 006/180] [react-navigation] Fix flow Object -> TS any --- types/react-navigation/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 792a6a5bea..70bb306d1d 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -149,7 +149,7 @@ export type NavigationScreenOptions = { export type NavigationScreenConfigProps = { navigation: NavigationScreenProp, - screenProps: Object, + screenProps: any, }; export type NavigationScreenConfig = @@ -426,7 +426,7 @@ export type TransitionConfig = { transitionSpec?: NavigationTransitionSpec, // How to animate position and opacity of the screen // based on the value generated by the transitionSpec - screenInterpolator?: (props: NavigationSceneRendererProps) => Object, + screenInterpolator?: (props: NavigationSceneRendererProps) => any, }; export type NavigationAnimationSetter = ( From 9be2563bfc81f9127474f0c319c54532a3321517 Mon Sep 17 00:00:00 2001 From: abrahambotros Date: Wed, 14 Jun 2017 21:42:24 -0700 Subject: [PATCH 007/180] [react-navigation] Typed generic for NavigationRoute * Also add NavigationParamsGeneric and screenProps additional placeholder types * Add custom/convenience wrapper section, including NavigationScreenProps --- types/react-navigation/index.d.ts | 86 +++++++++++++++++++------------ 1 file changed, 54 insertions(+), 32 deletions(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 70bb306d1d..615954c913 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -5,9 +5,15 @@ // abrahambotros // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/************************************* - * BEGIN FLOW TYPEDEFINITION.JS PORT * - *************************************/ +/** + * BEGIN FLOW TYPEDEFINITION.JS PORT + * Reference: https://github.com/react-community/react-navigation/commit/f3a958dca1180af87611a35fb64dbd8dd57da898 + * + * NOTE: Please update the commit/link above when updating to a new Flow + * TypeDefinition.js reference, so we can conveniently just look at diffs on + * TypeDefinition.js between this latest reference point and the one you are + * using when making new updates. + */ import * as React from 'react'; import { @@ -52,12 +58,12 @@ export type NavigationState = { * Index refers to the active child route in the routes array. */ index: number, - routes: Array, + routes: Array, }; -export type NavigationRoute = NavigationLeafRoute | NavigationStateRoute; +export type NavigationRoute = NavigationLeafRoute | NavigationStateRoute; -export type NavigationLeafRoute = { +export type NavigationLeafRoute = { /** * React's key used by some navigators. No need to specify these manually, * they will be defined by the router. @@ -76,17 +82,17 @@ export type NavigationLeafRoute = { * Params passed to this route when navigating to it, * e.g. `{ car_id: 123 }` in a route that displays a car. */ - params?: NavigationParams, + params?: Params, }; -export type NavigationStateRoute = NavigationLeafRoute & { +export type NavigationStateRoute = NavigationLeafRoute & { index: number, - routes: Array, + routes: Array>, }; export type NavigationScreenOptionsGetter = ( - navigation: NavigationScreenProp, - screenProps?: {} + navigation: NavigationScreenProp, Action>, + screenProps?: { [key: string]: any } ) => Options; export type NavigationRouter = { @@ -103,14 +109,14 @@ export type NavigationRouter = { */ getActionForPathAndParams: ( path: string, - params?: NavigationParams + params?: NavigationParamsGeneric ) => (Action | null), getPathAndParamsForState: ( state: State ) => { path: string, - params?: NavigationParams, + params?: NavigationParamsGeneric, }, getComponentForRouteName: (routeName: string) => NavigationComponent, @@ -131,7 +137,7 @@ export type NavigationRouter = { export type NavigationScreenOption = | T | (( - navigation: NavigationScreenProp, + navigation: NavigationScreenProp, NavigationAction>, config: T ) => T); @@ -139,8 +145,8 @@ export type Style = ViewStyle; export type NavigationScreenDetails = { options: T, - state: NavigationRoute, - navigation: NavigationScreenProp, + state: NavigationRoute, + navigation: NavigationScreenProp, NavigationAction>, }; export type NavigationScreenOptions = { @@ -148,8 +154,8 @@ export type NavigationScreenOptions = { }; export type NavigationScreenConfigProps = { - navigation: NavigationScreenProp, - screenProps: any, + navigation: NavigationScreenProp, NavigationAction>, + screenProps: { [key: string]: any } }; export type NavigationScreenConfig = @@ -157,7 +163,7 @@ export type NavigationScreenConfig = | (NavigationScreenConfigProps & ((navigationOptionsContainer: { navigationOptions: NavigationScreenProp< - NavigationRoute, + NavigationRoute, NavigationAction >, }) => Options)); @@ -175,14 +181,14 @@ export type NavigationNavigator = React.ComponentClas navigationOptions?: NavigationScreenConfig, }; -export type NavigationParams = { +export type NavigationParamsGeneric = { [key: string]: string, }; export type NavigationNavigateAction = { type: 'Navigation/NAVIGATE', routeName: string, - params?: NavigationParams, + params?: any, // The action to run inside the sub-router action?: NavigationNavigateAction, @@ -200,12 +206,12 @@ export type NavigationSetParamsAction = { key: string, // The new params to merge into the existing route params - params?: NavigationParams, + params?: any, }; export type NavigationInitAction = { type: 'Navigation/INIT', - params?: NavigationParams, + params?: any, }; export type NavigationResetAction = { @@ -246,7 +252,7 @@ export type NavigationStackScreenOptions = NavigationScreenOptions & { export type NavigationStackRouterConfig = { initialRouteName?: string, - initialRouteParams?: NavigationParams, + initialRouteParams?: any, paths?: NavigationPathsConfig, navigationOptions?: NavigationScreenConfig, }; @@ -340,15 +346,15 @@ export type NavigationScreenProp = { goBack: (routeKey?: (string | null)) => boolean, navigate: ( routeName: string, - params?: NavigationParams, + params?: NavigationParamsGeneric, action?: NavigationAction ) => boolean, - setParams: (newParams: NavigationParams) => boolean, + setParams: (newParams: NavigationParamsGeneric) => boolean, }; export type NavigationNavigatorProps = { navigation: NavigationProp, - screenProps: any, + screenProps: { [key: string]: any } navigationOptions: any, }; @@ -371,7 +377,7 @@ export type NavigationScene = { isActive: boolean, isStale: boolean, key: string, - route: NavigationRoute, + route: NavigationRoute, }; export type NavigationTransitionProps = { @@ -402,7 +408,7 @@ export type NavigationTransitionProps = { scene: NavigationScene, index: number, - screenProps?: {}, + screenProps?: { [key: string]: any } }; // The scene renderer props are nearly identical to the props used for rendering @@ -452,9 +458,10 @@ export type LayoutEvent = { }, }; -/*********************************** - * END FLOW TYPEDEFINITION.JS PORT * - ***********************************/ +/** + * END FLOW TYPEDEFINITION.JS PORT + */ + // From createNavigationContainer.js interface NavigationContainerProps { @@ -552,3 +559,18 @@ export function TabNavigator( export const TabBarTop: React.ReactElement; export const TabBarBottom: React.ReactElement; + + +/** + * BEGIN CUSTOM CONVENIENCE INTERFACES + */ + +export interface NavigationScreenProps { + navigation: NavigationScreenProp, NavigationAction>, + screenProps: { [key: string]: any }, + navigationOptions: any, +} + +/** + * END CUSTOM CONVENIENCE INTERFACES + */ From e5843ac8f5e492298e8974ee8413cd426d7f6cd4 Mon Sep 17 00:00:00 2001 From: abrahambotros Date: Wed, 14 Jun 2017 22:52:14 -0700 Subject: [PATCH 008/180] [react-navigation] Misc fixes and improvements --- types/react-navigation/index.d.ts | 40 ++++++++++--------- .../react-navigation-tests.tsx | 7 ++-- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 615954c913..82de567263 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -61,7 +61,7 @@ export type NavigationState = { routes: Array, }; -export type NavigationRoute = NavigationLeafRoute | NavigationStateRoute; +export type NavigationRoute = NavigationLeafRoute | NavigationStateRoute; export type NavigationLeafRoute = { /** @@ -85,7 +85,7 @@ export type NavigationLeafRoute = { params?: Params, }; -export type NavigationStateRoute = NavigationLeafRoute & { +export type NavigationStateRoute = NavigationLeafRoute & { index: number, routes: Array>, }; @@ -109,14 +109,14 @@ export type NavigationRouter = { */ getActionForPathAndParams: ( path: string, - params?: NavigationParamsGeneric + params?: NavigationParams ) => (Action | null), getPathAndParamsForState: ( state: State ) => { path: string, - params?: NavigationParamsGeneric, + params?: NavigationParams, }, getComponentForRouteName: (routeName: string) => NavigationComponent, @@ -181,7 +181,7 @@ export type NavigationNavigator = React.ComponentClas navigationOptions?: NavigationScreenConfig, }; -export type NavigationParamsGeneric = { +export type NavigationParams = { [key: string]: string, }; @@ -346,16 +346,16 @@ export type NavigationScreenProp = { goBack: (routeKey?: (string | null)) => boolean, navigate: ( routeName: string, - params?: NavigationParamsGeneric, + params?: any, action?: NavigationAction ) => boolean, - setParams: (newParams: NavigationParamsGeneric) => boolean, + setParams: (newParams: NavigationParams) => boolean, }; export type NavigationNavigatorProps = { - navigation: NavigationProp, - screenProps: { [key: string]: any } - navigationOptions: any, + navigation?: NavigationProp, + screenProps?: { [key: string]: any } + navigationOptions?: any, }; /** @@ -462,6 +462,8 @@ export type LayoutEvent = { * END FLOW TYPEDEFINITION.JS PORT */ +// From addNavigatorHelpers.js +export function addNavigationHelpers(navigation: NavigationProp): NavigationScreenProp; // From createNavigationContainer.js interface NavigationContainerProps { @@ -473,11 +475,13 @@ interface NavigationContainerProps { ) => void, } -export interface NavigationContainer extends React.Component< - NavigationContainerProps & NavigationNavigatorProps, - { nav: NavigationState | null } +export interface NavigationContainer extends React.ComponentClass< + NavigationContainerProps & NavigationNavigatorProps > { router: NavigationRouter + screenProps: { [key: string]: any }, + navigationOptions: any, + state: { nav: NavigationState | null }, } export interface StackNavigatorConfig extends NavigationStackViewConfig, NavigationStackRouterConfig { @@ -488,7 +492,7 @@ export interface StackNavigatorConfig extends NavigationStackViewConfig, Navigat export function StackNavigator( routeConfigMap: NavigationRouteConfigMap, stackConfig?: StackNavigatorConfig, -): NavigationContainer +): NavigationContainer; /** * Drawer Navigator @@ -515,7 +519,7 @@ export interface DrawerNavigatorConfig extends NavigationTabRouterConfig, Drawer export function DrawerNavigator( routeConfigMap: NavigationRouteConfigMap, drawerConfig?: DrawerNavigatorConfig, -): NavigationContainer; +): NavigationContainer; /** * Tab Navigator @@ -555,10 +559,10 @@ export interface TabNavigatorConfig extends NavigationTabRouterConfig, TabViewCo export function TabNavigator( routeConfigMap: NavigationRouteConfigMap, drawConfig?: TabNavigatorConfig, -): NavigationContainer; +): NavigationContainer; -export const TabBarTop: React.ReactElement; -export const TabBarBottom: React.ReactElement; +export const TabBarTop: React.ComponentClass; +export const TabBarBottom: React.ComponentClass; /** diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index 2493d92f84..884d57e4f0 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -2,8 +2,9 @@ import * as React from 'react'; import { View } from 'react-native'; import { addNavigationHelpers, + NavigationStackAction, + NavigationTabScreenOptions, StackNavigator, - TabNavigatorScreenOptions, TabNavigatorConfig, TabBarTop, TabBarBottom, @@ -26,14 +27,14 @@ const Router = (props: any) => ( { return true; }, state: {}, }) } /> ); -const tabNavigatorScreenOptions: TabNavigatorScreenOptions = { +const tabNavigatorScreenOptions: NavigationTabScreenOptions = { title: 'title', tabBarVisible: true, tabBarIcon: , From e34616fd3c94b0b4a1fc8a13c2becd801cdd97ba Mon Sep 17 00:00:00 2001 From: abrahambotros Date: Wed, 14 Jun 2017 22:58:27 -0700 Subject: [PATCH 009/180] [react-navigation] Improve test, add screen component props type checks --- types/react-navigation/index.d.ts | 9 ++++++ .../react-navigation-tests.tsx | 28 ++++++++++++++++--- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 82de567263..ffd543f261 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -462,6 +462,11 @@ export type LayoutEvent = { * END FLOW TYPEDEFINITION.JS PORT */ + +/** + * BEGIN MANUAL DEFINITIONS OUTSIDE OF TYPEDEFINITION.JS + */ + // From addNavigatorHelpers.js export function addNavigationHelpers(navigation: NavigationProp): NavigationScreenProp; @@ -564,6 +569,10 @@ export function TabNavigator( export const TabBarTop: React.ComponentClass; export const TabBarBottom: React.ComponentClass; +/** + * END MANUAL DEFINITIONS OUTSIDE OF TYPEDEFINITION.JS + */ + /** * BEGIN CUSTOM CONVENIENCE INTERFACES diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index 884d57e4f0..b95092d5e0 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -2,6 +2,7 @@ import * as React from 'react'; import { View } from 'react-native'; import { addNavigationHelpers, + NavigationScreenProps, NavigationStackAction, NavigationTabScreenOptions, StackNavigator, @@ -10,14 +11,33 @@ import { TabBarBottom, } from 'react-navigation'; -const Start = ( - -); +/** + * @class StartScreen @extends React.Component + * @desc Simple screen component class with typed component props that should + * receive the navigation prop from the AppNavigator. + */ +interface StartScreenComponentProps { + id: number, + s: string, +} +interface StartScreenProps extends NavigationScreenProps { } +class StartScreen extends React.Component { + render() { + // Implicit type checks. + const navigationStateParams: StartScreenComponentProps = this.props.navigation.state.params; + const id = this.props.navigation.state.params.id; + const s = this.props.navigation.state.params.s; + + return ( + + ); + } +} export const AppNavigator = StackNavigator({ StartImage: { path: 'startImage', - screen: Start, + screen: StartScreen, }, }, { initialRouteName: 'StartImage', From 4ba39d401688251ef3421d440e4c0bda142e7390 Mon Sep 17 00:00:00 2001 From: abrahambotros Date: Thu, 15 Jun 2017 08:40:23 -0700 Subject: [PATCH 010/180] [react-navigation] Fix linter errors --- types/react-navigation/index.d.ts | 34 +++++++++---------- .../react-navigation-tests.tsx | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index ffd543f261..f2c5ff3591 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -135,7 +135,7 @@ export type NavigationRouter = { }; export type NavigationScreenOption = - | T + T | (( navigation: NavigationScreenProp, NavigationAction>, config: T @@ -159,7 +159,7 @@ export type NavigationScreenConfigProps = { }; export type NavigationScreenConfig = - | Options + Options | (NavigationScreenConfigProps & ((navigationOptionsContainer: { navigationOptions: NavigationScreenProp< @@ -169,7 +169,7 @@ export type NavigationScreenConfig = }) => Options)); export type NavigationComponent = - | NavigationScreenComponent + NavigationScreenComponent | NavigationNavigator; export type NavigationScreenComponent = React.ComponentClass & { @@ -226,14 +226,14 @@ export type NavigationUriAction = { uri: string, }; -export type NavigationStackViewConfig = { +export interface NavigationStackViewConfig { mode?: 'card' | 'modal', headerMode?: HeaderMode, cardStyle?: Style, transitionConfig?: () => TransitionConfig, onTransitionStart?: () => void, onTransitionEnd?: () => void, -}; +} export type NavigationStackScreenOptions = NavigationScreenOptions & { header?: (React.ReactElement | ((headerProps: HeaderProps) => React.ReactElement)) | null, @@ -250,27 +250,27 @@ export type NavigationStackScreenOptions = NavigationScreenOptions & { gesturesEnabled?: boolean, }; -export type NavigationStackRouterConfig = { +export interface NavigationStackRouterConfig { initialRouteName?: string, initialRouteParams?: any, paths?: NavigationPathsConfig, navigationOptions?: NavigationScreenConfig, -}; +} export type NavigationStackAction = - | NavigationInitAction + NavigationInitAction | NavigationNavigateAction | NavigationBackAction | NavigationSetParamsAction | NavigationResetAction; export type NavigationTabAction = - | NavigationInitAction + NavigationInitAction | NavigationNavigateAction | NavigationBackAction; export type NavigationAction = - | NavigationInitAction + NavigationInitAction | NavigationStackAction | NavigationTabAction; @@ -280,7 +280,7 @@ export type NavigationRouteConfig = T & { }; export type NavigationScreenRouteConfig = - | { + { screen: NavigationComponent, } | { @@ -291,7 +291,7 @@ export type NavigationPathsConfig = { [routeName: string]: string, }; -export type NavigationTabRouterConfig = { +export interface NavigationTabRouterConfig { initialRouteName?: string, paths?: NavigationPathsConfig, navigationOptions?: NavigationScreenConfig, @@ -299,16 +299,16 @@ export type NavigationTabRouterConfig = { // Does the back button cause the router to switch to the initial tab backBehavior?: 'none' | 'initialRoute', // defaults `initialRoute` -}; +} export type NavigationTabScreenOptions = NavigationScreenOptions & { tabBarIcon?: - | React.ReactElement + React.ReactElement | ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement< any > | null)), tabBarLabel?: - | string + string | React.ReactElement | ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement< any @@ -318,12 +318,12 @@ export type NavigationTabScreenOptions = NavigationScreenOptions & { export type NavigationDrawerScreenOptions = NavigationScreenOptions & { drawerIcon?: - | React.ReactElement + React.ReactElement | ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement< any > | null)), drawerLabel?: - | React.ReactElement + React.ReactElement | ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement< any > | null)), diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index b95092d5e0..535a7a04af 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -47,7 +47,7 @@ const Router = (props: any) => ( { return true; }, + dispatch: (action: NavigationStackAction): boolean => true, state: {}, }) } From cf39e7e9bd7e233527ba8b86504d30c02815776e Mon Sep 17 00:00:00 2001 From: abrahambotros Date: Thu, 15 Jun 2017 08:48:33 -0700 Subject: [PATCH 011/180] [react-navigation] Add test to navigate to next screen --- .../react-navigation-tests.tsx | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index 535a7a04af..3a4e02a16c 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -1,5 +1,8 @@ import * as React from 'react'; -import { View } from 'react-native'; +import { + TouchableOpacity, + View, +} from 'react-native'; import { addNavigationHelpers, NavigationScreenProps, @@ -28,6 +31,40 @@ class StartScreen extends React.Component { const id = this.props.navigation.state.params.id; const s = this.props.navigation.state.params.s; + return ( + + + + ); + } + private navigateToNextScreen = (): void => { + this.props.navigation.navigate( + ROUTE_NAME_NEXT_SCREEN, + { + id: this.props.navigation.state.params.id, + name: this.props.navigation.state.params.s, + } as NextScreenComponentProps, + ); + + } +} + +/** + * @class NextScreen @extends React.Component + */ +const ROUTE_NAME_NEXT_SCREEN = "NextScreen"; +interface NextScreenComponentProps { + id: number, + name: string, +} +interface NextScreenProps extends NavigationScreenProps { } +class NextScreen extends React.Component { + render() { + // Implicit type checks. + const navigationStateParams: NextScreenComponentProps = this.props.navigation.state.params; + const id = this.props.navigation.state.params.id; + const name = this.props.navigation.state.params.name; + return ( ); From 28fc9fb21badc7211009614bc7ae552aa41208e5 Mon Sep 17 00:00:00 2001 From: abrahambotros Date: Thu, 15 Jun 2017 08:52:18 -0700 Subject: [PATCH 012/180] [react-navigation] NavigationParams fixes --- types/react-navigation/index.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index f2c5ff3591..5f53ea7b97 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -181,14 +181,14 @@ export type NavigationNavigator = React.ComponentClas navigationOptions?: NavigationScreenConfig, }; -export type NavigationParams = { - [key: string]: string, -}; +export interface NavigationParams { + [key: string]: any, +} export type NavigationNavigateAction = { type: 'Navigation/NAVIGATE', routeName: string, - params?: any, + params?: NavigationParams, // The action to run inside the sub-router action?: NavigationNavigateAction, @@ -206,12 +206,12 @@ export type NavigationSetParamsAction = { key: string, // The new params to merge into the existing route params - params?: any, + params?: NavigationParams, }; export type NavigationInitAction = { type: 'Navigation/INIT', - params?: any, + params?: NavigationParams, }; export type NavigationResetAction = { @@ -252,7 +252,7 @@ export type NavigationStackScreenOptions = NavigationScreenOptions & { export interface NavigationStackRouterConfig { initialRouteName?: string, - initialRouteParams?: any, + initialRouteParams?: NavigationParams, paths?: NavigationPathsConfig, navigationOptions?: NavigationScreenConfig, } @@ -346,7 +346,7 @@ export type NavigationScreenProp = { goBack: (routeKey?: (string | null)) => boolean, navigate: ( routeName: string, - params?: any, + params?: NavigationParams, action?: NavigationAction ) => boolean, setParams: (newParams: NavigationParams) => boolean, From 9f822c4b0781a6e14ee9ad1f65abc4b87572a089 Mon Sep 17 00:00:00 2001 From: abrahambotros Date: Thu, 15 Jun 2017 09:00:56 -0700 Subject: [PATCH 013/180] [react-navigation] Update reference commit link to tree link --- types/react-navigation/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 5f53ea7b97..d2bf9882de 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -7,7 +7,7 @@ /** * BEGIN FLOW TYPEDEFINITION.JS PORT - * Reference: https://github.com/react-community/react-navigation/commit/f3a958dca1180af87611a35fb64dbd8dd57da898 + * Reference: https://github.com/react-community/react-navigation/tree/52a2846e77119148320bcea83b8982a8bc6acce3 * * NOTE: Please update the commit/link above when updating to a new Flow * TypeDefinition.js reference, so we can conveniently just look at diffs on From dbdfb4a24fe0a9b481945e9046e351018d901fd7 Mon Sep 17 00:00:00 2001 From: abrahambotros Date: Thu, 15 Jun 2017 09:41:00 -0700 Subject: [PATCH 014/180] [react-navigation] Move NavigationActions namespace, add todo for possibly removal --- types/react-navigation/index.d.ts | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 5f86c8ed58..237813ec0d 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -274,14 +274,6 @@ export type NavigationAction = | NavigationStackAction | NavigationTabAction; -export namespace NavigationActions { - function init(options?: NavigationInitAction): NavigationInitAction; - function navigate(options: NavigationNavigateAction): NavigationNavigateAction; - function reset(options: NavigationResetAction): NavigationResetAction; - function back(options?: NavigationBackAction): NavigationBackAction; - function setParams(options: NavigationSetParamsAction): NavigationSetParamsAction; -} - export type NavigationRouteConfig = T & { navigationOptions?: NavigationScreenConfig, path?: string, @@ -577,6 +569,20 @@ export function TabNavigator( export const TabBarTop: React.ComponentClass; export const TabBarBottom: React.ComponentClass; +/** + * NavigationActions + * @todo Is this necessary, or can we remove? Not referenced anywhere else here, but it seems a + * recent commit or two touches these. Can anyone provide a strong use case for keeping this in? + */ +export namespace NavigationActions { + function init(options?: NavigationInitAction): NavigationInitAction; + function navigate(options: NavigationNavigateAction): NavigationNavigateAction; + function reset(options: NavigationResetAction): NavigationResetAction; + function back(options?: NavigationBackAction): NavigationBackAction; + function setParams(options: NavigationSetParamsAction): NavigationSetParamsAction; +} + + /** * END MANUAL DEFINITIONS OUTSIDE OF TYPEDEFINITION.JS */ From c5ab866dbccbdb4924946ac4f50ecc76841576c5 Mon Sep 17 00:00:00 2001 From: abrahambotros Date: Sun, 18 Jun 2017 15:21:51 -0700 Subject: [PATCH 015/180] [react-navigation] Minor fixes --- types/react-navigation/index.d.ts | 8 ++++---- .../react-navigation-tests.tsx | 19 ++++++++++++------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 237813ec0d..89ffec3a09 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -592,10 +592,10 @@ export namespace NavigationActions { * BEGIN CUSTOM CONVENIENCE INTERFACES */ -export interface NavigationScreenProps { - navigation: NavigationScreenProp, NavigationAction>, - screenProps: { [key: string]: any }, - navigationOptions: any, +export interface NavigationScreenProps { + navigation: NavigationScreenProp, NavigationAction>, + screenProps?: { [key: string]: any }, + navigationOptions?: NavigationScreenConfig, } /** diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index 3a4e02a16c..5fe48aef1b 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -19,15 +19,15 @@ import { * @desc Simple screen component class with typed component props that should * receive the navigation prop from the AppNavigator. */ -interface StartScreenComponentProps { +interface StartScreenNavigationParams { id: number, s: string, } -interface StartScreenProps extends NavigationScreenProps { } +interface StartScreenProps extends NavigationScreenProps { } class StartScreen extends React.Component { render() { // Implicit type checks. - const navigationStateParams: StartScreenComponentProps = this.props.navigation.state.params; + const navigationStateParams: StartScreenNavigationParams = this.props.navigation.state.params; const id = this.props.navigation.state.params.id; const s = this.props.navigation.state.params.s; @@ -43,7 +43,7 @@ class StartScreen extends React.Component { { id: this.props.navigation.state.params.id, name: this.props.navigation.state.params.s, - } as NextScreenComponentProps, + } as NextScreenNavigationParams, ); } @@ -53,15 +53,15 @@ class StartScreen extends React.Component { * @class NextScreen @extends React.Component */ const ROUTE_NAME_NEXT_SCREEN = "NextScreen"; -interface NextScreenComponentProps { +interface NextScreenNavigationParams { id: number, name: string, } -interface NextScreenProps extends NavigationScreenProps { } +interface NextScreenProps extends NavigationScreenProps { } class NextScreen extends React.Component { render() { // Implicit type checks. - const navigationStateParams: NextScreenComponentProps = this.props.navigation.state.params; + const navigationStateParams: NextScreenNavigationParams = this.props.navigation.state.params; const id = this.props.navigation.state.params.id; const name = this.props.navigation.state.params.name; @@ -71,6 +71,10 @@ class NextScreen extends React.Component { } } +const initialRouteParams: StartScreenNavigationParams = { + id: 1, + s: "Start", +}; export const AppNavigator = StackNavigator({ StartImage: { path: 'startImage', @@ -78,6 +82,7 @@ export const AppNavigator = StackNavigator({ }, }, { initialRouteName: 'StartImage', + initialRouteParams, }); const Router = (props: any) => ( From 246ddd52cff782412a25a597029099e53e1fdf43 Mon Sep 17 00:00:00 2001 From: David Philipson Date: Mon, 19 Jun 2017 12:02:45 -0700 Subject: [PATCH 016/180] Fixes to transducers-js types * Remove unnecessary type parameters * Update transduce() and reduce() to accept CompletingTransformers * Fix incorrect definition of transduce() * Fix incorrect definition of reduce() * Fix incorrect definition of completing() * Fix incorrect definition of wrap() * Fix incorrect definition of cat() * Fix overly strict definition of mapcat() * Make into() definition precise with overloads * Use es6 Iterables. * More precise typings for object iteration in reduce(), transduce(), and into() --- types/transducers-js/index.d.ts | 128 +++++++++++++------ types/transducers-js/transducers-js-tests.ts | 48 +++++++ 2 files changed, 137 insertions(+), 39 deletions(-) diff --git a/types/transducers-js/index.d.ts b/types/transducers-js/index.d.ts index cfed8fbbbe..3d9c6f7719 100644 --- a/types/transducers-js/index.d.ts +++ b/types/transducers-js/index.d.ts @@ -1,19 +1,9 @@ // Type definitions for transducers-js 0.4 // Project: https://github.com/cognitect-labs/transducers-js // Definitions by: Colin Kahn +// David Philipson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export interface IteratorResult { - done: boolean; - value?: T; -} - -export interface Iterator { - next(value?: any): IteratorResult; - return?(value?: any): IteratorResult; - throw?(e?: any): IteratorResult; -} - export interface Reduced { ['@@transducer/reduced']: boolean; ['@@transducer/value']: TResult; @@ -21,7 +11,7 @@ export interface Reduced { export type Reducer = (result: TResult, input: TInput) => TResult; -export type Transducer = (xf: Transformer) => Transformer; +export type Transducer = (xf: Transformer) => Transformer; export interface CompletingTransformer { ['@@transducer/init'](): TResult | void; @@ -66,7 +56,7 @@ export class Map implements Transformer(f: (x: TInput) => TOutput): Transducer; +export function map(f: (x: TInput) => TOutput): Transducer; export class Filter implements Transformer { constructor(pred: (x: TInput) => boolean, xf: Transformer); @@ -78,13 +68,13 @@ export class Filter implements Transformer { /** * Filtering transducer constructor */ -export function filter(pred: (x: TInput) => boolean): Transducer; +export function filter(pred: (x: TInput) => boolean): Transducer; /** * Similar to filter except the predicate is used to * eliminate values. */ -export function remove(pred: (x: TInput) => boolean): Transducer; +export function remove(pred: (x: TInput) => boolean): Transducer; export class Keep implements Transformer { constructor(f: (x: TInput) => any, xf: Transformer); @@ -97,7 +87,7 @@ export class Keep implements Transformer { * A keeping transducer. Keep inputs as long as the provided * function does not return null or undefined. */ -export function keep(f: (x: TInput) => any): Transducer; +export function keep(f: (x: TInput) => any): Transducer; export class KeepIndexed implements Transformer { constructor(f: (i: number, x: TInput) => any, xf: Transformer); @@ -110,7 +100,7 @@ export class KeepIndexed implements Transformer(f: (i: number, x: TInput) => any): Transducer; +export function keepIndexed(f: (i: number, x: TInput) => any): Transducer; export class Take implements Transformer { constructor(n: number, xf: Transformer); @@ -123,7 +113,7 @@ export class Take implements Transformer { * A take transducer constructor. Will take n values before * returning a reduced result. */ -export function take(n: number): Transducer; +export function take(n: number): Transducer; export class TakeWhile implements Transformer { constructor(pred: (n: TInput) => boolean, xf: Transformer); @@ -136,7 +126,7 @@ export class TakeWhile implements Transformer * Like the take transducer except takes as long as the pred * return true for inputs. */ -export function takeWhile(pred: (n: TInput) => boolean): Transducer; +export function takeWhile(pred: (n: TInput) => boolean): Transducer; export class TakeNth implements Transformer { constructor(n: number, xf: Transformer); @@ -148,7 +138,7 @@ export class TakeNth implements Transformer { /** * A transducer that takes every Nth input */ -export function takeNth(n: number): Transducer; +export function takeNth(n: number): Transducer; export class Drop implements Transformer { constructor(n: number, xf: Transformer); @@ -160,7 +150,7 @@ export class Drop implements Transformer { /** * A dropping transducer constructor */ -export function drop(n: number): Transducer; +export function drop(n: number): Transducer; export class DropWhile implements Transformer { constructor(pred: (input: TInput) => boolean, xf: Transformer); @@ -173,7 +163,7 @@ export class DropWhile implements Transformer * A dropping transducer that drop inputs as long as * pred is true. */ -export function dropWhile(pred: (input: TInput) => boolean): Transducer; +export function dropWhile(pred: (input: TInput) => boolean): Transducer; export class PartitionBy implements Transformer { constructor(f: (input: TInput) => any, xf: Transformer); @@ -187,7 +177,7 @@ export class PartitionBy implements Transformer(f: (input: TInput) => any): Transducer; +export function partitionBy(f: (input: TInput) => any): Transducer; export class PartitionAll implements Transformer { constructor(n: number, xf: Transformer); @@ -200,7 +190,7 @@ export class PartitionAll implements Transformer(n: number): Transducer; +export function partitionAll(n: number): Transducer; export class Completing implements CompletingTransformer { constructor(cf: (result: TResult) => TCompleteResult, xf: Transformer); @@ -213,7 +203,9 @@ export class Completing implements CompletingT * A completing transducer constructor. Useful to provide cleanup * logic at the end of a reduction/transduction. */ -export function completing(cf: (result: TResult) => TCompleteResult): CompletingTransformer; +export function completing( + xf: Transformer | Reducer, + cf: (result: TResult) => TCompleteResult): CompletingTransformer; export class Wrap implements Transformer { constructor(stepFn: Reducer, xf: Transformer); @@ -227,44 +219,102 @@ export class Wrap implements Transformer { * accumluation and the second argument is the next input and convert * it into a transducer transformer object. */ -export function wrap(stepFn: Reducer): Transducer; +export function wrap(stepFn: Reducer): Transformer; /** * Given a transformer return a concatenating transformer */ -export function cat(xf: Transformer): Transformer ; +export function cat(xf: Transformer): Transformer>; /** * A mapping concatenating transformer */ -export function mapcat(f: (arr: TInput[]) => TOutput[]): Transducer; +export function mapcat(f: (arr: TInput) => Iterable): Transducer; /** * Given a transducer, a builder function, an initial value * and a iterable collection - returns the reduction. */ export function transduce( - xf: Transducer, - f: Transformer | Reducer, + xf: Transducer, + f: Reducer, init: TResult, - coll: TInput[] | Iterator | string | Object): TResult; + coll: Iterable): TResult; +export function transduce( + xf: Transducer, + f: CompletingTransformer, + init: TResult, + coll: Iterable): TCompleteResult; +export function transduce( + xf: Transducer, + f: CompletingTransformer, + coll: Iterable): TCompleteResult; +// Overloads for object iteration. +export function transduce( + xf: Transducer<[string, TInput], TOutput>, + f: Reducer, + init: TResult, + coll: { [key: string]: TInput }): TResult; +export function transduce( + xf: Transducer<[string, TInput], TOutput>, + f: CompletingTransformer, + init: TResult, + coll: { [key: string]: TInput }): TCompleteResult; +export function transduce( + xf: Transducer<[string, TInput], TOutput>, + f: CompletingTransformer, + coll: { [key: string]: TInput }): TCompleteResult; /** * Given a transducer, an intial value and a * collection - returns the reduction. */ -export function reduce( - xf: Transducer, +export function reduce( + xf: Transformer | Reducer, init: TResult, - coll: TInput[] | Iterator | string | Object): TResult; + coll: Iterable): TResult; +export function reduce( + xf: CompletingTransformer, + init: TResult, + coll: Iterable): TCompleteResult; +// Overloads for object iteration. +export function reduce( + xf: Transformer | Reducer, + init: TResult, + coll: { [key: string]: TInput }): TResult; +export function reduce( + xf: CompletingTransformer, + init: TResult, + coll: { [key: string]: TInput }): TCompleteResult; /** * Reduce a value into the given empty value using a transducer. */ -export function into( - empty: TResult, - xf: Transducer, - coll: TInput[] | Iterator | string | Object): TResult; +export function into( + empty: TOutput[], + xf: Transducer, + coll: Iterable): TOutput[]; +export function into( + empty: string, + xf: Transducer, + coll: Iterable): string; +export function into( + empty: { [key: string]: TOutput }, + xf: Transducer, + coll: Iterable): { [key: string]: TOutput }; +// Overloads for object iteration. +export function into( + empty: TOutput[], + xf: Transducer<[string, TInput], TOutput>, + coll: { [key: string]: TInput }): TOutput[]; +export function into( + empty: string, + xf: Transducer<[string, TInput], string>, + coll: { [key: string]: TInput }): string; +export function into( + empty: { [key: string]: TOutput }, + xf: Transducer<[string, TInput], [string, TOutput]>, + coll: { [key: string]: TInput }): { [key: string]: TOutput }; /** * Convert a transducer transformer object into a function so @@ -272,7 +322,7 @@ export function into( * Underscore, lodash */ export function toFn( - xf: Transducer, + xf: Transducer, builder: Reducer | Transformer ): Reducer; diff --git a/types/transducers-js/transducers-js-tests.ts b/types/transducers-js/transducers-js-tests.ts index 634309a2b5..f39bf87384 100644 --- a/types/transducers-js/transducers-js-tests.ts +++ b/types/transducers-js/transducers-js-tests.ts @@ -124,3 +124,51 @@ function mapcatExample() { const xf = t.mapcat(reverse); t.into([], xf, [[3, 2, 1], [6, 5, 4]]); // [1, 2, 3, 4, 5, 6] } + +// Original tests + +function transduceExample() { + const { completing, transduce, wrap } = t; + const stringAppendFn = (acc: string, x: number) => acc + x; + const stringAppendTransformer = wrap(stringAppendFn); + const stringAppendThenLengthTransformer = completing( + stringAppendFn, + s => s.length, + ); + const lengthsString1: string = transduce( + t.map((s: string) => s.length), + stringAppendFn, + "", + ["a", "b"], + ); + const lengthsString2: string = transduce( + t.map((s: string) => s.length), + stringAppendTransformer, + "", + ["a", "b"], + ); + const lengthsStringLength: number = transduce( + t.map((s: string) => s.length), + stringAppendThenLengthTransformer, + "", + ["a", "b"], + ); +} + +function advancedIntoExample() { + const array: number[] = into([], t.map((s: string) => s.length), [ + "a", + "b", + ]); + const string: string = into("", t.map((s: string) => s + s), ["a", "b"]); + const object1: { [key: string]: number } = into( + {}, + t.map((s: string) => [s, s.length]), + ["a", "b"], + ); + const object2: { [key: string]: boolean } = into( + {}, + t.map((kv: [string, number]) => [kv[0], true]), + { a: 1, b: 2 } + ); +} From 690dcb6d31ff7e5bcca7c2cab43a5e3759bf19a6 Mon Sep 17 00:00:00 2001 From: Dona278 Date: Tue, 20 Jun 2017 14:41:47 +0200 Subject: [PATCH 017/180] [angular-local-storage] - Added missing parameter and function to the ILocalStorageServiceProvider * Added missing parameter "secure" to the "setStorageCookie" function * Added missing function "setDefaultToCookie" to the "ILocalStorageServiceProvider" --- .../angular-local-storage-tests.ts | 1 + types/angular-local-storage/index.d.ts | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/types/angular-local-storage/angular-local-storage-tests.ts b/types/angular-local-storage/angular-local-storage-tests.ts index ead14e85fb..b3fdde8b9e 100644 --- a/types/angular-local-storage/angular-local-storage-tests.ts +++ b/types/angular-local-storage/angular-local-storage-tests.ts @@ -64,6 +64,7 @@ app.config(function (localStorageServiceProvider: ng.local.storage.ILocalStorage localStorageServiceProvider .setPrefix('myApp') .setStorageType('sessionStorage') + .setDefaultToCookie(false) .setNotify(true, true); }); diff --git a/types/angular-local-storage/index.d.ts b/types/angular-local-storage/index.d.ts index faa99065da..76ab65b1b5 100644 --- a/types/angular-local-storage/index.d.ts +++ b/types/angular-local-storage/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for angular-local-storage v0.1.6 +// Type definitions for angular-local-storage v0.6.0 // Project: https://github.com/grevory/angular-local-storage -// Definitions by: Ken Fukuyama +// Definitions by: Ken Fukuyama , Davide Donadello // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -27,12 +27,18 @@ declare module 'angular' { * @param storageType localstorage or sessionStorage. default: localStorage */ setStorageType(storageType: string): ILocalStorageServiceProvider; + /** + * If localStorage is not supported, the library will default to cookies instead. This behavior can be disabled + * @param shouldDefault default: true + */ + setDefaultToCookie(shouldDefault: boolean): ILocalStorageServiceProvider; /** * Setter for cookie config * @param exp number of days before cookies expire (0 = does not expire). default: 30 * @param path the web path the cookie represents. default: '/' + * @param secure to store cookies as secure. default: false */ - setStorageCookie(exp: number, path: string): ILocalStorageServiceProvider; + setStorageCookie(exp: number, path: string, secure: boolean): ILocalStorageServiceProvider; /** * Set the cookie domain, since this runs inside a the config() block, only providers and constants can be injected. As a result, $location service can't be used here, use a hardcoded string or window.location. * No default value From 5609ba63702683bc43ccc377999cf58f904bf86d Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 20 Jun 2017 16:50:52 -0700 Subject: [PATCH 018/180] elasticsearch: type scroll result and change PromiseLike to Promise --- types/elasticsearch/index.d.ts | 236 ++++++++++++++++----------------- 1 file changed, 118 insertions(+), 118 deletions(-) diff --git a/types/elasticsearch/index.d.ts b/types/elasticsearch/index.d.ts index a0606a4961..34be61f5b0 100644 --- a/types/elasticsearch/index.d.ts +++ b/types/elasticsearch/index.d.ts @@ -13,75 +13,75 @@ declare module Elasticsearch { nodes: Nodes; snapshot: Snapshot; tasks: Tasks; - bulk(params: BulkIndexDocumentsParams): PromiseLike; + bulk(params: BulkIndexDocumentsParams): Promise; bulk(params: BulkIndexDocumentsParams, callback: (error: any, response: any) => void): void; clearScroll(params: ClearScrollParams, callback: (error: any, response: any) => void): void; - clearScroll(params: ClearScrollParams): PromiseLike; + clearScroll(params: ClearScrollParams): Promise; count(params: CountParams, callback: (error: any, response: CountResponse) => void): void; - count(params: CountParams): PromiseLike; - create(params: CreateDocumentParams): PromiseLike; + count(params: CountParams): Promise; + create(params: CreateDocumentParams): Promise; create(params: CreateDocumentParams, callback: (err: any, response: CreateDocumentResponse, status: any) => void): void; - delete(params: DeleteDocumentParams): PromiseLike; + delete(params: DeleteDocumentParams): Promise; delete(params: DeleteDocumentParams, callback: (error: any, response: DeleteDocumentResponse) => void): void; - deleteByQuery(params: DeleteDocumentByQueryParams): PromiseLike; + deleteByQuery(params: DeleteDocumentByQueryParams): Promise; deleteByQuery(params: DeleteDocumentByQueryParams, callback: (error: any, response: DeleteDocumentByQueryResponse) => void): void; - deleteScript(params: DeleteScriptParams): PromiseLike; + deleteScript(params: DeleteScriptParams): Promise; deleteScript(params: DeleteScriptParams, callback: (error: any, response: any) => void): void; - deleteTemplate(params: DeleteTemplateParams): PromiseLike; + deleteTemplate(params: DeleteTemplateParams): Promise; deleteTemplate(params: DeleteTemplateParams, callback: (error: any, response: any) => void): void; - exists(params: ExistsParams): PromiseLike; + exists(params: ExistsParams): Promise; exists(params: ExistsParams, callback: (error: any, response: any, status?: any) => void): void; - explain(params: ExplainParams): PromiseLike; + explain(params: ExplainParams): Promise; explain(params: ExplainParams, callback: (error: any, response: ExplainResponse) => void): void; - fieldStats(params: FieldStatsParams): PromiseLike; + fieldStats(params: FieldStatsParams): Promise; fieldStats(params: FieldStatsParams, callback: (error: any, response: FieldStatsResponse) => void): void; get(params: GetParams, callback: (error: any, response: GetResponse) => void): void; - get(params: GetParams): PromiseLike>; - getScript(params: GetScriptParams): PromiseLike; + get(params: GetParams): Promise>; + getScript(params: GetScriptParams): Promise; getScript(params: GetScriptParams, callback: (error: any, response: any) => void): void; - getSource(params: GetSourceParams): PromiseLike; + getSource(params: GetSourceParams): Promise; getSource(params: GetSourceParams, callback: (error: any, response: any) => void): void; - getTemplate(params: GetTemplateParams): PromiseLike; + getTemplate(params: GetTemplateParams): Promise; getTemplate(params: GetTemplateParams, callback: (error: any, response: any) => void): void; - index(params: IndexDocumentParams): PromiseLike; + index(params: IndexDocumentParams): Promise; index(params: IndexDocumentParams, callback: (error: any, response: any) => void): void; - info(params: InfoParams): PromiseLike; + info(params: InfoParams): Promise; info(params: InfoParams, callback: (error: any, response: any) => void): void; mget(params: MGetParams, callback: (error: any, response: MGetResponse) => void): void; - mget(params: MGetParams): PromiseLike>; + mget(params: MGetParams): Promise>; msearch(params: MSearchParams, callback: (error: any, response: MSearchResponse) => void): void; - msearch(params: MSearchParams): PromiseLike>; + msearch(params: MSearchParams): Promise>; msearchTemplate(params: MSearchTemplateParams, callback: (error: any, response: MSearchResponse) => void): void; - msearchTemplate(params: MSearchTemplateParams): PromiseLike>; - mtermvectors(params: MTermVectorsParams): PromiseLike; + msearchTemplate(params: MSearchTemplateParams): Promise>; + mtermvectors(params: MTermVectorsParams): Promise; mtermvectors(params: MTermVectorsParams, callback: (error: any, response: any) => void): void; - ping(params: PingParams): PromiseLike; + ping(params: PingParams): Promise; ping(params: PingParams, callback: (err: any, response: any, status: any) => void): void; - putScript(params: PutScriptParams): PromiseLike; + putScript(params: PutScriptParams): Promise; putScript(params: PutScriptParams, callback: (err: any, response: any, status: any) => void): void; - putTemplate(params: PutTemplateParams): PromiseLike; + putTemplate(params: PutTemplateParams): Promise; putTemplate(params: PutTemplateParams, callback: (err: any, response: any, status: any) => void): void; - reindex(params: ReindexParams): PromiseLike; + reindex(params: ReindexParams): Promise; reindex(params: ReindexParams, callback: (error: any, response: ReindexResponse) => void): void; - reindexRethrottle(params: ReindexRethrottleParams): PromiseLike; + reindexRethrottle(params: ReindexRethrottleParams): Promise; reindexRethrottle(params: ReindexRethrottleParams, callback: (error: any, response: any) => void): void; - renderSearchTemplate(params: RenderSearchTemplateParams): PromiseLike; + renderSearchTemplate(params: RenderSearchTemplateParams): Promise; renderSearchTemplate(params: RenderSearchTemplateParams, callback: (error: any, response: any) => void): void; - scroll(params: ScrollParams): PromiseLike; - scroll(params: ScrollParams, callback: (error: any, response: any) => void): void; - search(params: SearchParams): PromiseLike>; + scroll(params: ScrollParams): Promise>; + scroll(params: ScrollParams, callback: (error: any, response: SearchResponse) => void): void; + search(params: SearchParams): Promise>; search(params: SearchParams, callback: (error: any, response: SearchResponse) => void): void; - searchShards(params: SearchShardsParams): PromiseLike; + searchShards(params: SearchShardsParams): Promise; searchShards(params: SearchShardsParams, callback: (error: any, response: SearchShardsResponse) => void): void; - searchTemplate(params: SearchTemplateParams): PromiseLike; + searchTemplate(params: SearchTemplateParams): Promise; searchTemplate(params: SearchTemplateParams, callback: (error: any, response: any) => void): void; - suggest(params: SuggestParams): PromiseLike; + suggest(params: SuggestParams): Promise; suggest(params: SuggestParams, callback: (error: any, response: any) => void): void; - termvectors(params: TermvectorsParams): PromiseLike; + termvectors(params: TermvectorsParams): Promise; termvectors(params: TermvectorsParams, callback: (error: any, response: any) => void): void; - update(params: UpdateDocumentParams): PromiseLike; + update(params: UpdateDocumentParams): Promise; update(params: UpdateDocumentParams, callback: (error: any, response: any) => void): void; - updateByQuery(params: UpdateDocumentByQueryParams): PromiseLike; + updateByQuery(params: UpdateDocumentByQueryParams): Promise; updateByQuery(params: UpdateDocumentByQueryParams, callback: (error: any, response: any) => void): void; } @@ -774,43 +774,43 @@ declare module Elasticsearch { export interface Cat { aliases(params: CatAliasesParams, callback: (error: any, response: any) => void): void; - aliases(params: CatAliasesParams): PromiseLike; + aliases(params: CatAliasesParams): Promise; allocation(params: CatAllocationParams, callback: (error: any, response: any) => void): void; - allocation(params: CatAllocationParams): PromiseLike; + allocation(params: CatAllocationParams): Promise; count(params: CatCountParams, callback: (error: any, response: any) => void): void; - count(params: CatAllocationParams): PromiseLike; + count(params: CatAllocationParams): Promise; fielddata(params: CatFielddataParams, callback: (error: any, response: any) => void): void; - fielddata(params: CatFielddataParams): PromiseLike; + fielddata(params: CatFielddataParams): Promise; health(params: CatHealthParams, callback: (error: any, response: any) => void): void; - health(params: CatHealthParams): PromiseLike; + health(params: CatHealthParams): Promise; help(params: CatHelpParams, callback: (error: any, response: any) => void): void; - help(params: CatHelpParams): PromiseLike; + help(params: CatHelpParams): Promise; indices(params: CatIndicesParams, callback: (error: any, response: any) => void): void; - indices(params: CatIndicesParams): PromiseLike; + indices(params: CatIndicesParams): Promise; master(params: CatCommonParams, callback: (error: any, response: any) => void): void; - master(params: CatCommonParams): PromiseLike; + master(params: CatCommonParams): Promise; nodeattrs(params: CatCommonParams, callback: (error: any, response: any) => void): void; - nodeattrs(params: CatCommonParams): PromiseLike; + nodeattrs(params: CatCommonParams): Promise; nodes(params: CatCommonParams, callback: (error: any, response: any) => void): void; - nodes(params: CatCommonParams): PromiseLike; + nodes(params: CatCommonParams): Promise; pendingTasks(params: CatCommonParams, callback: (error: any, response: any) => void): void; - pendingTasks(params: CatCommonParams): PromiseLike; + pendingTasks(params: CatCommonParams): Promise; plugins(params: CatCommonParams, callback: (error: any, response: any) => void): void; - plugins(params: CatCommonParams): PromiseLike; + plugins(params: CatCommonParams): Promise; recovery(params: CatRecoveryParams, callback: (error: any, response: any) => void): void; - recovery(params: CatRecoveryParams): PromiseLike; + recovery(params: CatRecoveryParams): Promise; repositories(params: CatCommonParams, callback: (error: any, response: any) => void): void; - repositories(params: CatCommonParams): PromiseLike; + repositories(params: CatCommonParams): Promise; segments(params: CatSegmentsParams, callback: (error: any, response: any) => void): void; - segments(params: CatSegmentsParams): PromiseLike; + segments(params: CatSegmentsParams): Promise; shards(params: CatShardsParams, callback: (error: any, response: any) => void): void; - shards(params: CatShardsParams): PromiseLike; + shards(params: CatShardsParams): Promise; snapshots(params: CatSnapshotsParams, callback: (error: any, response: any) => void): void; - snapshots(params: CatSnapshotsParams): PromiseLike; + snapshots(params: CatSnapshotsParams): Promise; tasks(params: CatTasksParams, callback: (error: any, response: any) => void): void; - tasks(params: CatTasksParams): PromiseLike; + tasks(params: CatTasksParams): Promise; threadPool(params: CatThreadPoolParams, callback: (error: any, response: any) => void): void; - threadPool(params: CatThreadPoolParams): PromiseLike; + threadPool(params: CatThreadPoolParams): Promise; } export type CatBytes = "b" | "k" | "kb" | "m" | "mb" | "g" | "gb" | "t" | "tb" | "p" | "pb"; @@ -907,21 +907,21 @@ declare module Elasticsearch { export interface Cluster { allocationExplain(params: ClusterAllocationExplainParams, callback: (error: any, response: any) => void): void; - allocationExplain(params: ClusterAllocationExplainParams): PromiseLike; + allocationExplain(params: ClusterAllocationExplainParams): Promise; getSettings(params: ClusterGetSettingsParams, callback: (error: any, response: any) => void): void; - getSettings(params: ClusterGetSettingsParams): PromiseLike; + getSettings(params: ClusterGetSettingsParams): Promise; health(params: ClusterHealthParams, callback: (error: any, response: any) => void): void; - health(params: ClusterHealthParams): PromiseLike; + health(params: ClusterHealthParams): Promise; pendingTasks(params: ClusterPendingTasksParams, callback: (error: any, response: any) => void): void; - pendingTasks(params: ClusterPendingTasksParams): PromiseLike; + pendingTasks(params: ClusterPendingTasksParams): Promise; putSettings(params: ClusterPutSettingsParams, callback: (error: any, response: any) => void): void; - putSettings(params: ClusterPutSettingsParams): PromiseLike; + putSettings(params: ClusterPutSettingsParams): Promise; reroute(params: ClusterRerouteParams, callback: (error: any, response: any) => void): void; - reroute(params: ClusterRerouteParams): PromiseLike; + reroute(params: ClusterRerouteParams): Promise; state(params: ClusterStateParams, callback: (error: any, response: any) => void): void; - state(params: ClusterStateParams): PromiseLike; + state(params: ClusterStateParams): Promise; stats(params: ClusterStatsParams, callback: (error: any, response: any) => void): void; - stats(params: ClusterStatsParams): PromiseLike; + stats(params: ClusterStatsParams): Promise; } export interface ClusterAllocationExplainParams extends GenericParams { @@ -988,77 +988,77 @@ declare module Elasticsearch { export class Indices { analyze(params: IndicesAnalyzeParams, callback: (error: any, response: any, status: any) => void): void; - analyze(params: IndicesAnalyzeParams): PromiseLike; + analyze(params: IndicesAnalyzeParams): Promise; clearCache(params: IndicesClearCacheParams, callback: (error: any, response: any, status: any) => void): void; - clearCache(params: IndicesClearCacheParams): PromiseLike; + clearCache(params: IndicesClearCacheParams): Promise; close(params: IndicesCloseParams, callback: (error: any, response: any, status: any) => void): void; - close(params: IndicesCloseParams): PromiseLike; + close(params: IndicesCloseParams): Promise; create(params: IndicesCreateParams, callback: (error: any, response: any, status: any) => void): void; - create(params: IndicesCreateParams): PromiseLike; + create(params: IndicesCreateParams): Promise; delete(params: IndicesDeleteParams, callback: (error: any, response: any, status: any) => void): void; - delete(params: IndicesDeleteParams): PromiseLike; + delete(params: IndicesDeleteParams): Promise; deleteAlias(params: IndicesDeleteAliasParams, callback: (error: any, response: any, status: any) => void): void; - deleteAlias(params: IndicesDeleteAliasParams): PromiseLike; + deleteAlias(params: IndicesDeleteAliasParams): Promise; deleteTemplate(params: IndicesDeleteTemplateParams, callback: (error: any, response: any, status: any) => void): void; - deleteTemplate(params: IndicesDeleteTemplateParams): PromiseLike; + deleteTemplate(params: IndicesDeleteTemplateParams): Promise; exists(params: IndicesExistsParams, callback: (error: any, response: any, status: any) => void): void; - exists(params: IndicesExistsParams): PromiseLike; + exists(params: IndicesExistsParams): Promise; existsAlias(params: IndicesExistsAliasParams, callback: (error: any, response: any, status: any) => void): void; - existsAlias(params: IndicesExistsAliasParams): PromiseLike; + existsAlias(params: IndicesExistsAliasParams): Promise; existsTemplate(params: IndicesExistsTemplateParams, callback: (error: any, response: any, status: any) => void): void; - existsTemplate(params: IndicesExistsTemplateParams): PromiseLike; + existsTemplate(params: IndicesExistsTemplateParams): Promise; existsType(params: IndicesExistsTypeParams, callback: (error: any, response: any, status: any) => void): void; - existsType(params: IndicesExistsTypeParams): PromiseLike; + existsType(params: IndicesExistsTypeParams): Promise; flush(params: IndicesFlushParams, callback: (error: any, response: any, status: any) => void): void; - flush(params: IndicesFlushParams): PromiseLike; + flush(params: IndicesFlushParams): Promise; flushSynced(params: IndicesFlushSyncedParams, callback: (error: any, response: any, status: any) => void): void; - flushSynced(params: IndicesFlushSyncedParams): PromiseLike; + flushSynced(params: IndicesFlushSyncedParams): Promise; forcemerge(params: IndicesForcemergeParams, callback: (error: any, response: any, status: any) => void): void; - forcemerge(params: IndicesForcemergeParams): PromiseLike; + forcemerge(params: IndicesForcemergeParams): Promise; get(params: IndicesGetParams, callback: (error: any, response: any, status: any) => void): void; - get(params: IndicesGetParams): PromiseLike; + get(params: IndicesGetParams): Promise; getAlias(params: IndicesGetAliasParams, callback: (error: any, response: any, status: any) => void): void; - getAlias(params: IndicesGetAliasParams): PromiseLike; + getAlias(params: IndicesGetAliasParams): Promise; getFieldMapping(params: IndicesGetFieldMappingParams, callback: (error: any, response: any, status: any) => void): void; - getFieldMapping(params: IndicesGetFieldMappingParams): PromiseLike; + getFieldMapping(params: IndicesGetFieldMappingParams): Promise; getMapping(params: IndicesGetMappingParams, callback: (error: any, response: any, status: any) => void): void; - getMapping(params: IndicesGetMappingParams): PromiseLike; + getMapping(params: IndicesGetMappingParams): Promise; getSettings(params: IndicesGetSettingsParams, callback: (error: any, response: any, status: any) => void): void; - getSettings(params: IndicesGetSettingsParams): PromiseLike; + getSettings(params: IndicesGetSettingsParams): Promise; getTemplate(params: IndicesGetTemplateParams, callback: (error: any, response: any, status: any) => void): void; - getTemplate(params: IndicesGetTemplateParams): PromiseLike; + getTemplate(params: IndicesGetTemplateParams): Promise; getUpgrade(params: IndicesGetUpgradeParams, callback: (error: any, response: any, status: any) => void): void; - getUpgrade(params: IndicesGetUpgradeParams): PromiseLike; + getUpgrade(params: IndicesGetUpgradeParams): Promise; open(params: IndicesOpenParams, callback: (error: any, response: any, status: any) => void): void; - open(params: IndicesOpenParams): PromiseLike; + open(params: IndicesOpenParams): Promise; putAlias(params: IndicesPutAliasParams, callback: (error: any, response: any, status: any) => void): void; - putAlias(params: IndicesPutAliasParams): PromiseLike; + putAlias(params: IndicesPutAliasParams): Promise; putMapping(params: IndicesPutMappingParams, callback: (error: any, response: any, status: any) => void): void; - putMapping(params: IndicesPutMappingParams): PromiseLike; + putMapping(params: IndicesPutMappingParams): Promise; putSettings(params: IndicesPutSettingsParams, callback: (error: any, response: any, status: any) => void): void; - putSettings(params: IndicesPutSettingsParams): PromiseLike; + putSettings(params: IndicesPutSettingsParams): Promise; putTemplate(params: IndicesPutTemplateParams, callback: (error: any, response: any) => void): void; - putTemplate(params: IndicesPutTemplateParams): PromiseLike; + putTemplate(params: IndicesPutTemplateParams): Promise; recovery(params: IndicesRecoveryParams, callback: (error: any, response: any) => void): void; - recovery(params: IndicesRecoveryParams): PromiseLike; + recovery(params: IndicesRecoveryParams): Promise; refresh(params: IndicesRefreshParams, callback: (error: any, response: any) => void): void; - refresh(params: IndicesRefreshParams): PromiseLike; + refresh(params: IndicesRefreshParams): Promise; rollover(params: IndicesRolloverParams, callback: (error: any, response: IndicesRolloverResponse) => void): void; - rollover(params: IndicesRolloverParams): PromiseLike; + rollover(params: IndicesRolloverParams): Promise; segments(params: IndicesSegmentsParams, callback: (error: any, response: any) => void): void; - segments(params: IndicesSegmentsParams): PromiseLike; + segments(params: IndicesSegmentsParams): Promise; shardStores(params: IndicesShardStoresParams, callback: (error: any, response: any) => void): void; - shardStores(params: IndicesShardStoresParams): PromiseLike; + shardStores(params: IndicesShardStoresParams): Promise; shrink(params: IndicesShrinkParams, callback: (error: any, response: any) => void): void; - shrink(params: IndicesShrinkParams): PromiseLike; + shrink(params: IndicesShrinkParams): Promise; stats(params: IndicesStatsParams, callback: (error: any, response: any) => void): void; - stats(params: IndicesStatsParams): PromiseLike; + stats(params: IndicesStatsParams): Promise; updateAliases(params: IndicesUpdateAliasesParams, callback: (error: any, response: any) => void): void; - updateAliases(params: IndicesUpdateAliasesParams): PromiseLike; + updateAliases(params: IndicesUpdateAliasesParams): Promise; upgrade(params: IndicesUpgradeParams, callback: (error: any, response: any) => void): void; - upgrade(params: IndicesUpgradeParams): PromiseLike; + upgrade(params: IndicesUpgradeParams): Promise; validateQuery(params: IndicesValidateQueryParams, callback: (error: any, response: any) => void): void; - validateQuery(params: IndicesValidateQueryParams): PromiseLike; + validateQuery(params: IndicesValidateQueryParams): Promise; } export interface IndicesAnalyzeParams extends GenericParams { @@ -1416,13 +1416,13 @@ declare module Elasticsearch { export class Ingest { deletePipeline(params: IngestDeletePipelineParams, callback: (error: any, response: any, status: any) => void): void; - deletePipeline(params: IngestDeletePipelineParams): PromiseLike; + deletePipeline(params: IngestDeletePipelineParams): Promise; getPipeline(params: IngestGetPipelineParams, callback: (error: any, response: any, status: any) => void): void; - getPipeline(params: IngestGetPipelineParams): PromiseLike; + getPipeline(params: IngestGetPipelineParams): Promise; putPipeline(params: IngestPutPipelineParams, callback: (error: any, response: any, status: any) => void): void; - putPipeline(params: IngestPutPipelineParams): PromiseLike; + putPipeline(params: IngestPutPipelineParams): Promise; simulate(params: IngestSimulateParams, callback: (error: any, response: any, status: any) => void): void; - simulate(params: IngestSimulateParams): PromiseLike; + simulate(params: IngestSimulateParams): Promise; } export interface IngestDeletePipelineParams extends GenericParams { @@ -1450,11 +1450,11 @@ declare module Elasticsearch { export class Nodes { hotThreads(params: NodesHotThreadsParams, callback: (error: any, response: any, status: any) => void): void; - hotThreads(params: NodesHotThreadsParams): PromiseLike; + hotThreads(params: NodesHotThreadsParams): Promise; info(params: NodesInfoParams, callback: (error: any, response: any, status: any) => void): void; - info(params: NodesInfoParams): PromiseLike; + info(params: NodesInfoParams): Promise; stats(params: NodesStatsParams, callback: (error: any, response: any, status: any) => void): void; - stats(params: NodesStatsParams): PromiseLike; + stats(params: NodesStatsParams): Promise; } export interface NodesHotThreadsParams extends GenericParams { @@ -1491,23 +1491,23 @@ declare module Elasticsearch { export class Snapshot { create(params: SnapshotCreateParams, callback: (error: any, response: any, status: any) => void): void; - create(params: SnapshotCreateParams): PromiseLike; + create(params: SnapshotCreateParams): Promise; createRepository(params: SnapshotCreateRepositoryParams, callback: (error: any, response: any, status: any) => void): void; - createRepository(params: SnapshotCreateRepositoryParams): PromiseLike; + createRepository(params: SnapshotCreateRepositoryParams): Promise; delete(params: SnapshotDeleteParams, callback: (error: any, response: any, status: any) => void): void; - delete(params: SnapshotDeleteParams): PromiseLike; + delete(params: SnapshotDeleteParams): Promise; deleteRepository(params: SnapshotDeleteRepositoryParams, callback: (error: any, response: any, status: any) => void): void; - deleteRepository(params: SnapshotDeleteRepositoryParams): PromiseLike; + deleteRepository(params: SnapshotDeleteRepositoryParams): Promise; get(params: SnapshotGetParams, callback: (error: any, response: any, status: any) => void): void; - get(params: SnapshotGetParams): PromiseLike; + get(params: SnapshotGetParams): Promise; getRepository(params: SnapshotGetRepositoryParams, callback: (error: any, response: any, status: any) => void): void; - getRepository(params: SnapshotGetRepositoryParams): PromiseLike; + getRepository(params: SnapshotGetRepositoryParams): Promise; restore(params: SnapshotRestoreParams, callback: (error: any, response: any, status: any) => void): void; - restore(params: SnapshotRestoreParams): PromiseLike; + restore(params: SnapshotRestoreParams): Promise; status(params: SnapshotStatusParams, callback: (error: any, response: any, status: any) => void): void; - status(params: SnapshotStatusParams): PromiseLike; + status(params: SnapshotStatusParams): Promise; verifyRepository(params: SnapshotVerifyRepositoryParams, callback: (error: any, response: any, status: any) => void): void; - verifyRepository(params: SnapshotVerifyRepositoryParams): PromiseLike; + verifyRepository(params: SnapshotVerifyRepositoryParams): Promise; } export interface SnapshotCreateParams extends GenericParams { @@ -1571,11 +1571,11 @@ declare module Elasticsearch { export class Tasks { cancel(params: TasksCancelParams, callback: (error: any, response: any, status: any) => void): void; - cancel(params: TasksCancelParams): PromiseLike; + cancel(params: TasksCancelParams): Promise; get(params: TasksGetParams, callback: (error: any, response: any, status: any) => void): void; - get(params: TasksGetParams): PromiseLike; + get(params: TasksGetParams): Promise; list(params: TasksListParams, callback: (error: any, response: any, status: any) => void): void; - list(params: TasksListParams): PromiseLike; + list(params: TasksListParams): Promise; } export interface TasksCancelParams extends GenericParams { From fcd65b03192d6a6e4be96a2c187c3a8b61c67cd9 Mon Sep 17 00:00:00 2001 From: Paul Date: Wed, 21 Jun 2017 09:58:34 +0300 Subject: [PATCH 019/180] Add foldAll to IEditSession --- types/ace/index.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/ace/index.d.ts b/types/ace/index.d.ts index 90466c946e..58bf1c2bd8 100644 --- a/types/ace/index.d.ts +++ b/types/ace/index.d.ts @@ -474,7 +474,9 @@ declare namespace AceAjax { removeFold(arg: any): void; expandFold(arg: any): void; - + + foldAll(startRow?: number, endRow?: number, depth?: number): void + unfold(arg1: any, arg2: boolean): void; screenToDocumentColumn(row: number, column: number): void; From f2df68de0198be12917aab48e1aafe2c4a8812b0 Mon Sep 17 00:00:00 2001 From: Nicolas Voigt Date: Wed, 21 Jun 2017 12:20:28 +0200 Subject: [PATCH 020/180] modified crypto.verfier.verify --- types/node/index.d.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 952cf98e4d..3f8b5d5a4a 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -3632,8 +3632,10 @@ declare module "crypto" { export interface Verify extends NodeJS.WritableStream { update(data: string | Buffer): Verify; update(data: string | Buffer, input_encoding: Utf8AsciiLatin1Encoding): Verify; - verify(object: string, signature: Buffer): boolean; - verify(object: string, signature: string, signature_format: HexBase64Latin1Encoding): boolean; + verify(object: string | Object, signature: Buffer | DataView): boolean; + verify(object: string | Object, signature: string, signature_format: HexBase64Latin1Encoding): boolean; + // https://nodejs.org/api/crypto.html#crypto_verifier_verify_object_signature_signature_format + // The signature field accepts a TypedArray type, but it is only available starting ES2017 } export function createDiffieHellman(prime_length: number, generator?: number): DiffieHellman; export function createDiffieHellman(prime: Buffer): DiffieHellman; From 9d510d71fe139f72b6ae16af24798a732521c845 Mon Sep 17 00:00:00 2001 From: Nicolas Voigt Date: Wed, 21 Jun 2017 12:55:06 +0200 Subject: [PATCH 021/180] added author reference --- types/node/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 3f8b5d5a4a..647bf30cc6 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -6,6 +6,7 @@ // Roberto Desideri // Christian Vaagland Tellnes // Wilco Bakker +// Nicolas Voigt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 From 23455c0bc57a16fd3a7d7ece4d18028929567f5c Mon Sep 17 00:00:00 2001 From: David Philipson Date: Wed, 21 Jun 2017 04:03:15 -0700 Subject: [PATCH 022/180] Fix toFn typing, tweak comp typing --- types/transducers-js/index.d.ts | 9 ++++++--- types/transducers-js/transducers-js-tests.ts | 8 ++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/types/transducers-js/index.d.ts b/types/transducers-js/index.d.ts index 3d9c6f7719..413cfbfef5 100644 --- a/types/transducers-js/index.d.ts +++ b/types/transducers-js/index.d.ts @@ -34,7 +34,10 @@ export function isReduced(x: any): boolean; /** * Function composition. Take N function and return their composition. */ -export function comp(...args: T[]): T; +// Infers correct return type when all arguments have same type. +export function comp any>(...args: T[]): T; +// Falls back to (any => any) when argument types differ. +export function comp(...args: Array<(x: any) => any>): (x: any) => any; /** * Take a predicate function and return its complement. @@ -323,8 +326,8 @@ export function into( */ export function toFn( xf: Transducer, - builder: Reducer | Transformer -): Reducer; + builder: Reducer | Transformer +): Reducer; /** * A transformer which simply returns the first input. diff --git a/types/transducers-js/transducers-js-tests.ts b/types/transducers-js/transducers-js-tests.ts index f39bf87384..7a82b595c8 100644 --- a/types/transducers-js/transducers-js-tests.ts +++ b/types/transducers-js/transducers-js-tests.ts @@ -172,3 +172,11 @@ function advancedIntoExample() { { a: 1, b: 2 } ); } + +function compExample() { + const fn1: t.Transducer = comp(map(inc), filter(isEven)); + const fn2: t.Transducer = comp( + filter(isEven), + map((x: number) => "" + x), + ); +} From e01f2d7d8752ab11b8d1095bb125ac38337b5ac8 Mon Sep 17 00:00:00 2001 From: mailto1587 Date: Wed, 21 Jun 2017 20:01:17 +0800 Subject: [PATCH 023/180] Change the type of Request.query to any instead of Object for building a fast prototype --- types/hapi/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/hapi/index.d.ts b/types/hapi/index.d.ts index f0ed602864..502b8d4362 100644 --- a/types/hapi/index.d.ts +++ b/types/hapi/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for hapi 16.1 +// Type definitions for hapi 16.2 // Project: https://github.com/hapijs/hapi // Definitions by: Jason Swearingen , AJP // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -1938,7 +1938,7 @@ export class Request extends Podium { * an object containing the query parameters. * TODO update with outcome of: https://github.com/hapijs/hapi/pull/3479 */ - query: Object; + query: any; /** an object containing the Node HTTP server objects. **Direct interaction with these raw objects is not recommended.** */ raw: { req: http.IncomingMessage; // Or http.ClientRequest http://www.apetuts.com/tutorial/node-js-http-client-request-class/ ? From c06dcc56c23293a9e3ef548a951574dd31455845 Mon Sep 17 00:00:00 2001 From: Damien Rajon Date: Wed, 21 Jun 2017 15:04:45 +0200 Subject: [PATCH 024/180] Add type definition for async.nexttick --- types/async.nexttick/async.nexttick-test.ts | 11 ++++++++++ types/async.nexttick/index.d.ts | 1 + types/async.nexttick/tsconfig.json | 24 +++++++++++++++++++++ types/async.nexttick/tslint.json | 3 +++ 4 files changed, 39 insertions(+) create mode 100644 types/async.nexttick/async.nexttick-test.ts create mode 100644 types/async.nexttick/index.d.ts create mode 100644 types/async.nexttick/tsconfig.json create mode 100644 types/async.nexttick/tslint.json diff --git a/types/async.nexttick/async.nexttick-test.ts b/types/async.nexttick/async.nexttick-test.ts new file mode 100644 index 0000000000..9d8acb33aa --- /dev/null +++ b/types/async.nexttick/async.nexttick-test.ts @@ -0,0 +1,11 @@ +import nextTick from 'async.nexttick'; + +function calledOnNextTick(a: string): number { + return parseInt(a, 10); +} + +const aString = 'Hi!'; + +nextTick(() => { + calledOnNextTick(aString); +}); diff --git a/types/async.nexttick/index.d.ts b/types/async.nexttick/index.d.ts new file mode 100644 index 0000000000..7db4a43d87 --- /dev/null +++ b/types/async.nexttick/index.d.ts @@ -0,0 +1 @@ +export default function nextTick(callback: () => void, ...args: any[]): void; diff --git a/types/async.nexttick/tsconfig.json b/types/async.nexttick/tsconfig.json new file mode 100644 index 0000000000..7bf5157ec4 --- /dev/null +++ b/types/async.nexttick/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "es6", + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "async.nexttick-test.ts" + ] +} + diff --git a/types/async.nexttick/tslint.json b/types/async.nexttick/tslint.json new file mode 100644 index 0000000000..4c3a548997 --- /dev/null +++ b/types/async.nexttick/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dtslint.json" +} From 1065599f86fa230995c7aa5bb6ac9ae08513dc9b Mon Sep 17 00:00:00 2001 From: David Philipson Date: Wed, 21 Jun 2017 15:10:21 -0700 Subject: [PATCH 025/180] Fix definition of Wrap --- types/transducers-js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/transducers-js/index.d.ts b/types/transducers-js/index.d.ts index 413cfbfef5..66073d1cbc 100644 --- a/types/transducers-js/index.d.ts +++ b/types/transducers-js/index.d.ts @@ -211,7 +211,7 @@ export function completing( cf: (result: TResult) => TCompleteResult): CompletingTransformer; export class Wrap implements Transformer { - constructor(stepFn: Reducer, xf: Transformer); + constructor(stepFn: Reducer); ['@@transducer/init'](): TResult; ['@@transducer/step'](result: TResult, input: TInput): TResult; ['@@transducer/result'](result: TResult): TResult; From 1412dd25249f8c1cb9a0c4c48084060bfc383798 Mon Sep 17 00:00:00 2001 From: Mohsen Azimi Date: Wed, 21 Jun 2017 18:24:35 -0700 Subject: [PATCH 026/180] Export DraftEditorProps --- types/draft-js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/draft-js/index.d.ts b/types/draft-js/index.d.ts index 2474ecf56a..135824039e 100644 --- a/types/draft-js/index.d.ts +++ b/types/draft-js/index.d.ts @@ -54,7 +54,7 @@ declare namespace Draft { * These props are analagous to `value` and `onChange` in controlled React * text inputs. */ - interface DraftEditorProps { + export interface DraftEditorProps { editorState: EditorState; onChange(editorState: EditorState): void; From d4bdb400a0e12b615c4b2bd6d138d4723cf24231 Mon Sep 17 00:00:00 2001 From: David Philipson Date: Wed, 21 Jun 2017 18:27:55 -0700 Subject: [PATCH 027/180] More general Transducer definition --- types/transducers-js/index.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/types/transducers-js/index.d.ts b/types/transducers-js/index.d.ts index 66073d1cbc..83dbbe1573 100644 --- a/types/transducers-js/index.d.ts +++ b/types/transducers-js/index.d.ts @@ -11,7 +11,12 @@ export interface Reduced { export type Reducer = (result: TResult, input: TInput) => TResult; -export type Transducer = (xf: Transformer) => Transformer; +// Common case: Transducer = +// Transformer => Transformer. +export type Transducer = + ( + xf: CompletingTransformer + ) => CompletingTransformer; export interface CompletingTransformer { ['@@transducer/init'](): TResult | void; From cb8b474117833504681c7f72a77598388582ceaf Mon Sep 17 00:00:00 2001 From: Bernd Hacker Date: Thu, 22 Jun 2017 11:52:12 +0200 Subject: [PATCH 028/180] fix type for H.service.ServiceResult --- types/heremaps/index.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/heremaps/index.d.ts b/types/heremaps/index.d.ts index 206a932e68..8218718790 100644 --- a/types/heremaps/index.d.ts +++ b/types/heremaps/index.d.ts @@ -4603,9 +4603,11 @@ declare namespace H { /** * This type encapsulates a response object provider by a HERE platform service. + * In most cases the HERE Maps API for JavaScript communicates with the HERE REST APIs, using the JSON-P protocol. The resulting JSON response is parsed and provided to a callback function. + * The structure of a service response object is specific to each service. */ interface ServiceResult { - [key: string]: string; + [key: string]: any; } /** From 6c2fd39fcde2a3a54a64f6b7ec85817823a106c7 Mon Sep 17 00:00:00 2001 From: mailto1587 Date: Thu, 22 Jun 2017 19:35:03 +0800 Subject: [PATCH 029/180] [hapi] Added test for request.query --- types/hapi/test/request/query.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 types/hapi/test/request/query.ts diff --git a/types/hapi/test/request/query.ts b/types/hapi/test/request/query.ts new file mode 100644 index 0000000000..c6507c2da0 --- /dev/null +++ b/types/hapi/test/request/query.ts @@ -0,0 +1,14 @@ +// Added test in addition to docs, for request.query + +import * as Hapi from 'hapi'; + +interface GetThingQuery { + name: string; +} + +const handler: Hapi.RouteHandler = function (request, reply) { + + const query = request.query as GetThingQuery; + + return reply(`You asked for ${query.name}`); +}; From e86d4cc1269863ef3f8505f119bd689d21f701ea Mon Sep 17 00:00:00 2001 From: Sebastien PUECH Date: Thu, 22 Jun 2017 08:52:51 +0200 Subject: [PATCH 030/180] Fixup for "node" types, fs.createReadStream and fs.createWriteStream functions. --- types/node/index.d.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 952cf98e4d..423fae41f1 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -2497,6 +2497,7 @@ declare module "dgram" { declare module "fs" { import * as stream from "stream"; import * as events from "events"; + import * as url from "url"; interface Stats { isFile(): boolean; @@ -2975,7 +2976,7 @@ declare module "fs" { export function access(path: string | Buffer, mode: number, callback: (err: NodeJS.ErrnoException) => void): void; /** Synchronous version of fs.access. This throws if any accessibility checks fail, and does nothing otherwise. */ export function accessSync(path: string | Buffer, mode?: number): void; - export function createReadStream(path: string | Buffer, options?: { + export function createReadStream(path: string | Buffer | url.URL, options?: string | { flags?: string; encoding?: string; fd?: number; @@ -2984,9 +2985,9 @@ declare module "fs" { start?: number; end?: number; }): ReadStream; - export function createWriteStream(path: string | Buffer, options?: { + export function createWriteStream(path: string | Buffer | url.URL, options?: string | { flags?: string; - encoding?: string; + defaultEncoding?: string; fd?: number; mode?: number; autoClose?: boolean; From 161f65a1939e009ace1c1514fe2bfee234f087be Mon Sep 17 00:00:00 2001 From: mailto1587 Date: Thu, 22 Jun 2017 19:36:04 +0800 Subject: [PATCH 031/180] [hapi] Updated docstring of request.query to the latest docs --- types/hapi/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/hapi/index.d.ts b/types/hapi/index.d.ts index 502b8d4362..c03d6a954b 100644 --- a/types/hapi/index.d.ts +++ b/types/hapi/index.d.ts @@ -1935,8 +1935,9 @@ export class Request extends Podium { /** same as pre but represented as the response object created by the pre method. */ preResponses: Object; /** - * an object containing the query parameters. - * TODO update with outcome of: https://github.com/hapijs/hapi/pull/3479 + * by default the object outputted from [node's URL parse()](https://nodejs.org/docs/latest/api/url.html#url_urlobject_query) method. + * Might also be set indirectly via [request.setUrl](https://github.com/DefinitelyTyped/DefinitelyTyped/pull/17354#requestseturlurl-striptrailingslash) in which case it may be + * a string (if url is set to an object with the query attribute as an unparsed string). */ query: any; /** an object containing the Node HTTP server objects. **Direct interaction with these raw objects is not recommended.** */ From 0c95065c18c63b7354ed2821ddeee2067fe2b9cc Mon Sep 17 00:00:00 2001 From: mailto1587 Date: Thu, 22 Jun 2017 19:40:51 +0800 Subject: [PATCH 032/180] [hapi] Keep the version number of type definition as 16.1 --- types/hapi/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/hapi/index.d.ts b/types/hapi/index.d.ts index c03d6a954b..91432e1d1f 100644 --- a/types/hapi/index.d.ts +++ b/types/hapi/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for hapi 16.2 +// Type definitions for hapi 16.1 // Project: https://github.com/hapijs/hapi // Definitions by: Jason Swearingen , AJP // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 94f1d2c48ea5b459bd23bf1e3e0a160f86756343 Mon Sep 17 00:00:00 2001 From: mailto1587 Date: Thu, 22 Jun 2017 19:43:15 +0800 Subject: [PATCH 033/180] Add the test file for request.query to tsconfig.json --- types/hapi/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/types/hapi/tsconfig.json b/types/hapi/tsconfig.json index 01c5a12c89..39ff8e810c 100644 --- a/types/hapi/tsconfig.json +++ b/types/hapi/tsconfig.json @@ -35,6 +35,7 @@ "test/request/generate-response.ts", "test/request/get-log.ts", "test/request/log.ts", + "test/request/query.ts", "test/request/set-method.ts", "test/request/set-url.ts", "test/request/tail.ts", From 80825332fb797dc4b279f059c0387d0ac348a8e0 Mon Sep 17 00:00:00 2001 From: Bernd Hacker Date: Thu, 22 Jun 2017 14:41:59 +0200 Subject: [PATCH 034/180] fix typings, extend definition of H.service.ServiceResult --- types/heremaps/heremaps-tests.ts | 77 ++++++++++++++- types/heremaps/index.d.ts | 160 ++++++++++++++++++++++++++++--- 2 files changed, 222 insertions(+), 15 deletions(-) diff --git a/types/heremaps/heremaps-tests.ts b/types/heremaps/heremaps-tests.ts index 01360c1bdf..d3e161cb74 100644 --- a/types/heremaps/heremaps-tests.ts +++ b/types/heremaps/heremaps-tests.ts @@ -44,7 +44,7 @@ let map = new H.Map(mapContainer, defaultLayers.normal.map, { // initial center and zoom level of the map zoom: 16, // Champs-Elysees - center: {lat: 48.869145, lng: 2.314298} + center: { lat: 48.869145, lng: 2.314298 } }); // Step 3: make the map interactive @@ -85,3 +85,78 @@ let polyline = new H.map.Polyline(new H.geo.Strip()); // tslint:disable-next-line:array-type let clipArr: Array>; clipArr = polyline.clip(new H.geo.Rect(5, 5, 5, 5)); + +let router = platform.getRoutingService(); +let calculateRouteParams = { + waypoint0: 'geo!52.5,13.4', + waypoint1: 'geo!52.5,13.45', + mode: 'fastest;car;traffic:disabled' +}; +router.calculateRoute( + calculateRouteParams, + (result) => { + console.log(result.response.route[0]); + }, + (error) => { + console.log(error); + } +); + +let places = platform.getPlacesService(); +let entryPoint = H.service.PlacesService.EntryPoint; +places.request( + entryPoint.SEARCH, + { + at: '52.5044,13.3909', + q: 'pizza' + }, + (response) => { + console.log(response); + let items = response.results.items; + places.follow( + items[0].href, + (resp) => { + console.log(resp); + }, + (resp) => { + console.log('ERROR: ' + resp); + } + ); + }, + (error) => { + console.log('ERROR: ' + error); + } +); + +let geocoder = platform.getGeocodingService(); +let geocodingParams: H.service.ServiceParameters = { + searchText: '425 W Randolph Street, Chicago' +}; +geocoder.geocode( + geocodingParams, + (result) => { + console.log(result); + console.log(result.Response.View[0].Result[0].Location.DisplayPosition); + }, + (error) => { + console.log(error); + } +); + +// deprecated but w/e +let enterprieseRouter = platform.getEnterpriseRoutingService(); +let calculateIsoline: H.service.ServiceParameters = { + start: 'geo!52.5,13.4', + distance: '1000,2000', + mode: 'fastest;car;traffic:disabled' +}; +enterprieseRouter.calculateIsoline( + calculateIsoline, + (result) => { + console.log(result); + console.log(result.Response.isolines[0]); + }, + (error) => { + console.log(error); + } +); diff --git a/types/heremaps/index.d.ts b/types/heremaps/index.d.ts index 8218718790..ca32173bed 100644 --- a/types/heremaps/index.d.ts +++ b/types/heremaps/index.d.ts @@ -4301,14 +4301,15 @@ declare namespace H { /** * This is generic method to query places RestAPI. - * @param entryPoint {string} - can be one of available entry points H.service.PlacesService.EntryPoint i.e value of H.service.PlacesService.EntryPoint.SEARCH + * @param entryPoint {H.service.PlacesService.EntryPoint} - can be one of available entry points H.service.PlacesService.EntryPoint i.e value of H.service.PlacesService.EntryPoint.SEARCH * @param entryPointParams {Object} - parameter map key value pairs will be transformed into the url key=value parametes. For entry point parameters description please refer to places * restful api documentation documentation for available parameters for chose entry point * @param onResult {Function} - callback which is called when result is returned * @param onError {Function} - callback which is called when error occured (i.e request timeout) * @returns {H.service.JsonpRequestHandle} - jsonp request handle */ - request(entryPoint: string, entryPointParams: {}, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle; + request(entryPoint: H.service.PlacesService.EntryPoint, entryPointParams: {}, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): + H.service.JsonpRequestHandle; /** * Function triggers places api 'search' entry point. Please refer to documentation for parameter specification and response handling. @@ -4317,7 +4318,7 @@ declare namespace H { * @param onError {Function} * @returns {H.service.JsonpRequestHandle} - jsonp request handle */ - search(searchParams: H.service.ServiceParameters, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle; + search(searchParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): H.service.JsonpRequestHandle; /** * Function triggers places api 'suggestions' entry point. Please refer to documentation for parameter specification and response handling. @@ -4326,7 +4327,7 @@ declare namespace H { * @param onError {Function} * @returns {H.service.JsonpRequestHandle} - jsonp request handle */ - suggest(suggestParams: H.service.ServiceParameters, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle; + suggest(suggestParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): H.service.JsonpRequestHandle; /** * Function triggers places api 'explore' entry point. Please refer to documentation for parameter specification and response handling. @@ -4335,7 +4336,7 @@ declare namespace H { * @param onError {Function} * @returns {H.service.JsonpRequestHandle} - jsonp request handle */ - explore(exploreParams: H.service.ServiceParameters, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle; + explore(exploreParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): H.service.JsonpRequestHandle; /** * Function triggers places api 'around' entry point. Please refer to documentation for parameter specification and response handling. @@ -4344,7 +4345,7 @@ declare namespace H { * @param onError {Function} * @returns {H.service.JsonpRequestHandle} - jsonp request handle */ - around(aroundParams: H.service.ServiceParameters, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle; + around(aroundParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): H.service.JsonpRequestHandle; /** * Function triggers places api 'here' entry point. Please refer to documentation for parameter specification and response handling. @@ -4353,7 +4354,7 @@ declare namespace H { * @param onError {Function} * @returns {H.service.JsonpRequestHandle} - jsonp request handle */ - here(hereParams: H.service.ServiceParameters, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle; + here(hereParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): H.service.JsonpRequestHandle; /** * Function triggers places api 'categories' entry point. Please refer to documentation for parameter specification and response handling. @@ -4362,7 +4363,7 @@ declare namespace H { * @param onError {Function} * @returns {H.service.JsonpRequestHandle} - jsonp request handle */ - categories(categoriesParams: H.service.ServiceParameters, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle; + categories(categoriesParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): H.service.JsonpRequestHandle; /** * This method should be used to follow hyperlinks available in results returned by dicovery queries. @@ -4372,7 +4373,7 @@ declare namespace H { * @param opt_additionalParameters {Object=} - additional parameters to send with request * @returns {H.service.JsonpRequestHandle} - jsonp resquest handle */ - follow(hyperlink: string, onResult: () => void, onError: () => void, opt_additionalParameters?: {}): H.service.JsonpRequestHandle; + follow(hyperlink: string, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void, opt_additionalParameters?: {}): H.service.JsonpRequestHandle; } namespace PlacesService { @@ -4603,11 +4604,142 @@ declare namespace H { /** * This type encapsulates a response object provider by a HERE platform service. - * In most cases the HERE Maps API for JavaScript communicates with the HERE REST APIs, using the JSON-P protocol. The resulting JSON response is parsed and provided to a callback function. - * The structure of a service response object is specific to each service. */ interface ServiceResult { [key: string]: any; + response?: { + language?: string, + route?: Array<{ + leg: Array<{ + maneuver: Array<{ + id: string, + instruction: string, + length: number, + note: string[], + position: { + latitude: number, + longitude: number + }, + shape: string[], + travelTime: number, + _type: string + }> + }>, + mode: { + feature: any[], + trafficMode: string, + transportModes: string[], + type: string + } + shape: string[], + summary: { + baseTime: number, + distance: number, + flags: string[], + text: string, + trafficTime: number, + travelTime: number + } + waypoint: Array<{ + label: string, + linkId: string, + mappedPosition: { + latitude: number, + longitude: number + }, + mappedRoadName: string, + originalPosition: { + latitude: number, + longitude: number + }, + shapeIndex: number, + sideOfStreet: string, + spot: number, + type: string + }> + }>, + metaInfo: {} + }; + results?: { + items?: any[], + next?: string + }; + search?: { + context: { + href: string, + location: { + address: { + city: string, + country: string, + countryCode: string, + county: string, + district: string, + house: string, + postalCode: string, + stateCode: string, + street: string, + text: string + }, + position: number[] + }, + type: string + } + }; + Response?: { + MetaInfo: { + Timestamp: string + }, + View: Array<{ + Result: Array<{ + Location: { + Address: { + AdditionalData: Array<{ + key: string, + value: string + }>, + City: string, + Country: string, + County: string, + District: string, + HouseNumber: string, + Label: string, + PostalCode: string, + State: string, + Street: string + }, + DisplayPosition: { + Latitude: number, + Longitude: number + }, + LocationId: string, + LocationType: string, + MapView: { + BottomRight: { + Latitude: number, + Longitude: number + }, + TopLeft: { + Latitude: number, + Longitude: number + } + }, + NavigationPosition: Array<{ + Latitude: number, + Longitude: number + }> + }, + MatchLevel: string, + MatchQuality: { + City: number, + HouseNumber: number, + Street: number[] + }, + MatchType: string, + Relevance: number + }> + }>, + isolines: any[] + }; } /** @@ -4636,7 +4768,7 @@ declare namespace H { * @param onError {function()} * @returns {H.service.JsonpRequestHandle} */ - requestIncidents(serviceParams: H.service.ServiceParameters, onResponse: (result: H.service.ServiceResult) => void, onError: () => void): H.service.JsonpRequestHandle; + requestIncidents(serviceParams: H.service.ServiceParameters, onResponse: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): H.service.JsonpRequestHandle; /** * This method requests traffic incident information by tile coordinates @@ -4648,8 +4780,8 @@ declare namespace H { * @param opt_serviceParams {H.service.ServiceParameters=} - optional service parameters to be added to the request * @returns {H.service.JsonpRequestHandle} */ - requestIncidentsByTile(x: number, y: number, z: number, onResponse: (result: H.service.ServiceResult) => void, onError: () => void, opt_serviceParams?: H.service.ServiceParameters): - H.service.JsonpRequestHandle; + requestIncidentsByTile(x: number, y: number, z: number, onResponse: (result: H.service.ServiceResult) => void, onError: (error: Error) => void, + opt_serviceParams?: H.service.ServiceParameters): H.service.JsonpRequestHandle; } namespace TrafficIncidentsService { From 825083d238d7dc3ec72251960c74dfa70b6f08d5 Mon Sep 17 00:00:00 2001 From: Sebastien PUECH Date: Thu, 22 Jun 2017 16:57:50 +0200 Subject: [PATCH 035/180] Fixed the bind method for UDP. --- types/node/index.d.ts | 2 ++ types/node/node-tests.ts | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 423fae41f1..f1fbefbd0a 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -2437,6 +2437,8 @@ declare module "dgram" { send(msg: Buffer | String | any[], port: number, address: string, callback?: (error: Error, bytes: number) => void): void; send(msg: Buffer | String | any[], offset: number, length: number, port: number, address: string, callback?: (error: Error, bytes: number) => void): void; bind(port?: number, address?: string, callback?: () => void): void; + bind(port?: number, callback?: () => void): void; + bind(callback?: () => void): void; bind(options: BindOptions, callback?: Function): void; close(callback?: () => void): void; address(): AddressInfo; diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index aeefc2bbdc..3bb2ddcc69 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -1045,6 +1045,10 @@ namespace dgram_tests { }); ds.bind(); ds.bind(41234); + ds.bind(4123, 'localhost'); + ds.bind(4123, 'localhost', () => {}); + ds.bind(4123, () => {}); + ds.bind(() => {}); var ai: dgram.AddressInfo = ds.address(); ds.send(new Buffer("hello"), 0, 5, 5000, "127.0.0.1", (error: Error, bytes: number): void => { }); From 624cf76cb21d541e45a40592638c46c35da6138c Mon Sep 17 00:00:00 2001 From: cwmoo740 Date: Thu, 22 Jun 2017 11:20:42 -0400 Subject: [PATCH 036/180] google-map-react update BootstrapURLKeys add support for client identifier and version instead of api key --- types/google-map-react/google-map-react-tests.tsx | 7 +++++-- types/google-map-react/index.d.ts | 5 +---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/types/google-map-react/google-map-react-tests.tsx b/types/google-map-react/google-map-react-tests.tsx index 959bb8e68a..c01d1e3cab 100644 --- a/types/google-map-react/google-map-react-tests.tsx +++ b/types/google-map-react/google-map-react-tests.tsx @@ -1,6 +1,9 @@ -import GoogleMapReact from 'google-map-react'; +import GoogleMapReact, { BootstrapURLKeys } from 'google-map-react'; import * as React from 'react'; const center = { lat: 0, lng: 0 }; -; +const key: BootstrapURLKeys = { key: 'my-google-maps-key' }; +const client: BootstrapURLKeys = { client: 'my-client-identifier', v: '3.28' , language: 'en' }; + +; diff --git a/types/google-map-react/index.d.ts b/types/google-map-react/index.d.ts index 080dbe5762..812a14d04a 100644 --- a/types/google-map-react/index.d.ts +++ b/types/google-map-react/index.d.ts @@ -6,10 +6,7 @@ import * as React from 'react'; -export interface BootstrapURLKeys { - key: string; - language?: string; -} +export type BootstrapURLKeys = ({ key: string; } | { client: string; v: string; }) & { language?: string }; export interface Options { styles?: any[]; From 114d42bcdb4c79fed85e7d87988ba0b219c85825 Mon Sep 17 00:00:00 2001 From: Roberts Slisans Date: Thu, 22 Jun 2017 19:53:01 +0300 Subject: [PATCH 037/180] Created type definition & wrote test case --- types/mongoose-simple-random/index.d.ts | 12 ++++++++++ .../mongoose-simple-random-tests.ts | 15 +++++++++++++ types/mongoose-simple-random/tsconfig.json | 22 +++++++++++++++++++ types/mongoose-simple-random/tslint.json | 1 + 4 files changed, 50 insertions(+) create mode 100644 types/mongoose-simple-random/index.d.ts create mode 100644 types/mongoose-simple-random/mongoose-simple-random-tests.ts create mode 100644 types/mongoose-simple-random/tsconfig.json create mode 100644 types/mongoose-simple-random/tslint.json diff --git a/types/mongoose-simple-random/index.d.ts b/types/mongoose-simple-random/index.d.ts new file mode 100644 index 0000000000..deed6a036f --- /dev/null +++ b/types/mongoose-simple-random/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for mongoose-simple-random 0.4 +// Project: https://github.com/larryprice/mongoose-simple-random +// Definitions by: My Self +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + +declare module "mongoose" { + interface Model extends NodeJS.EventEmitter, ModelProperties { + findRandom(conditions: Object, projection?: Object | null, options?: Object | null, callback?: (err: any, res: T[]) => void) + : void; + } +} diff --git a/types/mongoose-simple-random/mongoose-simple-random-tests.ts b/types/mongoose-simple-random/mongoose-simple-random-tests.ts new file mode 100644 index 0000000000..2aa9e18296 --- /dev/null +++ b/types/mongoose-simple-random/mongoose-simple-random-tests.ts @@ -0,0 +1,15 @@ +import * as mongoose from 'mongoose'; + +// test compatibility with other libraries - from @types/mongoose +import * as _ from 'lodash'; +import * as fs from "fs"; + +mongoose.Model.findRandom({ + username: { $ne: "DummyUser" }, + rating: { + $gt: 1, + $lt: 11, + }, +}, {}, { limit: 1 }, (error, data) => { + if (error) { console.error("Error!"); } else { console.log("Success!"); } +}); diff --git a/types/mongoose-simple-random/tsconfig.json b/types/mongoose-simple-random/tsconfig.json new file mode 100644 index 0000000000..28627f97dd --- /dev/null +++ b/types/mongoose-simple-random/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "mongoose-simple-random-tests.ts" + ] +} diff --git a/types/mongoose-simple-random/tslint.json b/types/mongoose-simple-random/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/mongoose-simple-random/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 247d2506e083afe4ff89d41f412099b9617940c2 Mon Sep 17 00:00:00 2001 From: Sam Beran Date: Thu, 22 Jun 2017 11:29:24 -0500 Subject: [PATCH 038/180] Websocket: Use correct type for incoming message --- types/websocket/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/websocket/index.d.ts b/types/websocket/index.d.ts index 83d127c599..3b41a5f6da 100644 --- a/types/websocket/index.d.ts +++ b/types/websocket/index.d.ts @@ -181,7 +181,7 @@ export interface IExtension { export declare class request extends events.EventEmitter { /** A reference to the original Node HTTP request object */ - httpRequest: http.ClientRequest; + httpRequest: http.IncomingMessage; /** This will include the port number if a non-standard port is used */ host: string; /** A string containing the path that was requested by the client */ @@ -222,7 +222,7 @@ export declare class request extends events.EventEmitter { requestedProtocols: string[]; protocolFullCaseMap: { [key: string]: string }; - constructor(socket: net.Socket, httpRequest: http.ClientRequest, config: IServerConfig); + constructor(socket: net.Socket, httpRequest: http.IncomingMessage, config: IServerConfig); /** * After inspecting the `request` properties, call this function on the @@ -580,7 +580,7 @@ declare class client extends events.EventEmitter { declare class routerRequest extends events.EventEmitter { /** A reference to the original Node HTTP request object */ - httpRequest: http.ClientRequest; + httpRequest: http.IncomingMessage; /** A string containing the path that was requested by the client */ resource: string; /** Parsed resource, including the query string parameters */ From 8d0889c41a952b0beda53639843fedbd023b8ebb Mon Sep 17 00:00:00 2001 From: Roberts Slisans Date: Thu, 22 Jun 2017 20:24:22 +0300 Subject: [PATCH 039/180] Excluded Object from banned types (as in mongoose) --- types/mongoose-simple-random/tslint.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/types/mongoose-simple-random/tslint.json b/types/mongoose-simple-random/tslint.json index 3db14f85ea..8438350251 100644 --- a/types/mongoose-simple-random/tslint.json +++ b/types/mongoose-simple-random/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // This package uses the Function type, and it will take effort to fix. + "ban-types": false + } +} \ No newline at end of file From 96306a10b197753817c9dc13ac3a297f5a48d9c6 Mon Sep 17 00:00:00 2001 From: Eli Young Date: Mon, 5 Jun 2017 21:52:32 -0700 Subject: [PATCH 040/180] [convict] Support convict@4 --- types/convict/convict-tests.ts | 8 +++++++- types/convict/index.d.ts | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/types/convict/convict-tests.ts b/types/convict/convict-tests.ts index 3bc0b4565f..e8bc53fdcd 100644 --- a/types/convict/convict-tests.ts +++ b/types/convict/convict-tests.ts @@ -81,7 +81,13 @@ var conf = convict({ default: 0, env: 'PORT', arg: 'port', - } + }, + password: { + doc: 'The database password.', + default: 'secret', + format: String, + sensitive: true, + }, }, primeNumber: { format: 'prime', diff --git a/types/convict/index.d.ts b/types/convict/index.d.ts index 82b22ba2db..e07397aa76 100644 --- a/types/convict/index.d.ts +++ b/types/convict/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for convict 3.0 +// Type definitions for convict 4.0 // Project: https://github.com/mozilla/node-convict // Definitions by: Wim Looman , Vesa Poikajärvi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -45,6 +45,7 @@ declare namespace convict { format?: string | Array | Function; env?: string; arg?: string; + sensitive?: boolean; }; } From c2ada0503c3ce393d666db30f98a96ccf4c0b648 Mon Sep 17 00:00:00 2001 From: Eli Young Date: Mon, 5 Jun 2017 21:53:08 -0700 Subject: [PATCH 041/180] [convict] Clean up type definitions and tests --- types/convict/convict-tests.ts | 37 +++++++++++++++------------------- types/convict/index.d.ts | 29 +++++++++++--------------- types/convict/tslint.json | 7 +++++++ 3 files changed, 35 insertions(+), 38 deletions(-) create mode 100644 types/convict/tslint.json diff --git a/types/convict/convict-tests.ts b/types/convict/convict-tests.ts index e8bc53fdcd..83c9b03c8f 100644 --- a/types/convict/convict-tests.ts +++ b/types/convict/convict-tests.ts @@ -1,48 +1,41 @@ - -/// - import convict = require('convict'); import validator = require('validator'); // define a schema // straight from the convict tests -const format : convict.Format = { +const format: convict.Format = { name: 'float-percent', - validate: function(val) { + validate(val) { if (val !== 0 && (!val || val > 1 || val < 0)) { throw new Error('must be a float between 0 and 1, inclusive'); } }, - coerce: function(val) { - return +( val); + coerce(val) { + return parseFloat(val); } }; - - - convict.addFormat(format); convict.addFormats({ prime: { - validate: function(val) { + validate(val) { function isPrime(n: number) { if (n <= 1) return false; // zero and one are not prime - for (var i=2; i*i <= n; i++) { + for (let i = 2; i * i <= n; i++) { if (n % i === 0) return false; } return true; } if (!isPrime(val)) throw new Error('must be a prime number'); }, - coerce: function(val) { + coerce(val) { return parseInt(val, 10); } } }); - -var conf = convict({ +let conf = convict({ env: { doc: 'The applicaton environment.', format: ['production', 'development', 'test'], @@ -65,7 +58,11 @@ var conf = convict({ }, key: { doc: "API key", - format: (val: string) => validator.isUUID(val), + format: (val: string) => { + if (!validator.isUUID(val)) { + throw new Error('must be a valid UUID'); + } + }, default: '01527E56-8431-11E4-AF91-47B661C210CA' }, db: { @@ -97,14 +94,12 @@ var conf = convict({ format: 'float-percent', default: 0.5 }, - }); - // load environment dependent configuration -var env = conf.get('env'); -var dbip = conf.get('db.ip'); +let env = conf.get('env'); +let dbip = conf.get('db.ip'); conf.loadFile('./config/' + env + '.json'); conf.loadFile(['./configs/always.json', './configs/sometimes.json']); @@ -124,7 +119,7 @@ conf .validate({ allowed: 'warn' }) .toString(); -var port: number = conf.default('port'); +let port: number = conf.default('port'); if (conf.has('key')) { conf.set('the.awesome', true); diff --git a/types/convict/index.d.ts b/types/convict/index.d.ts index e07397aa76..183d91ed91 100644 --- a/types/convict/index.d.ts +++ b/types/convict/index.d.ts @@ -1,11 +1,11 @@ // Type definitions for convict 4.0 // Project: https://github.com/mozilla/node-convict -// Definitions by: Wim Looman , Vesa Poikajärvi +// Definitions by: Wim Looman +// Vesa Poikajärvi +// Eli Young // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - declare namespace convict { - type ValidationMethod = 'strict' | 'warn'; interface ValidateOptions { @@ -23,8 +23,8 @@ declare namespace convict { interface Format { name?: string; - validate?: (val: any) => void; - coerce?: (val: any) => any; + validate?(val: any): void; + coerce?(val: any): any; } interface Schema { @@ -35,14 +35,15 @@ declare namespace convict { * From the implementation: * * format can be a: - * - predefine type, as seen below + * - predefined type, as seen below * - an array of enumerated values, e.g. ["production", "development", "testing"] * - built-in JavaScript type, i.e. Object, Array, String, Number, Boolean - * - or if omitted, the Object.prototype.toString.call of the default value + * - function that performs validation and throws an Error on failure * - * The docs also state that any function that validates is ok too + * If omitted, format will be set to the value of Object.prototype.toString.call + * for the default value */ - format?: string | Array | Function; + format?: string | any[] | ((val: any) => void); env?: string; arg?: string; sensitive?: boolean; @@ -79,17 +80,11 @@ declare namespace convict { */ load(conf: Object): Config; /** - * Loads and merges one JSON configuration file into config + * Loads and merges JSON configuration file(s) into config * * @return {Config} instance */ - loadFile(file: string): Config; - /** - * Loads and merges multiple JSON configuration files into config - * - * @return {Config} instance - */ - loadFile(files: string[]): Config; + loadFile(files: string | string[]): Config; /** * Validates config against the schema used to initialize it * diff --git a/types/convict/tslint.json b/types/convict/tslint.json new file mode 100644 index 0000000000..09f94cd344 --- /dev/null +++ b/types/convict/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + // ban-types needs to be disabled to support TypeScript <2.2 + "ban-types": false + } +} From c564afbcc657b17e7756fcb852aa76f1e45daa02 Mon Sep 17 00:00:00 2001 From: Eli Young Date: Mon, 5 Jun 2017 21:59:21 -0700 Subject: [PATCH 042/180] [convict] Reformat tests --- types/convict/convict-tests.ts | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/types/convict/convict-tests.ts b/types/convict/convict-tests.ts index 83c9b03c8f..daa07c6875 100644 --- a/types/convict/convict-tests.ts +++ b/types/convict/convict-tests.ts @@ -18,22 +18,22 @@ const format: convict.Format = { convict.addFormat(format); convict.addFormats({ - prime: { - validate(val) { - function isPrime(n: number) { - if (n <= 1) return false; // zero and one are not prime - for (let i = 2; i * i <= n; i++) { - if (n % i === 0) return false; - } - return true; - } - if (!isPrime(val)) throw new Error('must be a prime number'); - }, - coerce(val) { - return parseInt(val, 10); + prime: { + validate(val) { + function isPrime(n: number) { + if (n <= 1) return false; // zero and one are not prime + for (let i = 2; i * i <= n; i++) { + if (n % i === 0) return false; } + return true; } - }); + if (!isPrime(val)) throw new Error('must be a prime number'); + }, + coerce(val) { + return parseInt(val, 10); + } + } +}); let conf = convict({ env: { From 0837fea9eb5a2c65c35a3be137a8860083d07116 Mon Sep 17 00:00:00 2001 From: Marcin Dobosz Date: Thu, 22 Jun 2017 16:33:50 -0700 Subject: [PATCH 043/180] Add optional message param to sinon.match overload that takes a callback --- types/sinon/index.d.ts | 2 +- types/sinon/sinon-tests.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/types/sinon/index.d.ts b/types/sinon/index.d.ts index a48df85258..75e87baae1 100644 --- a/types/sinon/index.d.ts +++ b/types/sinon/index.d.ts @@ -421,7 +421,7 @@ declare namespace Sinon { (value: string): SinonMatcher; (expr: RegExp): SinonMatcher; (obj: any): SinonMatcher; - (callback: (value: any) => boolean): SinonMatcher; + (callback: (value: any) => boolean, message?: string): SinonMatcher; any: SinonMatcher; defined: SinonMatcher; truthy: SinonMatcher; diff --git a/types/sinon/sinon-tests.ts b/types/sinon/sinon-tests.ts index 9184ec6808..406c790a2b 100644 --- a/types/sinon/sinon-tests.ts +++ b/types/sinon/sinon-tests.ts @@ -119,6 +119,14 @@ function testPromises() { rejectsStub2 = sinon.stub().rejects("TypeError"); } +function testMatchInvoke() { + let stub = sinon.stub(); + stub(123); + stub.calledWithMatch(sinon.match(123)); + stub.calledWithMatch(sinon.match((value: any) => value === 123)); + stub.calledWithMatch(sinon.match((value: any) => value === 123, "Must be 123")); +} + function testSymbolMatch() { let stub = sinon.stub(); stub(Symbol('TestSymbol')); From 5f329049a0e3cd3f84bc9818c4dd2661777967b7 Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Thu, 22 Jun 2017 16:51:57 -0700 Subject: [PATCH 044/180] Fix breaking change from co-vairant parameter call back --- types/recompose/recompose-tests.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/recompose/recompose-tests.tsx b/types/recompose/recompose-tests.tsx index a698de6ffa..0baef3db4d 100644 --- a/types/recompose/recompose-tests.tsx +++ b/types/recompose/recompose-tests.tsx @@ -1,5 +1,6 @@ import * as React from "react"; import { + ComponentEnhancer, Component, // Higher-order components mapProps, withProps, withPropsOnChange, withHandlers, @@ -69,13 +70,13 @@ function testWithHandlers() { const innerComponent = ({onChange, onSubmit}: InnerProps) =>

; - const enhancer = withHandlers({ + const enhancer = withHandlers({ onChange: (props: OutterProps) => (e: any) => {}, onSubmit: (props: OutterProps) => (e: any) => {}, }); const enhanced: React.ComponentClass = enhancer(innerComponent); - const enhancer2 = withHandlers((props: OutterProps) => ({ + const enhancer2 = withHandlers((props: OutterProps) => ({ onChange: (props: OutterProps) => (e: any) => {}, onSubmit: (props: OutterProps) => (e: any) => {}, })); From 2bdb5749a20abdfee2894f8b3461ecab4645adac Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Thu, 22 Jun 2017 16:52:50 -0700 Subject: [PATCH 045/180] Remove unuse import --- types/recompose/recompose-tests.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/types/recompose/recompose-tests.tsx b/types/recompose/recompose-tests.tsx index 0baef3db4d..a8bf57ee74 100644 --- a/types/recompose/recompose-tests.tsx +++ b/types/recompose/recompose-tests.tsx @@ -1,6 +1,5 @@ import * as React from "react"; import { - ComponentEnhancer, Component, // Higher-order components mapProps, withProps, withPropsOnChange, withHandlers, From 45f22ec21e3b253c3264e2f28c8bf33a36a104bb Mon Sep 17 00:00:00 2001 From: David Philipson Date: Thu, 22 Jun 2017 18:05:21 -0700 Subject: [PATCH 046/180] Improve complement definition --- types/transducers-js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/transducers-js/index.d.ts b/types/transducers-js/index.d.ts index 83dbbe1573..96fce6f671 100644 --- a/types/transducers-js/index.d.ts +++ b/types/transducers-js/index.d.ts @@ -47,7 +47,7 @@ export function comp(...args: Array<(x: any) => any>): (x: any) => any; /** * Take a predicate function and return its complement. */ -export function complement(f: Function): Function; +export function complement(f: (x: T) => boolean): (x: T) => boolean; /** * Identity function. From 3c34fad19420946701afa98b71a228f3e26ffd26 Mon Sep 17 00:00:00 2001 From: codemannz Date: Fri, 23 Jun 2017 13:31:50 +1200 Subject: [PATCH 047/180] Updated Application to include root region --- types/backbone.marionette/index.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/types/backbone.marionette/index.d.ts b/types/backbone.marionette/index.d.ts index 8b3d338293..d8ced49217 100644 --- a/types/backbone.marionette/index.d.ts +++ b/types/backbone.marionette/index.d.ts @@ -1265,17 +1265,17 @@ declare namespace Marionette { */ start(options?: any): void; - /** Deprecated! nstead of using the Application as the root of your view tree, you should use a Layout View.*/ - addRegions(regions: any): any; + /** Root region of the application*/ + region: string; - /** Deprecated! nstead of using the Application as the root of your view tree, you should use a Layout View.*/ - emptyRegions(): void; + /** Get the root region */ + getRegion(): Region; - /** Deprecated! nstead of using the Application as the root of your view tree, you should use a Layout View.*/ - removeRegion(region: Region): void; + /** Show a view in the root region */ + showView(view: any): void; - /** Deprecated! nstead of using the Application as the root of your view tree, you should use a Layout View.*/ - getRegion(regionName: string): Region; + /** Get the view from the root region*/ + getView(): any; module(moduleNames: any, moduleDefinition: any): Module; From 468858a1f209f9d201ab14b988784a445c56690f Mon Sep 17 00:00:00 2001 From: Marcus Noble Date: Fri, 23 Jun 2017 11:44:07 +0100 Subject: [PATCH 048/180] Added ping method to MySQL IConnection --- types/mysql/index.d.ts | 2 ++ types/mysql/mysql-tests.ts | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/types/mysql/index.d.ts b/types/mysql/index.d.ts index 9212d59ef6..d98ef82216 100644 --- a/types/mysql/index.d.ts +++ b/types/mysql/index.d.ts @@ -58,6 +58,8 @@ interface IConnection { end(callback: (err: IError, ...args: any[]) => void): void; end(options: any, callback: (err: IError, ...args: any[]) => void): void; + ping(callback: (err: IError) => void): void; + destroy(): void; pause(): void; diff --git a/types/mysql/mysql-tests.ts b/types/mysql/mysql-tests.ts index a6d9afc07e..d2c44e21ee 100644 --- a/types/mysql/mysql-tests.ts +++ b/types/mysql/mysql-tests.ts @@ -148,6 +148,11 @@ connection.connect(function (err) { console.log('connected as id ' + connection.threadId); }); +connection.ping(function (err) { + if (err) throw err; + console.log('Ping was successful'); +}) + /// Pools var poolConfig = { From ae4c64b79ddc3acab27c88ea818151cf15f9fa64 Mon Sep 17 00:00:00 2001 From: Sergey Tregub Date: Fri, 23 Jun 2017 14:18:28 +0300 Subject: [PATCH 049/180] bsClass attribute missing for some components --- types/react-bootstrap/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/react-bootstrap/index.d.ts b/types/react-bootstrap/index.d.ts index 3030e7d6a5..a696c4ac6d 100644 --- a/types/react-bootstrap/index.d.ts +++ b/types/react-bootstrap/index.d.ts @@ -847,6 +847,7 @@ declare namespace ReactBootstrap { // interface BadgeProps extends React.HTMLProps { + bsClass?: string; pullRight?: boolean; } type Badge = React.ClassicComponent; @@ -908,6 +909,7 @@ declare namespace ReactBootstrap { responsive?: boolean; striped?: boolean; fill?: boolean; + bsClass?: string; } type Table = React.ClassicComponent; var Table: React.ClassicComponentClass; From 94b781d6ae6d4b668030641ee506983a6ef90b43 Mon Sep 17 00:00:00 2001 From: Mahdi Abedi Date: Fri, 23 Jun 2017 18:25:45 +0430 Subject: [PATCH 050/180] add parameter for RTL --- types/jquery.fancytree/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/jquery.fancytree/index.d.ts b/types/jquery.fancytree/index.d.ts index e2c79b0341..cea0b4c8e4 100644 --- a/types/jquery.fancytree/index.d.ts +++ b/types/jquery.fancytree/index.d.ts @@ -721,6 +721,8 @@ declare namespace Fancytree { restore?(event: JQueryEventObject, data: EventData): void; /** `data.node` was selected */ select?(event: JQueryEventObject, data: EventData): void; + /** Enable RTL version, default is false */ + rtl?: boolean; } interface FancytreeOptions extends FancytreeEvents { From d4a36a80865d85d8455626faa22a2f151e92203d Mon Sep 17 00:00:00 2001 From: Mahdi Abedi Date: Fri, 23 Jun 2017 18:32:17 +0430 Subject: [PATCH 051/180] add contributor name --- types/jquery.fancytree/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/jquery.fancytree/index.d.ts b/types/jquery.fancytree/index.d.ts index cea0b4c8e4..f4e6ac7be8 100644 --- a/types/jquery.fancytree/index.d.ts +++ b/types/jquery.fancytree/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for jquery.fancytree 2.7.0 // Project: https://github.com/mar10/fancytree // Definitions by: Peter Palotas +// Mahdi Abedi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From e5c7b40a2ba986ead460d7684c8fc95bcd7f3223 Mon Sep 17 00:00:00 2001 From: Bob Buehler Date: Fri, 23 Jun 2017 11:33:26 -0500 Subject: [PATCH 052/180] Restricting types for route-parser. --- types/route-parser/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/route-parser/index.d.ts b/types/route-parser/index.d.ts index 2f5dd84e8d..f7b013447c 100644 --- a/types/route-parser/index.d.ts +++ b/types/route-parser/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for route-parser 0.0 +// Type definitions for route-parser 0.1 // Project: https://github.com/rcs/route-parser -// Definitions by: Ian Ker-Seymer +// Definitions by: Ian Ker-Seymer , Bob Buehler // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare class Route { @@ -23,7 +23,7 @@ declare class Route { * var route = new Route('/:one/:two') * route.match('/foo/bar/') // -> {one: 'foo', two: 'bar'} */ - match(pathname: string): { [i: string]: string } | boolean; + match(pathname: string): { [i: string]: string } | false; /** * Reverse a route specification to a path, returning false if it can't be @@ -32,7 +32,7 @@ declare class Route { * var route = new Route('/:one/:two') * route.reverse({one: 'foo', two: 'bar'}) -> '/foo/bar' */ - reverse(params: { [i: string]: any } ): string | boolean; + reverse(params: { [i: string]: any } ): string | false; } declare namespace Route {} From b0a675ccaad2cd33d5f08c5deebe07abaa4603f5 Mon Sep 17 00:00:00 2001 From: John J Czaplewski Date: Fri, 23 Jun 2017 12:04:17 -0500 Subject: [PATCH 053/180] Add maxTileCacheSize --- types/mapbox-gl/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/mapbox-gl/index.d.ts b/types/mapbox-gl/index.d.ts index 9438bfafac..46b5cd7d90 100644 --- a/types/mapbox-gl/index.d.ts +++ b/types/mapbox-gl/index.d.ts @@ -254,6 +254,9 @@ declare namespace mapboxgl { /** Initial zoom level */ zoom?: number; + + /** Maximum tile cache size for each layer. */ + maxTileCacheSize?: number; } export interface PaddingOptions { From 4ba0506fb710ac58cd141cd3e896d7ea287ea489 Mon Sep 17 00:00:00 2001 From: John J Czaplewski Date: Fri, 23 Jun 2017 12:08:09 -0500 Subject: [PATCH 054/180] Bump version number --- types/mapbox-gl/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mapbox-gl/index.d.ts b/types/mapbox-gl/index.d.ts index 46b5cd7d90..18ee4bbf1a 100644 --- a/types/mapbox-gl/index.d.ts +++ b/types/mapbox-gl/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Mapbox GL JS v0.38.0 +// Type definitions for Mapbox GL JS v0.39.0 // Project: https://github.com/mapbox/mapbox-gl-js // Definitions by: Dominik Bruderer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 9847777efecb8d7969aa1c1b55eda67aab0ffef2 Mon Sep 17 00:00:00 2001 From: Yui T Date: Fri, 23 Jun 2017 10:42:53 -0700 Subject: [PATCH 055/180] Remove void from type argument of React.Component since it is already has default type parameters --- types/react-router-native/index.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/types/react-router-native/index.d.ts b/types/react-router-native/index.d.ts index 214e81b0d3..453d9b122a 100644 --- a/types/react-router-native/index.d.ts +++ b/types/react-router-native/index.d.ts @@ -23,25 +23,25 @@ import * as React from 'react'; import * as H from 'history'; export interface AndroidBackButtonProps { - children: Array>; + children: Array; } -export class AndroidBackButton extends React.Component {} +export class AndroidBackButton extends React.Component {} -export class DeepLinking extends React.Component<{}, {}> {} +export class DeepLinking extends React.Component {} export interface LinkProps { - component?: React.Component; + component?: React.Component; replace?: boolean; style?: any; to: H.LocationDescriptor; } -export class Link extends React.Component {} +export class Link extends React.Component {} export interface NativeRouterProps { getUserConfirmation?: Function; keyLength?: number; } -export class NativeRouter extends React.Component {} +export class NativeRouter extends React.Component {} From 937b1fc4016d3d13c14f46f06fd3de372da71924 Mon Sep 17 00:00:00 2001 From: Yui T Date: Fri, 23 Jun 2017 10:50:13 -0700 Subject: [PATCH 056/180] Fix linting: line exceed max length of 200 --- types/react-native/index.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 06e777a270..5f9e6e3856 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -1,6 +1,10 @@ // Type definitions for react-native 0.44 // Project: https://github.com/facebook/react-native -// Definitions by: Eloy Durán , Fedor Nezhivoi , HuHuanming , Jeremi Stadler , Kyle Roach +// Definitions by: Eloy Durán +// Fedor Nezhivoi +// HuHuanming +// Jeremi Stadler +// Kyle Roach // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From 7220c95be68358afc5e142a8b4481e8a8ed74a71 Mon Sep 17 00:00:00 2001 From: Yui T Date: Fri, 23 Jun 2017 11:21:12 -0700 Subject: [PATCH 057/180] Update to use newer TypeScript --- types/react-router-native/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-router-native/index.d.ts b/types/react-router-native/index.d.ts index 453d9b122a..f2ab1c72b1 100644 --- a/types/react-router-native/index.d.ts +++ b/types/react-router-native/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/ReactTraining/react-router-native // Definitions by: Eduard Zintz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.3 export { match, @@ -23,7 +23,7 @@ import * as React from 'react'; import * as H from 'history'; export interface AndroidBackButtonProps { - children: Array; + children: React.Component[]; } export class AndroidBackButton extends React.Component {} From 4d0fe041f6cfc7a9c49584ef7ff90e307ed0f703 Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Fri, 23 Jun 2017 21:34:39 -0400 Subject: [PATCH 058/180] [clndr] Update to target @types/jquery v3. --- types/clndr/clndr-tests.ts | 1 - types/clndr/index.d.ts | 3 +++ types/clndr/tsconfig.json | 5 ----- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/types/clndr/clndr-tests.ts b/types/clndr/clndr-tests.ts index d0939c3e80..07bff7f9e4 100644 --- a/types/clndr/clndr-tests.ts +++ b/types/clndr/clndr-tests.ts @@ -1,5 +1,4 @@ import * as Clndr from 'clndr'; -import $ = require('jquery'); const options: Clndr.ClndrOptions = { template: '', diff --git a/types/clndr/index.d.ts b/types/clndr/index.d.ts index 2c01d82518..6e0c22d2f3 100644 --- a/types/clndr/index.d.ts +++ b/types/clndr/index.d.ts @@ -2,6 +2,9 @@ // Project: https://github.com/kylestetz/CLNDR // Definitions by: jasperjn // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// import * as moment from 'moment'; diff --git a/types/clndr/tsconfig.json b/types/clndr/tsconfig.json index e2791aa5f0..47e9476079 100644 --- a/types/clndr/tsconfig.json +++ b/types/clndr/tsconfig.json @@ -12,11 +12,6 @@ "typeRoots": [ "../" ], - "paths": { - "jquery": [ - "jquery/v2" - ] - }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true From 6027c82a7d155eb87856a6c103bc417885cfbd1b Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Fri, 23 Jun 2017 21:36:38 -0400 Subject: [PATCH 059/180] [ej.web.all] Update to target @types/jquery v3. --- types/ej.web.all/ej.web.all-tests.ts | 2 -- types/ej.web.all/index.d.ts | 5 ++++- types/ej.web.all/tsconfig.json | 5 ----- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/types/ej.web.all/ej.web.all-tests.ts b/types/ej.web.all/ej.web.all-tests.ts index c7d5521f1c..ae504eb752 100644 --- a/types/ej.web.all/ej.web.all-tests.ts +++ b/types/ej.web.all/ej.web.all-tests.ts @@ -1,7 +1,5 @@ /* tslint:disable */ -import $ = require('jquery'); - module AccordionComponent { $(function () { var sample = new ej.Accordion($("#basicAccordion"), { diff --git a/types/ej.web.all/index.d.ts b/types/ej.web.all/index.d.ts index ed36a800f6..9f46649c3e 100644 --- a/types/ej.web.all/index.d.ts +++ b/types/ej.web.all/index.d.ts @@ -2,6 +2,9 @@ // Project: http://help.syncfusion.com/js/typescript // Definitions by: Syncfusion // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// /*! * filename: ej.web.all.d.ts @@ -66684,7 +66687,7 @@ interface JQueryPromise { */ cancel?: boolean; } -interface JQueryDeferred extends JQueryPromise { +interface JQueryDeferred { /** * Returns the cancel option value. */ diff --git a/types/ej.web.all/tsconfig.json b/types/ej.web.all/tsconfig.json index 0dad85ed26..e187b54f67 100644 --- a/types/ej.web.all/tsconfig.json +++ b/types/ej.web.all/tsconfig.json @@ -12,11 +12,6 @@ "typeRoots": [ "../" ], - "paths": { - "jquery": [ - "jquery/v2" - ] - }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true From 0c9938daee65b052571cf546ca63299f46caa35f Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Fri, 23 Jun 2017 21:38:29 -0400 Subject: [PATCH 060/180] [flexslider] Update to target @types/jquery v3. --- types/flexslider/flexslider-tests.ts | 18 ++++++------------ types/flexslider/index.d.ts | 2 ++ types/flexslider/tsconfig.json | 5 ----- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/types/flexslider/flexslider-tests.ts b/types/flexslider/flexslider-tests.ts index 967a351604..8bf2d28db1 100644 --- a/types/flexslider/flexslider-tests.ts +++ b/types/flexslider/flexslider-tests.ts @@ -1,21 +1,17 @@ -import $ = require('jquery'); - -// Can also be used with $(document).ready() -$(window).load(function() { +$(window).ready(function() { $('.flexslider').flexslider({ animation: "slide" }); }); -// Can also be used with $(document).ready() -$(window).load(function() { +$(window).ready(function() { $('.flexslider').flexslider({ animation: "slide", controlNav: "thumbnails" }); }); -$(window).load(function() { +$(window).ready(function() { // The slider being synced must be initialized first $('#carousel').flexslider({ animation: "slide", @@ -36,7 +32,7 @@ $(window).load(function() { }); }); -$(window).load(function() { +$(window).ready(function() { $('.flexslider').flexslider({ animation: "slide", animationLoop: false, @@ -45,8 +41,7 @@ $(window).load(function() { }); }); -// Can also be used with $(document).ready() -$(window).load(function() { +$(window).ready(function() { $('.flexslider').flexslider({ animation: "slide", animationLoop: false, @@ -57,8 +52,7 @@ $(window).load(function() { }); }); -// Can also be used with $(document).ready() -$(window).load(function() { +$(window).ready(function() { // Vimeo API nonsense var player = document.getElementById('player_1'); diff --git a/types/flexslider/index.d.ts b/types/flexslider/index.d.ts index cf38995f94..d9110a26f5 100644 --- a/types/flexslider/index.d.ts +++ b/types/flexslider/index.d.ts @@ -4,6 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 +/// + interface SliderObject { //Object: The slider element itself container: Object; //Object: The ul.slides within the slider slides: Object; //Object: The slides of the slider diff --git a/types/flexslider/tsconfig.json b/types/flexslider/tsconfig.json index a2425d596e..12c0cc9692 100644 --- a/types/flexslider/tsconfig.json +++ b/types/flexslider/tsconfig.json @@ -12,11 +12,6 @@ "typeRoots": [ "../" ], - "paths": { - "jquery": [ - "jquery/v2" - ] - }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true From 64f1e27c15754777adb273e861c859fff90d601d Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Fri, 23 Jun 2017 21:39:13 -0400 Subject: [PATCH 061/180] [jquery-easy-loading] Update to target @types/jquery v3. --- types/jquery-easy-loading/index.d.ts | 3 +++ types/jquery-easy-loading/jquery-easy-loading-tests.ts | 1 - types/jquery-easy-loading/tsconfig.json | 5 ----- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/types/jquery-easy-loading/index.d.ts b/types/jquery-easy-loading/index.d.ts index 72ab6cd65d..9498e6ac9a 100644 --- a/types/jquery-easy-loading/index.d.ts +++ b/types/jquery-easy-loading/index.d.ts @@ -2,6 +2,9 @@ // Project: http://carlosbonetti.github.io/jquery-loading/ // Definitions by: delphinus // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// declare namespace JQueryEasyLoading { diff --git a/types/jquery-easy-loading/jquery-easy-loading-tests.ts b/types/jquery-easy-loading/jquery-easy-loading-tests.ts index ece98fd6d0..b8c6ac219c 100644 --- a/types/jquery-easy-loading/jquery-easy-loading-tests.ts +++ b/types/jquery-easy-loading/jquery-easy-loading-tests.ts @@ -35,7 +35,6 @@ function test_commands() { .loading("toggle"); } -import * as jQuery from "jquery"; import * as factory from "jquery-easy-loading"; function test_factory() { diff --git a/types/jquery-easy-loading/tsconfig.json b/types/jquery-easy-loading/tsconfig.json index efe892fc96..9e16b77cbf 100644 --- a/types/jquery-easy-loading/tsconfig.json +++ b/types/jquery-easy-loading/tsconfig.json @@ -12,11 +12,6 @@ "typeRoots": [ "../" ], - "paths": { - "jquery": [ - "jquery/v2" - ] - }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true From 6530fe0e1a60be3bb089d1d2b71f9ee6dc6ba6d5 Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Fri, 23 Jun 2017 21:39:39 -0400 Subject: [PATCH 062/180] [jquery-mockjaw] Update to target @types/jquery v3. --- types/jquery-mockjax/index.d.ts | 3 +++ types/jquery-mockjax/jquery-mockjax-tests.ts | 2 -- types/jquery-mockjax/tsconfig.json | 5 ----- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/types/jquery-mockjax/index.d.ts b/types/jquery-mockjax/index.d.ts index f5dc5c8db1..2e8441131f 100644 --- a/types/jquery-mockjax/index.d.ts +++ b/types/jquery-mockjax/index.d.ts @@ -2,6 +2,9 @@ // Project: https://github.com/jakerella/jquery-mockjax // Definitions by: Laszlo Jakab , Vladimir Đokić // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// interface MockJaxSettingsHeaders { [key: string]: string; diff --git a/types/jquery-mockjax/jquery-mockjax-tests.ts b/types/jquery-mockjax/jquery-mockjax-tests.ts index a0df96dad6..3090a1c3cc 100644 --- a/types/jquery-mockjax/jquery-mockjax-tests.ts +++ b/types/jquery-mockjax/jquery-mockjax-tests.ts @@ -1,7 +1,5 @@ /// -import $ = require('jquery'); - class Tests { private _noErrorCallbackExpected: (jqXHR: JQueryXHR, textStatus: string, errorThrown: string) => any; private _defaultMockjaxSettings: MockJaxSettings; diff --git a/types/jquery-mockjax/tsconfig.json b/types/jquery-mockjax/tsconfig.json index 5fcedf714e..660cf14287 100644 --- a/types/jquery-mockjax/tsconfig.json +++ b/types/jquery-mockjax/tsconfig.json @@ -12,11 +12,6 @@ "typeRoots": [ "../" ], - "paths": { - "jquery": [ - "jquery/v2" - ] - }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true From e3da7f0400dc5e73b9bb015d9049aacfe1af5c86 Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Fri, 23 Jun 2017 21:40:12 -0400 Subject: [PATCH 063/180] [jquery.clientsidelogging] Update to target @types/jquery v3. --- types/jquery.clientsidelogging/index.d.ts | 4 ++++ .../jquery.clientsidelogging-tests.ts | 2 -- types/jquery.clientsidelogging/tsconfig.json | 5 ----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/types/jquery.clientsidelogging/index.d.ts b/types/jquery.clientsidelogging/index.d.ts index f0548b89b2..896e921e23 100644 --- a/types/jquery.clientsidelogging/index.d.ts +++ b/types/jquery.clientsidelogging/index.d.ts @@ -2,6 +2,9 @@ // Project: https://github.com/remybach/jQuery.clientSideLogging // Definitions by: Diullei Gomes // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// interface ClientSideLoggingClientInfoObject { location?: boolean; // The url to the page on which the error occurred. @@ -23,6 +26,7 @@ interface ClientSideLoggingObject { interface JQueryStatic { info: (what?: any) => any; + error(what?: any): any; log: (what?: any) => any; clientSideLogging: (options: ClientSideLoggingObject) => any; } diff --git a/types/jquery.clientsidelogging/jquery.clientsidelogging-tests.ts b/types/jquery.clientsidelogging/jquery.clientsidelogging-tests.ts index f23b9acb25..24cba342f7 100644 --- a/types/jquery.clientsidelogging/jquery.clientsidelogging-tests.ts +++ b/types/jquery.clientsidelogging/jquery.clientsidelogging-tests.ts @@ -1,5 +1,3 @@ -import $ = require('jquery'); - $.clientSideLogging({ log_level: 3, client_info: { diff --git a/types/jquery.clientsidelogging/tsconfig.json b/types/jquery.clientsidelogging/tsconfig.json index db54f5cd84..5a94a133b5 100644 --- a/types/jquery.clientsidelogging/tsconfig.json +++ b/types/jquery.clientsidelogging/tsconfig.json @@ -12,11 +12,6 @@ "typeRoots": [ "../" ], - "paths": { - "jquery": [ - "jquery/v2" - ] - }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true From 3113d28334f3465d8a04668593c1fefb7bc077ad Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Fri, 23 Jun 2017 21:41:14 -0400 Subject: [PATCH 064/180] [imagemapster] Fix missing @types/jquery dependency. --- types/imagemapster/imagemapster-tests.ts | 2 - types/imagemapster/index.d.ts | 1816 +++++++++++----------- 2 files changed, 910 insertions(+), 908 deletions(-) diff --git a/types/imagemapster/imagemapster-tests.ts b/types/imagemapster/imagemapster-tests.ts index 8ee3942fd4..9712cb4e1a 100644 --- a/types/imagemapster/imagemapster-tests.ts +++ b/types/imagemapster/imagemapster-tests.ts @@ -1,5 +1,3 @@ -import $ = require('jquery'); - const areaOptions: ImageMapster.AreaRenderingOptions = { key: "foo", includeKeys: "foo", diff --git a/types/imagemapster/index.d.ts b/types/imagemapster/index.d.ts index 0ab0991f7e..101191baca 100644 --- a/types/imagemapster/index.d.ts +++ b/types/imagemapster/index.d.ts @@ -3,992 +3,996 @@ // Definitions by: delphinus // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare namespace ImageMapster { +import jQuery = require('jquery'); - type Select = "select"; - type Deselect = "deselect"; - type Set = "set"; - type Get = "get"; - type Highlight = "highlight"; - type Unbind = "unbind"; - type Resize = "resize"; - type Snapshot = "snapshot"; - type Rebind = "rebind"; - type Keys = "keys"; - type SetOptions = "set_options"; - type GetOptions = "get_options"; - type Tooltip = "tooltip"; - type ToolTipCloseEvent = "area-mouseout" | "area-click" | "tooltip-click" | "image-mouseout"; - type State = "highlight" | "select"; +declare global { + namespace ImageMapster { - interface RenderingOptions { + type Select = "select"; + type Deselect = "deselect"; + type Set = "set"; + type Get = "get"; + type Highlight = "highlight"; + type Unbind = "unbind"; + type Resize = "resize"; + type Snapshot = "snapshot"; + type Rebind = "rebind"; + type Keys = "keys"; + type SetOptions = "set_options"; + type GetOptions = "get_options"; + type Tooltip = "tooltip"; + type ToolTipCloseEvent = "area-mouseout" | "area-click" | "tooltip-click" | "image-mouseout"; + type State = "highlight" | "select"; - /** - * fade effect - can only be applied to "render_highlight". - * - * Use a fade effect when highlighting areas on mouseover. - */ - fade?: boolean; + interface RenderingOptions { - /** - * The duration of the fade-in effect, in milliseconds. - */ - fadeDuration?: number; + /** + * fade effect - can only be applied to "render_highlight". + * + * Use a fade effect when highlighting areas on mouseover. + */ + fade?: boolean; - /** - * highlight areas on mouseover. When null (default), the behavior is - * disabled for mobile browsers. You can explicitly enable or disable - * it by setting this option to a boolean value. - */ - highlight?: boolean; + /** + * The duration of the fade-in effect, in milliseconds. + */ + fadeDuration?: number; - /** - * the map or an area on the map can be selected (or deselected). - * - * When true, the image map will function like a multiple-select menu. - * Users can click any area to select or deselect it. When applied to - * the entire map, it determines whether or not the click-selection - * functionality is enabled. When applied to an area, it determines - * whether that individual area (or group) can be selected. By default, - * the map and all areas are selectable. - */ - isSelectable?: boolean; + /** + * highlight areas on mouseover. When null (default), the behavior is + * disabled for mobile browsers. You can explicitly enable or disable + * it by setting this option to a boolean value. + */ + highlight?: boolean; - /** - * the map or area on the map can be deselected. - * - * Normally true, this option can be used to prevent users from - * unselecting items once they have been selected. When combined with - * singleSelect, the effect is that one and only one option can be - * selected at any given time. Users cannot deselect the active option. - * This provides a menu-like functionality. It is possible for zero - * items to be selected if this is the default state (or the only - * selected item is deselected programatically). - */ - isDeselectable?: boolean; + /** + * the map or an area on the map can be selected (or deselected). + * + * When true, the image map will function like a multiple-select menu. + * Users can click any area to select or deselect it. When applied to + * the entire map, it determines whether or not the click-selection + * functionality is enabled. When applied to an area, it determines + * whether that individual area (or group) can be selected. By default, + * the map and all areas are selectable. + */ + isSelectable?: boolean; - /** - * only one area can be selected at a time - * - * When true, only one or zero areas can be selected at any given time. - * If an area is selected and the user selects another area, the - * previously selected area will become deselected. Unlike - * "staticState", this property cannot be overridden by setting areas - * programatically, only one (or zero) areas can ever be selected when - * this option is true. - */ - singleSelect?: boolean; + /** + * the map or area on the map can be deselected. + * + * Normally true, this option can be used to prevent users from + * unselecting items once they have been selected. When combined with + * singleSelect, the effect is that one and only one option can be + * selected at any given time. Users cannot deselect the active option. + * This provides a menu-like functionality. It is possible for zero + * items to be selected if this is the default state (or the only + * selected item is deselected programatically). + */ + isDeselectable?: boolean; - /** - * the map or area is permanently in a selected or deselected state. - * - * When true or false, the map or area to which this option applies - * will be permanently selected or deselected. Typically this is more - * useful applied to individual areas that you want to exclude from the - * interactive part of the map. - * - * staticState forces an area to be always selected or deselected. If - * set, this will supercede isSelectable. Something with a staticState - * will always be in that state and it cannot be changed by the user. - * Note that when setting states programatically, this option will not - * be honored; it only affects user interaction. - */ - staticState?: boolean; + /** + * only one area can be selected at a time + * + * When true, only one or zero areas can be selected at any given time. + * If an area is selected and the user selects another area, the + * previously selected area will become deselected. Unlike + * "staticState", this property cannot be overridden by setting areas + * programatically, only one (or zero) areas can ever be selected when + * this option is true. + */ + singleSelect?: boolean; - /** - * initial selection state of an area. - * - * The area in question is selected. To set default selections when - * creating a new mapster, use this option for a specific area (see - * above). - */ - selected?: boolean; + /** + * the map or area is permanently in a selected or deselected state. + * + * When true or false, the map or area to which this option applies + * will be permanently selected or deselected. Typically this is more + * useful applied to individual areas that you want to exclude from the + * interactive part of the map. + * + * staticState forces an area to be always selected or deselected. If + * set, this will supercede isSelectable. Something with a staticState + * will always be in that state and it cannot be changed by the user. + * Note that when setting states programatically, this option will not + * be honored; it only affects user interaction. + */ + staticState?: boolean; - /** - * Use an alternate image of the same size as the imagemap as the - * source for highlight or select effects. - * - * When specified, the mapster will highlight areas using the image - * data obtained from the same area in an alternate image, instead of - * using a fill effect to highlight or select the area. This feature is - * currently available in browsers with HTML5 canvas support. In - * practical terms, this means it will work in all commonly used - * browsers except IE 8 or lower. - * - * If this feature is enabled when an unsupported browser is used, it - * will fall back to the normal highlight method. - * - * The fill, stroke and opacity effects can be specified independently - * from those used for the normal higlight effect. This ensures that - * when your page is viewed with a non-supported browser, you can still - * control the rendering as would be appropriate for a normal - * fill/stroke effect, which may be different from when you're using an - * alternate image. - */ - altImage?: string; - altImageFill?: boolean; - altImageStroke?: boolean; - altImageOpacity?: number; + /** + * initial selection state of an area. + * + * The area in question is selected. To set default selections when + * creating a new mapster, use this option for a specific area (see + * above). + */ + selected?: boolean; - /** - * Areas should be flood-filled when moused over or highlighted. - */ - fill?: boolean; + /** + * Use an alternate image of the same size as the imagemap as the + * source for highlight or select effects. + * + * When specified, the mapster will highlight areas using the image + * data obtained from the same area in an alternate image, instead of + * using a fill effect to highlight or select the area. This feature is + * currently available in browsers with HTML5 canvas support. In + * practical terms, this means it will work in all commonly used + * browsers except IE 8 or lower. + * + * If this feature is enabled when an unsupported browser is used, it + * will fall back to the normal highlight method. + * + * The fill, stroke and opacity effects can be specified independently + * from those used for the normal higlight effect. This ensures that + * when your page is viewed with a non-supported browser, you can still + * control the rendering as would be appropriate for a normal + * fill/stroke effect, which may be different from when you're using an + * alternate image. + */ + altImage?: string; + altImageFill?: boolean; + altImageStroke?: boolean; + altImageOpacity?: number; - /** - * The color used for flood fill. - */ - fillColor?: string; - fillColorMask?: string; + /** + * Areas should be flood-filled when moused over or highlighted. + */ + fill?: boolean; - /** - * The opacity of the fill. This is a number from 0 to 1. - */ - fillOpacity?: number; + /** + * The color used for flood fill. + */ + fillColor?: string; + fillColorMask?: string; - /** - * Areas should be outlined when moused over or highlighted. - */ - stroke?: boolean; + /** + * The opacity of the fill. This is a number from 0 to 1. + */ + fillOpacity?: number; - /** - * The color of the outline. - */ - strokeColor?: string; + /** + * Areas should be outlined when moused over or highlighted. + */ + stroke?: boolean; - /** - * The opacity of the outline. - */ - strokeOpacity?: number; + /** + * The color of the outline. + */ + strokeColor?: string; - /** - * The width of the outline. - */ - strokeWidth?: number; + /** + * The opacity of the outline. + */ + strokeOpacity?: number; - /** - * The options below control the way highlighted areas are rendered. - * Each can be applied globally to the map, or to each element, using - * the areas option to pass area-specific options. These options apply - * to either highlighted or selected areas. Highlighting occurs when - * the mouse enters an area on the image map. Selection occurs when an - * area is clicked, and selection is enabled. These options will be - * applied to both situations if present in the root of the options - * object. They can also be applied to one or the other situations - * specifically using the render_highlight and render_select options. - */ - render_highlight?: string | RenderingOptions; - render_select?: string | RenderingOptions; + /** + * The width of the outline. + */ + strokeWidth?: number; + + /** + * The options below control the way highlighted areas are rendered. + * Each can be applied globally to the map, or to each element, using + * the areas option to pass area-specific options. These options apply + * to either highlighted or selected areas. Highlighting occurs when + * the mouse enters an area on the image map. Selection occurs when an + * area is clicked, and selection is enabled. These options will be + * applied to both situations if present in the root of the options + * object. They can also be applied to one or the other situations + * specifically using the render_highlight and render_select options. + */ + render_highlight?: string | RenderingOptions; + render_select?: string | RenderingOptions; + } + + interface AreaRenderingOptions extends RenderingOptions { + + key: string; + + /** + * when rendering an area or area group, also render the areas in the + * other group (or groups) specified + * + * This is an area-specific option that allows you to create + * supergroups. A supergroup is a collection of groups that will all be + * highlighted simultaneously, but only when the area that defines the + * supergroup is moused over or activated through code. + * + * When the area for which this option has been set is activated, all + * the areas specified in the includeKeys list will also be rendered. + * This is a one-way relationship. Defining a supergroup in an area + * causes all the other groups to be highlighted, but not the other way + * around. + * + * A typical use of this is to define areas that you want to be + * highlighted when the mouse enters some specific area, but that you + * do not want to be highlighted on their own if the target area is + * moused over. This could be a hidden menu, for example: you want the + * menu to display when the hotspot is moused over, but when it's + * hidden, mousing over the menu area itself should have no effect. + */ + includeKeys?: string; + + /** + * the area is a mask rather than a highlighted area. + * + * Normally, every area in an imagemap is an active area, and would be + * highlighted when moused over (unless its behavior was otherwise + * specified with staticState). The isMask option allows you to + * identify an area as being a mask. When a mask is part of an area + * group, the masked area will be specifically excluded from the + * rendering of a highlight or selected state. + * + * This is usually used in conjunction, or instead of, the nohref + * attribute of the area tag. When nohref is specified on an area tag, + * that area is specifically excluded from the hotspot of any area that + * encompasses it. It will not respond to mouse events, and will not be + * highlighted. This can be used to create "holes" in hotspots. By + * default, ImageMapster will treat any area with nohref or no href tag + * as masks, the same as if this option had been applied. + * + * Sometimes you won't be able to use nohref to identify something as a + * mask, for example, if you intend to re-use an area has both a mask, + * and an independent hotspot. This would be typical if you wanted to a + * selectable area that was completely included within another + * selectable area, but functioned independently, such as concentric + * circles. In this case, you would need to identify the inner circle + * as both a mask, and a hotspot. The nohref attribute would make it + * not act as a hotspot, and only function as a mask. You couldn't also + * select the inner area. You can solve this problem by including the + * inner circle in two different groups - one group which is a mask for + * the main area, and another which is an independent selectable area. + * You can specify different options for each group, so even though + * it's just one area, it can function as two completely independent + * ones. + * + * There may also be situations where you do not want an area marked + * with nohref to be treated as a mask. For example, given "area1" and + * "area2," you may want to create a configuration where mousing over + * "area1" causes both "area1" and "area2" to be highlighted, but + * "area2" should not be highlighted on its own when it is moused over. + * In this situation, you'll need to use "nohref" to prevent the hover + * behavior for the area, but you still want it to be treated normally + * when it's rendered as a result of mousing over "area1." You can + * accomplish this using the noHrefIsMask global option, below. + * + * Generally, masked areas will appear as a window to the underlying + * image. If stroke is in effect, the stroke will be rendered for the + * mask as well as the areas, to create both inner and outer borders. + * You can always specifically enable or disable this, or any other + * effect, for any area as desired. + * + */ + isMask?: boolean; + + /** + * tool tip data for an area + * + * When this area-specific option is present and showToolTips = true, a + * toolTipContainer will be created this will be inserted into it, + * either as inner text (if only text as passed) or as HTML if a jQuery + * object is passed. In order to pass anything other than plain text + * using this option you must use a jQuery object. Any string will be + * treated as plain text (and special characters rendered correctly). + */ + toolTip?: string; + } + + interface OnClickData { + + /** + * $(item) from boundList + */ + listTarget?: JQuery; + + /** + * mapKey for this area + */ + key: string; + + e: JQueryEventObject; + selected: boolean; + } + + interface OnStateChangeData { + + /** + * map key + */ + key: string; + + state: "highlight" | "select"; + + /** + * indicating the current state (following the event) + */ + selected: boolean; + } + + interface OnMouseData { + + /** + * area key + */ + key: string; + + /** + * true if area is currently selected + */ + selected: boolean; + + e: JQueryEventObject; + options: AreaRenderingOptions; + } + + interface OnGetListData { + + /** + * primary mapKey for this area or area group + */ + key: string; + + /** + * mapValue for this area or group + */ + value: string; + + /** + * array of areas that make up this group + */ + area: any[]; + + options: AreaRenderingOptions; + } + + interface OnShowToolTipData { + + /** + * jQuery object of the tooltip container + */ + toolTip: JQuery; + + /** + * map key for this area + */ + key: string; + + /** + * current state of the area + */ + selected: boolean; + + areaOptions: AreaRenderingOptions; + } + + interface Options extends RenderingOptions { + + /** + * an attribute identifying each imagemap area. + * + * If specified, this refers to an attribute on the area tags that will + * be used to group them logically. Any areas containing the same + * mapKey will be considered part of a group, and rendered together + * when any of these areas is activated. If you don't want this + * functionality, ensure each key is unique. When mapKey is omitted, + * then each area is considered to be independent from the other and no + * grouping is applied. + * + * When mapKey is present, any area tags that are missing this + * attribute will be excluded from the image map e ntirely. This is + * functionally identical to setting staticState=false for these areas, + * except they will be inaccessible through the API. + * + * ImageMapster will work with any attribute you identify as a key. If + * you wish to maintain HTML compliance, it's recommeded that you use + * attribute names starting with "data-", for example, data-mapkey. Any + * such names are legal for the HTML5 document type. If you are using + * older document types, the class attribute is part of the HTML spec + * for area and will not cause any visual effects, so this is also a + * good choice. It is not recommended to use id, since the values of + * this attribute must be unique. title and alt also will cause + * possibly undesired side effects. + * + * You can specify more than one value in the mapKey attribute, + * separated by commas. This will cause an area to be a member of more + * than one group. The area may have different options in the context + * of each group. When the area is physically moused over, the first + * key listed will identify the group that's effective for that action. + */ + mapKey?: string; + + /** + * an attribute on each area tag containing additional descriptive + * information about an area. + * + * This option is applicable only when using onGetList. When set, the + * data provided to the callback function will include the value of + * this attribute for each group. This can be used to simplify building + * a list with associated information, without having to match against + * another resource. It also ties this information to the image map + * itself. It is not required to use this option when using onGetList. + * + * For example, you could set mapValue: 'data-statename' to an imagemap + * of the united states, and add an attribute to your areas that + * provided the full name of each state, e.g. data-statename="Alaska". + * This text would be included in the onGetList callback, and so you + * could use it to construct an external list of states. + * + * If there are grouped areas (areas with the same key), then the value + * from the first area found with data in this attribute will be used. + */ + mapValue?: string; + + /** + * Clicking on a link should cause the browser to navigate to the href + * whenever it's not a hash sign (#). Version 1.2.4.050 and later + * + * By default, ImageMapster will prevent the default browser behavior + * in image maps, and "select" areas when they are clicked. If you want + * to navigate to the url for an area, use this option. When enabled, + * all areas that have an href attribute, and its value is not empty or + * "#" (just a hashtag). + * + * When area grouping is used, if an href is present for any area in + * the primary group, this will be used as the navigation target. This + * way you don't need to copy the url for every area in groups, rather, + * you can include it on just one, and clicking any area will cause the + * appropraite navigation. + */ + clickNavigate?: boolean; + + /** + * an attribute on items in a boundList that corresponds to the value + * of the mapKey attributes. + * + * This is used to synchronize the actions on the imagemap with the + * actions on a boundList. Each value should match a value from the + * imageMap mapKey tag. Any item in the boundList with missing or + * mismatched data will be ignored. + */ + listKey?: string; + + /** + * attribute to set or remove when an area is selected or deselected + * + * If boundList is present, when a map area is selected, set or remove + * this attribute on the list element that matches that area based on + * their respective keys. + */ + listSelectedAttribute?: string; + + /** + * a class to add or remove when an area is selected or deselected + * + * If a boundList is present, when a map area is selected, this class + * is added or removed from the corresponding list element. This can be + * used to easily create any kind of associated action when areas on + * the map are changed. + */ + listSelectedClass?: string; + + /** + * + * define area-specific options; each object in the array must contain + * a "key" property identifying a valid mapKey, and additional + * rendering options specific to that area or group + */ + areas?: AreaRenderingOptions[], + + /** + * add "classname" class to the wrapper created around the image, or + * copy classes from the image if "true" + */ + wrapClass?: string | boolean; + + /** + * add CSS to the wrapper created around the image + */ + wrapCss?: string | boolean; + + /** + * delay removing highlight when mouse exits an area (1.2.5b36) + * + * Normally, when the user's mouse pointer exits an area, the highlight + * effect is removed immediately. This behavior can be changed with + * this option. Setting it to a positive number causes a delay of n + * milliseconds before the effect is removed. Setting to -1 causes the + * effect to remain active until another hotspot is entered (e.g., it + * will only be removed when superceded by a different area being + * highlighted). + * + * When using mouseoutDelay, the onMouseover event will still be fired + * at the time the user's mouse pointer leaves the area. However, the + * onStateChange event will be delayed until the highlight is actually + * removed. + * + * Whether or not you are using mouseoutDelay, only one area can be + * highlighted at a time. That is, whenever the mouse pointer moves + * onto a new active area, any previously highlighted area will become + * un-highlighted, regardless of any delay in effect. Hovering over a + * new area will always supercede any delay and cause the new area (and + * only the new area) to be highlighted at that time. So, for dense + * imagemaps where most areas adjoin one another, this option may not + * have much effect within the boundaries of the imagemap. Rather, it + * is intended to help keep the higlights active for imagemaps that are + * sparse, or have very small areas. + */ + mouseoutDelay?: number; + + /** + * sort the values before calling onGetList + * + * If a non-false value or "asc" is passed, the list will be sorted in + * ascending order by the area value from mapValue. If "desc" is + * passed, the list will be sorted in descending order. + */ + sortList?: boolean | "asc" | "desc"; + + /** + * time (in milliseconds) to wait for images to load before giving up + * + * When first bound, ImageMapster has to wait for the source image,and + * any altImage images to load before it can finish binding. This is + * necessary because otherwise it's not alwasy possible to know the + * native size of the images. After this period of time, ImageMapster + * will give up. If you have particularly large pages or images, you + * may want to increase this to account for long load times. + */ + configTimeout?: number; + + /** + * Automatically scale imagemaps to match the size of a + * dynamically-scaled image. + * + * When you render an image, you can optionally define a size through + * CSS or using the "height" and "width" attributes. If omitted, the + * image will be displayed in its native size. If included, browsers + * will automatically resize the image to display in the dimensions you + * have provided. + * + * Starting with 1.1.3, ImageMapster will automatically recalculate all + * area data to match the effective size of the image. This means that + * you can set the size of your image to anything you want and + * ImageMapster will work with no changes at all needed to the "area" + * data. + * + * If this behavior is not desired for some reason, this can be + * disabled by setting this option to false. + */ + scaleMap?: boolean; + + /** + * Treat areas containing the onhref attribute (or missing the href + * attribute) as masks. This is true by default. + * + * Set this to "false" to disable automatic masking of these areas. You + * can control them explicitly by creating independent groups for areas + * you wish to mask and assigning the isMask area-specific option when + * using this option. + * + * There are some things to be aware of when using nohref and masking: + * + * * You must put the area that include the nohref attribute before + * other areas that overlap it, or it will be ignored. + * + * * You should also explicitly omit the href tag when using nohref. + * + * * Due to limitations in rendering with VML (e.g. Internet Explorer + * 6-8), it is not possible to create a true mask, which would allow + * the underlying image to show through the masked area. Instead, the + * "masked" areas are rendered on top of the highlighted area in a + * different color. This can be specified for each area (see the + * fillColorMask option below) to create the best possible effect. + */ + noHrefIsMask?: boolean; + + /** + * a jQuery object whose elements are bound to the map. + * + * boundList can be any list of objects. To be bound to the map, they + * must contain an attribute whose name is identified by the option + * listKey, and whose value matches the value in an area tag's mapKey + * attribute. If more than one element in the list has the same value, + * the action will affect all matching elements. + */ + boundList?: JQuery; + + /** + * enable tooltips + * + * When showToolTip is true, mapster will look for a property called + * toolTip in the areas option for a an area. If present, a tool tip + * dialog will be shown on mouseover for that area. It will + * automatically be closed according to the behavior specified by + * toolTipClose. This option does not apply at the item level, but + * rather enables tooltips for the entire map. At the item level, only + * the presence of tooltip data is necessary for a tooltip to appear. + */ + showToolTip?: boolean; + + /** + * HTML describing the popup that will be created for tooltips. + * + * A div with some simple styling is included as the default tooltip + * container. This can be replaced with anything using this option. + * + * When tooltips are rendered, the code attempts to determine the best + * place for it. It will try to position it in near the top-left part + * of the area, and continue to try other corners in order to render it + * within the confines of the container where the image map resides. If + * it can't be placed within the image, it will be placed in the + * lower-right corner and extend outside the image. + */ + toolTipContainer?: string | JQuery; + + /** + * specify the behavior that causes a toolTip to close. + * + * This option should be passed an array of strings that define the + * events that cause active tooltips to close. The array can include + * one or more of the following stings: + * + * 'area-mouseout' - tooltips close when the mouse pointer leaves the + * area that activated it. This is the default. + * + * 'area-click' - tooltips close when another area (or the same one) is + * clicked + * + * 'tooltip-click' - tooltips close when the tooltip itself is clicked + * anywhere + * + * 'image-mouseout' - tooltips close when the mouse pointer leaves the + * image itself. + * + * Under any circumstances, active tooltip will disappear when a new + * one is created. You don't have to define an automatic closing + * behavior; setting this option to an empty array will result in + * tooltips never closing, leaving it to you to close them manually + * though the tooltip method. + */ + toolTipClose?: ToolTipCloseEvent[]; + + /** + * callback when a hotspot area is clicked. Return false to cancel + * default select action, or true to navigate to the 'href' + */ + + /** + * a callback when an area is clicked.:silent doautocmd FocusLost % + * + * This event occurs when the usual click event happens, but includes + * data from the mapster about the area: + * + * This can be used to perform additional actions on a click without + * binding another event and having to obtain information manually. + */ + onClick?: (data: OnClickData) => void; + + /** + * callback when mouse enters a bound area. + * + * This function is called when the mouse enters a bound area. + */ + onMouseover?: (data: OnMouseData) => void; + + /** + * callback when mouse leavesd a bound area. + * + * Callback when the mouse leaves a bound area. The data structure + * passed to the callback is the same as onMouseover. + */ + onMouseout?: (data: OnMouseData) => void; + + /** + * a callback on mapster initialization that provides summary data + * about the image map, and expects a jQuery list to be returned. + * + * This callback allows you to dynamically provide a boundList based on + * summary data from the imagemap itself, rather than providing the + * list up front. The event passes an array of AreaData objects + * + * The client should return a jQuery object containing all the elements + * that make up the bound list, the same as if it was assigned + * manually. + */ + onGetList?: (data: OnGetListData) => JQuery; + + /** + * a callback when the mapster has finished initial configuration + * + * This event is fired when the mapster configuration completes. When + * control execution continues after a first-time bind operation, the + * mapster is not guaranteed to be configured, because images are + * loaded asynchronously by web browsers. If a mapster is bound to an + * image that is not yet loaded, it will attempt to rebind every 200 + * milliseconds. This event will be fired when it is eventually + * successful, or the length of time specified by configTimeout is + * exceeded (default of ten seconds). + * + * The altImage option will also increase the time needed to configure, + * because the alternate image is loaded by the client at configure + * time to ensure it is available immediately when needed. + */ + onConfigured?: (success: boolean) => void; + + /** + * callback when area state is changed (either highlight or select). + * + * onStateChange can be used to get more specific information than the + * mouseover or click events. + */ + onStateChange?: (data: OnStateChangeData) => void; + + /** + * callback when a toolTip is created + * + * This can be used to control tooltip closing behavior directly, if + * desired. + */ + onShowToolTip?: (data: OnShowToolTipData) => void; + } } - interface AreaRenderingOptions extends RenderingOptions { - - key: string; + interface JQuery { /** - * when rendering an area or area group, also render the areas in the - * other group (or groups) specified * - * This is an area-specific option that allows you to create - * supergroups. A supergroup is a collection of groups that will all be - * highlighted simultaneously, but only when the area that defines the - * supergroup is moused over or activated through code. + * All images in the jQuery object will be bound. The specific example + * above will attempt to bind to all images present on the page. Each image + * must be bound to an image map identified with the usemap attribute. If + * there is no usemap attribute, or it does not refer to a valid map, then + * the image will be ignored. Therefore you can use this syntax to activate + * all imagemaps on a page. Because pages often contain many images, + * though, it will be faster to select just the image you are targeting + * using a more specific selector. * - * When the area for which this option has been set is activated, all - * the areas specified in the includeKeys list will also be rendered. - * This is a one-way relationship. Defining a supergroup in an area - * causes all the other groups to be highlighted, but not the other way - * around. + * Images are often not completely loaded when script execution begins. + * ImageMapster will ensure that all images are loaded before it permits + * interaction from the client. If an alternate image is specified, this + * will also be preloaded. * - * A typical use of this is to define areas that you want to be - * highlighted when the mouse enters some specific area, but that you - * do not want to be highlighted on their own if the target area is - * moused over. This could be a hidden menu, for example: you want the - * menu to display when the hotspot is moused over, but when it's - * hidden, mousing over the menu area itself should have no effect. + * Because images are loaded asynchronously, code execution will often + * return to your script before the ImageMapster is available. If you apply + * other methods to it (such as selecting or deselecting areas), these + * commands will be queued until the image has been loaded, and then + * executed automatically. So you don't need to worry about using callbacks + * for initial configuration. You can assign a function to a callback when + * configuration is complete if needed to perform other setup activities on + * the page. */ - includeKeys?: string; + mapster(options?: ImageMapster.Options): JQuery; /** - * the area is a mask rather than a highlighted area. + * select: Cause an area to become selected. This is similar to a user + * click, but will not cause a click event to be fired. * - * Normally, every area in an imagemap is an active area, and would be - * highlighted when moused over (unless its behavior was otherwise - * specified with staticState). The isMask option allows you to - * identify an area as being a mask. When a mask is part of an area - * group, the masked area will be specifically excluded from the - * rendering of a highlight or selected state. + * Programatically select elements from the image map. The programmatic + * selection/deselection methods will not honor the staticState property. + */ + mapster(method: ImageMapster.Select): void; + + /** + * deselect: Cause an area to become deselected * - * This is usually used in conjunction, or instead of, the nohref - * attribute of the area tag. When nohref is specified on an area tag, - * that area is specifically excluded from the hotspot of any area that - * encompasses it. It will not respond to mouse events, and will not be - * highlighted. This can be used to create "holes" in hotspots. By - * default, ImageMapster will treat any area with nohref or no href tag - * as masks, the same as if this option had been applied. + * The opposite of select, this causes an area to become deselected. If it + * was not previously selected, nothing changes. + */ + mapster(method: ImageMapster.Deselect): void; + + /** + * set: select or deselect an area * - * Sometimes you won't be able to use nohref to identify something as a - * mask, for example, if you intend to re-use an area has both a mask, - * and an independent hotspot. This would be typical if you wanted to a - * selectable area that was completely included within another - * selectable area, but functioned independently, such as concentric - * circles. In this case, you would need to identify the inner circle - * as both a mask, and a hotspot. The nohref attribute would make it - * not act as a hotspot, and only function as a mask. You couldn't also - * select the inner area. You can solve this problem by including the - * inner circle in two different groups - one group which is a mask for - * the main area, and another which is an independent selectable area. - * You can specify different options for each group, so even though - * it's just one area, it can function as two completely independent - * ones. + * Select or deselect elements from jQuery objects wrapping "area" tags on + * the map based on truthiness of selected. If the area represents a bound + * area on the imagemap, it will be selected or deselected. The method can + * be called from an AREA, or from a bound image, passing a specific key as + * a 2nd parameter * - * There may also be situations where you do not want an area marked - * with nohref to be treated as a mask. For example, given "area1" and - * "area2," you may want to create a configuration where mousing over - * "area1" causes both "area1" and "area2" to be highlighted, but - * "area2" should not be highlighted on its own when it is moused over. - * In this situation, you'll need to use "nohref" to prevent the hover - * behavior for the area, but you still want it to be treated normally - * when it's rendered as a result of mousing over "area1." You can - * accomplish this using the noHrefIsMask global option, below. + * If the selected parameter is omitted (or anything other than "true" or + * "false") then the state of each area will be toggled. * - * Generally, masked areas will appear as a window to the underlying - * image. If stroke is in effect, the stroke will be rendered for the - * mask as well as the areas, to create both inner and outer borders. - * You can always specifically enable or disable this, or any other - * effect, for any area as desired. + * You can include an object containing rendering options as the last + * parameter. When present, these will supercede the default and + * area-specific rendering options. + */ + mapster(method: ImageMapster.Set, selected: boolean, options: ImageMapster.RenderingOptions): JQuery; + mapster(method: ImageMapster.Set, options: ImageMapster.RenderingOptions): JQuery; + + /** + * get: get keys for all selected areas * + * When no "key" parameter is included, returns a comma-separated list of + * keys representing the areas currently selected. If specified, returns + * true or false indicating whether the area specified is selected. */ - isMask?: boolean; + mapster(method: ImageMapster.Get, key?: string): string | boolean; /** - * tool tip data for an area + * highlight: highlight, clear, or return highlight state * - * When this area-specific option is present and showToolTips = true, a - * toolTipContainer will be created this will be inserted into it, - * either as inner text (if only text as passed) or as HTML if a jQuery - * object is passed. In order to pass anything other than plain text - * using this option you must use a jQuery object. Any string will be - * treated as plain text (and special characters rendered correctly). - */ - toolTip?: string; - } - - interface OnClickData { - - /** - * $(item) from boundList - */ - listTarget?: JQuery; - - /** - * mapKey for this area - */ - key: string; - - e: JQueryEventObject; - selected: boolean; - } - - interface OnStateChangeData { - - /** - * map key - */ - key: string; - - state: "highlight" | "select"; - - /** - * indicating the current state (following the event) - */ - selected: boolean; - } - - interface OnMouseData { - - /** - * area key - */ - key: string; - - /** - * true if area is currently selected - */ - selected: boolean; - - e: JQueryEventObject; - options: AreaRenderingOptions; - } - - interface OnGetListData { - - /** - * primary mapKey for this area or area group - */ - key: string; - - /** - * mapValue for this area or group - */ - value: string; - - /** - * array of areas that make up this group - */ - area: any[]; - - options: AreaRenderingOptions; - } - - interface OnShowToolTipData { - - /** - * jQuery object of the tooltip container - */ - toolTip: JQuery; - - /** - * map key for this area - */ - key: string; - - /** - * current state of the area - */ - selected: boolean; - - areaOptions: AreaRenderingOptions; - } - - interface Options extends RenderingOptions { - - /** - * an attribute identifying each imagemap area. + * This method is used to control or obtain the current highlight state. + * Setting the highlight does not mimic a mouseover, rather, it only sets + * the highlight. Events and tooltips will not be activated. Even using + * these methods, it is not possible to highlight more than one area at a + * time. If another area is highlighted programatically, any existing + * highlight will be removed. * - * If specified, this refers to an attribute on the area tags that will - * be used to group them logically. Any areas containing the same - * mapKey will be considered part of a group, and rendered together - * when any of these areas is activated. If you don't want this - * functionality, ensure each key is unique. When mapKey is omitted, - * then each area is considered to be independent from the other and no - * grouping is applied. - * - * When mapKey is present, any area tags that are missing this - * attribute will be excluded from the image map e ntirely. This is - * functionally identical to setting staticState=false for these areas, - * except they will be inaccessible through the API. - * - * ImageMapster will work with any attribute you identify as a key. If - * you wish to maintain HTML compliance, it's recommeded that you use - * attribute names starting with "data-", for example, data-mapkey. Any - * such names are legal for the HTML5 document type. If you are using - * older document types, the class attribute is part of the HTML spec - * for area and will not cause any visual effects, so this is also a - * good choice. It is not recommended to use id, since the values of - * this attribute must be unique. title and alt also will cause - * possibly undesired side effects. - * - * You can specify more than one value in the mapKey attribute, - * separated by commas. This will cause an area to be a member of more - * than one group. The area may have different options in the context - * of each group. When the area is physically moused over, the first - * key listed will identify the group that's effective for that action. + * Once set this way, the highlight will be removed when any user-event + * that would normally cause a highlight to be removed occurs (e.g. moving + * the mouse into any area), or it is removed programatically. */ - mapKey?: string; + mapster(method: ImageMapster.Highlight, flag?: string | boolean): void; /** - * an attribute on each area tag containing additional descriptive - * information about an area. + * unbind: unbind ImageMapster from an image * - * This option is applicable only when using onGetList. When set, the - * data provided to the callback function will include the value of - * this attribute for each group. This can be used to simplify building - * a list with associated information, without having to match against - * another resource. It also ties this information to the image map - * itself. It is not required to use this option when using onGetList. - * - * For example, you could set mapValue: 'data-statename' to an imagemap - * of the united states, and add an attribute to your areas that - * provided the full name of each state, e.g. data-statename="Alaska". - * This text would be included in the onGetList callback, and so you - * could use it to construct an external list of states. - * - * If there are grouped areas (areas with the same key), then the value - * from the first area found with data in this attribute will be used. - */ - mapValue?: string; - - /** - * Clicking on a link should cause the browser to navigate to the href - * whenever it's not a hash sign (#). Version 1.2.4.050 and later - * - * By default, ImageMapster will prevent the default browser behavior - * in image maps, and "select" areas when they are clicked. If you want - * to navigate to the url for an area, use this option. When enabled, - * all areas that have an href attribute, and its value is not empty or - * "#" (just a hashtag). - * - * When area grouping is used, if an href is present for any area in - * the primary group, this will be used as the navigation target. This - * way you don't need to copy the url for every area in groups, rather, - * you can include it on just one, and clicking any area will cause the - * appropraite navigation. - */ - clickNavigate?: boolean; - - /** - * an attribute on items in a boundList that corresponds to the value - * of the mapKey attributes. - * - * This is used to synchronize the actions on the imagemap with the - * actions on a boundList. Each value should match a value from the - * imageMap mapKey tag. Any item in the boundList with missing or - * mismatched data will be ignored. - */ - listKey?: string; - - /** - * attribute to set or remove when an area is selected or deselected - * - * If boundList is present, when a map area is selected, set or remove - * this attribute on the list element that matches that area based on - * their respective keys. - */ - listSelectedAttribute?: string; - - /** - * a class to add or remove when an area is selected or deselected - * - * If a boundList is present, when a map area is selected, this class - * is added or removed from the corresponding list element. This can be - * used to easily create any kind of associated action when areas on - * the map are changed. - */ - listSelectedClass?: string; - - /** - * - * define area-specific options; each object in the array must contain - * a "key" property identifying a valid mapKey, and additional - * rendering options specific to that area or group - */ - areas?: AreaRenderingOptions[], - - /** - * add "classname" class to the wrapper created around the image, or - * copy classes from the image if "true" - */ - wrapClass?: string | boolean; - - /** - * add CSS to the wrapper created around the image - */ - wrapCss?: string | boolean; - - /** - * delay removing highlight when mouse exits an area (1.2.5b36) - * - * Normally, when the user's mouse pointer exits an area, the highlight - * effect is removed immediately. This behavior can be changed with - * this option. Setting it to a positive number causes a delay of n - * milliseconds before the effect is removed. Setting to -1 causes the - * effect to remain active until another hotspot is entered (e.g., it - * will only be removed when superceded by a different area being - * highlighted). - * - * When using mouseoutDelay, the onMouseover event will still be fired - * at the time the user's mouse pointer leaves the area. However, the - * onStateChange event will be delayed until the highlight is actually + * Removes the ImageMapster binding from an image and restores it to its + * original state. All visible elements (selections, tooltips) will be * removed. * - * Whether or not you are using mouseoutDelay, only one area can be - * highlighted at a time. That is, whenever the mouse pointer moves - * onto a new active area, any previously highlighted area will become - * un-highlighted, regardless of any delay in effect. Hovering over a - * new area will always supercede any delay and cause the new area (and - * only the new area) to be highlighted at that time. So, for dense - * imagemaps where most areas adjoin one another, this option may not - * have much effect within the boundaries of the imagemap. Rather, it - * is intended to help keep the higlights active for imagemaps that are - * sparse, or have very small areas. + * If the optional "preserveState" parameter is true, the selection overlay + * and any active tooltips will be preserved. Tooltips can still be + * dismissed by a user click, but once unbound, the selection states can no + * longer be controlled either by the user or programatically. To remove + * them, the actual DOM elements must be removed. + * + * Notes: When a mapster is first bound, several things happen. A div + * element is created which wraps the image. A copy is made of the original + * image, and the original image is set be transparent. This allows + * creating visible elements for the selections & highlights without + * interfering with the image map. Additionally, canvas elements are + * created (for HTML5 browsers), or a VML elements are created for Internet + * Explorer, to render the effects. Profile information about each bound + * image map is stored in memory, and finally, event handlers are bound to + * the image map. + * + * The "unbind" method cleans up these resources: it removes the wrapper, + * restores the image to its original visibility state, and releases + * internal resources. When using 'preserveState', the internal resources + * are cleaned up and event handling is disabled, but HTML elements are not + * removed. Each element created by ImageMapster is assigned a class of + * "mapster_el", which can be used to target them for later removal, though + * it is not easy to complete this process manually because of the wrapper + * and styles applied during configuration, which will be left intact when + * using "preserveState." */ - mouseoutDelay?: number; + mapster(method: ImageMapster.Unbind, preserveState?: boolean): JQuery; /** - * sort the values before calling onGetList + * snapshot: take a "snapshot" of the current selection state, and reset + * ImageMapster * - * If a non-false value or "asc" is passed, the list will be sorted in - * ascending order by the area value from mapValue. If "desc" is - * passed, the list will be sorted in descending order. + * This option is similar to unbind with preserveState. After a snapshot, + * any active selections will still appear as they did at the time of the + * snapshot, but they are no longer part of the ImageMapster. This is + * useful for configuring an initial state, or creating complex + * representations that may not be easily accomplished with area + * configuration options. + * + * For example, you could bind in image with a specific set of options; + * programatically select some areas; and take a snapshot; then set new + * options that cause a different rendering mode. This way you could have + * certain areas appear differently from the selection highlight, but be + * "highlighted again" using the new rendering options. Any effects in + * place at the time of the snapshot essentially become part of the image + * and are not affected by future operations. */ - sortList?: boolean | "asc" | "desc"; + mapster(method: ImageMapster.Snapshot): JQuery; /** - * time (in milliseconds) to wait for images to load before giving up + * rebind: rebind ImageMapster with new options * - * When first bound, ImageMapster has to wait for the source image,and - * any altImage images to load before it can finish binding. This is - * necessary because otherwise it's not alwasy possible to know the - * native size of the images. After this period of time, ImageMapster - * will give up. If you have particularly large pages or images, you - * may want to increase this to account for long load times. + * This method is similar to set_options, in that its purpose is to change + * options for an existing bound map. However, unlike set_options rebind + * will immediately apply all the new options to the existing map. This + * means that rendering options will change areas that are already selected + * to be rendered with the new options. If you pass area-specific options, + * these will also be applied, e.g. you could cause new areas to be + * selected by passing selected: true in an area specific options. + * + * set_options, in contrast only changes the options, and does not apply + * them to any existing data. When using set_options the new options only + * apply to future actions. */ - configTimeout?: number; + mapster(method: ImageMapster.Rebind, options: ImageMapster.Options): JQuery; /** - * Automatically scale imagemaps to match the size of a - * dynamically-scaled image. + * resize: change the size of the image and map * - * When you render an image, you can optionally define a size through - * CSS or using the "height" and "width" attributes. If omitted, the - * image will be displayed in its native size. If included, browsers - * will automatically resize the image to display in the dimensions you - * have provided. + * This will resize the image map to the dimensions specified. Note that + * either width or height should be passed, and the other will be + * calculated in the same aspect ratio as the original image. If you pass + * both, only the width will be used to calculate the new dimensions: the + * proportions must remain the same as the original image. (Though I intend + * to allow scaling without constraining proportions, it will be difficult + * to make work for certain shapes -- e.g. circles, which would have to + * become ovals). * - * Starting with 1.1.3, ImageMapster will automatically recalculate all - * area data to match the effective size of the image. This means that - * you can set the size of your image to anything you want and - * ImageMapster will work with no changes at all needed to the "area" - * data. + * This method will recalculate and re-render the entire imagemap, so it + * will work exactly the same under the new sizing scheme. When the image + * is unbound, the imagemap will be restored to its original condition. * - * If this behavior is not desired for some reason, this can be - * disabled by setting this option to false. + * When using HTML5 canvases, any existing selections, etc. will be + * preserved during the animation. VML data cannot be resized dynamically, + * however, so in IE<9 the selections will be erased, then redrawn when the + * animation is complete. */ - scaleMap?: boolean; + mapster(method: ImageMapster.Resize, width: number, height: number, duration?: number): JQuery; /** - * Treat areas containing the onhref attribute (or missing the href - * attribute) as masks. This is true by default. + * keys: get the primary mapKey (or comma-separated list of keys) for an + * area, set of areas, or key group. Version 1.2.4.050 * - * Set this to "false" to disable automatic masking of these areas. You - * can control them explicitly by creating independent groups for areas - * you wish to mask and assigning the isMask area-specific option when - * using this option. + * This method allows you to obtain the primary mapKey (or keys) associated + * with another key, or one or more areas. If the all parameter is true, + * the method returns all keys or groups that include the area. * - * There are some things to be aware of when using nohref and masking: + * When using area groups, it is possible for more than one key to be + * associated with a map area. It's also possible for an area to be + * highlighted from code as part of a group, but be inaccessible to the + * end-user. This is because area groups are separate physical entities + * from the areas defined by their primary key. They can have different + * options, and are highlighted independently. Note: the way area groups + * work is not well documented here yet. I am working on a more + * comprehensive tutorial for the site. In the meantime please see this + * example which describes area groups in detail, and shows how they work + * through an active demonstration. * - * * You must put the area that include the nohref attribute before - * other areas that overlap it, or it will be ignored. + * There are reasons you may want to be able to access the primary keys + * that make up an area group directly. Perhaps you want to select a group + * of areas using the options from a group - but not as a separate group. + * Perhaps you want to be able to compare the area clicked against a group + * you have defined to take some action if the area is a member of a + * certain group. This method provides access to that information. * - * * You should also explicitly omit the href tag when using nohref. - * - * * Due to limitations in rendering with VML (e.g. Internet Explorer - * 6-8), it is not possible to create a true mask, which would allow - * the underlying image to show through the masked area. Instead, the - * "masked" areas are rendered on top of the highlighted area in a - * different color. This can be specified for each area (see the - * fillColorMask option below) to create the best possible effect. + * This method allows working with groups in a variety of ways by providing + * access to a complete list of primary keys in any group, or all keys + * which contain a given primary key. */ - noHrefIsMask?: boolean; + mapster(method: ImageMapster.Keys, key: string, all?: boolean): string | string[]; + mapster(method: ImageMapster.Keys, all: boolean): string | string[]; /** - * a jQuery object whose elements are bound to the map. + * set_options: set active options * - * boundList can be any list of objects. To be bound to the map, they - * must contain an attribute whose name is identified by the option - * listKey, and whose value matches the value in an area tag's mapKey - * attribute. If more than one element in the list has the same value, - * the action will affect all matching elements. + * When called without the "options" parameter, returns an object with all + * active options. When the parameter is included, the active options are + * updated for the imagemap, and any area options are merged with existing + * area options. Unlike "rebind", this will not rebind or reapply any + * options, but only update the state. This may affect future actions, but + * it will not change any existing state information. */ - boundList?: JQuery; + mapster(method: ImageMapster.SetOptions, options?: ImageMapster.Options): JQuery; /** - * enable tooltips + * get_options: get active options * - * When showToolTip is true, mapster will look for a property called - * toolTip in the areas option for a an area. If present, a tool tip - * dialog will be shown on mouseover for that area. It will - * automatically be closed according to the behavior specified by - * toolTipClose. This option does not apply at the item level, but - * rather enables tooltips for the entire map. At the item level, only - * the presence of tooltip data is necessary for a tooltip to appear. + * When called with no parameters, returns the options that the mapster was + * configured using. When called with a single key it returns the + * area-specific options assigned to that area. The final parameter + * effective determines whether the actual options in effect for this area, + * or the specific options assigned are returned. + * + * Areas inherit the global options assigned, but can be overridden by + * area-specific options. The "effective" options contain all options + * including those that are inherited, as well as any specifically assigned + * to the area. */ - showToolTip?: boolean; + mapster(method: ImageMapster.GetOptions, key?: string, effective?: boolean): ImageMapster.Options | ImageMapster.AreaRenderingOptions; /** - * HTML describing the popup that will be created for tooltips. + * tooltip: show/hide tooltips from code * - * A div with some simple styling is included as the default tooltip - * container. This can be replaced with anything using this option. + * See the tooltip options section below for options to control how + * tooltips appear and are dismissed. * - * When tooltips are rendered, the code attempts to determine the best - * place for it. It will try to position it in near the top-left part - * of the area, and continue to try other corners in order to render it - * within the confines of the container where the image map resides. If - * it can't be placed within the image, it will be placed in the - * lower-right corner and extend outside the image. + * This method can be used to manipulate tooltips from code. If the global + * showToolTip option is false, these methods will still work, so you have + * the ability to control tooltips bound to areas completely using your own + * logic, if desired. These methods can also be used to have better control + * over events needed to close the tooltip, e.g. you could have no tooltip + * closing event, but add a "close" button to your contianer that will + * cause the tooltip to close when clicked. */ - toolTipContainer?: string | JQuery; - - /** - * specify the behavior that causes a toolTip to close. - * - * This option should be passed an array of strings that define the - * events that cause active tooltips to close. The array can include - * one or more of the following stings: - * - * 'area-mouseout' - tooltips close when the mouse pointer leaves the - * area that activated it. This is the default. - * - * 'area-click' - tooltips close when another area (or the same one) is - * clicked - * - * 'tooltip-click' - tooltips close when the tooltip itself is clicked - * anywhere - * - * 'image-mouseout' - tooltips close when the mouse pointer leaves the - * image itself. - * - * Under any circumstances, active tooltip will disappear when a new - * one is created. You don't have to define an automatic closing - * behavior; setting this option to an empty array will result in - * tooltips never closing, leaving it to you to close them manually - * though the tooltip method. - */ - toolTipClose?: ToolTipCloseEvent[]; - - /** - * callback when a hotspot area is clicked. Return false to cancel - * default select action, or true to navigate to the 'href' - */ - - /** - * a callback when an area is clicked.:silent doautocmd FocusLost % - * - * This event occurs when the usual click event happens, but includes - * data from the mapster about the area: - * - * This can be used to perform additional actions on a click without - * binding another event and having to obtain information manually. - */ - onClick?: (data: OnClickData) => void; - - /** - * callback when mouse enters a bound area. - * - * This function is called when the mouse enters a bound area. - */ - onMouseover?: (data: OnMouseData) => void; - - /** - * callback when mouse leavesd a bound area. - * - * Callback when the mouse leaves a bound area. The data structure - * passed to the callback is the same as onMouseover. - */ - onMouseout?: (data: OnMouseData) => void; - - /** - * a callback on mapster initialization that provides summary data - * about the image map, and expects a jQuery list to be returned. - * - * This callback allows you to dynamically provide a boundList based on - * summary data from the imagemap itself, rather than providing the - * list up front. The event passes an array of AreaData objects - * - * The client should return a jQuery object containing all the elements - * that make up the bound list, the same as if it was assigned - * manually. - */ - onGetList?: (data: OnGetListData) => JQuery; - - /** - * a callback when the mapster has finished initial configuration - * - * This event is fired when the mapster configuration completes. When - * control execution continues after a first-time bind operation, the - * mapster is not guaranteed to be configured, because images are - * loaded asynchronously by web browsers. If a mapster is bound to an - * image that is not yet loaded, it will attempt to rebind every 200 - * milliseconds. This event will be fired when it is eventually - * successful, or the length of time specified by configTimeout is - * exceeded (default of ten seconds). - * - * The altImage option will also increase the time needed to configure, - * because the alternate image is loaded by the client at configure - * time to ensure it is available immediately when needed. - */ - onConfigured?: (success: boolean) => void; - - /** - * callback when area state is changed (either highlight or select). - * - * onStateChange can be used to get more specific information than the - * mouseover or click events. - */ - onStateChange?: (data: OnStateChangeData) => void; - - /** - * callback when a toolTip is created - * - * This can be used to control tooltip closing behavior directly, if - * desired. - */ - onShowToolTip?: (data: OnShowToolTipData) => void; + mapster(method: ImageMapster.Tooltip, key?: string): JQuery; } } - -interface JQuery { - - /** - * - * All images in the jQuery object will be bound. The specific example - * above will attempt to bind to all images present on the page. Each image - * must be bound to an image map identified with the usemap attribute. If - * there is no usemap attribute, or it does not refer to a valid map, then - * the image will be ignored. Therefore you can use this syntax to activate - * all imagemaps on a page. Because pages often contain many images, - * though, it will be faster to select just the image you are targeting - * using a more specific selector. - * - * Images are often not completely loaded when script execution begins. - * ImageMapster will ensure that all images are loaded before it permits - * interaction from the client. If an alternate image is specified, this - * will also be preloaded. - * - * Because images are loaded asynchronously, code execution will often - * return to your script before the ImageMapster is available. If you apply - * other methods to it (such as selecting or deselecting areas), these - * commands will be queued until the image has been loaded, and then - * executed automatically. So you don't need to worry about using callbacks - * for initial configuration. You can assign a function to a callback when - * configuration is complete if needed to perform other setup activities on - * the page. - */ - mapster(options?: ImageMapster.Options): JQuery; - - /** - * select: Cause an area to become selected. This is similar to a user - * click, but will not cause a click event to be fired. - * - * Programatically select elements from the image map. The programmatic - * selection/deselection methods will not honor the staticState property. - */ - mapster(method: ImageMapster.Select): void; - - /** - * deselect: Cause an area to become deselected - * - * The opposite of select, this causes an area to become deselected. If it - * was not previously selected, nothing changes. - */ - mapster(method: ImageMapster.Deselect): void; - - /** - * set: select or deselect an area - * - * Select or deselect elements from jQuery objects wrapping "area" tags on - * the map based on truthiness of selected. If the area represents a bound - * area on the imagemap, it will be selected or deselected. The method can - * be called from an AREA, or from a bound image, passing a specific key as - * a 2nd parameter - * - * If the selected parameter is omitted (or anything other than "true" or - * "false") then the state of each area will be toggled. - * - * You can include an object containing rendering options as the last - * parameter. When present, these will supercede the default and - * area-specific rendering options. - */ - mapster(method: ImageMapster.Set, selected: boolean, options: ImageMapster.RenderingOptions): JQuery; - mapster(method: ImageMapster.Set, options: ImageMapster.RenderingOptions): JQuery; - - /** - * get: get keys for all selected areas - * - * When no "key" parameter is included, returns a comma-separated list of - * keys representing the areas currently selected. If specified, returns - * true or false indicating whether the area specified is selected. - */ - mapster(method: ImageMapster.Get, key?: string): string | boolean; - - /** - * highlight: highlight, clear, or return highlight state - * - * This method is used to control or obtain the current highlight state. - * Setting the highlight does not mimic a mouseover, rather, it only sets - * the highlight. Events and tooltips will not be activated. Even using - * these methods, it is not possible to highlight more than one area at a - * time. If another area is highlighted programatically, any existing - * highlight will be removed. - * - * Once set this way, the highlight will be removed when any user-event - * that would normally cause a highlight to be removed occurs (e.g. moving - * the mouse into any area), or it is removed programatically. - */ - mapster(method: ImageMapster.Highlight, flag?: string | boolean): void; - - /** - * unbind: unbind ImageMapster from an image - * - * Removes the ImageMapster binding from an image and restores it to its - * original state. All visible elements (selections, tooltips) will be - * removed. - * - * If the optional "preserveState" parameter is true, the selection overlay - * and any active tooltips will be preserved. Tooltips can still be - * dismissed by a user click, but once unbound, the selection states can no - * longer be controlled either by the user or programatically. To remove - * them, the actual DOM elements must be removed. - * - * Notes: When a mapster is first bound, several things happen. A div - * element is created which wraps the image. A copy is made of the original - * image, and the original image is set be transparent. This allows - * creating visible elements for the selections & highlights without - * interfering with the image map. Additionally, canvas elements are - * created (for HTML5 browsers), or a VML elements are created for Internet - * Explorer, to render the effects. Profile information about each bound - * image map is stored in memory, and finally, event handlers are bound to - * the image map. - * - * The "unbind" method cleans up these resources: it removes the wrapper, - * restores the image to its original visibility state, and releases - * internal resources. When using 'preserveState', the internal resources - * are cleaned up and event handling is disabled, but HTML elements are not - * removed. Each element created by ImageMapster is assigned a class of - * "mapster_el", which can be used to target them for later removal, though - * it is not easy to complete this process manually because of the wrapper - * and styles applied during configuration, which will be left intact when - * using "preserveState." - */ - mapster(method: ImageMapster.Unbind, preserveState?: boolean): JQuery; - - /** - * snapshot: take a "snapshot" of the current selection state, and reset - * ImageMapster - * - * This option is similar to unbind with preserveState. After a snapshot, - * any active selections will still appear as they did at the time of the - * snapshot, but they are no longer part of the ImageMapster. This is - * useful for configuring an initial state, or creating complex - * representations that may not be easily accomplished with area - * configuration options. - * - * For example, you could bind in image with a specific set of options; - * programatically select some areas; and take a snapshot; then set new - * options that cause a different rendering mode. This way you could have - * certain areas appear differently from the selection highlight, but be - * "highlighted again" using the new rendering options. Any effects in - * place at the time of the snapshot essentially become part of the image - * and are not affected by future operations. - */ - mapster(method: ImageMapster.Snapshot): JQuery; - - /** - * rebind: rebind ImageMapster with new options - * - * This method is similar to set_options, in that its purpose is to change - * options for an existing bound map. However, unlike set_options rebind - * will immediately apply all the new options to the existing map. This - * means that rendering options will change areas that are already selected - * to be rendered with the new options. If you pass area-specific options, - * these will also be applied, e.g. you could cause new areas to be - * selected by passing selected: true in an area specific options. - * - * set_options, in contrast only changes the options, and does not apply - * them to any existing data. When using set_options the new options only - * apply to future actions. - */ - mapster(method: ImageMapster.Rebind, options: ImageMapster.Options): JQuery; - - /** - * resize: change the size of the image and map - * - * This will resize the image map to the dimensions specified. Note that - * either width or height should be passed, and the other will be - * calculated in the same aspect ratio as the original image. If you pass - * both, only the width will be used to calculate the new dimensions: the - * proportions must remain the same as the original image. (Though I intend - * to allow scaling without constraining proportions, it will be difficult - * to make work for certain shapes -- e.g. circles, which would have to - * become ovals). - * - * This method will recalculate and re-render the entire imagemap, so it - * will work exactly the same under the new sizing scheme. When the image - * is unbound, the imagemap will be restored to its original condition. - * - * When using HTML5 canvases, any existing selections, etc. will be - * preserved during the animation. VML data cannot be resized dynamically, - * however, so in IE<9 the selections will be erased, then redrawn when the - * animation is complete. - */ - mapster(method: ImageMapster.Resize, width: number, height: number, duration?: number): JQuery; - - /** - * keys: get the primary mapKey (or comma-separated list of keys) for an - * area, set of areas, or key group. Version 1.2.4.050 - * - * This method allows you to obtain the primary mapKey (or keys) associated - * with another key, or one or more areas. If the all parameter is true, - * the method returns all keys or groups that include the area. - * - * When using area groups, it is possible for more than one key to be - * associated with a map area. It's also possible for an area to be - * highlighted from code as part of a group, but be inaccessible to the - * end-user. This is because area groups are separate physical entities - * from the areas defined by their primary key. They can have different - * options, and are highlighted independently. Note: the way area groups - * work is not well documented here yet. I am working on a more - * comprehensive tutorial for the site. In the meantime please see this - * example which describes area groups in detail, and shows how they work - * through an active demonstration. - * - * There are reasons you may want to be able to access the primary keys - * that make up an area group directly. Perhaps you want to select a group - * of areas using the options from a group - but not as a separate group. - * Perhaps you want to be able to compare the area clicked against a group - * you have defined to take some action if the area is a member of a - * certain group. This method provides access to that information. - * - * This method allows working with groups in a variety of ways by providing - * access to a complete list of primary keys in any group, or all keys - * which contain a given primary key. - */ - mapster(method: ImageMapster.Keys, key: string, all?: boolean): string | string[]; - mapster(method: ImageMapster.Keys, all: boolean): string | string[]; - - /** - * set_options: set active options - * - * When called without the "options" parameter, returns an object with all - * active options. When the parameter is included, the active options are - * updated for the imagemap, and any area options are merged with existing - * area options. Unlike "rebind", this will not rebind or reapply any - * options, but only update the state. This may affect future actions, but - * it will not change any existing state information. - */ - mapster(method: ImageMapster.SetOptions, options?: ImageMapster.Options): JQuery; - - /** - * get_options: get active options - * - * When called with no parameters, returns the options that the mapster was - * configured using. When called with a single key it returns the - * area-specific options assigned to that area. The final parameter - * effective determines whether the actual options in effect for this area, - * or the specific options assigned are returned. - * - * Areas inherit the global options assigned, but can be overridden by - * area-specific options. The "effective" options contain all options - * including those that are inherited, as well as any specifically assigned - * to the area. - */ - mapster(method: ImageMapster.GetOptions, key?: string, effective?: boolean): ImageMapster.Options | ImageMapster.AreaRenderingOptions; - - /** - * tooltip: show/hide tooltips from code - * - * See the tooltip options section below for options to control how - * tooltips appear and are dismissed. - * - * This method can be used to manipulate tooltips from code. If the global - * showToolTip option is false, these methods will still work, so you have - * the ability to control tooltips bound to areas completely using your own - * logic, if desired. These methods can also be used to have better control - * over events needed to close the tooltip, e.g. you could have no tooltip - * closing event, but add a "close" button to your contianer that will - * cause the tooltip to close when clicked. - */ - mapster(method: ImageMapster.Tooltip, key?: string): JQuery; -} From 1c162e09ae25b927131566e4866be8ab8c6abd31 Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Fri, 23 Jun 2017 21:41:26 -0400 Subject: [PATCH 065/180] [jquery.bbq] Fix missing @types/jquery dependency. --- types/jquery.bbq/index.d.ts | 296 ++++++++++++++++++------------------ 1 file changed, 150 insertions(+), 146 deletions(-) diff --git a/types/jquery.bbq/index.d.ts b/types/jquery.bbq/index.d.ts index 1860d63343..7040200d11 100644 --- a/types/jquery.bbq/index.d.ts +++ b/types/jquery.bbq/index.d.ts @@ -3,156 +3,160 @@ // Definitions by: Adam R. Smith // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare namespace JQueryBbq { +import $ = require('jquery'); + +declare global { + namespace JQueryBbq { + + interface JQuery { + /** + * Adds a 'state' into the browser history at the current position, setting + * location.hash and triggering any bound callbacks + * (provided the new state is different than the previous state). + * + * @name params A serialized params string or a hash string beginning with # to merge into location.hash. + * @name merge_mode Merge behavior defaults to 0 if merge_mode is not specified (unless a hash string beginning with # is specified, in which case merge behavior defaults to 2) + */ + pushState(params?: string, merge_mode?: number): void; + + pushState(params?: any, merge_mode?: number): void; + + /** + * Retrieves the current 'state' from the browser history, parsing + * location.hash for a specific key or returning an object containing the + * entire state, optionally coercing numbers, booleans, null and undefined + * values. + * + * @name key An optional state key for which to return a value. + * @name coerce If true, coerces any numbers or true, false, null, and undefined to their actual value. Defaults to false + */ + getState(key?: string, coerce?: boolean): any; + + getState(coerce?: boolean): any; + + /** + * Remove one or more keys from the current browser history 'state', creating + * a new state, setting location.hash and triggering any bound + * callbacks (provided the new state is different than + * the previous state). + * + * @name key One or more key values to remove from the current state. + */ + removeState(...key: any[]): void; + } + + interface ParamFragment { + (url?: string): string; + + (url: string, params: any, merge_mode?: number): string; + + /** + * Specify characters that will be left unescaped when fragments are created + * or merged using , or when the fragment is modified + * using . This option only applies to serialized data + * object fragments, and not set-as-string fragments. Does not affect the + * query string. Defaults to ",/" (comma, forward slash). + * + * @name chars The characters to not escape in the fragment. If unspecified, defaults to empty string (escape all characters). + */ + noEscape: (chars?: string) => void; + + /** + * TODO: DESCRIBE + * + * @name state TODO: DESCRIBE + */ + ajaxCrawlable(state?: boolean): boolean; + } + + interface JQueryDeparam { + /** + * Deserialize a params string into an object, optionally coercing numbers, + * booleans, null and undefined values; this method is the counterpart to the + * internal jQuery.param method. + * + * @name params A params string to be parsed. + * @name coerce If true, coerces any numbers or true, false, null, and undefined to their actual value. Defaults to false if omitted. + */ + (params: string, coerce?: boolean): any; + + + /** + * Parse the query string from a URL or the current window.location.href, + * deserializing it into an object, optionally coercing numbers, booleans, + * null and undefined values. + * + * @name url An optional params string or URL containing query string params to be parsed. If url is omitted, the current window.location.href is used. + * @name coerce If true, coerces any numbers or true, false, null, and undefined to their actual value. Defaults to false if omitted. + */ + querystring(url?: string, coerce?: boolean): any; + + /** + * Parse the fragment (hash) from a URL or the current window.location.href, + * deserializing it into an object, optionally coercing numbers, booleans, + * null and undefined values. + * + * @name url An optional params string or URL containing fragment (hash) params to be parsed. If url is omitted, the current window.location.href is used. + * @name coerce If true, coerces any numbers or true, false, null, and undefined to their actual value. Defaults to false if omitted. + */ + fragment(url?: string, coerce?: boolean): any; + } + + interface EventObject extends JQueryEventObject { + fragment: string; + + getState(key?: string, coerce?: boolean); + } + } + + interface JQueryParam { + /** + * Parse the query string from a URL or the current window.location.href, + * deserializing it into an object, optionally coercing numbers, booleans, + * null and undefined values. + * + * @name url An optional params string or URL containing query string params to be parsed. If url is omitted, the current window.location.href is used. + * @name coerce (Boolean) If true, coerces any numbers or true, false, null, and undefined to their actual value. Defaults to false if omitted. + * @name merge_mode An object representing the deserialized params string. + */ + querystring(url?: string, coerce?: boolean, merge_mode?: number): string; + + querystring(url?: string, coerce?: any, merge_mode?: number): string; + + fragment: JQueryBbq.ParamFragment; + + /** + * Returns a params string equivalent to that returned by the internal + * jQuery.param method, but sorted, which makes it suitable for use as a + * cache key. + * + * @name obj An object to be serialized. + * @name traditional Params deep/shallow serialization mode. See the documentation at http://api.jquery.com/jQuery.param/ for more detail. + */ + sorted(obj: any, traditional?: boolean): string; + } + + interface JQueryStatic { + bbq: JQueryBbq.JQuery; + + deparam: JQueryBbq.JQueryDeparam; + + /** + * Get the internal "Default URL attribute per tag" list, or augment the list + * with additional tag-attribute pairs, in case the defaults are insufficient. + * + * @name tag_attr An object containing a list of tag names and their associated default attribute names in the format { tag: 'attr', ... } to be merged into the internal tag-attribute list. + */ + elemUrlAttr(tag_attr?: any): any; + } interface JQuery { - /** - * Adds a 'state' into the browser history at the current position, setting - * location.hash and triggering any bound callbacks - * (provided the new state is different than the previous state). - * - * @name params A serialized params string or a hash string beginning with # to merge into location.hash. - * @name merge_mode Merge behavior defaults to 0 if merge_mode is not specified (unless a hash string beginning with # is specified, in which case merge behavior defaults to 2) - */ - pushState(params?: string, merge_mode?: number): void; + querystring(attr?: any, params?: any, merge_mode?: number): JQuery; - pushState(params?: any, merge_mode?: number): void; + fragment(attr?: any, params?: any, merge_mode?: number): JQuery; - /** - * Retrieves the current 'state' from the browser history, parsing - * location.hash for a specific key or returning an object containing the - * entire state, optionally coercing numbers, booleans, null and undefined - * values. - * - * @name key An optional state key for which to return a value. - * @name coerce If true, coerces any numbers or true, false, null, and undefined to their actual value. Defaults to false - */ - getState(key?: string, coerce?: boolean): any; + hashchange(eventData?: any, handler?: (eventObject: JQueryBbq.EventObject) => any): JQuery; - getState(coerce?: boolean): any; - - /** - * Remove one or more keys from the current browser history 'state', creating - * a new state, setting location.hash and triggering any bound - * callbacks (provided the new state is different than - * the previous state). - * - * @name key One or more key values to remove from the current state. - */ - removeState(...key: any[]): void; - } - - interface ParamFragment { - (url?: string): string; - - (url: string, params: any, merge_mode?: number): string; - - /** - * Specify characters that will be left unescaped when fragments are created - * or merged using , or when the fragment is modified - * using . This option only applies to serialized data - * object fragments, and not set-as-string fragments. Does not affect the - * query string. Defaults to ",/" (comma, forward slash). - * - * @name chars The characters to not escape in the fragment. If unspecified, defaults to empty string (escape all characters). - */ - noEscape: (chars?: string) => void; - - /** - * TODO: DESCRIBE - * - * @name state TODO: DESCRIBE - */ - ajaxCrawlable(state?: boolean): boolean; - } - - interface JQueryDeparam { - /** - * Deserialize a params string into an object, optionally coercing numbers, - * booleans, null and undefined values; this method is the counterpart to the - * internal jQuery.param method. - * - * @name params A params string to be parsed. - * @name coerce If true, coerces any numbers or true, false, null, and undefined to their actual value. Defaults to false if omitted. - */ - (params: string, coerce?: boolean): any; - - - /** - * Parse the query string from a URL or the current window.location.href, - * deserializing it into an object, optionally coercing numbers, booleans, - * null and undefined values. - * - * @name url An optional params string or URL containing query string params to be parsed. If url is omitted, the current window.location.href is used. - * @name coerce If true, coerces any numbers or true, false, null, and undefined to their actual value. Defaults to false if omitted. - */ - querystring(url?: string, coerce?: boolean): any; - - /** - * Parse the fragment (hash) from a URL or the current window.location.href, - * deserializing it into an object, optionally coercing numbers, booleans, - * null and undefined values. - * - * @name url An optional params string or URL containing fragment (hash) params to be parsed. If url is omitted, the current window.location.href is used. - * @name coerce If true, coerces any numbers or true, false, null, and undefined to their actual value. Defaults to false if omitted. - */ - fragment(url?: string, coerce?: boolean): any; - } - - interface EventObject extends JQueryEventObject { - fragment: string; - - getState(key?: string, coerce?: boolean); + hashchange(handler: (eventObject: JQueryBbq.EventObject) => any): JQuery; } } - -interface JQueryParam { - /** - * Parse the query string from a URL or the current window.location.href, - * deserializing it into an object, optionally coercing numbers, booleans, - * null and undefined values. - * - * @name url An optional params string or URL containing query string params to be parsed. If url is omitted, the current window.location.href is used. - * @name coerce (Boolean) If true, coerces any numbers or true, false, null, and undefined to their actual value. Defaults to false if omitted. - * @name merge_mode An object representing the deserialized params string. - */ - querystring(url?: string, coerce?: boolean, merge_mode?: number): string; - - querystring(url?: string, coerce?: any, merge_mode?: number): string; - - fragment: JQueryBbq.ParamFragment; - - /** - * Returns a params string equivalent to that returned by the internal - * jQuery.param method, but sorted, which makes it suitable for use as a - * cache key. - * - * @name obj An object to be serialized. - * @name traditional Params deep/shallow serialization mode. See the documentation at http://api.jquery.com/jQuery.param/ for more detail. - */ - sorted(obj: any, traditional?: boolean): string; -} - -interface JQueryStatic { - bbq: JQueryBbq.JQuery; - - deparam: JQueryBbq.JQueryDeparam; - - /** - * Get the internal "Default URL attribute per tag" list, or augment the list - * with additional tag-attribute pairs, in case the defaults are insufficient. - * - * @name tag_attr An object containing a list of tag names and their associated default attribute names in the format { tag: 'attr', ... } to be merged into the internal tag-attribute list. - */ - elemUrlAttr(tag_attr?: any): any; -} - -interface JQuery { - querystring(attr?: any, params?: any, merge_mode?: number): JQuery; - - fragment(attr?: any, params?: any, merge_mode?: number): JQuery; - - hashchange(eventData?: any, handler?: (eventObject: JQueryBbq.EventObject) => any): JQuery; - - hashchange(handler: (eventObject: JQueryBbq.EventObject) => any): JQuery; -} From bfec425192161ab6c0ef0fa539f04e04ae1e4556 Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Fri, 23 Jun 2017 21:41:40 -0400 Subject: [PATCH 066/180] [jquery.joyride] Fix missing @types/jquery dependency. --- types/jquery.joyride/index.d.ts | 519 ++++++++++++++++---------------- 1 file changed, 261 insertions(+), 258 deletions(-) diff --git a/types/jquery.joyride/index.d.ts b/types/jquery.joyride/index.d.ts index 05e5b5e2d9..d67262f4af 100644 --- a/types/jquery.joyride/index.d.ts +++ b/types/jquery.joyride/index.d.ts @@ -3,269 +3,272 @@ // Definitions by: Vincent Bortone // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/** -* HTML segments for tip layout -*/ -interface JoyrideTemplate { - /** - * Link template - * @member {string} - */ - link?: string; +import $ = require('jquery'); +declare global { /** - * Timer template - * @member {string} - */ - timer?: string; + * HTML segments for tip layout + */ + interface JoyrideTemplate { + /** + * Link template + * @member {string} + */ + link?: string; - /** - * Tip template - * @member {string} - */ - tip?: string; + /** + * Timer template + * @member {string} + */ + timer?: string; - /** - * Wrapper template - * @member {string} - */ - wrapper?: string; + /** + * Tip template + * @member {string} + */ + tip?: string; - /** - * Button template - * @member {string} - */ - button?: string; + /** + * Wrapper template + * @member {string} + */ + wrapper?: string; - /** - * Modal template - * @member {string} - */ - modal?: string; + /** + * Button template + * @member {string} + */ + button?: string; - /** - * Exposed Cover template - * @member {string} - */ - exposeCover?: string; -} - -interface JoyrideOptions { - /** - * Version - * @member {string} - */ - version?: string; - - /** - * 'top' or 'bottom' in relation to parent - * @member {string} - */ - tipLocation?: string; - - /** - * override on a per tooltip bases - * @member {any} - */ - nubPosition?: any; - - /** - * whether to scroll to tips - * @member {boolean} - */ - scroll?: boolean; - - /** - * Page scrolling speed in ms - * @member {number} - */ - scrollSpeed?: number; - - /** - * 0 = off, all other numbers = time(ms) - * @member {number} - */ - timer?: number; - - /** - * true or false - false tour starts when restart called - * @member {boolean} - */ - autoStart?: boolean; - - /** - * true/false to start timer on first click - * @member {boolean} - */ - startTimerOnClick?: boolean; - - /** - * the index of the tooltip you want to start on (index of the li) - * @member {number} - */ - startOffset?: number; - - /** - * true/false for next button visibility - * @member {boolean} - */ - nextButton?: boolean; - - /** - * 'pop' or 'fade' in each tip - * @member {string} - */ - tipAnimation?: string; - - /** - * array of indexes where to pause the tour after - * @member {any[]} - */ - pauseAfter?: any[]; - - /** - * if 'fade'- speed in ms of transition - * @member {number} - */ - tipAnimationFadeSpeed?: number; - - /** - * true/false for whether cookies are used - * @member {boolean} - */ - cookieMonster?: boolean; - - /** - * choose your own cookie name - * member {string} - */ - cookieName?: string; - - /** - * Will this cookie be attached to a domain, ie. '.notableapp.com' - * @member {any} - */ - cookieDomain?: any; - - /** - * Set to '/' if you want the cookie for the whole website - * @member {any} - */ - cookiePath?: any; - - /** - * true or false to control whether localstorage is used - * @member {boolean} - */ - localStorage?: boolean; - - /** - * Keyname in localstorage - @member {string} - */ - localStorageKey?: string; - - /** - * Where the tip be attached if not inline - * @member {HTMLElement} - */ - tipContainer?: HTMLElement; - - /** - * Whether to cover page with modal during the tour - * @member {boolean} - */ - modal?: boolean; - - /** - * Whether to expose the elements at each step in the tour (requires modal:true) - * @member {boolean} - */ - expose?: boolean; - - /** - * A method to call after an element has been exposed - * @method - * @param {number} index Tip Index - * @param {JQuery} nextTip Tip object - * @param {JQuery} el Element - */ - postExposeCallback?: (index: number, nextTip: JQuery, el?: JQuery) => void; - - /** - * A method to call before the tour starts (passed index, tip, and cloned exposed element) - * @method - * @param {number} index Current Tip Index - * @param {JQuery} currentTip Current Tip object - * @param {JQuery} el Element - */ - preRideCallback?: (index: number, currentTip: JQuery, el?: JQuery) => void; - - /** - * a method to call once the tour closes - * @method - * @param {number} index Current Tip Index - * @param {JQuery} currentTip Current Tip object - * @param {boolean} isAborted Is Aborted? - */ - postRideCallback?: (index: number, currentTip: JQuery, isAborted?: boolean) => void; - - /** - * A method to call after each step - * @method - * @param {number} index Current Tip Index - * @param {JQuery} currentTip Current Tip object - * @param {boolean} isAborted Is Aborted? - */ - postStepCallback?: (index: number, currentTip: JQuery, isAborted?: boolean) => void; - - /** - * A method to call before each step - * @method - * @param {number} index Tip Index - * @param {JQuery} nextTip Tip object - * @param {JQuery} el Element - */ - preStepCallback?: (index: number, nextTip: JQuery, el?: JQuery) => void; - - /** - * HTML segments for tip layout - * @member {JoyrideTemplate} - */ - template?: JoyrideTemplate; -} - -interface Joyride -{ - /** - * Default function, no options - * @method - * @return {JQuery} JQuery instance - */ - (): JQuery; - - /** - * Function with options - * @method - * @param {JoyrideOptions} options An object with all the joyride options you want to overwrite. - * @return {JQuery} JQuery instance - */ - (options: JoyrideOptions): JQuery; - - /** - * Function with method name and params - * @method - * @param {string} methodName Name of method to call. - * @param {any[]} params parameters for method - * @return {JQuery} JQuery instance - */ - (methodName: string, ...params: any[]): JQuery; -} - -interface JQuery { - /** - * joyride function - * @return {Joyride} Joyride instance. - */ - joyride: Joyride; + /** + * Modal template + * @member {string} + */ + modal?: string; + + /** + * Exposed Cover template + * @member {string} + */ + exposeCover?: string; + } + + interface JoyrideOptions { + /** + * Version + * @member {string} + */ + version?: string; + + /** + * 'top' or 'bottom' in relation to parent + * @member {string} + */ + tipLocation?: string; + + /** + * override on a per tooltip bases + * @member {any} + */ + nubPosition?: any; + + /** + * whether to scroll to tips + * @member {boolean} + */ + scroll?: boolean; + + /** + * Page scrolling speed in ms + * @member {number} + */ + scrollSpeed?: number; + + /** + * 0 = off, all other numbers = time(ms) + * @member {number} + */ + timer?: number; + + /** + * true or false - false tour starts when restart called + * @member {boolean} + */ + autoStart?: boolean; + + /** + * true/false to start timer on first click + * @member {boolean} + */ + startTimerOnClick?: boolean; + + /** + * the index of the tooltip you want to start on (index of the li) + * @member {number} + */ + startOffset?: number; + + /** + * true/false for next button visibility + * @member {boolean} + */ + nextButton?: boolean; + + /** + * 'pop' or 'fade' in each tip + * @member {string} + */ + tipAnimation?: string; + + /** + * array of indexes where to pause the tour after + * @member {any[]} + */ + pauseAfter?: any[]; + + /** + * if 'fade'- speed in ms of transition + * @member {number} + */ + tipAnimationFadeSpeed?: number; + + /** + * true/false for whether cookies are used + * @member {boolean} + */ + cookieMonster?: boolean; + + /** + * choose your own cookie name + * member {string} + */ + cookieName?: string; + + /** + * Will this cookie be attached to a domain, ie. '.notableapp.com' + * @member {any} + */ + cookieDomain?: any; + + /** + * Set to '/' if you want the cookie for the whole website + * @member {any} + */ + cookiePath?: any; + + /** + * true or false to control whether localstorage is used + * @member {boolean} + */ + localStorage?: boolean; + + /** + * Keyname in localstorage + @member {string} + */ + localStorageKey?: string; + + /** + * Where the tip be attached if not inline + * @member {HTMLElement} + */ + tipContainer?: HTMLElement; + + /** + * Whether to cover page with modal during the tour + * @member {boolean} + */ + modal?: boolean; + + /** + * Whether to expose the elements at each step in the tour (requires modal:true) + * @member {boolean} + */ + expose?: boolean; + + /** + * A method to call after an element has been exposed + * @method + * @param {number} index Tip Index + * @param {JQuery} nextTip Tip object + * @param {JQuery} el Element + */ + postExposeCallback?: (index: number, nextTip: JQuery, el?: JQuery) => void; + + /** + * A method to call before the tour starts (passed index, tip, and cloned exposed element) + * @method + * @param {number} index Current Tip Index + * @param {JQuery} currentTip Current Tip object + * @param {JQuery} el Element + */ + preRideCallback?: (index: number, currentTip: JQuery, el?: JQuery) => void; + + /** + * a method to call once the tour closes + * @method + * @param {number} index Current Tip Index + * @param {JQuery} currentTip Current Tip object + * @param {boolean} isAborted Is Aborted? + */ + postRideCallback?: (index: number, currentTip: JQuery, isAborted?: boolean) => void; + + /** + * A method to call after each step + * @method + * @param {number} index Current Tip Index + * @param {JQuery} currentTip Current Tip object + * @param {boolean} isAborted Is Aborted? + */ + postStepCallback?: (index: number, currentTip: JQuery, isAborted?: boolean) => void; + + /** + * A method to call before each step + * @method + * @param {number} index Tip Index + * @param {JQuery} nextTip Tip object + * @param {JQuery} el Element + */ + preStepCallback?: (index: number, nextTip: JQuery, el?: JQuery) => void; + + /** + * HTML segments for tip layout + * @member {JoyrideTemplate} + */ + template?: JoyrideTemplate; + } + + interface Joyride { + /** + * Default function, no options + * @method + * @return {JQuery} JQuery instance + */ + (): JQuery; + + /** + * Function with options + * @method + * @param {JoyrideOptions} options An object with all the joyride options you want to overwrite. + * @return {JQuery} JQuery instance + */ + (options: JoyrideOptions): JQuery; + + /** + * Function with method name and params + * @method + * @param {string} methodName Name of method to call. + * @param {any[]} params parameters for method + * @return {JQuery} JQuery instance + */ + (methodName: string, ...params: any[]): JQuery; + } + + interface JQuery { + /** + * joyride function + * @return {Joyride} Joyride instance. + */ + joyride: Joyride; + } } From cd798c1e6f18f8842f4a811aae026b715045b69f Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Fri, 23 Jun 2017 21:41:58 -0400 Subject: [PATCH 067/180] [jsdeferred] Fix missing @types/jquery dependency. --- types/jsdeferred/index.d.ts | 172 ++++++++++++++++++++---------------- 1 file changed, 97 insertions(+), 75 deletions(-) diff --git a/types/jsdeferred/index.d.ts b/types/jsdeferred/index.d.ts index 4002ffaee8..9cae18ee60 100644 --- a/types/jsdeferred/index.d.ts +++ b/types/jsdeferred/index.d.ts @@ -3,79 +3,101 @@ // Definitions by: Daisuke Mino // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -interface Loop { - begin?: number; - end?: number; - step?: number; +import $ = require('jquery'); + +declare global { + interface Loop { + begin?: number; + end?: number; + step?: number; + } + + interface ConnectOption { + target: any; + args?: any[]; + ok?: number; + ng?: number; + } + + interface RetryOption { + wait: number; + } + + interface DeferredizedFunction { (...arg: any[]): Deferred; } + interface DeferredizedFunctionWithNumber { (n: number): Deferred; } + interface FunctionWithNumber { (i: number, o?: any): any; } + interface ErrorCallback { (d: Deferred, ...args: any[]): any; } + + class Deferred { + + static methods: string[]; + + static isDeferred(obj: any): boolean; + + static next(fun: Function): Deferred; + + static chain(...args: any[]): Deferred; + + static wait(n: number): Deferred; + + static call(fun?: Function, ...args: any[]): Deferred; + + static parallel(dl: any): Deferred; + + static earlier(dl: any): Deferred; + + static loop(n: number, fun: FunctionWithNumber): Deferred; + static loop(n: Loop, fun: FunctionWithNumber): Deferred; + + static repeat(n: number, fun: FunctionWithNumber): Deferred; + + static register(name: string, fun: DeferredizedFunction): void; + + static connect(funo: any, options: string): DeferredizedFunction; + static connect(funo: Function, options?: ConnectOption): DeferredizedFunction; + + static retry(retryCount: number, funcDeferred: DeferredizedFunctionWithNumber, options?: RetryOption): Deferred; + + static define(obj?: any, list?: string[]): any; + + constructor(); + + next(fun: Function): Deferred; + + wait(n: number): Deferred; + + error(fun: ErrorCallback): Deferred; + + call(val?: any): Deferred; + + fail(err: any): Deferred; + + cancel(): Deferred; + + parallel(dl: any): Deferred; + + loop(n: number, fun: FunctionWithNumber): Deferred; + loop(n: Loop, fun: FunctionWithNumber): Deferred; + } + + interface JQueryXHR { + next(fun: Function): Deferred; + } + + function chain(...args: any[]): Deferred; + + function wait(n: number): Deferred; + + function call(fun?: Function, ...args: any[]): Deferred; + + function parallel(dl: any): Deferred; + + function earlier(dl: any): Deferred; + + function loop(n: number, fun: FunctionWithNumber): Deferred; + function loop(n: Loop, fun: FunctionWithNumber): Deferred; + + function repeat(n: number, fun: FunctionWithNumber): Deferred; + + function next(fun: Function): Deferred; } - -interface ConnectOption { - target: any; - args?: any[]; - ok?: number; - ng?: number; -} - -interface RetryOption { - wait: number; -} - -interface DeferredizedFunction { (...arg: any[]): Deferred; } -interface DeferredizedFunctionWithNumber { (n: number): Deferred; } -interface FunctionWithNumber { (i: number, o?: any): any; } -interface ErrorCallback { (d: Deferred, ...args: any[]): any; } - -declare class Deferred { - - static methods: string[]; - static isDeferred(obj: any): boolean; - static next(fun: Function): Deferred; - static chain(...args: any[]): Deferred; - static wait(n: number): Deferred; - static call(fun?: Function, ...args: any[]): Deferred; - static parallel(dl: any): Deferred; - static earlier(dl: any): Deferred; - - static loop(n: number, fun: FunctionWithNumber): Deferred; - static loop(n: Loop, fun: FunctionWithNumber): Deferred; - - static repeat(n: number, fun: FunctionWithNumber): Deferred; - static register(name: string, fun: DeferredizedFunction): void; - - static connect(funo: any, options: string): DeferredizedFunction; - static connect(funo: Function, options?: ConnectOption): DeferredizedFunction; - - static retry(retryCount: number, funcDeferred: DeferredizedFunctionWithNumber, options?: RetryOption): Deferred; - static define(obj?: any, list?: string[]): any; - - constructor(); - - next(fun: Function): Deferred; - wait(n: number): Deferred; - error(fun: ErrorCallback): Deferred; - call(val?: any): Deferred; - fail(err: any): Deferred; - cancel(): Deferred; - parallel(dl: any): Deferred; - - loop(n: number, fun: FunctionWithNumber): Deferred; - loop(n: Loop, fun: FunctionWithNumber): Deferred; -} - -interface JQueryXHR { - next(fun: Function): Deferred; -} - -declare function chain(...args: any[]): Deferred; -declare function wait(n: number): Deferred; -declare function call(fun?: Function, ...args: any[]): Deferred; -declare function parallel(dl: any): Deferred; -declare function earlier(dl: any): Deferred; - -declare function loop(n: number, fun: FunctionWithNumber): Deferred; -declare function loop(n: Loop, fun: FunctionWithNumber): Deferred; - -declare function repeat(n: number, fun: FunctionWithNumber): Deferred; - -declare function next(fun: Function): Deferred; - From dddc76636954b1a3ddbdd827e08563f06743bbf3 Mon Sep 17 00:00:00 2001 From: Nicolas Voigt Date: Sat, 24 Jun 2017 14:35:27 +0200 Subject: [PATCH 068/180] setEncoding in stream interface --- types/node/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 131dbc96a1..2d15ee12c2 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -6,6 +6,7 @@ // Roberto Desideri // Christian Vaagland Tellnes // Wilco Bakker +// Nicolas Voigt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -307,7 +308,7 @@ declare namespace NodeJS { export interface ReadableStream extends EventEmitter { readable: boolean; read(size?: number): string | Buffer; - setEncoding(encoding: string | null): this; + setEncoding(encoding?: string): this; pause(): this; resume(): this; isPaused(): boolean; From d1ffcfe713c59d06de73be8aad8b5e60be4c4289 Mon Sep 17 00:00:00 2001 From: Roberts Slisans Date: Sat, 24 Jun 2017 15:43:13 +0300 Subject: [PATCH 069/180] Update index.d.ts Accepted proposed change from pull request --- types/mongoose-simple-random/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/mongoose-simple-random/index.d.ts b/types/mongoose-simple-random/index.d.ts index deed6a036f..cf41c64241 100644 --- a/types/mongoose-simple-random/index.d.ts +++ b/types/mongoose-simple-random/index.d.ts @@ -4,6 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// +// tslint:disable-next-line no-single-declare-module declare module "mongoose" { interface Model extends NodeJS.EventEmitter, ModelProperties { findRandom(conditions: Object, projection?: Object | null, options?: Object | null, callback?: (err: any, res: T[]) => void) From 56020af82175db6e4645874ceeb5c59cfff2bc97 Mon Sep 17 00:00:00 2001 From: abrahambotros Date: Sat, 24 Jun 2017 09:22:23 -0700 Subject: [PATCH 070/180] [react-navigation] Fix and extend tests --- .../react-navigation-tests.tsx | 104 ++++++++++++++---- 1 file changed, 83 insertions(+), 21 deletions(-) diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index b3370f412d..835e63d756 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -2,14 +2,19 @@ import * as React from 'react'; import { TouchableOpacity, View, + ViewStyle, } from 'react-native'; import { addNavigationHelpers, + NavigationRouteConfigMap, NavigationScreenProp, NavigationScreenProps, NavigationStackAction, + NavigationStackScreenOptions, NavigationTabScreenOptions, StackNavigator, + StackNavigatorConfig, + TabNavigator, TabNavigatorConfig, TabBarTop, Transitioner, @@ -18,11 +23,21 @@ import { NavigationTransitionProps, } from 'react-navigation'; +// Constants +const viewStyle: ViewStyle = { + flex: 1, + margin: 42, + padding: 0, + backgroundColor: "white", +}; + + /** * @class StartScreen @extends React.Component * @desc Simple screen component class with typed component props that should * receive the navigation prop from the AppNavigator. */ +const ROUTE_NAME_START_SCREEN = "StartScreen"; interface StartScreenNavigationParams { id: number, s: string, @@ -79,30 +94,39 @@ const initialRouteParams: StartScreenNavigationParams = { id: 1, s: "Start", }; -export const AppNavigator = StackNavigator({ - StartImage: { - path: 'startImage', +const routeConfigMap: NavigationRouteConfigMap = { + [ROUTE_NAME_START_SCREEN]: { + path: "start", screen: StartScreen, }, -}, { - initialRouteName: 'StartImage', - initialRouteParams, -}); + [ROUTE_NAME_NEXT_SCREEN]: { + path: "next", + screen: NextScreen, + }, +}; +export const AppNavigator = StackNavigator( + routeConfigMap, + { + initialRouteName: ROUTE_NAME_START_SCREEN, + initialRouteParams, + }, +); /** * Router. */ const Router = (props: any) => ( - true, - state: {}, - }) - } + true, + state: {}, + }) + } /> ); + /** * Tab navigator. */ @@ -112,11 +136,55 @@ const tabNavigatorScreenOptions: NavigationTabScreenOptions = { tabBarVisible: true, tabBarIcon: , tabBarLabel: 'label', -} +}; const tabNavigatorConfig: TabNavigatorConfig = { lazy: true, tabBarComponent: TabBarTop, + tabBarOptions: tabNavigatorScreenOptions, +}; + +const BasicTabNavigator = TabNavigator( + routeConfigMap, + tabNavigatorConfig, +); + +function renderBasicTabNavigator(): JSX.Element { + return ( + { }} + style={viewStyle} + /> + ); +} + + +/** + * Stack navigator. + */ + +const stackNavigatorScreenOptions: NavigationStackScreenOptions = { + title: 'title', +}; + +const stackNavigatorConfig: StackNavigatorConfig = { + mode: "card", + headerMode: "screen", + navigationOptions: stackNavigatorScreenOptions, +}; + +const BasicStackNavigator = StackNavigator( + routeConfigMap, + stackNavigatorConfig, +); + +function renderBasicStackNavigator(): JSX.Element { + return ( + { }} + style={viewStyle} + /> + ); } @@ -151,9 +219,3 @@ class CustomTransitioner extends React.Component return {} } } - -const BasicStackNavigation = StackNavigator({ - StartScreen: { screen: Start } -}); - - From f8c68213bf02e6a29bfa6f3ef4b2cc85049e3d44 Mon Sep 17 00:00:00 2001 From: Michiel de Bruijne Date: Sat, 24 Jun 2017 16:41:47 +0200 Subject: [PATCH 071/180] [node] set correct type for process.env and fix node dependents --- types/dockerode/index.d.ts | 3 ++- types/jake/index.d.ts | 1 + types/libpq/index.d.ts | 2 +- types/main-bower-files/index.d.ts | 1 + types/node/index.d.ts | 6 ++++- types/passport-beam/index.d.ts | 3 ++- types/passport-facebook-token/index.d.ts | 1 + types/passport-facebook/index.d.ts | 1 + types/passport-github/index.d.ts | 1 + .../passport-github/passport-github-tests.ts | 22 ++++++++++++++++--- types/passport-google-oauth/index.d.ts | 1 + types/passport-twitter/index.d.ts | 1 + types/pg-types/package.json | 2 +- types/pty.js/index.d.ts | 1 + types/stylus/index.d.ts | 1 + types/swagger-express-mw/index.d.ts | 1 + types/swagger-hapi/index.d.ts | 1 + types/swagger-node-runner/index.d.ts | 1 + types/swagger-restify-mw/index.d.ts | 1 + types/swagger-tools/index.d.ts | 1 + 20 files changed, 44 insertions(+), 8 deletions(-) diff --git a/types/dockerode/index.d.ts b/types/dockerode/index.d.ts index a4a1144872..ec2808cf3d 100644 --- a/types/dockerode/index.d.ts +++ b/types/dockerode/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/apocas/dockerode // Definitions by: Carl Winkler , Nicolas Laplante // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// @@ -637,7 +638,7 @@ declare namespace Dockerode { interface DockerOptions { socketPath?: string; host?: string; - port?: number; + port?: number | string; ca?: string; cert?: string; key?: string; diff --git a/types/jake/index.d.ts b/types/jake/index.d.ts index cb23f992f0..6abb7e125c 100644 --- a/types/jake/index.d.ts +++ b/types/jake/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/mde/jake // Definitions by: Kon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/libpq/index.d.ts b/types/libpq/index.d.ts index 49c00db818..d336d95c9f 100644 --- a/types/libpq/index.d.ts +++ b/types/libpq/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/brianc/node-libpq#readme // Definitions by: Vlad Rindevich // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 +// TypeScript Version: 2.2 /// diff --git a/types/main-bower-files/index.d.ts b/types/main-bower-files/index.d.ts index 0a00b19b8b..f3cc5e7228 100644 --- a/types/main-bower-files/index.d.ts +++ b/types/main-bower-files/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/ck86/main-bower-files // Definitions by: Keita Kagurazaka // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 131dbc96a1..21d48b504a 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -400,6 +400,10 @@ declare namespace NodeJS { isTTY?: true; } + export interface ProcessEnv { + [key: string]: string | undefined + } + export interface Process extends EventEmitter { stdout: Socket; stderr: Socket; @@ -413,7 +417,7 @@ declare namespace NodeJS { chdir(directory: string): void; cwd(): string; emitWarning(warning: string | Error, name?: string, ctor?: Function): void; - env: any; + env: ProcessEnv; exit(code?: number): never; exitCode: number; getgid(): number; diff --git a/types/passport-beam/index.d.ts b/types/passport-beam/index.d.ts index 7d34ef4173..852ac6f698 100644 --- a/types/passport-beam/index.d.ts +++ b/types/passport-beam/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/alfw/passport-beam // Definitions by: AtlasDev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// /// @@ -31,4 +32,4 @@ export namespace Strategy { _raw: any; _json: any; } -} \ No newline at end of file +} diff --git a/types/passport-facebook-token/index.d.ts b/types/passport-facebook-token/index.d.ts index 173992a701..49bfc62d11 100644 --- a/types/passport-facebook-token/index.d.ts +++ b/types/passport-facebook-token/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/drudge/passport-facebook-token // Definitions by: Ray Martone // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/passport-facebook/index.d.ts b/types/passport-facebook/index.d.ts index cd35cbe0c8..01db85012d 100644 --- a/types/passport-facebook/index.d.ts +++ b/types/passport-facebook/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/jaredhanson/passport-facebook // Definitions by: James Roland Cabresos , Lucas Acosta // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/passport-github/index.d.ts b/types/passport-github/index.d.ts index 38704a0a88..0b0880bb05 100644 --- a/types/passport-github/index.d.ts +++ b/types/passport-github/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/jaredhanson/passport-github // Definitions by: Yasunori Ohoka // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import passport = require('passport'); import express = require('express'); diff --git a/types/passport-github/passport-github-tests.ts b/types/passport-github/passport-github-tests.ts index 72697a7dd2..10c24a366d 100644 --- a/types/passport-github/passport-github-tests.ts +++ b/types/passport-github/passport-github-tests.ts @@ -11,11 +11,27 @@ const User = { } }; +const callbackURL = process.env.PASSPORT_GITHUB_CALLBACK_URL; +const clientID = process.env.PASSPORT_GITHUB_CONSUMER_KEY; +const clientSecret = process.env.PASSPORT_GITHUB_CONSUMER_SECRET; + +if (typeof callbackURL === "undefined") { + throw new Error("callbackURL is undefined"); +} + +if (typeof clientID === "undefined") { + throw new Error("clientID is undefined"); +} + +if (typeof clientSecret === "undefined") { + throw new Error("clientSecret is undefined"); +} + passport.use(new github.Strategy( { - clientID: process.env.PASSPORT_GITHUB_CONSUMER_KEY, - clientSecret: process.env.PASSPORT_GITHUB_CONSUMER_SECRET, - callbackURL: process.env.PASSPORT_GITHUB_CALLBACK_URL + callbackURL, + clientID, + clientSecret }, (accessToken: string, refreshToken: string, profile: github.Profile, done: (error: any, user?: any) => void) => { User.findOrCreate(profile.id, profile.provider, (err, user) => { diff --git a/types/passport-google-oauth/index.d.ts b/types/passport-google-oauth/index.d.ts index 50930a45ad..cefd05fe20 100644 --- a/types/passport-google-oauth/index.d.ts +++ b/types/passport-google-oauth/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/jaredhanson/passport-facebook // Definitions by: James Roland Cabresos // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/passport-twitter/index.d.ts b/types/passport-twitter/index.d.ts index f819ef721d..41cee10286 100644 --- a/types/passport-twitter/index.d.ts +++ b/types/passport-twitter/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/jaredhanson/passport-twitter // Definitions by: James Roland Cabresos // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/pg-types/package.json b/types/pg-types/package.json index 4c6d24a445..d33ff913ce 100644 --- a/types/pg-types/package.json +++ b/types/pg-types/package.json @@ -2,4 +2,4 @@ "dependencies": { "moment": ">=2.14.0" } -} \ No newline at end of file +} diff --git a/types/pty.js/index.d.ts b/types/pty.js/index.d.ts index 49acad6260..c54022279b 100644 --- a/types/pty.js/index.d.ts +++ b/types/pty.js/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/chjj/pty.js // Definitions by: Vadim Macagon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/stylus/index.d.ts b/types/stylus/index.d.ts index a2a75b2ebc..47854aaf60 100644 --- a/types/stylus/index.d.ts +++ b/types/stylus/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/LearnBoost/stylus // Definitions by: Maxime LUCE // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/swagger-express-mw/index.d.ts b/types/swagger-express-mw/index.d.ts index 04c09866d6..104bd0fc39 100644 --- a/types/swagger-express-mw/index.d.ts +++ b/types/swagger-express-mw/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/apigee-127/swagger-express#readme // Definitions by: Michael Mrowetz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /* =================== USAGE =================== diff --git a/types/swagger-hapi/index.d.ts b/types/swagger-hapi/index.d.ts index 2c723cbf61..7e62dbbdbb 100644 --- a/types/swagger-hapi/index.d.ts +++ b/types/swagger-hapi/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/apigee-127/swagger-hapi#readme // Definitions by: Michael Mrowetz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /* =================== USAGE =================== diff --git a/types/swagger-node-runner/index.d.ts b/types/swagger-node-runner/index.d.ts index 033abb434b..79118bb2e5 100644 --- a/types/swagger-node-runner/index.d.ts +++ b/types/swagger-node-runner/index.d.ts @@ -2,6 +2,7 @@ // Project: https://www.npmjs.com/package/swagger-node-runner // Definitions by: Michael Mrowetz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /* =================== USAGE =================== diff --git a/types/swagger-restify-mw/index.d.ts b/types/swagger-restify-mw/index.d.ts index c9518b2ecb..efc63693f3 100644 --- a/types/swagger-restify-mw/index.d.ts +++ b/types/swagger-restify-mw/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/apigee-127/swagger-restify#readme // Definitions by: Michael Mrowetz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /* =================== USAGE =================== import * as SwaggerRestify from "swagger-restify-mw"; diff --git a/types/swagger-tools/index.d.ts b/types/swagger-tools/index.d.ts index 09d42138b6..a697e9d7e8 100644 --- a/types/swagger-tools/index.d.ts +++ b/types/swagger-tools/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/apigee-127/swagger-tools // Definitions by: Alex Brick // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import { NextHandleFunction } from 'connect'; import { IncomingMessage } from 'http'; From 073b961832e1552c98d38722d13f89a9fbda2abf Mon Sep 17 00:00:00 2001 From: Benjamin Feng Date: Tue, 16 May 2017 23:39:02 -0500 Subject: [PATCH 072/180] Unwrap Bluebird.props() via generics --- types/bluebird/bluebird-tests.ts | 12 +++++++++++- types/bluebird/index.d.ts | 14 +++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/types/bluebird/bluebird-tests.ts b/types/bluebird/bluebird-tests.ts index e616ae3f85..8aef9daa66 100644 --- a/types/bluebird/bluebird-tests.ts +++ b/types/bluebird/bluebird-tests.ts @@ -576,7 +576,6 @@ barProm = fooArrProm.spread((one: Foo, two: Bar, twotwo: Foo) => { //TODO fix collection inference barArrProm = fooProm.all(); -objProm = fooProm.props(); fooInspectionPromise = fooProm.reflect(); barProm = fooProm.any(); barArrProm = fooProm.some(num); @@ -584,6 +583,17 @@ barProm = fooProm.race(); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +var propsValue: { num: number, str: string }; +Promise.resolve({ num: 1, str: Promise.resolve('a') }).props().then(val => { propsValue = val }); +Promise.props({ num: 1, str: Promise.resolve('a') }).then(val => { propsValue = val }); +Promise.props(Promise.props({ num: 1, str: Promise.resolve('a') })).then(val => { propsValue = val }); + +var propsMapValue: Map; +Promise.resolve(new Map>()).props().then(val => { propsMapValue = val }); +Promise.props(new Map>()).then(val => { propsMapValue = val }); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Promise.all([fooProm, barProm]).then(result => { result[0].foo(); result[1].bar(); diff --git a/types/bluebird/index.d.ts b/types/bluebird/index.d.ts index 8482e5fe6e..844dad53d4 100644 --- a/types/bluebird/index.d.ts +++ b/types/bluebird/index.d.ts @@ -620,8 +620,8 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { /** * Same as calling `Promise.props(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. */ - // TODO how to model instance.props()? - props(): Bluebird; + props(this: PromiseLike | V>>): Bluebird>; + props(this: PromiseLike>): Bluebird; /** * Same as calling `Promise.any(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. @@ -806,11 +806,13 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { * * *The original object is not modified.* */ - // TODO verify this is correct // trusted promise for object - static props(object: Bluebird): Bluebird; + static props(map: PromiseLike | V>>): Bluebird>; + static props(object: PromiseLike>): Bluebird; + // map + static props(map: Map | V>): Bluebird>; // object - static props(object: Object): Bluebird; + static props(object: Bluebird.ResolvableProps): Bluebird; /** * Like `Promise.some()`, with 1 as `count`. However, if the promise fulfills, the fulfillment value is not an array of 1 but the value directly. @@ -1074,6 +1076,8 @@ declare namespace Bluebird { /** @deprecated Use PromiseLike directly. */ export type Thenable = PromiseLike; + export type ResolvableProps = object & { [K in keyof T]: PromiseLike | T[K] }; + export interface Resolver { /** * Returns a reference to the controlled promise that can be passed to clients. From c678a29fc7f31317ade405e9c55556cf33c8e5d5 Mon Sep 17 00:00:00 2001 From: rajab Date: Sun, 25 Jun 2017 00:39:23 +0300 Subject: [PATCH 073/180] add react-burger-menu definitions --- types/react-burger-menu/index.d.ts | 53 +++++++++++++++++++ .../react-burger-menu-tests.tsx | 21 ++++++++ types/react-burger-menu/tsconfig.json | 24 +++++++++ types/react-burger-menu/tslint.json | 1 + 4 files changed, 99 insertions(+) create mode 100644 types/react-burger-menu/index.d.ts create mode 100644 types/react-burger-menu/react-burger-menu-tests.tsx create mode 100644 types/react-burger-menu/tsconfig.json create mode 100644 types/react-burger-menu/tslint.json diff --git a/types/react-burger-menu/index.d.ts b/types/react-burger-menu/index.d.ts new file mode 100644 index 0000000000..a05ce2215c --- /dev/null +++ b/types/react-burger-menu/index.d.ts @@ -0,0 +1,53 @@ +// Type definitions for react-burger-menu 2.1 +// Project: https://github.com/negomi/react-burger-menu +// Definitions by: Rajab Shakirov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as React from "react"; + +interface Props { + burgerBarClassName?: string; + burgerButtonClassName?: string; + crossButtonClassName?: string; + crossClassName?: string; + customBurgerIcon?: Element | false; + customCrossIcon?: Element | false; + id?: string; + isOpen?: boolean; + itemListClassName?: string; + menuClassName?: string; + morphShapeClassName?: string; + noOverlay?: boolean; + onStateChange?(): void; + // TODO (Rajab) This can be improved, though I do not know how. From PropTypes: + // styles && styles.outerContainer ? PropTypes.string.isRequired : PropTypes.string + outerContainerId?: string; + overlayClassName?: string; + // TODO (Rajab) This can be improved, though I do not know how. From PropTypes: + // styles && styles.pageWrap ? PropTypes.string.isRequired : PropTypes.string, + pageWrapId?: string; + right?: boolean; + styles?: { + bmBurgerButton: CSSStyleDeclaration; + bmBurgerBars: CSSStyleDeclaration; + bmCrossButton: CSSStyleDeclaration; + bmCross: CSSStyleDeclaration; + bmMenu: CSSStyleDeclaration; + bmMorphShape: CSSStyleDeclaration; + bmItemList: CSSStyleDeclaration; + bmOverlay: CSSStyleDeclaration; + }; + width?: number | string; +} + +declare class ReactBurgerMenu extends React.Component { } + +export class slide extends ReactBurgerMenu { } +export class stack extends ReactBurgerMenu { } +export class elastic extends ReactBurgerMenu { } +export class bubble extends ReactBurgerMenu { } +export class push extends ReactBurgerMenu { } +export class pushRotate extends ReactBurgerMenu { } +export class scaleDown extends ReactBurgerMenu { } +export class scaleRotate extends ReactBurgerMenu { } +export class fallDown extends ReactBurgerMenu { } diff --git a/types/react-burger-menu/react-burger-menu-tests.tsx b/types/react-burger-menu/react-burger-menu-tests.tsx new file mode 100644 index 0000000000..562b7ee3da --- /dev/null +++ b/types/react-burger-menu/react-burger-menu-tests.tsx @@ -0,0 +1,21 @@ +import * as React from 'react'; +import { slide as Menu } from 'react-burger-menu'; + +class Example extends React.Component { + showSettings(event: { + preventDefault: Function; + }) { + event.preventDefault(); + } + + render() { + return ( + + Home + About + Contact + Settings + + ); + } +} \ No newline at end of file diff --git a/types/react-burger-menu/tsconfig.json b/types/react-burger-menu/tsconfig.json new file mode 100644 index 0000000000..19dc806fbe --- /dev/null +++ b/types/react-burger-menu/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-burger-menu-tests.tsx" + ] +} diff --git a/types/react-burger-menu/tslint.json b/types/react-burger-menu/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-burger-menu/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From bdf2a661c803c5635a95393f9e2c32e2aa6d3e5e Mon Sep 17 00:00:00 2001 From: rajab Date: Sun, 25 Jun 2017 01:16:52 +0300 Subject: [PATCH 074/180] fix react-burger-menu definitions for pr --- types/react-burger-menu/index.d.ts | 72 ++++++++++--------- .../react-burger-menu-tests.tsx | 6 +- 2 files changed, 41 insertions(+), 37 deletions(-) diff --git a/types/react-burger-menu/index.d.ts b/types/react-burger-menu/index.d.ts index a05ce2215c..6d3a508c97 100644 --- a/types/react-burger-menu/index.d.ts +++ b/types/react-burger-menu/index.d.ts @@ -5,42 +5,46 @@ import * as React from "react"; -interface Props { - burgerBarClassName?: string; - burgerButtonClassName?: string; - crossButtonClassName?: string; - crossClassName?: string; - customBurgerIcon?: Element | false; - customCrossIcon?: Element | false; - id?: string; - isOpen?: boolean; - itemListClassName?: string; - menuClassName?: string; - morphShapeClassName?: string; - noOverlay?: boolean; - onStateChange?(): void; - // TODO (Rajab) This can be improved, though I do not know how. From PropTypes: - // styles && styles.outerContainer ? PropTypes.string.isRequired : PropTypes.string - outerContainerId?: string; - overlayClassName?: string; - // TODO (Rajab) This can be improved, though I do not know how. From PropTypes: - // styles && styles.pageWrap ? PropTypes.string.isRequired : PropTypes.string, - pageWrapId?: string; - right?: boolean; - styles?: { - bmBurgerButton: CSSStyleDeclaration; - bmBurgerBars: CSSStyleDeclaration; - bmCrossButton: CSSStyleDeclaration; - bmCross: CSSStyleDeclaration; - bmMenu: CSSStyleDeclaration; - bmMorphShape: CSSStyleDeclaration; - bmItemList: CSSStyleDeclaration; - bmOverlay: CSSStyleDeclaration; - }; - width?: number | string; +// TODO (Rajab) actually I don't want export Props, but +// `npm run lint react-burger-menu` error doesn't allow me to do it; +export interface Props { + burgerBarClassName?: string; + burgerButtonClassName?: string; + crossButtonClassName?: string; + crossClassName?: string; + customBurgerIcon?: Element | false; + customCrossIcon?: Element | false; + id?: string; + isOpen?: boolean; + itemListClassName?: string; + menuClassName?: string; + morphShapeClassName?: string; + noOverlay?: boolean; + onStateChange?(): void; + // TODO (Rajab) This can be improved, though I do not know how. From PropTypes: + // styles && styles.outerContainer ? PropTypes.string.isRequired : PropTypes.string + outerContainerId?: string; + overlayClassName?: string; + // TODO (Rajab) This can be improved, though I do not know how. From PropTypes: + // styles && styles.pageWrap ? PropTypes.string.isRequired : PropTypes.string, + pageWrapId?: string; + right?: boolean; + styles?: { + bmBurgerButton: CSSStyleDeclaration; + bmBurgerBars: CSSStyleDeclaration; + bmCrossButton: CSSStyleDeclaration; + bmCross: CSSStyleDeclaration; + bmMenu: CSSStyleDeclaration; + bmMorphShape: CSSStyleDeclaration; + bmItemList: CSSStyleDeclaration; + bmOverlay: CSSStyleDeclaration; + }; + width?: number | string; } -declare class ReactBurgerMenu extends React.Component { } +// TODO (Rajab) actually I don't want export ReactBurgerMenu, but +// `npm run lint react-burger-menu` error doesn't allow me to do it; +export class ReactBurgerMenu extends React.Component { } export class slide extends ReactBurgerMenu { } export class stack extends ReactBurgerMenu { } diff --git a/types/react-burger-menu/react-burger-menu-tests.tsx b/types/react-burger-menu/react-burger-menu-tests.tsx index 562b7ee3da..4a9190000b 100644 --- a/types/react-burger-menu/react-burger-menu-tests.tsx +++ b/types/react-burger-menu/react-burger-menu-tests.tsx @@ -1,9 +1,9 @@ import * as React from 'react'; import { slide as Menu } from 'react-burger-menu'; -class Example extends React.Component { +class Example extends React.Component<{}, {}> { showSettings(event: { - preventDefault: Function; + preventDefault(): void; }) { event.preventDefault(); } @@ -18,4 +18,4 @@ class Example extends React.Component { ); } -} \ No newline at end of file +} From 03e42972ba5b04c317e5906bdcc4e001900b0ec4 Mon Sep 17 00:00:00 2001 From: Alex Gentile Date: Sat, 24 Jun 2017 23:07:32 -0700 Subject: [PATCH 075/180] Update headerTitleStyle to extend TextStyle headerTitleStyle is a TextStyle, not a ViewStyle. --- types/react-navigation/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 829c897a6e..e64bfa26be 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -582,7 +582,7 @@ export interface StackNavigatorScreenOptions { headerRight?: React.ReactElement; headerLeft?: React.ReactElement; headerStyle?: ViewStyle; - headerTitleStyle?: ViewStyle; + headerTitleStyle?: TextStyle; headerTintColor?: string; headerPressColorAndroid?: string; gesturesEnabled?: boolean; From b9553156553c86d5d230f76dfd4f13ec04689acf Mon Sep 17 00:00:00 2001 From: Jeremy Marzka Date: Sun, 25 Jun 2017 09:52:29 -0500 Subject: [PATCH 076/180] knex: join supports object syntax when using a querybuilder --- types/knex/index.d.ts | 5 ++--- types/knex/knex-tests.ts | 8 ++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/types/knex/index.d.ts b/types/knex/index.d.ts index 2e301af850..a7c08661d2 100644 --- a/types/knex/index.d.ts +++ b/types/knex/index.d.ts @@ -177,9 +177,8 @@ declare namespace Knex { interface Join { (raw: Raw): QueryBuilder; - (builder: QueryBuilder, clause: (this: JoinClause) => void): QueryBuilder; - (tableName: string, columns: { [key: string]: string | number | Raw }): QueryBuilder; - (tableName: string, callback: Function): QueryBuilder; + (tableName: TableName, clause: (this: JoinClause) => void): QueryBuilder; + (tableName: TableName, columns: { [key: string]: string | number | Raw }): QueryBuilder; (tableName: TableName, raw: Raw): QueryBuilder; (tableName: TableName, column1: string, column2: string): QueryBuilder; (tableName: TableName, column1: string, raw: Raw): QueryBuilder; diff --git a/types/knex/knex-tests.ts b/types/knex/knex-tests.ts index 1f12a1044a..610f51cc1f 100644 --- a/types/knex/knex-tests.ts +++ b/types/knex/knex-tests.ts @@ -213,6 +213,14 @@ knex('users') .join(knex('contacts').select('user_id', 'phone').as('contacts'), 'users.id', 'contacts.user_id') .select('users.id', 'contacts.phone'); +knex('users') + .join(knex('contacts').select('user_id', 'phone').as('contacts'), { 'users.id': 'contacts.user_id' }) + .select('users.id', 'contacts.phone'); + +knex.select('*').from('users').join(knex('accounts').select('id', 'owner_id').as('accounts'), function() { + this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id') +}); + knex.select('*').from('users').join('accounts', function() { this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id') }); From 9cb211daaa67a45cd4cebd9652de0c025df10e8e Mon Sep 17 00:00:00 2001 From: myxvisual Date: Mon, 26 Jun 2017 13:06:41 +0800 Subject: [PATCH 077/180] Add forceCheck for react-lazyload forceCheck is available to manually trigger checking for elements in viewport. Helpful when LazyLoad components enter the viewport without resize or scroll events, e.g. when the components' container was hidden then become visible. --- types/react-lazyload/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/react-lazyload/index.d.ts b/types/react-lazyload/index.d.ts index 2766d998b0..7ec2ae156c 100644 --- a/types/react-lazyload/index.d.ts +++ b/types/react-lazyload/index.d.ts @@ -24,3 +24,5 @@ export default class LazyLoad extends Component { } export function lazyload(option: {}): LazyLoad; + +export function forceCheck(): void; From 505aa4bed39df28b1dc4312110f862935905b3eb Mon Sep 17 00:00:00 2001 From: myxvisual Date: Mon, 26 Jun 2017 13:08:32 +0800 Subject: [PATCH 078/180] Update react-lazyload-tests.tsx --- types/react-lazyload/react-lazyload-tests.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/types/react-lazyload/react-lazyload-tests.tsx b/types/react-lazyload/react-lazyload-tests.tsx index 37b928a99c..74353a51ed 100644 --- a/types/react-lazyload/react-lazyload-tests.tsx +++ b/types/react-lazyload/react-lazyload-tests.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import LazyLoad from "react-lazyload"; +import LazyLoad, { forceCheck } from "react-lazyload"; interface State { arr: string[]; @@ -14,6 +14,11 @@ class Normal extends React.Component<{}, State> { } this.state = { arr }; } + + componentDidMount() { + forceCheck(); + } + render() { return (
From 6bd192c61abd576bd0ff5f73d7acbd1d0f5161c3 Mon Sep 17 00:00:00 2001 From: Diogo Franco Date: Mon, 26 Jun 2017 14:21:19 +0900 Subject: [PATCH 079/180] jquery: Add null as a possible return value on val() ```ts $(``).val() === null ``` --- types/jquery/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index db7af3d2ad..ac047d0167 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -2329,7 +2329,7 @@ interface JQuery { * @see {@link https://api.jquery.com/val/} * @since 1.0 */ - val(): string | number | string[] | undefined; + val(): string | number | string[] | null | undefined; /** * Set the CSS width of each element in the set of matched elements. * From 90f3ef9cd7402afd6d503c11e675494f6de53809 Mon Sep 17 00:00:00 2001 From: myxvisual Date: Mon, 26 Jun 2017 14:08:49 +0800 Subject: [PATCH 080/180] fix: Fixed tsling no-trailing-whitespace error Sorry, I was online editor, did not notice the trailing space... --- types/react-lazyload/react-lazyload-tests.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-lazyload/react-lazyload-tests.tsx b/types/react-lazyload/react-lazyload-tests.tsx index 74353a51ed..ce9641dee4 100644 --- a/types/react-lazyload/react-lazyload-tests.tsx +++ b/types/react-lazyload/react-lazyload-tests.tsx @@ -14,7 +14,7 @@ class Normal extends React.Component<{}, State> { } this.state = { arr }; } - + componentDidMount() { forceCheck(); } From d1f7e5ff1b321728c63496a2a56b0fbd568528c9 Mon Sep 17 00:00:00 2001 From: Michael Handley Date: Wed, 21 Jun 2017 18:09:19 -0700 Subject: [PATCH 081/180] Update react-sortable-hoc to 0.6.3 --- types/react-sortable-hoc/index.d.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/types/react-sortable-hoc/index.d.ts b/types/react-sortable-hoc/index.d.ts index f4886cd7d6..767cf1405c 100644 --- a/types/react-sortable-hoc/index.d.ts +++ b/types/react-sortable-hoc/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for nes 0.0.7 +// Type definitions for nes 0.6.3 // Project: https://github.com/clauderic/react-sortable-hoc // Definitions by: Ivo Stratev , Charles Rey // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -33,12 +33,20 @@ declare module 'react-sortable-hoc' { export type ContainerGetter = (element: React.ReactElement) => HTMLElement; + export interface Dimensions { + width: number; + height: number; + } + export interface SortableContainerProps { axis?: Axis; lockAxis?: Axis; helperClass?: string; transitionDuration?: number; pressDelay?: number; + pressThreshold?: number; + distance?: number; + shouldCancelStart?: (event: SortEvent) => boolean; onSortStart?: SortStartHandler; onSortMove?: SortMoveHandler; onSortEnd?: SortEndHandler; @@ -48,7 +56,7 @@ declare module 'react-sortable-hoc' { lockToContainerEdges?: boolean; lockOffset?: Offset | [Offset, Offset]; getContainer?: ContainerGetter; - shouldCancelStart?: (event: SortEvent) => boolean; + getHelperDimensions?: (sort: SortStart) => Dimensions; } export interface SortableElementProps { From 763c1347f1eac4f3d6f07dcdeb14e31f68cc908f Mon Sep 17 00:00:00 2001 From: Michael Handley Date: Wed, 21 Jun 2017 18:09:37 -0700 Subject: [PATCH 082/180] Test typings for 0.6.3 update --- .../react-sortable-hoc-tests.tsx | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/types/react-sortable-hoc/react-sortable-hoc-tests.tsx b/types/react-sortable-hoc/react-sortable-hoc-tests.tsx index 4700612d01..af742734bf 100644 --- a/types/react-sortable-hoc/react-sortable-hoc-tests.tsx +++ b/types/react-sortable-hoc/react-sortable-hoc-tests.tsx @@ -35,21 +35,38 @@ const SortableList = ReactSortableHOC.SortableContainer((props: SortableListProp class SortableComponent extends React.Component<{}, SortableComponentState> { private _onSortEnd: ReactSortableHOC.SortEndHandler; - private _handleSotEnd(sort: ReactSortableHOC.SortEnd, event: ReactSortableHOC.SortEvent): void { + private _handleSortEnd(sort: ReactSortableHOC.SortEnd, event: ReactSortableHOC.SortEvent): void { this.setState({items: ReactSortableHOC.arrayMove(this.state.items, sort.oldIndex, sort.newIndex)}); } + private _getHelperDimensions(sort: ReactSortableHOC.SortStart): ReactSortableHOC.Dimensions { + if (sort.node instanceof HTMLElement) { + return ({ + width: sort.node.offsetWidth, + height: sort.node.offsetHeight + }); + } + return {width: 0, height: 0}; + } + public constructor() { super(); this.state = { items: ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6'], axis: 'x' }; - this._onSortEnd = this._handleSotEnd.bind(this); + this._onSortEnd = this._handleSortEnd.bind(this); } public render(): JSX.Element { - return ; + return ; } } From d8957d2d4314df556ed1304930af3d2bbc424015 Mon Sep 17 00:00:00 2001 From: Donald Pipowitch Date: Mon, 26 Jun 2017 09:48:48 +0200 Subject: [PATCH 083/180] Update index.d.ts --- types/autoprefixer/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/autoprefixer/index.d.ts b/types/autoprefixer/index.d.ts index b5249746d1..1957632053 100644 --- a/types/autoprefixer/index.d.ts +++ b/types/autoprefixer/index.d.ts @@ -7,7 +7,7 @@ import { Plugin, Transformer as PostcssTransformer } from 'postcss'; declare namespace autoprefixer { interface Options { - browsers?: string[]; + browsers?: string[] | string; env?: string; cascade?: boolean; add?: boolean; From 834287de2653a19b479a3715275f8cd750be595e Mon Sep 17 00:00:00 2001 From: Wouter Hardeman Date: Mon, 26 Jun 2017 10:06:33 +0200 Subject: [PATCH 084/180] Added types for react-sortable-tree 0.1 --- types/react-sortable-tree/index.d.ts | 120 ++++++++++++++++++ .../react-sortable-tree-tests.tsx | 66 ++++++++++ types/react-sortable-tree/tsconfig.json | 23 ++++ types/react-sortable-tree/tslint.json | 1 + .../utils/default-handlers.d.ts | 4 + .../utils/tree-data-utils.d.ts | 21 +++ 6 files changed, 235 insertions(+) create mode 100644 types/react-sortable-tree/index.d.ts create mode 100644 types/react-sortable-tree/react-sortable-tree-tests.tsx create mode 100644 types/react-sortable-tree/tsconfig.json create mode 100644 types/react-sortable-tree/tslint.json create mode 100644 types/react-sortable-tree/utils/default-handlers.d.ts create mode 100644 types/react-sortable-tree/utils/tree-data-utils.d.ts diff --git a/types/react-sortable-tree/index.d.ts b/types/react-sortable-tree/index.d.ts new file mode 100644 index 0000000000..961b218be4 --- /dev/null +++ b/types/react-sortable-tree/index.d.ts @@ -0,0 +1,120 @@ +// Type definitions for react-sortable-tree 0.1 +// Project: https://fritz-c.github.io/react-sortable-tree +// Definitions by: Wouter Hardeman +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as React from 'react'; +import { ListProps, Index } from 'react-virtualized'; +import { ConnectDragSource, ConnectDragPreview, DragSourceMonitor } from 'react-dnd'; + +export * from './utils/tree-data-utils'; +export * from './utils/default-handlers'; + +export interface TreeItem { + title?: string; + subtitle?: string; + expanded?: boolean; + children: TreeItem[]; + [x: string]: any; +} + +export interface TreeNode { + node: TreeItem; +} + +export interface TreePath { + path: NumberArrayOrStringArray; +} + +export interface TreeIndex { + treeIndex: number; +} + +export interface FullTree { + treeData: TreeItem[]; +} + +export interface NodeData extends TreeNode, TreePath, TreeIndex {} + +export interface SearchData extends NodeData { + searchQuery: any; +} + +export interface ExtendedNodeData extends NodeData { + lowerSiblingsCounts: number[]; + isSearchMatch: boolean; + isSearchFocus: boolean; +} + +export interface OnVisibilityToggleData extends FullTree, TreeNode { + expanded: boolean; +} +export interface PreviousAnNextLocation { + prevPath: number[]; + prevParent: TreeItem; + prevTreeIndex: number; + nextPath: number[]; + nextParent: TreeItem; + nextTreeIndex: number; +} + +export type NodeRenderer = React.Component; + +export interface NodeRendererProps { + node: TreeItem; + path: NumberArrayOrStringArray; + treeIndex: number; + isSearchMatch: boolean; + isSearchFocus: boolean; + canDrag: boolean; + scaffoldBlockPxWidth: number; + toggleChildrenVisibility?(data: NodeData): void; + buttons?: any[]; + className?: string; + style?: {[index: string]: any}; + + connectDragPreview: ConnectDragPreview; + connectDragSource: ConnectDragSource; + parentNode?: {[index: string]: any}; + startDrag: any; + endDrag: any; + isDragging: boolean; + didDrop: boolean; + draggedNode?: {[index: string]: any}; + isOver: boolean; + canDrop?: boolean; +} + +type NumberArrayOrStringArray = string[] | number[]; + +export interface ReactSortableTreeProps { + treeData: TreeItem[]; + onChange(treeData: TreeItem[]): void; + style?: {[index: string]: any; }; + className?: string; + innerStyle?: {[index: string]: any; }; + maxDepth?: number; + searchMethod?(data: SearchData): boolean; + searchQuery?: string | any; + searchFocusOffset?: number; + searchFinishCallback?(matches: NodeData[]): void; + generateNodeProps?(data: ExtendedNodeData): {[index: string]: any}; + getNodeKey?(data: TreeNode & TreeIndex): string | number; + onMoveNode?(data: NodeData & FullTree): void; + onVisibilityToggle?(data: OnVisibilityToggleData): void; + canDrag?: ((data: ExtendedNodeData) => boolean) | boolean; + canDrop?(data: PreviousAnNextLocation & NodeData): boolean; + reactVirtualizedListProps?: ListProps; + rowHeight?: ((info: Index) => number) | number; + slideRegionSize?: number; + scaffoldBlockPxWidth?: number; + isVirtualized?: boolean; + nodeContentRenderer?: NodeRenderer; +} + +declare const SortableTree: React.ComponentClass; + +export const SortableTreeWithoutDndContext: React.ComponentClass; + +export default SortableTree; diff --git a/types/react-sortable-tree/react-sortable-tree-tests.tsx b/types/react-sortable-tree/react-sortable-tree-tests.tsx new file mode 100644 index 0000000000..21c18410e5 --- /dev/null +++ b/types/react-sortable-tree/react-sortable-tree-tests.tsx @@ -0,0 +1,66 @@ +import * as React from "react"; +import SortableTree, + { + SortableTreeWithoutDndContext, + defaultGetNodeKey, + NodeRenderer, + TreeItem, + defaultSearchMethod, + SearchData, + NodeData, + ExtendedNodeData, + FullTree, + OnVisibilityToggleData, + PreviousAnNextLocation + } from "react-sortable-tree"; +import { ListProps, ListRowRenderer } from "react-virtualized"; + +class Test extends React.Component { + render() { + const treeData = [ + { + title: "Title", subtitle: "Subtitle", children: [ + {title: "Child 1", subtitle: "Subtitle", children: []}, + {title: "Child 2", subtitle: "Subtitle", children: []} + ] + } + ]; + const reactVirtualizedListProps: ListProps = { + width: 100, height: 44, rowCount: 3, rowHeight: 44, rowRenderer: "test" as any as ListRowRenderer + }; + const nodeRenderer: NodeRenderer = "test" as any as NodeRenderer; + return ( +
+ {}} + style={{width: "100%"}} + className="test-class" + innerStyle={{backgroundColor: "#3A3A3A"}} + maxDepth={3} + searchMethod={defaultSearchMethod} + searchQuery={"Child 1"} + searchFocusOffset={1} + searchFinishCallback={(matches: NodeData[]) => { const firstTitle = matches[0].node.title; }} + generateNodeProps={(data: ExtendedNodeData) => ({buttons: [data.node.title]}) } + getNodeKey={defaultGetNodeKey} + onMoveNode={(data: NodeData & FullTree) => {}} + onVisibilityToggle={(data: OnVisibilityToggleData) => {}} + canDrag={true} + canDrop={(data: PreviousAnNextLocation & NodeData) => true} + reactVirtualizedListProps={reactVirtualizedListProps} + rowHeight={62} + slideRegionSize={100} + scaffoldBlockPxWidth={44} + isVirtualized={true} + nodeContentRenderer={nodeRenderer} + /> + {}} + style={{width: "100px"}} + /> +
+ ); + } +} diff --git a/types/react-sortable-tree/tsconfig.json b/types/react-sortable-tree/tsconfig.json new file mode 100644 index 0000000000..f82f976d38 --- /dev/null +++ b/types/react-sortable-tree/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "jsx": "react", + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-sortable-tree-tests.tsx" + ] +} diff --git a/types/react-sortable-tree/tslint.json b/types/react-sortable-tree/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-sortable-tree/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/react-sortable-tree/utils/default-handlers.d.ts b/types/react-sortable-tree/utils/default-handlers.d.ts new file mode 100644 index 0000000000..4d24792196 --- /dev/null +++ b/types/react-sortable-tree/utils/default-handlers.d.ts @@ -0,0 +1,4 @@ +import { TreeIndex, SearchData } from "../"; + +export function defaultGetNodeKey(data: TreeIndex): number; +export function defaultSearchMethod(data: SearchData): boolean; \ No newline at end of file diff --git a/types/react-sortable-tree/utils/tree-data-utils.d.ts b/types/react-sortable-tree/utils/tree-data-utils.d.ts new file mode 100644 index 0000000000..0446b00ed4 --- /dev/null +++ b/types/react-sortable-tree/utils/tree-data-utils.d.ts @@ -0,0 +1,21 @@ +import { FullTree, TreePath, TreeItem, TreeIndex, SearchData, NodeData, TreeNode } from "../"; + +type GetNodeKeyFunction = (data: TreeIndex & TreeNode) => string | number; +type WalkAndMapFunctionParameters = FullTree & {getNodeKey: GetNodeKeyFunction, callback: Function, ignoreCollapsed?: boolean} +type FlattenedData = (TreeNode & TreePath & {lowerSiblingsCounts: number[]})[]; + +export function getDescendantCount(data: TreeNode & {ignoreCollapsed?: boolean}): number; +export function getVisibleNodeCount(data: FullTree): number; +export function getVisibleNodeInfoAtIndex(data: FullTree & {targetIndex: number, getNodeKey: GetNodeKeyFunction}): TreeNode & TreePath & {lowerSiblingsCounts: number[]}; +export function walk(data: WalkAndMapFunctionParameters): void; +export function map(data: WalkAndMapFunctionParameters): TreeItem[]; +export function changeNodeAtPath(data: FullTree & TreePath & {newNode: Function | any, getNodeKey: GetNodeKeyFunction, ignoreCollapsed?: boolean}): TreeItem[]; +export function removeNodeAtPath(data: FullTree & TreePath & {getNodeKey: GetNodeKeyFunction, ignoreCollapsed?: boolean}): TreeItem[]; +export function getNodeAtPath(data: FullTree & TreePath & {getNodeKey: GetNodeKeyFunction, ignoreCollapsed?: boolean}): TreeItem | null; +export function addNodeUnderParent(data: FullTree & {newNode: TreeItem, parentKey?: number | string, getNodeKey: GetNodeKeyFunction, ignoreCollapsed?: boolean, expandParent?: boolean}): FullTree & TreeIndex; +export function insertNode(data: FullTree & {depth: number, newNode: TreeItem, minimumTreeIndex: number, ignoreCollapsed?: boolean, expandParent?: boolean, getNodeKey: GetNodeKeyFunction}): FullTree & TreeIndex & TreePath & {parentNode: TreeItem}; +export function getFlatDataFromTree(data: FullTree & {getNodeKey: GetNodeKeyFunction, ignoreCollapsed?: boolean}): (TreeNode & TreePath & {lowerSiblingsCounts: number[], parentNode: TreeItem})[]; +export function getTreeFromFlatData(data: {flatData: FlattenedData, getKey?: GetNodeKeyFunction, getParentKey?: GetNodeKeyFunction, rootKey?: string | number}): TreeItem[] +export function isDescendant(older: TreeItem, younger: TreeItem): boolean; +export function getDepth(node: TreeItem, depth?: number): number; +export function find(data: FullTree & {getNodeKey: GetNodeKeyFunction, searchQuery?: string | number, searchMethod: (data: SearchData) => boolean, searchFocusOffset?: number, expandAllMatchPaths?: boolean, expandFocusMatchPaths?: boolean}): {matches: NodeData[]} & FullTree; From c77f43d7e933e79fe62fe082bbf4cfc16e3741e3 Mon Sep 17 00:00:00 2001 From: "Diogo Franco (Kovensky)" Date: Mon, 26 Jun 2017 17:58:28 +0900 Subject: [PATCH 085/180] jquery: Update test annotation --- types/jquery/jquery-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jquery/jquery-tests.ts b/types/jquery/jquery-tests.ts index 7a05a5630a..438f36c79b 100644 --- a/types/jquery/jquery-tests.ts +++ b/types/jquery/jquery-tests.ts @@ -3025,7 +3025,7 @@ function JQuery() { return 'myVal'; }); - // $ExpectType string | number | string[] | undefined + // $ExpectType string | number | string[] | null | undefined $('p').val(); } } From 5ab8522e7fc07458ed60b4cb6cf41e2d8e468a8d Mon Sep 17 00:00:00 2001 From: clarenceh Date: Mon, 26 Jun 2017 17:27:04 +0800 Subject: [PATCH 086/180] Updates to Table interface definition --- types/massive/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/massive/index.d.ts b/types/massive/index.d.ts index 67be093bb0..ccf6469d91 100644 --- a/types/massive/index.d.ts +++ b/types/massive/index.d.ts @@ -50,9 +50,9 @@ declare namespace massive { count(criteria: object): Promise; where(query: string, params: any[] | object): Promise; search(criteria: SearchCriteria, queryOptions?: QueryOptions): Promise; - save(data: object): Promise; - insert(data: object): Promise; - update(dataOrCriteria: object, changesMap?: object): Promise; + save(data: object | object[]): Promise | Promise; + insert(data: object | object[]): Promise | Promise; + update(dataOrCriteria: object | object[], changesMap?: object): Promise | Promise; destroy(criteria: object): Promise; } From 51995773e3f48b3e91df767a737e9b3727669a6d Mon Sep 17 00:00:00 2001 From: Wouter Hardeman Date: Mon, 26 Jun 2017 11:54:04 +0200 Subject: [PATCH 087/180] Fixed NodeRenderer type --- types/react-sortable-tree/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-sortable-tree/index.d.ts b/types/react-sortable-tree/index.d.ts index 961b218be4..a7805cd90e 100644 --- a/types/react-sortable-tree/index.d.ts +++ b/types/react-sortable-tree/index.d.ts @@ -59,7 +59,7 @@ export interface PreviousAnNextLocation { nextTreeIndex: number; } -export type NodeRenderer = React.Component; +export type NodeRenderer = React.ComponentClass; export interface NodeRendererProps { node: TreeItem; From 922fbf29014c072181ced556f570a09cac906de2 Mon Sep 17 00:00:00 2001 From: Wouter Hardeman Date: Mon, 26 Jun 2017 12:10:59 +0200 Subject: [PATCH 088/180] Fixed parent references for react-sortable-tree --- types/react-sortable-tree/utils/default-handlers.d.ts | 2 +- types/react-sortable-tree/utils/tree-data-utils.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-sortable-tree/utils/default-handlers.d.ts b/types/react-sortable-tree/utils/default-handlers.d.ts index 4d24792196..5b00de104d 100644 --- a/types/react-sortable-tree/utils/default-handlers.d.ts +++ b/types/react-sortable-tree/utils/default-handlers.d.ts @@ -1,4 +1,4 @@ -import { TreeIndex, SearchData } from "../"; +import { TreeIndex, SearchData } from 'react-sortable-tree'; export function defaultGetNodeKey(data: TreeIndex): number; export function defaultSearchMethod(data: SearchData): boolean; \ No newline at end of file diff --git a/types/react-sortable-tree/utils/tree-data-utils.d.ts b/types/react-sortable-tree/utils/tree-data-utils.d.ts index 0446b00ed4..84f68840c7 100644 --- a/types/react-sortable-tree/utils/tree-data-utils.d.ts +++ b/types/react-sortable-tree/utils/tree-data-utils.d.ts @@ -1,4 +1,4 @@ -import { FullTree, TreePath, TreeItem, TreeIndex, SearchData, NodeData, TreeNode } from "../"; +import { FullTree, TreePath, TreeItem, TreeIndex, SearchData, NodeData, TreeNode } from 'react-sortable-tree'; type GetNodeKeyFunction = (data: TreeIndex & TreeNode) => string | number; type WalkAndMapFunctionParameters = FullTree & {getNodeKey: GetNodeKeyFunction, callback: Function, ignoreCollapsed?: boolean} From 787dc502fa84b87234a84852c06d425658ef7332 Mon Sep 17 00:00:00 2001 From: yairm210 Date: Mon, 26 Jun 2017 13:15:08 +0300 Subject: [PATCH 089/180] Added .withCredentials to CoreOptions Although not specified on the main page, as per https://github.com/request/request/blob/b12a6245d9acdb1e13c6486d427801e123fdafae/tests/browser/test.js we can see that this is part of the request module. More practically: local testing shows adding the {withCredentials:false} option allows us to create a request that accepts an "*" value for the Access-Control-Allow-Origin header. --- types/request/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/request/index.d.ts b/types/request/index.d.ts index fae6a2f65c..2cf7b08cf9 100644 --- a/types/request/index.d.ts +++ b/types/request/index.d.ts @@ -143,6 +143,7 @@ declare namespace request { gzip?: boolean; preambleCRLF?: boolean; postambleCRLF?: boolean; + withCredentials?: boolean; key?: Buffer; cert?: Buffer; passphrase?: string; From 6711c77b2f40e99832820ecc33400dea87d35851 Mon Sep 17 00:00:00 2001 From: SkyAo Date: Mon, 26 Jun 2017 18:22:52 +0800 Subject: [PATCH 090/180] [mongoose] add useMongoClient in ConnectOpenOptionsBase Interface --- types/mongoose/v3/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/mongoose/v3/index.d.ts b/types/mongoose/v3/index.d.ts index 80cca9da2f..c914af0813 100644 --- a/types/mongoose/v3/index.d.ts +++ b/types/mongoose/v3/index.d.ts @@ -68,6 +68,7 @@ declare module "mongoose" { pass?: string; /** Options for authentication */ auth?: any; + useMongoClient?: boolean; } export interface ConnectionOptions extends ConnectOpenOptionsBase { @@ -656,4 +657,4 @@ declare module "mongoose" { error(err: any): Promise; } -} \ No newline at end of file +} From 55161b13d937241f04c17438f85bbd06215b9bdd Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Mon, 26 Jun 2017 07:18:51 -0400 Subject: [PATCH 091/180] [flexslider] Update tests to use non-deprecated code. --- types/flexslider/flexslider-tests.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/types/flexslider/flexslider-tests.ts b/types/flexslider/flexslider-tests.ts index 8bf2d28db1..80421e1a99 100644 --- a/types/flexslider/flexslider-tests.ts +++ b/types/flexslider/flexslider-tests.ts @@ -1,17 +1,17 @@ -$(window).ready(function() { +$(function() { $('.flexslider').flexslider({ animation: "slide" }); }); -$(window).ready(function() { +$(function() { $('.flexslider').flexslider({ animation: "slide", controlNav: "thumbnails" }); }); -$(window).ready(function() { +$(function() { // The slider being synced must be initialized first $('#carousel').flexslider({ animation: "slide", @@ -32,7 +32,7 @@ $(window).ready(function() { }); }); -$(window).ready(function() { +$(function() { $('.flexslider').flexslider({ animation: "slide", animationLoop: false, @@ -41,7 +41,7 @@ $(window).ready(function() { }); }); -$(window).ready(function() { +$(function() { $('.flexslider').flexslider({ animation: "slide", animationLoop: false, @@ -52,11 +52,10 @@ $(window).ready(function() { }); }); -$(window).ready(function() { +$(function() { // Vimeo API nonsense - var player = document.getElementById('player_1'); - $(player).on('ready', ready); + $(ready); function addEvent(element:any, eventName:any, callback:any) { if (element.addEventListener) { @@ -66,8 +65,8 @@ $(window).ready(function() { } } - function ready(player_id: any) { - var froogaloop = $(player_id); + function ready() { + var froogaloop = $('#player_1'); froogaloop.on('play', function(data) { $('.flexslider').flexslider({ pauseText: "pause" }); }); From 3510b58e50b1be69baa640cf96b0dd284ee11d71 Mon Sep 17 00:00:00 2001 From: york yao Date: Mon, 26 Jun 2017 19:49:33 +0800 Subject: [PATCH 092/180] update types of uppercaselcase --- types/uppercamelcase/index.d.ts | 1 + types/uppercamelcase/uppercamelcase-tests.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/types/uppercamelcase/index.d.ts b/types/uppercamelcase/index.d.ts index cbdfed1925..b1e0ff34ba 100644 --- a/types/uppercamelcase/index.d.ts +++ b/types/uppercamelcase/index.d.ts @@ -5,3 +5,4 @@ declare function upperCamelCase(...args: string[]): string; export = upperCamelCase; +declare namespace upperCamelCase { } diff --git a/types/uppercamelcase/uppercamelcase-tests.ts b/types/uppercamelcase/uppercamelcase-tests.ts index 29d31d58e6..eb850ee8cd 100644 --- a/types/uppercamelcase/uppercamelcase-tests.ts +++ b/types/uppercamelcase/uppercamelcase-tests.ts @@ -1,4 +1,5 @@ import upperCamelCase = require('uppercamelcase'); +import * as upperCamelCase2 from "uppercamelcase"; upperCamelCase('foo-bar'); //=> FooBar From 297e70484e07161ea11d6f27e01699a2a85d3040 Mon Sep 17 00:00:00 2001 From: Niels van Hoorn Date: Mon, 26 Jun 2017 15:06:22 +0200 Subject: [PATCH 093/180] Added ColorInput type --- types/tinycolor2/index.d.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/types/tinycolor2/index.d.ts b/types/tinycolor2/index.d.ts index 7ad9d849a2..a84cfef5fb 100644 --- a/types/tinycolor2/index.d.ts +++ b/types/tinycolor2/index.d.ts @@ -70,7 +70,7 @@ interface tinycolor { * @param firstColor - the first color to be used in the comparison. * @param secondColor - the second color to be used in the comparison. */ - readability(firstColor: tinycolorInstance, secondColor: tinycolorInstance): Readable.Readable; + readability(firstColor: ColorInput, secondColor: ColorInput): Readable.Readable; /** * Ensure that foreground and background color combinations provide sufficient contrast. @@ -90,7 +90,7 @@ interface tinycolor { mostReadable(color: tinycolorInstance, colorsToCompare: tinycolorInstance[]): tinycolorInstance; /**/ - mix(color1: tinycolorInstance, color2: tinycolorInstance, amount?: number): tinycolorInstance; + mix(color1: ColorInput, color2: ColorInput, amount?: number): tinycolorInstance; /** * Returns a random color @@ -265,7 +265,6 @@ interface tinycolorInstance { * Default value: 10. */ darken(amount?: number): tinycolorInstance; - /** * Desaturate the color a given amount. * Providing 100 will is the same as calling greyscale. @@ -380,6 +379,8 @@ declare namespace ColorFormats { } } +type ColorInput = string | ColorFormats.RGB | ColorFormats.RGBA | ColorFormats.HSL | ColorFormats.HSLA | ColorFormats.HSV | ColorFormats.HSVA | tinycolorInstance + declare module 'tinycolor2' { export = tinycolor; -} +} \ No newline at end of file From cfd790c64aabf727efbdea7866ff268fb4cd1a5a Mon Sep 17 00:00:00 2001 From: Niels van Hoorn Date: Mon, 26 Jun 2017 15:06:55 +0200 Subject: [PATCH 094/180] Added equals function --- types/tinycolor2/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/tinycolor2/index.d.ts b/types/tinycolor2/index.d.ts index a84cfef5fb..b9bd88fd44 100644 --- a/types/tinycolor2/index.d.ts +++ b/types/tinycolor2/index.d.ts @@ -92,6 +92,11 @@ interface tinycolor { /**/ mix(color1: ColorInput, color2: ColorInput, amount?: number): tinycolorInstance; + /** + * Can be called with any tinycolor input + */ + equals(color1: ColorInput, color2: ColorInput): boolean; + /** * Returns a random color */ From 785ee394c2694853f0954346123a8e00c8f51b1a Mon Sep 17 00:00:00 2001 From: Niels van Hoorn Date: Mon, 26 Jun 2017 15:07:38 +0200 Subject: [PATCH 095/180] Updated definitions to 1.4.1 --- types/tinycolor2/index.d.ts | 16 +++++++++------- types/tinycolor2/tinycolor2-tests.ts | 4 ++++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/types/tinycolor2/index.d.ts b/types/tinycolor2/index.d.ts index b9bd88fd44..921d8a4f08 100644 --- a/types/tinycolor2/index.d.ts +++ b/types/tinycolor2/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for tinycolor v1.1.1 +// Type definitions for tinycolor v1.4.1 // Project: https://github.com/bgrins/TinyColor -// Definitions by: Mordechai Zuber , Geert Jansen +// Definitions by: Mordechai Zuber , Geert Jansen , Niels van Hoorn // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare var tinycolor: tinycolor; @@ -73,21 +73,23 @@ interface tinycolor { readability(firstColor: ColorInput, secondColor: ColorInput): Readable.Readable; /** - * Ensure that foreground and background color combinations provide sufficient contrast. + * Ensure that foreground and background color combinations meet WCAG2 guidelines. * * @param foreColor - the fore color wanted. - * @param backCOlor - the back color wanted. + * @param backColor - the back color wanted. + * @param wcag2 - The 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA'; the 'size' property states 'large' or 'small' - if missing or invalid, it defaults to 'small'. If the entire object is absent, isReadable defaults to {level:"AA",size:"small"}. */ - isReadable(foreColor: tinycolorInstance, backColor: tinycolorInstance): boolean; + isReadable(foreColor: ColorInput, backColor: ColorInput, wcag2?: {level?: string, size?: string}): boolean; /** * Given a base color and a list of possible foreground or background colors for that base, - * returns the most readable color. + * returns the most readable color. Optionally returns Black or White if the most readable color is unreadable. * * @param color - the base color. * @param colorsToCompare - array of colors to pick the most readable one from. + * @param args - and object with extra arguments */ - mostReadable(color: tinycolorInstance, colorsToCompare: tinycolorInstance[]): tinycolorInstance; + mostReadable(color: ColorInput, colorsToCompare: ColorInput[], args?: {includeFallbackColors?: boolean, level?: string, size?: string}): tinycolorInstance; /**/ mix(color1: ColorInput, color2: ColorInput, amount?: number): tinycolorInstance; diff --git a/types/tinycolor2/tinycolor2-tests.ts b/types/tinycolor2/tinycolor2-tests.ts index b3e0d0769a..f6a6634f5f 100644 --- a/types/tinycolor2/tinycolor2-tests.ts +++ b/types/tinycolor2/tinycolor2-tests.ts @@ -28,14 +28,18 @@ tester = tinycolor({ h: 0, s: 0, v: 0, a: 0 }); //tinycolor static methods tester = tinycolor.mix(tester, tester); +tester = tinycolor.mix("#ff0000", "#00ff00"); tester = tinycolor.mix(tester, tester, 50); tester = tinycolor.random(); +var isEqual = tinycolor.equals(tester, tester); /*Tinycolor object properties*/ var readable: Readable.Readable = tinycolor.readability(tester, tester); var isReadable: boolean = tinycolor.isReadable(tester, tester); +var isReadable: boolean = tinycolor.isReadable(tester, tester, {size: "small"}); tester = tinycolor.mostReadable(tester, [tester, tester, tester]); +tester = tinycolor.mostReadable(tester, [tester, tester, tester], {size: "large", level:"AA"}); var hexNames: { [key: string]: string } = tinycolor.hexNames; var names: { [key: string]: string } = tinycolor.names; From 3d4ac4abf946d086bf5a4f5f4311473952084c1c Mon Sep 17 00:00:00 2001 From: Gaspard Bucher Date: Wed, 7 Jun 2017 11:26:31 +0200 Subject: [PATCH 096/180] [types/react] Allow null return from stateless components. Fixes #14064 --- types/react-native/index.d.ts | 4 +++- types/react-router-native/index.d.ts | 12 ++++++------ types/react/index.d.ts | 2 +- types/react/test/index.ts | 5 +++-- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 06e777a270..ef2486fef5 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for react-native 0.44 // Project: https://github.com/facebook/react-native -// Definitions by: Eloy Durán , Fedor Nezhivoi , HuHuanming , Jeremi Stadler , Kyle Roach +// Definitions by: Eloy Durán , Fedor Nezhivoi , +// HuHuanming , Jeremi Stadler , +// Kyle Roach // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/react-router-native/index.d.ts b/types/react-router-native/index.d.ts index 214e81b0d3..23c6c63794 100644 --- a/types/react-router-native/index.d.ts +++ b/types/react-router-native/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/ReactTraining/react-router-native // Definitions by: Eduard Zintz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.3 export { match, @@ -23,25 +23,25 @@ import * as React from 'react'; import * as H from 'history'; export interface AndroidBackButtonProps { - children: Array>; + children: Array>; } -export class AndroidBackButton extends React.Component {} +export class AndroidBackButton extends React.Component {} export class DeepLinking extends React.Component<{}, {}> {} export interface LinkProps { - component?: React.Component; + component?: React.Component<{}, {}>; replace?: boolean; style?: any; to: H.LocationDescriptor; } -export class Link extends React.Component {} +export class Link extends React.Component {} export interface NativeRouterProps { getUserConfirmation?: Function; keyLength?: number; } -export class NativeRouter extends React.Component {} +export class NativeRouter extends React.Component {} diff --git a/types/react/index.d.ts b/types/react/index.d.ts index 283fb57ba7..b0356ae4b6 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -227,7 +227,7 @@ declare namespace React { type SFC

= StatelessComponent

; interface StatelessComponent

{ - (props: P & { children?: ReactNode }, context?: any): ReactElement; + (props: P & { children?: ReactNode }, context?: any): ReactElement | null; propTypes?: ValidationMap

; contextTypes?: ValidationMap; defaultProps?: Partial

; diff --git a/types/react/test/index.ts b/types/react/test/index.ts index 80d4d574df..77e46e49aa 100644 --- a/types/react/test/index.ts +++ b/types/react/test/index.ts @@ -138,7 +138,7 @@ interface SCProps { } function StatelessComponent(props: SCProps) { - return React.DOM.div(null, props.foo); + return props.foo ? React.DOM.div(null, props.foo) : null; }; namespace StatelessComponent { export var displayName = "StatelessComponent"; @@ -155,7 +155,8 @@ StatelessComponent2.defaultProps = { var StatelessComponent3: React.SFC = // allows usage of props.children - props => React.DOM.div(null, props.foo, props.children); + // allows null return + props => props.foo ? React.DOM.div(null, props.foo, props.children) : null; // React.createFactory var factory: React.CFactory = From 3fe74104369b0f02dd28185f09e76f54136767f0 Mon Sep 17 00:00:00 2001 From: Alex Brick Date: Mon, 26 Jun 2017 17:35:10 +0200 Subject: [PATCH 097/180] [superagent] Adding types for custom serializers --- types/superagent/index.d.ts | 4 ++++ types/superagent/superagent-tests.ts | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/types/superagent/index.d.ts b/types/superagent/index.d.ts index 4032a9d543..e9b0018ed7 100644 --- a/types/superagent/index.d.ts +++ b/types/superagent/index.d.ts @@ -12,6 +12,8 @@ import * as https from 'https'; type CallbackHandler = (err: any, res: request.Response) => void; +type Serializer = (obj: any) => string; + declare const request: request.SuperAgentStatic; declare namespace request { @@ -28,6 +30,7 @@ declare namespace request { (method: string, url: string): SuperAgentRequest; agent(): SuperAgent; + serialize: { [type: string]: Serializer }; } interface SuperAgent extends stream.Stream { @@ -109,6 +112,7 @@ declare namespace request { redirects(n: number): this; responseType(type: string): this; send(data?: string | object): this; + serialize(serializer: Serializer): this; set(field: string, val: string): this; set(field: object): this; timeout(ms: number | { deadline?: number, response?: number }): this; diff --git a/types/superagent/superagent-tests.ts b/types/superagent/superagent-tests.ts index a6d07c3eaa..f38dcb31ea 100644 --- a/types/superagent/superagent-tests.ts +++ b/types/superagent/superagent-tests.ts @@ -171,6 +171,22 @@ request .send({post: 'data', here: 'wahoo'}) .end(callback); +// Custom request serializer +function testParser(data: any) { + return JSON.stringify(data); +} + +request + .post('/user') + .serialize(testParser) + .type('json') + .send({ foo: 123 }) + .end(callback); + +// Default serialization map + +request.serialize['application/xml'] = (obj: any) => 'generated xml here'; + // Parsing response bodies request('/search') .end((res: request.Response) => { From e2c87fc5b8660d2a8607b67382fe2ecb32e17f01 Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Mon, 26 Jun 2017 17:52:16 +0200 Subject: [PATCH 098/180] add @storybook/addon-actions --- types/storybook__addon-actions/index.d.ts | 16 +++++++++++ .../storybook__addon-actions-tests.tsx | 19 +++++++++++++ types/storybook__addon-actions/tsconfig.json | 28 +++++++++++++++++++ types/storybook__addon-actions/tslint.json | 1 + 4 files changed, 64 insertions(+) create mode 100644 types/storybook__addon-actions/index.d.ts create mode 100644 types/storybook__addon-actions/storybook__addon-actions-tests.tsx create mode 100644 types/storybook__addon-actions/tsconfig.json create mode 100644 types/storybook__addon-actions/tslint.json diff --git a/types/storybook__addon-actions/index.d.ts b/types/storybook__addon-actions/index.d.ts new file mode 100644 index 0000000000..b650cd2d55 --- /dev/null +++ b/types/storybook__addon-actions/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for @storybook/addon-actions 3.0 +// Project: https://github.com/storybooks/storybook +// Definitions by: Joscha Feth +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +// TODO: Once https://github.com/DefinitelyTyped/DefinitelyTyped/pull/17434 is merged +// Remove the `declare module` wrapper. +// tslint:disable-next-line no-single-declare-module +declare module '@storybook/addon-actions' { + type HandlerFunction = (...args: any[]) => undefined; + type DecoratorFunction = (args: any[]) => any[]; + + function decorateAction(decorators: DecoratorFunction[]): HandlerFunction; + function action(name: string): HandlerFunction; +} diff --git a/types/storybook__addon-actions/storybook__addon-actions-tests.tsx b/types/storybook__addon-actions/storybook__addon-actions-tests.tsx new file mode 100644 index 0000000000..837a4ba214 --- /dev/null +++ b/types/storybook__addon-actions/storybook__addon-actions-tests.tsx @@ -0,0 +1,19 @@ +import * as React from 'react'; +import { storiesOf } from '@storybook/react'; +import { action, decorateAction } from '@storybook/addon-actions'; + +const firstArgAction = decorateAction([ + args => args.slice(0, 1) +]); + +storiesOf('Button', module) + .add('action', () => ( + + )) + .add('decorated action', () => ( + + )); diff --git a/types/storybook__addon-actions/tsconfig.json b/types/storybook__addon-actions/tsconfig.json new file mode 100644 index 0000000000..1e05a92628 --- /dev/null +++ b/types/storybook__addon-actions/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "dom", + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "paths": { + "@storybook/addon-actions": ["storybook__addon-actions"], + "@storybook/react": ["storybook__react"] + } + }, + "files": [ + "index.d.ts", + "storybook__addon-actions-tests.tsx" + ] +} diff --git a/types/storybook__addon-actions/tslint.json b/types/storybook__addon-actions/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/storybook__addon-actions/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From c176e0bedcf36f66029ed38d2de955d0017126e4 Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Mon, 26 Jun 2017 18:13:32 +0200 Subject: [PATCH 099/180] remove path mapping --- types/storybook__addon-actions/tsconfig.json | 1 - 1 file changed, 1 deletion(-) diff --git a/types/storybook__addon-actions/tsconfig.json b/types/storybook__addon-actions/tsconfig.json index 1e05a92628..00d0b235e5 100644 --- a/types/storybook__addon-actions/tsconfig.json +++ b/types/storybook__addon-actions/tsconfig.json @@ -17,7 +17,6 @@ "noEmit": true, "forceConsistentCasingInFileNames": true, "paths": { - "@storybook/addon-actions": ["storybook__addon-actions"], "@storybook/react": ["storybook__react"] } }, From 63dca8150f09650b8db24a2fe0c54b579fd302db Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Mon, 26 Jun 2017 18:19:38 +0200 Subject: [PATCH 100/180] make tests pass --- .../storybook__addon-actions-tests.tsx | 2 ++ types/storybook__addon-actions/tsconfig.json | 5 +---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/types/storybook__addon-actions/storybook__addon-actions-tests.tsx b/types/storybook__addon-actions/storybook__addon-actions-tests.tsx index 837a4ba214..77ba80985b 100644 --- a/types/storybook__addon-actions/storybook__addon-actions-tests.tsx +++ b/types/storybook__addon-actions/storybook__addon-actions-tests.tsx @@ -1,3 +1,5 @@ +/// + import * as React from 'react'; import { storiesOf } from '@storybook/react'; import { action, decorateAction } from '@storybook/addon-actions'; diff --git a/types/storybook__addon-actions/tsconfig.json b/types/storybook__addon-actions/tsconfig.json index 00d0b235e5..e22f8849a3 100644 --- a/types/storybook__addon-actions/tsconfig.json +++ b/types/storybook__addon-actions/tsconfig.json @@ -15,10 +15,7 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true, - "paths": { - "@storybook/react": ["storybook__react"] - } + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", From f78f1e3523c950048982aca90d17efb4ba90795a Mon Sep 17 00:00:00 2001 From: rzymek Date: Mon, 26 Jun 2017 18:22:03 +0200 Subject: [PATCH 101/180] lodash - Add _.multiply --- types/lodash/index.d.ts | 28 ++++++++++++++++++++++++++++ types/lodash/lodash-tests.ts | 17 +++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index 6326773899..9e58196fd1 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -13543,6 +13543,34 @@ declare namespace _ { ): T; } + //_.multiply + interface LoDashStatic { + /** + * Multiply two numbers. + * @param multiplier The first number in a multiplication. + * @param multiplicand The second number in a multiplication. + * @returns Returns the product. + */ + multiply( + multiplier: number, + multiplicand: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.multiply + */ + multiply(multiplicand: number): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.multiply + */ + multiply(multiplicand: number): LoDashExplicitWrapper; + } + //_.round interface LoDashStatic { /** diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index b260df8ee5..311d5078c9 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -7937,6 +7937,23 @@ namespace TestMinBy { result = _(dictionary).minBy<{a: number}, number>({a: 42}); } +// _.multiply +namespace TestMultiply { + { + let result: number; + + result = _.multiply(6, 4); + + result = _(6).multiply(4); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(6).chain().multiply(4); + } +} + // _.round namespace TestRound { { From 2160e7b86f8ab70daf07f7bac3ad0dfcc1982fdf Mon Sep 17 00:00:00 2001 From: rzymek Date: Mon, 26 Jun 2017 18:12:46 +0200 Subject: [PATCH 102/180] lodash - Add _.divide --- types/lodash/divide/index.d.ts | 2 ++ types/lodash/index.d.ts | 29 +++++++++++++++++++++++++++++ types/lodash/lodash-tests.ts | 17 +++++++++++++++++ types/lodash/tsconfig.json | 1 + 4 files changed, 49 insertions(+) create mode 100644 types/lodash/divide/index.d.ts diff --git a/types/lodash/divide/index.d.ts b/types/lodash/divide/index.d.ts new file mode 100644 index 0000000000..2df6f40e3a --- /dev/null +++ b/types/lodash/divide/index.d.ts @@ -0,0 +1,2 @@ +import { divide } from "../index"; +export = divide; diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index 6326773899..5d203ebb6d 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -13198,6 +13198,35 @@ declare namespace _ { ceil(precision?: number): LoDashExplicitWrapper; } + //_.divide + interface LoDashStatic { + /** + * Divide two numbers. + * + * @param dividend The first number in a division. + * @param divisor The second number in a division. + * @returns Returns the quotient. + */ + divide( + dividend: number, + divisor: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.divide + */ + divide(divisor: number): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.divide + */ + divide(divisor: number): LoDashExplicitWrapper; + } + //_.floor interface LoDashStatic { /** diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index b260df8ee5..f3c1b22495 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -7789,6 +7789,23 @@ namespace TestCeil { } } +// _.divide +namespace TestDivide { + { + let result: number; + + result = _.divide(6, 4); + + result = _(6).divide(4); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(6).chain().floor(4); + } +} + // _.floor namespace TestFloor { { diff --git a/types/lodash/tsconfig.json b/types/lodash/tsconfig.json index 419b6142b1..864cc03249 100644 --- a/types/lodash/tsconfig.json +++ b/types/lodash/tsconfig.json @@ -19,6 +19,7 @@ "capitalize/index.d.ts", "castArray/index.d.ts", "ceil/index.d.ts", + "divide/index.d.ts", "chain/index.d.ts", "chunk/index.d.ts", "clamp/index.d.ts", From e57c630919234111329e5a0b306e281c11fef936 Mon Sep 17 00:00:00 2001 From: rzymek Date: Mon, 26 Jun 2017 18:36:18 +0200 Subject: [PATCH 103/180] lodash - Enabled _.flow & _.flowRight to accept an array of functions --- types/lodash/index.d.ts | 23 ++++++++++++++++++++++- types/lodash/lodash-tests.ts | 7 +++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index 6326773899..282a98d789 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -189,7 +189,7 @@ Misc: - [ ] _.extendWith as an alias of _.assignInWith - [ ] Added clear method to _.memoize.Cache - [ ] Added support for ES6 maps, sets, & symbols to _.clone, _.isEqual, & _.toArray -- [ ] Enabled _.flow & _.flowRight to accept an array of functions +- [x] Enabled _.flow & _.flowRight to accept an array of functions - [ ] Ensured “Collection” methods treat functions as objects - [ ] Ensured _.assign, _.defaults, & _.merge coerce object values to objects - [ ] Ensured _.bindKey bound functions call object[key] when called with the new operator @@ -10475,6 +10475,7 @@ declare namespace _ { flow(f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (a1: A1, a2: A2, a3: A3, a4: A4) => R7; // generic function flow(...funcs: Function[]): TResult; + flow(funcs: Function[]): TResult; } interface LoDashImplicitObjectWrapper { @@ -10482,6 +10483,10 @@ declare namespace _ { * @see _.flow */ flow(...funcs: Function[]): LoDashImplicitObjectWrapper; + /** + * @see _.flow + */ + flow(funcs: Function[]): LoDashImplicitObjectWrapper; } interface LoDashExplicitObjectWrapper { @@ -10489,6 +10494,10 @@ declare namespace _ { * @see _.flow */ flow(...funcs: Function[]): LoDashExplicitObjectWrapper; + /** + * @see _.flow + */ + flow(funcs: Function[]): LoDashExplicitObjectWrapper; } //_.flowRight @@ -10501,6 +10510,10 @@ declare namespace _ { * @return Returns the new function. */ flowRight(...funcs: Function[]): TResult; + /** + * @see _.flowRight + */ + flowRight(funcs: Function[]): TResult; } interface LoDashImplicitObjectWrapper { @@ -10508,6 +10521,10 @@ declare namespace _ { * @see _.flowRight */ flowRight(...funcs: Function[]): LoDashImplicitObjectWrapper; + /** + * @see _.flowRight + */ + flowRight(funcs: Function[]): LoDashImplicitObjectWrapper; } interface LoDashExplicitObjectWrapper { @@ -10515,6 +10532,10 @@ declare namespace _ { * @see _.flowRight */ flowRight(...funcs: Function[]): LoDashExplicitObjectWrapper; + /** + * @see _.flowRight + */ + flowRight(funcs: Function[]): LoDashExplicitObjectWrapper; } diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index b260df8ee5..b504e73288 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -5823,6 +5823,7 @@ namespace TestFlow { result = _.flow(Fn2, Fn1, Fn1, Fn1, Fn1, Fn1); result = _.flow(Fn2, Fn1, Fn1, Fn1, Fn1, Fn1, Fn1); result = _.flow(Fn2, Fn1, Fn3, Fn4); + result = _.flow<(m: number, n: number) => number>([Fn2, Fn1, Fn3, Fn4]); } { @@ -5831,6 +5832,7 @@ namespace TestFlow { result = _.flow<(m: number, n: number) => number>(Fn1, Fn2); result = _.flow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); result = _.flow<(m: number, n: number) => number>(Fn1, Fn1, Fn1, Fn2); + result = _.flow<(m: number, n: number) => number>([Fn1, Fn1, Fn1, Fn2]); } { @@ -5839,6 +5841,7 @@ namespace TestFlow { result = _(Fn1).flow<(m: number, n: number) => number>(Fn2); result = _(Fn1).flow<(m: number, n: number) => number>(Fn1, Fn2); result = _(Fn1).flow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + result = _(Fn1).flow<(m: number, n: number) => number>([Fn1, Fn1, Fn2]); } { @@ -5847,6 +5850,7 @@ namespace TestFlow { result = _(Fn1).chain().flow<(m: number, n: number) => number>(Fn2); result = _(Fn1).chain().flow<(m: number, n: number) => number>(Fn1, Fn2); result = _(Fn1).chain().flow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + result = _(Fn1).chain().flow<(m: number, n: number) => number>([Fn1, Fn1, Fn2]); } } @@ -5861,6 +5865,7 @@ namespace TestFlowRight { result = _.flowRight<(m: number, n: number) => number>(Fn1, Fn2); result = _.flowRight<(m: number, n: number) => number>(Fn1, Fn1, Fn2); result = _.flowRight<(m: number, n: number) => number>(Fn1, Fn1, Fn1, Fn2); + result = _.flowRight<(m: number, n: number) => number>([Fn1, Fn1, Fn1, Fn2]); } { @@ -5869,6 +5874,7 @@ namespace TestFlowRight { result = _(Fn1).flowRight<(m: number, n: number) => number>(Fn2); result = _(Fn1).flowRight<(m: number, n: number) => number>(Fn1, Fn2); result = _(Fn1).flowRight<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + result = _(Fn1).flowRight<(m: number, n: number) => number>([Fn1, Fn1, Fn2]); } { @@ -5877,6 +5883,7 @@ namespace TestFlowRight { result = _(Fn1).chain().flowRight<(m: number, n: number) => number>(Fn2); result = _(Fn1).chain().flowRight<(m: number, n: number) => number>(Fn1, Fn2); result = _(Fn1).chain().flowRight<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + result = _(Fn1).chain().flowRight<(m: number, n: number) => number>([Fn1, Fn1, Fn2]); } } From 2f8bbfbe2847aee9d643ba0d6fa1caf0dbc1733e Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Mon, 26 Jun 2017 09:50:14 -0700 Subject: [PATCH 104/180] Add dom lib reference to react-navigation --- types/react-navigation/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/react-navigation/tsconfig.json b/types/react-navigation/tsconfig.json index e670f06667..ad15863a78 100644 --- a/types/react-navigation/tsconfig.json +++ b/types/react-navigation/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, From 0a2007983a7d9812fce2f1cd6e4acdd1aec25727 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Mon, 26 Jun 2017 11:21:36 -0700 Subject: [PATCH 105/180] createElement splits SVG/HTML props based on type parameter This is required for 2.4 to avoid a weak type error since DOMAttributes is a weak type. --- types/react/index.d.ts | 16 +++++++++++----- types/react/test/index.ts | 2 ++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index b0356ae4b6..99e9de616f 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -136,8 +136,12 @@ declare namespace React { type: ClassType): CFactory; function createFactory

(type: ComponentClass

): Factory

; - function createElement

, T extends Element>( - type: string, + function createElement

, T extends Element>( + type: keyof ReactHTML, + props?: ClassAttributes & P, + ...children: ReactNode[]): DOMElement; + function createElement

, T extends Element>( + type: keyof ReactSVG, props?: ClassAttributes & P, ...children: ReactNode[]): DOMElement; function createElement

( @@ -2526,8 +2530,7 @@ declare namespace React { // React.DOM // ---------------------------------------------------------------------- - interface ReactDOM { - // HTML + interface ReactHTML { a: HTMLFactory; abbr: HTMLFactory; address: HTMLFactory; @@ -2641,8 +2644,9 @@ declare namespace React { "var": HTMLFactory; video: HTMLFactory; wbr: HTMLFactory; + } - // SVG + interface ReactSVG { svg: SVGFactory; animate: SVGFactory; circle: SVGFactory; @@ -2666,6 +2670,8 @@ declare namespace React { use: SVGFactory; } + interface ReactDOM extends ReactHTML, ReactSVG { } + // // React.PropTypes // ---------------------------------------------------------------------- diff --git a/types/react/test/index.ts b/types/react/test/index.ts index 77e46e49aa..27acc07d34 100644 --- a/types/react/test/index.ts +++ b/types/react/test/index.ts @@ -190,6 +190,8 @@ var classicElement: React.ClassicElement = React.createElement(ClassicComponent, props); var domElement: React.ReactHTMLElement = React.createElement("div"); +var htmlElement = React.createElement("input", { type: "text" }); +var svgElement = React.createElement("svg", { accentHeight: 12 }); // React.cloneElement var clonedElement: React.CElement = From d937ac72392faaf31e0c1e4af1a816429e94d62f Mon Sep 17 00:00:00 2001 From: Kyle Roach Date: Mon, 26 Jun 2017 14:46:20 -0400 Subject: [PATCH 106/180] Added react-native-vector-icons definitions --- types/react-native-vector-icons/Entypo.d.ts | 2 + .../react-native-vector-icons/EvilIcons.d.ts | 2 + .../FontAwesome.d.ts | 2 + .../react-native-vector-icons/Foundation.d.ts | 2 + types/react-native-vector-icons/Icon.d.ts | 197 ++++++++++++++++++ types/react-native-vector-icons/Ionicons.d.ts | 2 + .../MaterialCommunityIcons.d.ts | 2 + .../MaterialIcons.d.ts | 2 + types/react-native-vector-icons/Octicons.d.ts | 2 + .../SimpleLineIcons.d.ts | 2 + types/react-native-vector-icons/Zocial.d.ts | 2 + types/react-native-vector-icons/index.d.ts | 61 ++++++ .../react-native-vector-icons-tests.tsx | 30 +++ types/react-native-vector-icons/tsconfig.json | 35 ++++ types/react-native-vector-icons/tslint.json | 1 + 15 files changed, 344 insertions(+) create mode 100644 types/react-native-vector-icons/Entypo.d.ts create mode 100644 types/react-native-vector-icons/EvilIcons.d.ts create mode 100644 types/react-native-vector-icons/FontAwesome.d.ts create mode 100644 types/react-native-vector-icons/Foundation.d.ts create mode 100644 types/react-native-vector-icons/Icon.d.ts create mode 100644 types/react-native-vector-icons/Ionicons.d.ts create mode 100644 types/react-native-vector-icons/MaterialCommunityIcons.d.ts create mode 100644 types/react-native-vector-icons/MaterialIcons.d.ts create mode 100644 types/react-native-vector-icons/Octicons.d.ts create mode 100644 types/react-native-vector-icons/SimpleLineIcons.d.ts create mode 100644 types/react-native-vector-icons/Zocial.d.ts create mode 100644 types/react-native-vector-icons/index.d.ts create mode 100644 types/react-native-vector-icons/react-native-vector-icons-tests.tsx create mode 100644 types/react-native-vector-icons/tsconfig.json create mode 100644 types/react-native-vector-icons/tslint.json diff --git a/types/react-native-vector-icons/Entypo.d.ts b/types/react-native-vector-icons/Entypo.d.ts new file mode 100644 index 0000000000..b4e8bbc633 --- /dev/null +++ b/types/react-native-vector-icons/Entypo.d.ts @@ -0,0 +1,2 @@ +import { Icon } from './Icon'; +export default Icon; diff --git a/types/react-native-vector-icons/EvilIcons.d.ts b/types/react-native-vector-icons/EvilIcons.d.ts new file mode 100644 index 0000000000..b4e8bbc633 --- /dev/null +++ b/types/react-native-vector-icons/EvilIcons.d.ts @@ -0,0 +1,2 @@ +import { Icon } from './Icon'; +export default Icon; diff --git a/types/react-native-vector-icons/FontAwesome.d.ts b/types/react-native-vector-icons/FontAwesome.d.ts new file mode 100644 index 0000000000..b4e8bbc633 --- /dev/null +++ b/types/react-native-vector-icons/FontAwesome.d.ts @@ -0,0 +1,2 @@ +import { Icon } from './Icon'; +export default Icon; diff --git a/types/react-native-vector-icons/Foundation.d.ts b/types/react-native-vector-icons/Foundation.d.ts new file mode 100644 index 0000000000..b4e8bbc633 --- /dev/null +++ b/types/react-native-vector-icons/Foundation.d.ts @@ -0,0 +1,2 @@ +import { Icon } from './Icon'; +export default Icon; diff --git a/types/react-native-vector-icons/Icon.d.ts b/types/react-native-vector-icons/Icon.d.ts new file mode 100644 index 0000000000..3ae4916eea --- /dev/null +++ b/types/react-native-vector-icons/Icon.d.ts @@ -0,0 +1,197 @@ +import * as React from 'react'; +import { + TextStyle, + ViewStyle, + TextProperties, + TouchableHighlightProperties, + TouchableNativeFeedbackProperties, + TabBarIOSProperties, + ToolbarAndroidProperties +} from 'react-native'; + +export interface IconProps extends TextProperties { + /** + * Size of the icon, can also be passed as fontSize in the style object. + * + * @default 12 + * @type {string} + * @memberof IconProps + */ + size?: number; + + /** + * Name of the icon to show + * + * See Icon Explorer app + * {@link https://github.com/oblador/react-native-vector-icons/tree/master/Examples/IconExplorer} + * @type {string} + * @memberof IconProps + */ + name: string; + + /** + * Color of the icon + * + * @type {string} + * @memberof IconProps + */ + color?: string; +} + +export interface IconButtonProps extends IconProps, TouchableHighlightProperties, TouchableNativeFeedbackProperties { + /** + * Text and icon color + * Use iconStyle or nest a Text component if you need different colors. + * + * @default 'white' + * @type {string} + * @memberof IconButtonProps + */ + color?: string; + + /** + * Border radius of the button + * Set to 0 to disable. + * + * @default 5 + * @type {number} + * @memberof IconButtonProps + */ + borderRadius?: number; + + /** + * Styles applied to the icon only + * Good for setting margins or a different color. + * + * @default {marginRight: 10} + * @type {ViewStyle} + * @memberof IconButtonProps + */ + iconStyle?: ViewStyle; + + /** + * Style prop inherited from TextProperties and TouchableWithoutFeedbackProperties + * Only exist here so we can have ViewStyle or TextStyle + * + * @type {(ViewStyle | TextStyle)} + * @memberof IconButtonProps + */ + style?: ViewStyle | TextStyle; + + /** + * Background color of the button + * + * @default '#007AFF' + * @type {string} + * @memberof IconButtonProps + */ + backgroundColor?: string; +} + +export type ImageSource = any; + +export interface TabBarIOSProps extends TabBarIOSProperties { + /** + * Name of the default icon (similar to TabBarIOS.Item icon) + * + * @type {string} + * @memberof TabBarIOSProps + */ + iconName: string; + + /** + * Name of the selected icon (similar to TabBarIOS.Item selectedIcon). + * + * @default iconName + * @type {string} + * @memberof TabBarIOSProps + */ + selectedIconName: string; + + /** + * Size of the icon. + * + * @default 30 + * @type {number} + * @memberof TabBarIOSProps + */ + iconSize: number; + + /** + * Color of the icon + * + * @type {string} + * @memberof TabBarIOSProps + */ + iconColor: string; + + /** + * Color of the selected icon. + * + * @default iconColor + * @type {string} + * @memberof TabBarIOSProps + */ + selectedIconColor: string; +} + +export interface ToolbarAndroidProps extends ToolbarAndroidProperties { + /** + * Name of the navigation logo icon + * (similar to ToolbarAndroid logo) + * + * @type {string} + * @memberof ToolbarAndroidProps + */ + logoName: string; + + /** + * Name of the navigation icon + * (similar to ToolbarAndroid navIcon) + * + * @type {string} + * @memberof ToolbarAndroidProps + */ + navIconName: string; + + /** + * Name of the overflow icon + * (similar to ToolbarAndroid overflowIcon) + * + * @type {string} + * @memberof ToolbarAndroidProps + */ + overflowIconName: string; + + /** + * Size of the icons + * + * @default 24 + * @type {number} + * @memberof ToolbarAndroidProps + */ + iconSize: number; + + /** + * Color of the icons + * + * @default 'black' + * @type {string} + * @memberof ToolbarAndroidProps + */ + iconColor: string; +} + +export class Icon extends React.Component { + static getImageSource( + name: string, + color: string, + size?: number + ): Promise; +} + +export namespace Icon { + class ToolbarAndroid extends React.Component {} + class TabBarIOS extends React.Component {} + class Button extends React.Component {} +} diff --git a/types/react-native-vector-icons/Ionicons.d.ts b/types/react-native-vector-icons/Ionicons.d.ts new file mode 100644 index 0000000000..b4e8bbc633 --- /dev/null +++ b/types/react-native-vector-icons/Ionicons.d.ts @@ -0,0 +1,2 @@ +import { Icon } from './Icon'; +export default Icon; diff --git a/types/react-native-vector-icons/MaterialCommunityIcons.d.ts b/types/react-native-vector-icons/MaterialCommunityIcons.d.ts new file mode 100644 index 0000000000..b4e8bbc633 --- /dev/null +++ b/types/react-native-vector-icons/MaterialCommunityIcons.d.ts @@ -0,0 +1,2 @@ +import { Icon } from './Icon'; +export default Icon; diff --git a/types/react-native-vector-icons/MaterialIcons.d.ts b/types/react-native-vector-icons/MaterialIcons.d.ts new file mode 100644 index 0000000000..b4e8bbc633 --- /dev/null +++ b/types/react-native-vector-icons/MaterialIcons.d.ts @@ -0,0 +1,2 @@ +import { Icon } from './Icon'; +export default Icon; diff --git a/types/react-native-vector-icons/Octicons.d.ts b/types/react-native-vector-icons/Octicons.d.ts new file mode 100644 index 0000000000..b4e8bbc633 --- /dev/null +++ b/types/react-native-vector-icons/Octicons.d.ts @@ -0,0 +1,2 @@ +import { Icon } from './Icon'; +export default Icon; diff --git a/types/react-native-vector-icons/SimpleLineIcons.d.ts b/types/react-native-vector-icons/SimpleLineIcons.d.ts new file mode 100644 index 0000000000..b4e8bbc633 --- /dev/null +++ b/types/react-native-vector-icons/SimpleLineIcons.d.ts @@ -0,0 +1,2 @@ +import { Icon } from './Icon'; +export default Icon; diff --git a/types/react-native-vector-icons/Zocial.d.ts b/types/react-native-vector-icons/Zocial.d.ts new file mode 100644 index 0000000000..b4e8bbc633 --- /dev/null +++ b/types/react-native-vector-icons/Zocial.d.ts @@ -0,0 +1,2 @@ +import { Icon } from './Icon'; +export default Icon; diff --git a/types/react-native-vector-icons/index.d.ts b/types/react-native-vector-icons/index.d.ts new file mode 100644 index 0000000000..d46847b1ae --- /dev/null +++ b/types/react-native-vector-icons/index.d.ts @@ -0,0 +1,61 @@ +// Type definitions for react-native-vector-icons 4.2 +// Project: https://github.com/oblador/react-native-vector-icons +// Definitions by: Kyle Roach +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as React from 'react'; +import { Icon } from './Icon'; +import { TextProperties } from 'react-native'; + +/** + * Returns your own custom font based on the glyphMap where the key is the icon name + * and the value is either a UTF-8 character or it's character code. fontFamily is the name + * of the font NOT the filename. Open the font in Font Book.app or similar to learn the name. + * Optionally pass the third fontFile argument for android support, it should be a path + * to the font file in you asset folder. + * + * @param glyphMap + * @param fontFamily + * @param fontFile + */ +export function createIconSet( + glyphMap: {}, + fontFamily: string, + fontFile?: string +): Icon; + +/** + * Convenience method to create a custom font based on a fontello config file. + * Don't forget to import the font as described above and drop the config.json + * somewhere convenient in your project. + * + * Example usage + * import { createIconSetFromFontello } from 'react-native-vector-icons'; + * import fontelloConfig from './config.json'; + * const Icon = createIconSetFromFontello(fontelloConfig); + * + * @see http://fontello.com + * @export + * @param {{}} config + * @returns {Icon} + */ +export function createIconSetFromFontello(config: {}): Icon; + +/** + * Convenience method to create a custom font from IcoMoon + * Make sure you're using the Download option in IcoMoon, and use the .json file that's + * included in the .zip you've downloaded. You'll also need to import the .ttf font + * file into your project + * + * Example usage + * import { createIconSetFromIcoMoon } from 'react-native-vector-icons'; + * import icoMoonConfig from './config.json'; + * const Icon = createIconSetFromIcoMoon(icoMoonConfig); + * + * @see https://icomoon.io/app + * @export + * @param {{}} config + * @returns {Icon} + */ +export function createIconSetFromIcoMoon(config: {}): Icon; diff --git a/types/react-native-vector-icons/react-native-vector-icons-tests.tsx b/types/react-native-vector-icons/react-native-vector-icons-tests.tsx new file mode 100644 index 0000000000..270c8fbdc4 --- /dev/null +++ b/types/react-native-vector-icons/react-native-vector-icons-tests.tsx @@ -0,0 +1,30 @@ +import * as React from 'react'; +import { View, Text } from 'react-native'; +import MaterialIcon from 'react-native-vector-icons/MaterialIcons'; +import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome'; + +class Example extends React.Component<{}, {}> { + handleButton() { + console.log('You pressed me'); + } + + render() { + return ( + + {/* Normal Icon */} + + + {/* Icon button */} + this.handleButton()} + > + + Login with Facebook + + + + ); + } +} diff --git a/types/react-native-vector-icons/tsconfig.json b/types/react-native-vector-icons/tsconfig.json new file mode 100644 index 0000000000..746ae7e0ff --- /dev/null +++ b/types/react-native-vector-icons/tsconfig.json @@ -0,0 +1,35 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "dom", + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "Icon.d.ts", + "Entypo.d.ts", + "EvilIcons.d.ts", + "FontAwesome.d.ts", + "Foundation.d.ts", + "Ionicons.d.ts", + "MaterialCommunityIcons.d.ts", + "MaterialIcons.d.ts", + "Octicons.d.ts", + "SimpleLineIcons.d.ts", + "Zocial.d.ts", + "react-native-vector-icons-tests.tsx" + ] +} diff --git a/types/react-native-vector-icons/tslint.json b/types/react-native-vector-icons/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-vector-icons/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 4e765d80ff32b58b62f8124a0dfe147a0c7daece Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Mon, 26 Jun 2017 12:26:35 -0700 Subject: [PATCH 107/180] Fix linit --- types/react-router-native/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-router-native/index.d.ts b/types/react-router-native/index.d.ts index 45fa83decb..f2ab1c72b1 100644 --- a/types/react-router-native/index.d.ts +++ b/types/react-router-native/index.d.ts @@ -44,4 +44,4 @@ export interface NativeRouterProps { keyLength?: number; } -export class NativeRouter extends React.Component {} \ No newline at end of file +export class NativeRouter extends React.Component {} From c4b70febc65857900ee5c4a4332bb219dfd2a78e Mon Sep 17 00:00:00 2001 From: amikhalev Date: Mon, 26 Jun 2017 15:21:56 -0600 Subject: [PATCH 108/180] Added string literal types for @types/semver --- types/semver/index.d.ts | 8 +++++--- types/semver/semver-tests.ts | 18 +++++++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/types/semver/index.d.ts b/types/semver/index.d.ts index 60e7275f7a..336fa85574 100644 --- a/types/semver/index.d.ts +++ b/types/semver/index.d.ts @@ -5,6 +5,8 @@ export const SEMVER_SPEC_VERSION: "2.0.0"; +export type ReleaseType = "major" | "premajor" | "minor" | "preminor" | "patch" | "prepatch" | "prerelease"; + /** * Return the parsed version, or null if it's not valid. */ @@ -16,7 +18,7 @@ export function clean(version: string, loose?: boolean): string; /** * Return the version incremented by the release type (major, minor, patch, or prerelease), or null if it's not valid. */ -export function inc(v: string, release: string, loose?: boolean): string; +export function inc(v: string, release: ReleaseType, loose?: boolean): string; /** * Return the major version number. */ @@ -76,7 +78,7 @@ export function rcompare(v1: string, v2: string, loose?: boolean): number; /** * Returns difference between two versions by the release type (major, premajor, minor, preminor, patch, prepatch, or prerelease), or null if the versions are the same. */ -export function diff(v1: string, v2: string, loose?: boolean): string; +export function diff(v1: string, v2: string, loose?: boolean): ReleaseType; // Ranges /** @@ -127,7 +129,7 @@ export class SemVer { compare(other: SemVer): number; compareMain(other: SemVer): number; comparePre(other: SemVer): number; - inc(release: string): SemVer; + inc(release: ReleaseType): SemVer; } export class Comparator { diff --git a/types/semver/semver-tests.ts b/types/semver/semver-tests.ts index b7a1299ad3..42088eef4d 100644 --- a/types/semver/semver-tests.ts +++ b/types/semver/semver-tests.ts @@ -4,7 +4,7 @@ let obj: {}; let bool: boolean; let num: number; let str: string; -let diff: string; +let diff: semver.ReleaseType; let x: any = null; let arr: any[]; let exp: RegExp; @@ -22,7 +22,13 @@ str = semver.clean(str); str = semver.valid(str, loose); str = semver.clean(str, loose); -str = semver.inc(str, str, loose); +str = semver.inc(str, "major", loose); +str = semver.inc(str, "premajor", loose); +str = semver.inc(str, "minor", loose); +str = semver.inc(str, "preminor", loose); +str = semver.inc(str, "patch", loose); +str = semver.inc(str, "prepatch", loose); +str = semver.inc(str, "prerelease", loose); num = semver.major(str, loose); num = semver.minor(str, loose); num = semver.patch(str, loose); @@ -66,7 +72,13 @@ strArr = ver.prerelease; num = ver.compare(ver); num = ver.compareMain(ver); num = ver.comparePre(ver); -ver = ver.inc(str); +ver = ver.inc("major"); +ver = ver.inc("premajor"); +ver = ver.inc("minor"); +ver = ver.inc("preminor"); +ver = ver.inc("patch"); +ver = ver.inc("prepatch"); +ver = ver.inc("prerelease"); const comp = new semver.Comparator(str, bool); str = comp.toString(); From efc67e63d92187669026441e7c43c68a1f2ea795 Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Mon, 26 Jun 2017 17:36:16 -0400 Subject: [PATCH 109/180] [angular][jquery] Fix merge issue with cssPropertySetter. --- types/angular/index.d.ts | 5 ++++- types/angular/jqlite.d.ts | 4 +++- types/jquery/v1/index.d.ts | 4 +++- types/jquery/v2/index.d.ts | 4 +++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/types/angular/index.d.ts b/types/angular/index.d.ts index 4f8d55f9dc..3683c1aed6 100644 --- a/types/angular/index.d.ts +++ b/types/angular/index.d.ts @@ -1,6 +1,9 @@ // Type definitions for Angular JS 1.6 // Project: http://angularjs.org -// Definitions by: Diego Vilar , Georgii Dolzhykov , Caleb St-Denis +// Definitions by: Diego Vilar +// Georgii Dolzhykov +// Caleb St-Denis +// Leonard Thieu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/angular/jqlite.d.ts b/types/angular/jqlite.d.ts index 36509143fa..016411c848 100644 --- a/types/angular/jqlite.d.ts +++ b/types/angular/jqlite.d.ts @@ -796,7 +796,9 @@ interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObjec /** * The interface used to specify the properties parameter in css() */ -type cssPropertySetter = (index: number, value?: string) => string | number; +interface cssPropertySetter { + (index: number, value?: string): string | number; +} interface JQueryCssProperties { [propertyName: string]: string | number | cssPropertySetter; } diff --git a/types/jquery/v1/index.d.ts b/types/jquery/v1/index.d.ts index a3c2d42979..ee66781019 100644 --- a/types/jquery/v1/index.d.ts +++ b/types/jquery/v1/index.d.ts @@ -702,7 +702,9 @@ interface JQueryCoordinates { /** * The interface used to specify the properties parameter in css() */ -type cssPropertySetter = (index: number, value?: string) => string | number; +interface cssPropertySetter { + (index: number, value?: string): string | number; +} interface JQueryCssProperties { [propertyName: string]: string | number | cssPropertySetter; } diff --git a/types/jquery/v2/index.d.ts b/types/jquery/v2/index.d.ts index b01e4ceda7..9d30f12c38 100644 --- a/types/jquery/v2/index.d.ts +++ b/types/jquery/v2/index.d.ts @@ -702,7 +702,9 @@ interface JQueryCoordinates { /** * The interface used to specify the properties parameter in css() */ -type cssPropertySetter = (index: number, value?: string) => string | number; +interface cssPropertySetter { + (index: number, value?: string): string | number; +} interface JQueryCssProperties { [propertyName: string]: string | number | cssPropertySetter; } From af76b010ba6445595185d435dc1730c92488c7ba Mon Sep 17 00:00:00 2001 From: Selkin Vitaly Date: Tue, 27 Jun 2017 00:39:59 +0300 Subject: [PATCH 110/180] added types for bem-cn --- types/bem-cn/bem-cn-tests.ts | 46 ++++++++++++++++++++++++++++++++++++ types/bem-cn/index.d.ts | 41 ++++++++++++++++++++++++++++++++ types/bem-cn/tsconfig.json | 22 +++++++++++++++++ types/bem-cn/tslint.json | 3 +++ 4 files changed, 112 insertions(+) create mode 100644 types/bem-cn/bem-cn-tests.ts create mode 100644 types/bem-cn/index.d.ts create mode 100644 types/bem-cn/tsconfig.json create mode 100644 types/bem-cn/tslint.json diff --git a/types/bem-cn/bem-cn-tests.ts b/types/bem-cn/bem-cn-tests.ts new file mode 100644 index 0000000000..d57e138777 --- /dev/null +++ b/types/bem-cn/bem-cn-tests.ts @@ -0,0 +1,46 @@ +import * as block from "bem-cn"; + +// expected 'block' +block("block")(); + +// expected 'block__elem' +block("block")("elem")(); + +// expected 'block__elem block__elem_disabled block__elem_size_small' +block("block")("elem", { disabled: true, size: 'small' })(); + +// expected 'block block_disabled' +block("block")({ disabled: true})(); + +// expected 'block mix' +block("block").mix("mix"); + +// expected 'block mix mix2' +block("block").mix(["mix", "mix2"]); + +// expected 'block is-hidden' +block("block").state({ hidden: true }); + +// expected 'block' +block("block").state({ hidden: false }); + +// expected 'block is-hidden is-error' +block("block").state({ hidden: true, error: true }); + +// expected 'block is-loading' +block("block").is({ loading: true }); + +// expected 'block has-content' +block("block").has({ content: true }); + +block.setup({ + el: '~~', + mod: '--', + modValue: '-' +}); + +// expected 'block~~elem' +block("block")("elem"); + +// expected 'block block--mod-value' +block("block")({ mod: "value"}); diff --git a/types/bem-cn/index.d.ts b/types/bem-cn/index.d.ts new file mode 100644 index 0000000000..5a78df4435 --- /dev/null +++ b/types/bem-cn/index.d.ts @@ -0,0 +1,41 @@ +// Type definitions for bem-cn 2.1 +// Project: https://github.com/albburtsev/bem-cn +// Definitions by: Vitaly Selkin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +type StateFn = (states: { [key: string]: boolean }) => Inner; + +interface Modifications { + [key: string]: (string | boolean); +} + +interface Block { + (name: string): Inner; + + reset(): void; + setup(settings?: Settings): void; +} + +interface Inner { + (elem: string | Modifications): Inner; + (elem: string, mods: Modifications): Inner; + (): string; + + mix(mixes: string | string[]): Inner; + has: StateFn; + state: StateFn; + is: StateFn; + toString(): string; + split(separator: string, limit?: number): string[]; +} + +interface Settings { + ns?: string; + el?: string; + mod?: string; + modValue?: string; + classMap?: { [className: string]: string } | null; +} + +declare const block: Block; +export = block; diff --git a/types/bem-cn/tsconfig.json b/types/bem-cn/tsconfig.json new file mode 100644 index 0000000000..a4c2cd86cb --- /dev/null +++ b/types/bem-cn/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bem-cn-tests.ts" + ] +} diff --git a/types/bem-cn/tslint.json b/types/bem-cn/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/bem-cn/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From e6a401f7dafb11114e07cf6a4b2c8528da639452 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Mon, 26 Jun 2017 14:48:23 -0700 Subject: [PATCH 111/180] React.createElement has more specific return types --- types/react/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index 99e9de616f..c70dbaa3fa 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -136,14 +136,14 @@ declare namespace React { type: ClassType): CFactory; function createFactory

(type: ComponentClass

): Factory

; - function createElement

, T extends Element>( + function createElement

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

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

( type: SFC

, props?: Attributes & P, From 4bbd7803bd9f2faba8cb22333b763ed82d2549f0 Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Mon, 26 Jun 2017 17:55:25 -0400 Subject: [PATCH 112/180] [angular][jquery] Workaround duplicate index signature. --- types/angular/jqlite.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/angular/jqlite.d.ts b/types/angular/jqlite.d.ts index 016411c848..7c8975b8bb 100644 --- a/types/angular/jqlite.d.ts +++ b/types/angular/jqlite.d.ts @@ -169,7 +169,7 @@ interface JQuery { * @param properties An object of property-value pairs to set. * @see {@link https://api.jquery.com/css/#css-properties} */ - css(properties: JQueryCssProperties): JQuery; + css(properties: JQLiteCssProperties): JQuery; /** * Store arbitrary data associated with the matched elements. @@ -799,6 +799,6 @@ interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObjec interface cssPropertySetter { (index: number, value?: string): string | number; } -interface JQueryCssProperties { +interface JQLiteCssProperties { [propertyName: string]: string | number | cssPropertySetter; } From 70e1029f3a6f52262ab1881e0129cfa9920fc038 Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Mon, 26 Jun 2017 18:17:27 -0400 Subject: [PATCH 113/180] [angular] Linty --- types/angular/jqlite.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/angular/jqlite.d.ts b/types/angular/jqlite.d.ts index 7c8975b8bb..ee7d6acf1c 100644 --- a/types/angular/jqlite.d.ts +++ b/types/angular/jqlite.d.ts @@ -796,6 +796,7 @@ interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObjec /** * The interface used to specify the properties parameter in css() */ +// tslint:disable-next-line:class-name interface cssPropertySetter { (index: number, value?: string): string | number; } From b5eb45232a190879384e731c8b57fcf0b7cc0d92 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Mon, 26 Jun 2017 15:31:09 -0700 Subject: [PATCH 114/180] Better constraint for React.createElement for SVG --- types/react/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index c70dbaa3fa..577959ae7b 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -140,7 +140,7 @@ declare namespace React { type: keyof ReactHTML, props?: ClassAttributes & P, ...children: ReactNode[]): ReactHTMLElement; - function createElement

, T extends Element>( + function createElement

, T extends SVGElement>( type: keyof ReactSVG, props?: ClassAttributes & P, ...children: ReactNode[]): ReactSVGElement; From c326dd87d4549561c7008089b7a7022c91084898 Mon Sep 17 00:00:00 2001 From: Chigozirim C Date: Mon, 26 Jun 2017 18:36:35 -0500 Subject: [PATCH 115/180] node: Add cork and uncork type definitions Fixes: #16726 --- types/node/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 131dbc96a1..e9a40754d4 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -3823,6 +3823,8 @@ declare module "stream" { end(): void; end(chunk: any, cb?: Function): void; end(chunk: any, encoding?: string, cb?: Function): void; + cork(): void; + uncork(): void; /** * Event emitter From 135e6ac043cf15d01263c1d6db13c89faf676a38 Mon Sep 17 00:00:00 2001 From: Chigozirim C Date: Mon, 26 Jun 2017 18:36:35 -0500 Subject: [PATCH 116/180] node: Add cork and uncork type definitions Fixes: #16726 --- types/node/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 131dbc96a1..f76c3a7607 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -6,6 +6,7 @@ // Roberto Desideri // Christian Vaagland Tellnes // Wilco Bakker +// Chigozirim C. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -3823,6 +3824,8 @@ declare module "stream" { end(): void; end(chunk: any, cb?: Function): void; end(chunk: any, encoding?: string, cb?: Function): void; + cork(): void; + uncork(): void; /** * Event emitter @@ -3908,6 +3911,8 @@ declare module "stream" { end(): void; end(chunk: any, cb?: Function): void; end(chunk: any, encoding?: string, cb?: Function): void; + cork(): void; + uncork(): void; } export interface TransformOptions extends DuplexOptions { From 67bcf68325a56630a1d33aeebe41307770c6feeb Mon Sep 17 00:00:00 2001 From: Ruslan Voronkov Date: Mon, 26 Jun 2017 10:03:19 +0300 Subject: [PATCH 117/180] Move firstDay attribute out of days object *firstDay* attribute should be in calendar object --- types/kendo-ui/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/kendo-ui/index.d.ts b/types/kendo-ui/index.d.ts index 8c58c182be..733845e514 100644 --- a/types/kendo-ui/index.d.ts +++ b/types/kendo-ui/index.d.ts @@ -16,8 +16,8 @@ declare namespace kendo { names: string[]; namesAbbr: string[]; namesShort: string[]; - firstDay: number; }; + firstDay: number; months: { names: string[]; namesAbbr: string[]; From ffd486c5373bfbac125830746a57b5b5833b515e Mon Sep 17 00:00:00 2001 From: Paul Datsiuk Date: Tue, 27 Jun 2017 10:49:28 +0300 Subject: [PATCH 118/180] add typescript definition for browser-report --- types/browser-report/browser-report-tests.ts | 13 +++++ types/browser-report/index.d.ts | 56 ++++++++++++++++++++ types/browser-report/tsconfig.json | 22 ++++++++ 3 files changed, 91 insertions(+) create mode 100644 types/browser-report/browser-report-tests.ts create mode 100644 types/browser-report/index.d.ts create mode 100644 types/browser-report/tsconfig.json diff --git a/types/browser-report/browser-report-tests.ts b/types/browser-report/browser-report-tests.ts new file mode 100644 index 0000000000..11734d810c --- /dev/null +++ b/types/browser-report/browser-report-tests.ts @@ -0,0 +1,13 @@ +import 'browser-report'; + +function test_sync() { + var browserInfo = window.browserReportSync(); + console.log(browserInfo.browser.name); +} + +function test_async() { + window.browserReport((error, result) => { + console.log(result.ip + ' ' + result.browser.name); + debugger; + }); +} \ No newline at end of file diff --git a/types/browser-report/index.d.ts b/types/browser-report/index.d.ts new file mode 100644 index 0000000000..8c7dec2b5d --- /dev/null +++ b/types/browser-report/index.d.ts @@ -0,0 +1,56 @@ +// Type definitions for browser-report v2.2.9 +// Project: https://github.com/JTOne123/browser-report +// Definitions by: Paul Datsiuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface Window { + browserReport(result: (error: ErrorEvent, report: ReportResult) => any): void; + browserReportSync(): ReportResult; +} + +interface ReportResult { + "browser": { + "name": (string), + "version": (string) + }, + "cookies": (boolean), + "flash": { + "version": (string) + }, + "ip": (string), + "country": { + "name": (string), + "code": (string), + "city": (string), + "latitude" : (string), + "longitude": (string), + "timezone": (string) + }, + "java": { + "version": (string) + }, + "lang": (Array), + "os": { + "name": (string), + "version": (string) + }, + "screen": { + "colors": (number), + "dppx": (number), + "height": (number), + "width": (number) + }, + "scripts": (boolean), + "timestamp": (string), + "userAgent": (string), + "viewport": { + "height": (number), + "layout": { + "height": (number), + "width": (number) + } + "width": (number), + "zoom": (number) + } + "websockets": (boolean) +} \ No newline at end of file diff --git a/types/browser-report/tsconfig.json b/types/browser-report/tsconfig.json new file mode 100644 index 0000000000..fa2a017bdd --- /dev/null +++ b/types/browser-report/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "browser-report-tests.ts" + ] +} \ No newline at end of file From 130cf981c3e8026d44ad835c396cccb51e7dc567 Mon Sep 17 00:00:00 2001 From: Paul Datsiuk Date: Tue, 27 Jun 2017 10:56:25 +0300 Subject: [PATCH 119/180] fix test --- types/browser-report/browser-report-tests.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/browser-report/browser-report-tests.ts b/types/browser-report/browser-report-tests.ts index 11734d810c..9f50b5b0f2 100644 --- a/types/browser-report/browser-report-tests.ts +++ b/types/browser-report/browser-report-tests.ts @@ -8,6 +8,5 @@ function test_sync() { function test_async() { window.browserReport((error, result) => { console.log(result.ip + ' ' + result.browser.name); - debugger; }); } \ No newline at end of file From 2a104b3dcc8c5e1d49987541033b9a33a5372e09 Mon Sep 17 00:00:00 2001 From: Paul Datsiuk Date: Tue, 27 Jun 2017 11:08:12 +0300 Subject: [PATCH 120/180] add dom lib --- types/browser-report/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/browser-report/tsconfig.json b/types/browser-report/tsconfig.json index fa2a017bdd..997b307339 100644 --- a/types/browser-report/tsconfig.json +++ b/types/browser-report/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, From 24803718e1608c107b005a2dd250ace4302f5796 Mon Sep 17 00:00:00 2001 From: Wouter Hardeman Date: Tue, 27 Jun 2017 10:09:30 +0200 Subject: [PATCH 121/180] Removed useless props and state from react-sortable-tree-tests --- types/react-sortable-tree/react-sortable-tree-tests.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-sortable-tree/react-sortable-tree-tests.tsx b/types/react-sortable-tree/react-sortable-tree-tests.tsx index 21c18410e5..8b89db5196 100644 --- a/types/react-sortable-tree/react-sortable-tree-tests.tsx +++ b/types/react-sortable-tree/react-sortable-tree-tests.tsx @@ -15,7 +15,7 @@ import SortableTree, } from "react-sortable-tree"; import { ListProps, ListRowRenderer } from "react-virtualized"; -class Test extends React.Component { +class Test extends React.Component { render() { const treeData = [ { From d3641c0ab18b2cb2a40ac32c56c4c51bd9f92a76 Mon Sep 17 00:00:00 2001 From: Gyusun Yeom Date: Thu, 22 Jun 2017 18:27:38 +0900 Subject: [PATCH 122/180] add types for @mapbox/shelf-pack --- types/mapbox__shelf-pack/index.d.ts | 59 +++++++++++++++++++ .../mapbox__shelf-pack-tests.ts | 30 ++++++++++ types/mapbox__shelf-pack/tsconfig.json | 22 +++++++ types/mapbox__shelf-pack/tslint.json | 1 + 4 files changed, 112 insertions(+) create mode 100644 types/mapbox__shelf-pack/index.d.ts create mode 100644 types/mapbox__shelf-pack/mapbox__shelf-pack-tests.ts create mode 100644 types/mapbox__shelf-pack/tsconfig.json create mode 100644 types/mapbox__shelf-pack/tslint.json diff --git a/types/mapbox__shelf-pack/index.d.ts b/types/mapbox__shelf-pack/index.d.ts new file mode 100644 index 0000000000..3ef3ec3507 --- /dev/null +++ b/types/mapbox__shelf-pack/index.d.ts @@ -0,0 +1,59 @@ +// Type definitions for @mapbox/shelf-pack 3.0 +// Project: https://github.com/mapbox/shelf-pack +// Definitions by: Gyusun Yeom +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// tslint:disable-next-line no-single-declare-module +declare module "@mapbox/shelf-pack" { + export = ShelfPack; + + class ShelfPack { + constructor(width?: number, height?: number, options?: ShelfPack.CreateOption); + + pack(bins: Array, options?: ShelfPack.PackOption): ShelfPack.Bin[]; + packOne(w: number, h: number, id?: ShelfPack.ID): ShelfPack.Bin; + getBin(id: ShelfPack.ID): ShelfPack.Bin; + ref(bin: ShelfPack.Bin): number; + unref(bin: ShelfPack.Bin): number; + clear(): void; + resize(w: number, h: number): boolean; + + w: number; + h: number; + } + + namespace ShelfPack { + class Bin { + constructor(id: ID, x: number, y: number, w: number, h: number, maxw?: number, maxh?: number); + + id: ID; + x: number; + y: number; + w: number; + h: number; + } + + type ID = number | string; + interface Request { + id?: ID; + } + interface RequestShort extends Request { + w: number; + h: number; + } + interface RequestLong extends Request { + width: number; + height: number; + } + + interface PackOption { + /// If true , the supplied bin objects will be updated inplace with x and y properties + inPlace?: boolean; + } + + interface CreateOption { + /// If true , the sprite will automatically grow + autoResize?: boolean; + } + } +} diff --git a/types/mapbox__shelf-pack/mapbox__shelf-pack-tests.ts b/types/mapbox__shelf-pack/mapbox__shelf-pack-tests.ts new file mode 100644 index 0000000000..3baff984cb --- /dev/null +++ b/types/mapbox__shelf-pack/mapbox__shelf-pack-tests.ts @@ -0,0 +1,30 @@ +import * as ShelfPack from '@mapbox/shelf-pack'; + +let sprite = new ShelfPack(64, 64); + +for (let i = 0; i < 5; i++) { + const bin = sprite.packOne(32, 32); +} + +sprite.clear(); + +sprite.resize(128, 128); + +sprite = new ShelfPack(64, 64); + +[100, 101, 102].forEach(id => { + const bin = sprite.packOne(16, 16, id); +}); + +const bin102 = sprite.packOne(16, 16, 102); + +const bin101 = sprite.getBin(101); +sprite.ref(bin101); + +const bin100 = sprite.getBin(100); +sprite.unref(bin100); + +const bin103 = sprite.packOne(16, 15, 103); +sprite.unref(bin103); + +const bin104 = sprite.packOne(16, 16, 104); diff --git a/types/mapbox__shelf-pack/tsconfig.json b/types/mapbox__shelf-pack/tsconfig.json new file mode 100644 index 0000000000..540d660492 --- /dev/null +++ b/types/mapbox__shelf-pack/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "mapbox__shelf-pack-tests.ts" + ] +} diff --git a/types/mapbox__shelf-pack/tslint.json b/types/mapbox__shelf-pack/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/mapbox__shelf-pack/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From abf87f7c822b61d78c2496fe26011c4657c3765a Mon Sep 17 00:00:00 2001 From: arminbaljic Date: Tue, 27 Jun 2017 11:03:49 +0200 Subject: [PATCH 123/180] Added type definitions for iframe-resizer --- types/iframe-resizer/iframe-resizer-tests.ts | 1 + types/iframe-resizer/index.d.ts | 184 +++++++++++++++++++ types/iframe-resizer/tsconfig.json | 25 +++ types/iframe-resizer/tslint.json | 1 + 4 files changed, 211 insertions(+) create mode 100644 types/iframe-resizer/iframe-resizer-tests.ts create mode 100644 types/iframe-resizer/index.d.ts create mode 100644 types/iframe-resizer/tsconfig.json create mode 100644 types/iframe-resizer/tslint.json diff --git a/types/iframe-resizer/iframe-resizer-tests.ts b/types/iframe-resizer/iframe-resizer-tests.ts new file mode 100644 index 0000000000..1996490390 --- /dev/null +++ b/types/iframe-resizer/iframe-resizer-tests.ts @@ -0,0 +1 @@ +import resizer = require('iframe-resizer'); diff --git a/types/iframe-resizer/index.d.ts b/types/iframe-resizer/index.d.ts new file mode 100644 index 0000000000..04ff130667 --- /dev/null +++ b/types/iframe-resizer/index.d.ts @@ -0,0 +1,184 @@ +// Type definitions for iframe-resizer +// Project: https://github.com/davidjbradshaw/iframe-resizer +// Definitions by: Armin Baljic +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'iframe-resizer' { + export interface IFrameObject { + close(): void; + moveToAnchor(anchor): void; + resize(): void; + sendMessage(message: any): void; + } + + export interface IFrameComponent extends HTMLIFrameElement { + iFrameResizer: IFrameObject + } + + export interface IFrameOptions { + /** + * When enabled changes to the Window size or the DOM will cause the iFrame to resize to the new content size. + * Disable if using size method with custom dimensions. + */ + autoResize?: boolean; + /** + * Override the body background style in the iFrame. + */ + bodyBackground?: string; + /** + * Override the default body margin style in the iFrame. A string can be any valid value for the + * CSS margin attribute, for example '8px 3em'. A number value is converted into px. + */ + bodyMargin?: number; + /** + * When set to true, only allow incoming messages from the domain listed in the src property of the iFrame tag. + * If your iFrame navigates between different domains, ports or protocols; then you will need to + * provide an array of URLs or disable this option. + */ + checkOrigin?: boolean; + /** + * When enabled in page linking inside the iFrame and from the iFrame to the parent page will be enabled. + */ + inPageLinks?: boolean; + /** + * Height calculation method. + */ + heightCalculationMethod?: string; + /** + * Set iFrame Id + */ + id?: string; + /** + * In browsers that don't support mutationObserver, such as IE10, the library falls back to using + * setInterval, to check for changes to the page size. + */ + interval?: number; + /** + * Setting the log option to true will make the scripts in both the host page and the iFrame output + * everything they do to the JavaScript console so you can see the communication between the two scripts. + */ + log?: boolean; + /** + * Set maximum height of iFrame. + */ + maxHeight?: number; + /** + * Set maximum width of iFrame. + */ + maxWidth?: number; + /** + * Set minimum height of iFrame. + */ + minHeight?: number; + /** + * Set minimum width of iFrame. + */ + minWidth?: number; + /** + * Listen for resize events from the parent page, or the iFrame. Select the 'child' value if the iFrame + * can be resized independently of the browser window. Selecting this value can cause issues with some + * height calculation methods on mobile devices. + */ + resizeFrom?: string; + /** + * Enable scroll bars in iFrame. + */ + scrolling?: boolean; + /** + * Resize iFrame to content height. + */ + sizeHeight?: boolean; + /** + * Resize iFrame to content width. + */ + sizeWidth?: boolean; + /** + * Set the number of pixels the iFrame content size has to change by, before triggering a resize of the iFrame. + */ + tolerance?: number; + /** + * Width calculation method. + */ + widthCalculationMethod?: string; + /** + * Called when iFrame is closed via parentIFrame.close() or iframe.iframeResizer.close() methods. + */ + closedCallback?: (iframeId: string) => void; + /** + * Initial setup callback function. + */ + initCallback?: (iframe: IFrameComponent) => void; + /** + * Receive message posted from iFrame with the parentIFrame.sendMessage() method. + */ + messageCallback?: (data: IFrameMessageData) => void; + /** + * Function called after iFrame resized. Passes in messageData object containing the iFrame, height, width + * and the type of event that triggered the iFrame to resize. + */ + resizedCallback?: (data: IFrameResizedData) => void; + /** + * Called before the page is repositioned after a request from the iFrame, due to either an in page link, + * or a direct request from either parentIFrame.scrollTo() or parentIFrame.scrollToOffset(). + * If this callback function returns false, it will stop the library from repositioning the page, so that + * you can implement your own animated page scrolling instead. + */ + scrollCallback?: (data: IFrameScrollData) => boolean; + } + + export interface IFramePageOptions { + /** + * This option allows you to restrict the domain of the parent page, + * to prevent other sites mimicking your parent page. + */ + targetOrigin?: string; + /** + * Receive message posted from the parent page with the iframe.iFrameResizer.sendMessage() method. + */ + messageCallback?: (message: any) => void; + /** + * This function is called once iFrame-Resizer has been initialized after receiving a call from the parent page. + */ + readyCallback?: () => void; + /** + * These option can be used to override the option set in the parent page + */ + heightCalculationMethod?: string; + /** + * These option can be used to override the option set in the parent page + */ + widthCalculationMethod?: string; + } + + export interface IFramePage { + autoResize(resize?: boolean): boolean; + close(): void; + getId(): string; + getPageInfo(callback: (data: any) => void | false): void; + scrollTo(x: number, y: number); + scrollToOffset(x: number, y: number); + sendMessage(message: any): void; + setHeightCalculationMethod(method: string): void; + size(customHeight?, customWidth?): void + } + + + export interface IFrameResizedData { + iframe: IFrameComponent; + height: number; + width: number; + type: string; + } + + export interface IFrameMessageData { + iframe: IFrameComponent; + message: string; + } + + export interface IFrameScrollData { + x: number; + y: number; + } + + export function iframeResizer(options: IFrameOptions, target: HTMLElement): IFrameComponent; +} \ No newline at end of file diff --git a/types/iframe-resizer/tsconfig.json b/types/iframe-resizer/tsconfig.json new file mode 100644 index 0000000000..ef96a6d33a --- /dev/null +++ b/types/iframe-resizer/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "exclude": [ + "node_modules" + ], + "files": [ + "index.d.ts", + "iframe-resizer-tests.ts" + ] +} \ No newline at end of file diff --git a/types/iframe-resizer/tslint.json b/types/iframe-resizer/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/iframe-resizer/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 3314dd9601333818b0cb63fd0c38082b4201d207 Mon Sep 17 00:00:00 2001 From: Arturs Vonda Date: Tue, 27 Jun 2017 12:13:01 +0300 Subject: [PATCH 124/180] Add missing methods for opening date picker dialog --- types/material-ui/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/material-ui/index.d.ts b/types/material-ui/index.d.ts index a7b13f2bb4..16c6b5dce7 100644 --- a/types/material-ui/index.d.ts +++ b/types/material-ui/index.d.ts @@ -942,6 +942,8 @@ declare namespace __MaterialUI { utils?: propTypes.utils; } export class DatePicker extends React.Component { + focus(): void; + openDialog(): void; } interface DatePickerDialogProps { From 6a66c72a8ed8ac56aba0e5da3220310215aee738 Mon Sep 17 00:00:00 2001 From: arminbaljic Date: Tue, 27 Jun 2017 11:27:34 +0200 Subject: [PATCH 125/180] Finished type definitions for iframe-resizer. --- types/iframe-resizer/iframe-resizer-tests.ts | 33 ++++++++++++- types/iframe-resizer/index.d.ts | 52 ++++++++++++-------- types/iframe-resizer/tsconfig.json | 5 +- types/iframe-resizer/tslint.json | 4 +- 4 files changed, 70 insertions(+), 24 deletions(-) diff --git a/types/iframe-resizer/iframe-resizer-tests.ts b/types/iframe-resizer/iframe-resizer-tests.ts index 1996490390..d127f8bf36 100644 --- a/types/iframe-resizer/iframe-resizer-tests.ts +++ b/types/iframe-resizer/iframe-resizer-tests.ts @@ -1 +1,32 @@ -import resizer = require('iframe-resizer'); +import {IFrameComponent, IFrameOptions, iframeResizer} from "iframe-resizer"; + +function testOne(): void { + let iframe: HTMLIFrameElement = document.createElement('iframe'); + let options: IFrameOptions = {log: true}; + let components: IFrameComponent[] = iframeResizer(options, iframe); + if (components) { + components.forEach(component => console.log(component.iFrameResizer)); + } else { + console.log("No components"); + } +} + +function testTwo(): void { + let iframe: HTMLIFrameElement = document.createElement('iframe'); + let components: IFrameComponent[] = iframeResizer({ + initCallback: () => { + console.log('Init'); + }, + closedCallback: () => { + console.log('Closed'); + } + }, iframe); + if (components) { + components.forEach(component => console.log(component.iFrameResizer)); + } else { + console.log("No components"); + } +} + +testOne(); +testTwo(); diff --git a/types/iframe-resizer/index.d.ts b/types/iframe-resizer/index.d.ts index 04ff130667..1a05833692 100644 --- a/types/iframe-resizer/index.d.ts +++ b/types/iframe-resizer/index.d.ts @@ -1,21 +1,26 @@ -// Type definitions for iframe-resizer +// Type definitions for iframe-resizer 3.5 // Project: https://github.com/davidjbradshaw/iframe-resizer // Definitions by: Armin Baljic // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// tslint:disable:prefer-method-signature +// tslint:disable-next-line:no-single-declare-module declare module 'iframe-resizer' { - export interface IFrameObject { + // tslint:disable-next-line:interface-name + interface IFrameObject { close(): void; - moveToAnchor(anchor): void; + moveToAnchor(anchor: string): void; resize(): void; sendMessage(message: any): void; } - export interface IFrameComponent extends HTMLIFrameElement { - iFrameResizer: IFrameObject + // tslint:disable-next-line:interface-name + interface IFrameComponent extends HTMLIFrameElement { + iFrameResizer: IFrameObject; } - export interface IFrameOptions { + // tslint:disable-next-line:interface-name + interface IFrameOptions { /** * When enabled changes to the Window size or the DOM will cause the iFrame to resize to the new content size. * Disable if using size method with custom dimensions. @@ -103,11 +108,11 @@ declare module 'iframe-resizer' { /** * Called when iFrame is closed via parentIFrame.close() or iframe.iframeResizer.close() methods. */ - closedCallback?: (iframeId: string) => void; + closedCallback?: (iframeId?: string) => void; /** * Initial setup callback function. */ - initCallback?: (iframe: IFrameComponent) => void; + initCallback?: (iframe?: IFrameComponent) => void; /** * Receive message posted from iFrame with the parentIFrame.sendMessage() method. */ @@ -126,7 +131,8 @@ declare module 'iframe-resizer' { scrollCallback?: (data: IFrameScrollData) => boolean; } - export interface IFramePageOptions { + // tslint:disable-next-line:interface-name + interface IFramePageOptions { /** * This option allows you to restrict the domain of the parent page, * to prevent other sites mimicking your parent page. @@ -150,35 +156,41 @@ declare module 'iframe-resizer' { widthCalculationMethod?: string; } - export interface IFramePage { + // tslint:disable-next-line:interface-name + interface IFramePage { autoResize(resize?: boolean): boolean; close(): void; getId(): string; getPageInfo(callback: (data: any) => void | false): void; - scrollTo(x: number, y: number); - scrollToOffset(x: number, y: number); - sendMessage(message: any): void; + scrollTo(x: number, y: number): void; + scrollToOffset(x: number, y: number): void; + sendMessage(message: any, targetOrigin: string): void; setHeightCalculationMethod(method: string): void; - size(customHeight?, customWidth?): void + setWidthCalculationMethod(method: string): void; + setTargetOrigin(targetOrigin: string): void; + size(customHeight: string, customWidth: string): void; } - - export interface IFrameResizedData { + // tslint:disable-next-line:interface-name + interface IFrameResizedData { iframe: IFrameComponent; height: number; width: number; type: string; } - export interface IFrameMessageData { + // tslint:disable-next-line:interface-name + interface IFrameMessageData { iframe: IFrameComponent; message: string; } - export interface IFrameScrollData { + // tslint:disable-next-line:interface-name + interface IFrameScrollData { x: number; y: number; } - export function iframeResizer(options: IFrameOptions, target: HTMLElement): IFrameComponent; -} \ No newline at end of file + function iframeResizer(options: IFrameOptions, target: HTMLElement): IFrameComponent[]; +} +// tslint:enable:prefer-method-signature diff --git a/types/iframe-resizer/tsconfig.json b/types/iframe-resizer/tsconfig.json index ef96a6d33a..d2b812a1f7 100644 --- a/types/iframe-resizer/tsconfig.json +++ b/types/iframe-resizer/tsconfig.json @@ -2,11 +2,12 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/types/iframe-resizer/tslint.json b/types/iframe-resizer/tslint.json index 3db14f85ea..30a1bdde2e 100644 --- a/types/iframe-resizer/tslint.json +++ b/types/iframe-resizer/tslint.json @@ -1 +1,3 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file From 4ebb655fa656caf8319d44660a4c3b9d250d6a59 Mon Sep 17 00:00:00 2001 From: Nicolas Voigt Date: Tue, 27 Jun 2017 12:01:43 +0200 Subject: [PATCH 126/180] setEncoding argument to be mandatory --- types/node/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 2d15ee12c2..c6307a8a13 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -308,7 +308,7 @@ declare namespace NodeJS { export interface ReadableStream extends EventEmitter { readable: boolean; read(size?: number): string | Buffer; - setEncoding(encoding?: string): this; + setEncoding(encoding: string): this; pause(): this; resume(): this; isPaused(): boolean; From 6f9e67bb1813218a5c8497c7100140f39d26b935 Mon Sep 17 00:00:00 2001 From: Donald Pipowitch Date: Tue, 27 Jun 2017 13:01:41 +0200 Subject: [PATCH 127/180] Update index.d.ts --- 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 cc686b93b0..24012bcd8b 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -504,7 +504,7 @@ declare namespace webpack { * Turns hints on/off. In addition, tells webpack to throw either an error or a warning when hints are * found. This property is set to "warning" by default. */ - hints?: 'warning' | 'error' | boolean; + hints?: 'warning' | 'error' | false; /** * An asset is any emitted file from webpack. This option controls when webpack emits a performance hint * based on individual asset size. The default value is 250000 (bytes). From d28f0c306c6390f0120272029f9ee42d1ef59709 Mon Sep 17 00:00:00 2001 From: Donald Pipowitch Date: Tue, 27 Jun 2017 13:06:05 +0200 Subject: [PATCH 128/180] Update index.d.ts --- 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 cc686b93b0..26b95b01f4 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -1216,7 +1216,7 @@ declare namespace webpack { * Target of compilation. Passed from configuration options. * Example values: "web", "node" */ - target: 'web' | 'node' | string; + target: 'web' | 'webworker' | 'async-node' | 'node' | 'electron-main' | 'electron-renderer' | 'node-webkit' | string; /** * This boolean is set to true when this is compiled by webpack. From 909d2e994dc62b90da9f57ee5c84b2bdfd326e0c Mon Sep 17 00:00:00 2001 From: Uwe Quitter Date: Tue, 27 Jun 2017 15:45:52 +0200 Subject: [PATCH 129/180] Update index.d.ts In SelectRow interface type add an alternative type of number[] to the selected property. That resolves compiler errors if the key field of the row data is of type number. --- types/react-bootstrap-table/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-bootstrap-table/index.d.ts b/types/react-bootstrap-table/index.d.ts index 06e965c04b..1b80e670fa 100644 --- a/types/react-bootstrap-table/index.d.ts +++ b/types/react-bootstrap-table/index.d.ts @@ -157,7 +157,7 @@ export interface SelectRow { Give an array data to perform which rows you want to be selected when table loading. The content of array should be the rowkey which you want to be selected. */ - selected?: string[]; + selected?: string[] | number[]; /** if true, the radio/checkbox column will be hide. You can enable this attribute if you enable clickToSelect and you don't want to show the selection column. From e3f59cc5e8915383c54c92a9537d184438933eaf Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Tue, 27 Jun 2017 09:48:55 -0400 Subject: [PATCH 130/180] [angular] Add Document to JQueryStatic(). Add full header for JQLite definitions. --- types/angular/jqlite.d.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/types/angular/jqlite.d.ts b/types/angular/jqlite.d.ts index ee7d6acf1c..9702ee8f6d 100644 --- a/types/angular/jqlite.d.ts +++ b/types/angular/jqlite.d.ts @@ -1,3 +1,5 @@ +// Type definitions for jQuery 2.0 +// Project: http://jquery.com/ // Definitions by: Boris Yankov // Christian Hoffmeister // Steve Fenton @@ -19,6 +21,20 @@ // Dick van den Brink // Thomas Schulz // Leonard Thieu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/* ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ // Definitions copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0480c5ec87fab41aa23047a02b27f0ea71aaf975/types/jquery/v2/index.d.ts @@ -664,7 +680,7 @@ interface JQuery { } interface JQueryStatic { - (element: string | Element): JQuery; + (element: string | Element | Document): JQuery; } /** From afb3c676648232deefc6e2aeba716947d3afc7dd Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Tue, 27 Jun 2017 10:05:00 -0400 Subject: [PATCH 131/180] [angular] types-publisher doesn't like a full header. --- types/angular/jqlite.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/angular/jqlite.d.ts b/types/angular/jqlite.d.ts index 9702ee8f6d..ee8eea9928 100644 --- a/types/angular/jqlite.d.ts +++ b/types/angular/jqlite.d.ts @@ -1,4 +1,3 @@ -// Type definitions for jQuery 2.0 // Project: http://jquery.com/ // Definitions by: Boris Yankov // Christian Hoffmeister From 1c4ffe1b607aa1ec76f6753580e8c667f4c8e595 Mon Sep 17 00:00:00 2001 From: Matt Lewis Date: Tue, 27 Jun 2017 15:08:50 +0100 Subject: [PATCH 132/180] webpack: remove myself from the authors list --- types/webpack/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts index cc686b93b0..f1337e7c0d 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -1,7 +1,6 @@ // Type definitions for webpack 3.0 // Project: https://github.com/webpack/webpack // Definitions by: Qubo -// Matt Lewis // Benjamin Lim // Boris Cherny // Tommy Troy Lin From 968741c3b62aaf96ae2ce88e2e070fd43c027918 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20Ksi=C4=99ski?= Date: Tue, 27 Jun 2017 16:36:13 +0200 Subject: [PATCH 133/180] Update Node interface methods for dockerode package --- types/dockerode/dockerode-tests.ts | 33 ++++++++++++++++++++++++++++++ types/dockerode/index.d.ts | 8 ++++++++ 2 files changed, 41 insertions(+) diff --git a/types/dockerode/dockerode-tests.ts b/types/dockerode/dockerode-tests.ts index 8dd9a380de..ef2ed924d1 100644 --- a/types/dockerode/dockerode-tests.ts +++ b/types/dockerode/dockerode-tests.ts @@ -145,3 +145,36 @@ secret.remove((err, response) => { secret.update((err, response) => { // NOOP }); + +const node = docker.getNode('nodeName'); +node.inspect((err, reponse) => { + // NOOP +}); + +node.inspect().then(response => { + // NOOP +}); + +node.update({}, (err, response) => { + // NOOP +}); + +node.update((err, response) => { + // NOOP +}); + +node.update({}).then(response => { + // NOOP; +}); + +node.remove({}, (err, response) => { + // NOOP +}); + +node.remove((err, response) => { + // NOOP +}); + +node.remove({}).then(response => { + // NOOP; +}); diff --git a/types/dockerode/index.d.ts b/types/dockerode/index.d.ts index ec2808cf3d..1b456e8f45 100644 --- a/types/dockerode/index.d.ts +++ b/types/dockerode/index.d.ts @@ -170,6 +170,14 @@ declare namespace Dockerode { inspect(callback: Callback): void; inspect(): Promise; + update(options: {}, callback: Callback): void; + update(callback: Callback): void; + update(options?: {}): Promise; + + remove(options: {}, callback: Callback): void; + remove(callback: Callback): void; + remove(options?: {}): Promise; + modem: any; id?: string; } From 123aa2984e6faccac17dc6a16b7480b446ae2e73 Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Tue, 27 Jun 2017 10:59:45 -0400 Subject: [PATCH 134/180] [DefinitelyTyped] Increase nProcesses from 1 to 4. (#17511) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1be6d06c89..8e734f2b89 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "scripts": { "compile-scripts": "tsc -p scripts", "not-needed": "node scripts/not-needed.js", - "test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed --nProcesses 1", + "test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed --nProcesses 4", "lint": "dtslint types" }, "devDependencies": { From 7bff99cf63c2516be2155bc321ff2ea04b28d650 Mon Sep 17 00:00:00 2001 From: Hussein Shabbir Date: Tue, 27 Jun 2017 21:00:24 +0400 Subject: [PATCH 135/180] Export the ReactDatePickerProps interface This is useful when wrapping the date picker in a custom component so that the props of the custom component can extend ReactDatePickerProps. --- types/react-datepicker/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-datepicker/index.d.ts b/types/react-datepicker/index.d.ts index f31f0316e1..aeb44be606 100644 --- a/types/react-datepicker/index.d.ts +++ b/types/react-datepicker/index.d.ts @@ -9,7 +9,7 @@ import * as React from "react"; import * as moment from "moment"; -interface ReactDatePickerProps { +export interface ReactDatePickerProps { autoComplete?: string; autoFocus?: boolean; calendarClassName?: string; From dc1ea691f9916fc5774b73e3e17a349ace77bf1e Mon Sep 17 00:00:00 2001 From: Ed Staub Date: Tue, 27 Jun 2017 13:36:34 -0400 Subject: [PATCH 136/180] Update formatError.d.ts See e.g. the flow definition in https://github.com/graphql/graphql-js/blob/master/src/error/formatError.js, where they are defined as optional. I'm no GraphQL expert; caveat emptor. --- types/graphql/error/formatError.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/graphql/error/formatError.d.ts b/types/graphql/error/formatError.d.ts index 712c68c77b..5b974d5461 100644 --- a/types/graphql/error/formatError.d.ts +++ b/types/graphql/error/formatError.d.ts @@ -8,11 +8,11 @@ export function formatError(error: GraphQLError): GraphQLFormattedError; export type GraphQLFormattedError = { message: string, - locations: Array, - path: Array + locations?: Array, + path?: Array }; export type GraphQLErrorLocation = { line: number, column: number -}; \ No newline at end of file +}; From 38c6c6691ee3b7c37ab294bcccc0f0a3458be16f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Par=C3=A9?= Date: Tue, 27 Jun 2017 14:09:51 -0400 Subject: [PATCH 137/180] fix typo --- types/mapbox-gl/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mapbox-gl/index.d.ts b/types/mapbox-gl/index.d.ts index 9438bfafac..59611440b3 100644 --- a/types/mapbox-gl/index.d.ts +++ b/types/mapbox-gl/index.d.ts @@ -173,7 +173,7 @@ declare namespace mapboxgl { keyboard: KeyboardHandler; - doublClickZoom: DoubleClickZoomHandler; + doubleClickZoom: DoubleClickZoomHandler; touchZoomRotate: TouchZoomRotateHandler; } From 0e32c73f0c36905de3a828371aa6f9487e9ccc7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ro=CC=81bert=20Kiss?= Date: Tue, 27 Jun 2017 21:13:04 +0200 Subject: [PATCH 138/180] node-hid: Add 'usagePage' and 'usage' properties to Device --- types/node-hid/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/node-hid/index.d.ts b/types/node-hid/index.d.ts index 34afff06b1..e1196cf53e 100644 --- a/types/node-hid/index.d.ts +++ b/types/node-hid/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for node-hid 0.5 // Project: https://github.com/node-hid/node-hid#readme // Definitions by: Mohamed Hegazy +// Robert Kiss // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export interface Device { @@ -12,6 +13,8 @@ export interface Device { product: string; release: number; interface: number; + usagePage: number; + usage: number; } export class HID { From aa5ba74640cbf935fc995f900291f38c5896c152 Mon Sep 17 00:00:00 2001 From: Peter Jihoon Kim Date: Mon, 26 Jun 2017 22:35:09 -0700 Subject: [PATCH 139/180] [react-navigation] Fixed type definitions for NavigationActions.* --- types/react-navigation/index.d.ts | 66 ++++++++++++------- .../react-navigation-tests.tsx | 50 ++++++++++++-- 2 files changed, 86 insertions(+), 30 deletions(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 5286540963..1d07494104 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -4,6 +4,7 @@ // mhcgrq // fangpenlin // abrahambotros +// petejkim // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -188,46 +189,63 @@ export interface NavigationParams { [key: string]: any, } -export type NavigationNavigateAction = { - type: 'Navigation/NAVIGATE', +export interface NavigationNavigateActionPayload { routeName: string, params?: NavigationParams, // The action to run inside the sub-router action?: NavigationNavigateAction, -}; +} -export type NavigationBackAction = { - type: 'Navigation/BACK', +export interface NavigationNavigateAction extends NavigationNavigateActionPayload { + type: 'Navigation/NAVIGATE', +} + +export interface NavigationBackActionPayload { key?: string | null, -}; +} -export type NavigationSetParamsAction = { - type: 'Navigation/SET_PARAMS', +export interface NavigationBackAction extends NavigationBackActionPayload { + type: 'Navigation/BACK', +} +export interface NavigationSetParamsActionPayload { // The key of the route where the params should be set key: string, // The new params to merge into the existing route params params?: NavigationParams, -}; +} -export type NavigationInitAction = { - type: 'Navigation/INIT', +export interface NavigationSetParamsAction extends NavigationSetParamsActionPayload { + type: 'Navigation/SET_PARAMS', +} + +export interface NavigationInitActionPayload { params?: NavigationParams, -}; +} -export type NavigationResetAction = { - type: 'Navigation/RESET', +export interface NavigationInitAction extends NavigationInitActionPayload { + type: 'Navigation/INIT', +} + +export interface NavigationResetActionPayload { index: number, key?: string | null, actions: Array, -}; +} -export type NavigationUriAction = { - type: 'Navigation/URI', +export interface NavigationResetAction extends NavigationResetActionPayload { + type: 'Navigation/RESET', +} + +export interface NavigationUriActionPayload { uri: string, -}; +} + +export interface NavigationUriAction extends NavigationUriActionPayload { + type: 'Navigation/URI', +} export interface NavigationStackViewConfig { mode?: 'card' | 'modal', @@ -575,15 +593,13 @@ export const TabBarBottom: React.ComponentClass; /** * NavigationActions - * @todo Is this necessary, or can we remove? Not referenced anywhere else here, but it seems a - * recent commit or two touches these. Can anyone provide a strong use case for keeping this in? */ export namespace NavigationActions { - function init(options?: NavigationInitAction): NavigationInitAction; - function navigate(options: NavigationNavigateAction): NavigationNavigateAction; - function reset(options: NavigationResetAction): NavigationResetAction; - function back(options?: NavigationBackAction): NavigationBackAction; - function setParams(options: NavigationSetParamsAction): NavigationSetParamsAction; + export function init(options?: NavigationInitActionPayload): NavigationInitAction; + export function navigate(options: NavigationNavigateActionPayload): NavigationNavigateAction; + export function reset(options: NavigationResetActionPayload): NavigationResetAction; + export function back(options?: NavigationBackActionPayload): NavigationBackAction; + export function setParams(options: NavigationSetParamsActionPayload): NavigationSetParamsAction; } /** diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index 835e63d756..1840fd7ccf 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -5,22 +5,28 @@ import { ViewStyle, } from 'react-native'; import { - addNavigationHelpers, + NavigationAction, + NavigationActions, + NavigationBackAction, + NavigationInitAction, + NavigationNavigateAction, + NavigationProp, + NavigationResetAction, NavigationRouteConfigMap, NavigationScreenProp, NavigationScreenProps, + NavigationSetParamsAction, NavigationStackAction, NavigationStackScreenOptions, NavigationTabScreenOptions, + NavigationTransitionProps, StackNavigator, StackNavigatorConfig, + TabBarTop, TabNavigator, TabNavigatorConfig, - TabBarTop, Transitioner, - NavigationProp, - NavigationAction, - NavigationTransitionProps, + addNavigationHelpers, } from 'react-navigation'; // Constants @@ -42,6 +48,7 @@ interface StartScreenNavigationParams { id: number, s: string, } + interface StartScreenProps extends NavigationScreenProps { } class StartScreen extends React.Component { render() { @@ -219,3 +226,36 @@ class CustomTransitioner extends React.Component return {} } } + +const initAction: NavigationInitAction = NavigationActions.init({ + params: { + foo: "bar" + } +}) + +const navigateAction: NavigationNavigateAction = NavigationActions.navigate({ + routeName: "FooScreen", + params: { + foo: "bar" + }, + action: NavigationActions.navigate({ routeName: "BarScreen" }) +}) + +const resetAction: NavigationResetAction = NavigationActions.reset({ + index: 0, + key: "foo", + actions: [ + NavigationActions.navigate({ routeName: "FooScreen" }) + ] +}) + +const backAction: NavigationBackAction = NavigationActions.back({ + key: "foo" +}) + +const setParamsAction: NavigationSetParamsAction = NavigationActions.setParams({ + key: "foo", + params: { + foo: "bar" + } +}) From 6f114653600265e936e1c88e8ebcc8776c53fc1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ro=CC=81bert=20Kiss?= Date: Tue, 27 Jun 2017 22:55:55 +0200 Subject: [PATCH 140/180] node-hid: set optional properties --- types/node-hid/index.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/types/node-hid/index.d.ts b/types/node-hid/index.d.ts index e1196cf53e..92ffd4a60a 100644 --- a/types/node-hid/index.d.ts +++ b/types/node-hid/index.d.ts @@ -7,14 +7,14 @@ export interface Device { vendorId: number; productId: number; - path: string; - serialNumber: string; - manufacturer: string; - product: string; + path?: string; + serialNumber?: string; + manufacturer?: string; + product?: string; release: number; interface: number; - usagePage: number; - usage: number; + usagePage?: number; + usage?: number; } export class HID { From 86e255d38bf3add28248d1a795ede453b81e93ac Mon Sep 17 00:00:00 2001 From: Paul Datsiuk Date: Wed, 28 Jun 2017 00:15:03 +0300 Subject: [PATCH 141/180] parentheses was deleted --- types/browser-report/index.d.ts | 56 ++++++++++++++++----------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/types/browser-report/index.d.ts b/types/browser-report/index.d.ts index 8c7dec2b5d..c5852aae97 100644 --- a/types/browser-report/index.d.ts +++ b/types/browser-report/index.d.ts @@ -10,47 +10,47 @@ interface Window { interface ReportResult { "browser": { - "name": (string), - "version": (string) + "name": string, + "version": string }, - "cookies": (boolean), + "cookies": boolean, "flash": { - "version": (string) + "version": string }, - "ip": (string), + "ip": string, "country": { - "name": (string), - "code": (string), - "city": (string), - "latitude" : (string), - "longitude": (string), - "timezone": (string) + "name": string, + "code": string, + "city": string, + "latitude" : string, + "longitude": string, + "timezone": string }, "java": { - "version": (string) + "version": string }, - "lang": (Array), + "lang": Array, "os": { - "name": (string), - "version": (string) + "name": string, + "version": string }, "screen": { - "colors": (number), - "dppx": (number), - "height": (number), - "width": (number) + "colors": number, + "dppx": number, + "height": number, + "width": number }, - "scripts": (boolean), - "timestamp": (string), - "userAgent": (string), + "scripts": boolean, + "timestamp": string, + "userAgent": string, "viewport": { - "height": (number), + "height": number, "layout": { - "height": (number), - "width": (number) + "height": number, + "width": number } - "width": (number), - "zoom": (number) + "width": number, + "zoom": number } - "websockets": (boolean) + "websockets": boolean } \ No newline at end of file From b8fa44da6133029913edd27e4d14b8e916664305 Mon Sep 17 00:00:00 2001 From: Damien Rajon Date: Tue, 27 Jun 2017 23:22:51 +0200 Subject: [PATCH 142/180] Added header for async.nexttick definitions --- types/async.nexttick/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/async.nexttick/index.d.ts b/types/async.nexttick/index.d.ts index 7db4a43d87..8971239963 100644 --- a/types/async.nexttick/index.d.ts +++ b/types/async.nexttick/index.d.ts @@ -1 +1,6 @@ +// Type definitions for async.nexttick 0.5.2 +// Project: https://www.npmjs.com/package/async.nexttick +// Definitions by: Damien "pyrho" Rajon +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + export default function nextTick(callback: () => void, ...args: any[]): void; From 67b71f679b5e0c22340996549e87a4dcaaf7446b Mon Sep 17 00:00:00 2001 From: Sam Baxter Date: Tue, 27 Jun 2017 17:27:27 -0400 Subject: [PATCH 143/180] gapi.drive: refactor typings and fix bugs --- types/gapi.drive/index.d.ts | 510 +++++++++++++++++++----------------- 1 file changed, 273 insertions(+), 237 deletions(-) diff --git a/types/gapi.drive/index.d.ts b/types/gapi.drive/index.d.ts index ad8c64aa50..e0d4037ec9 100644 --- a/types/gapi.drive/index.d.ts +++ b/types/gapi.drive/index.d.ts @@ -6,8 +6,24 @@ /// -declare namespace gapi.client.drive { - export namespace files { +declare namespace gapi.client { + export module drive { + const files: { + get: (parameters: GetParameters) => HttpRequest; + patch: (parameters: PatchParameters) => HttpRequest; + copy: (parameters: CopyParameters) => HttpRequest; + delete: (parameters: DeleteParameters) => HttpRequest; + emptyTrash: () => HttpRequest; + export: (parameters: ExportParameters) => HttpRequest; + generateIds: (parameters: GenerateIdsParameters) => HttpRequest; + insert: (parameters: InsertParameters) => HttpRequest; + list: (parameters: ListParameters) => HttpRequest; + touch: (parameters: TouchParameters) => HttpRequest; + trash: (parameters: TrashParameters) => HttpRequest; + untrash: (parameters: UntrashParameters) => HttpRequest; + watch: (parameters: WatchParameters) => HttpRequest; + } + interface GetParameters { fileId: string; acknowledgeAbuse?: boolean; @@ -17,8 +33,6 @@ declare namespace gapi.client.drive { updateViewedDate?: boolean; } - export function get(parameters: GetParameters): HttpRequest; - interface PatchParameters { fileId: string; resource?: FileResource @@ -37,8 +51,6 @@ declare namespace gapi.client.drive { useContentAsIndexableText?: boolean; } - export function patch(parameters: PatchParameters): HttpRequest; - interface CopyParameters { fileId: string; resource?: FileResource; @@ -52,13 +64,39 @@ declare namespace gapi.client.drive { visibility?: string; } - export function copy(parameters: CopyParameters): HttpRequest; + interface DeleteParameters { + fileId: string; + supportsTeamDrives?: boolean; + } + + interface ExportParameters { + fileId: string; + mimeType: string; + } + + interface GenerateIdsParameters { + maxResults?: number; + space?: string; + } + + interface InsertParameters { + uploadType: string; + convert?: boolean; + ocr?: boolean; + ocrLanguage?: string; + pinned?: boolean; + supportsTeamDrives?: boolean; + timedTextLanguage?: string; + timedTextTrackName?: string; + usecontentAsIndexableText?: boolean; + visibility?: string; + } interface ListParameters { corpora?: string; corpus?: string; includeTeamDriveItems?: boolean; - maxResults: number; + maxResults?: number; orderBy?: string; pageToken?: string; projection?: string; @@ -68,28 +106,22 @@ declare namespace gapi.client.drive { teamDriveId?: string; } - export function list(parameters: ListParameters): HttpRequest; - interface TouchParameters { fileId: string; supportsTeamDrives?: boolean; } - export function touch(parameters: TouchParameters): HttpRequest; - interface TrashParameters { fileId: string; supportsTeamDrives?: boolean; } - export function trash(parameters: TrashParameters): HttpRequest; interface UntrashParameters { fileId: string; supportsTeamDrives?: boolean; } - export function untrash(parameters: UntrashParameters): HttpRequest; interface WatchParameters { fileId: string; @@ -98,239 +130,243 @@ declare namespace gapi.client.drive { supportsTeamDrives?: boolean; } - export function watch(parameters: WatchParameters): HttpRequest; - } - - export interface FileResource { - kind: 'drive#file'; - id?: string; - // etag - selfLink?: string; - webContentLink?: string; - webViewLink?: string; - alternateLink?: string; - embedLink?: string; - // openWithLinks - defaultOpenWithLink?: string; - iconLink?: string; - hasThumbnail?: boolean; - thumbnailLink?: string; - thumbnail?: { - image: Uint8Array; - mimType: string; - }; - title?: string; - mimeType?: string; - description?: string; - labels?: { - starred?: boolean; - hidden?: boolean; - trashed?: boolean; - restricted?: boolean; - viewed?: boolean; - modified?: boolean; - }; - createdDate?: Date; - modifiedDate?: Date; - modifiedByMeDate?: Date; - lastViewedByMeDate?: Date; - markedViewedByMeDate?: Date; - sharedWithMeDate?: Date; - version?: number; - sharingUser?: { - kind: 'drive#user'; - displayName?: string; - picture?: { - url: string; + interface FileResource { + kind: 'drive#file'; + id: string; + etag: string; + selfLink: string; + webContentLink: string; + webViewLink: string; + alternateLink: string; + embedLink: string; + // openWithLinks + defaultOpenWithLink: string; + iconLink: string; + hasThumbnail: boolean; + thumbnailLink: string; + thumbnail: { + image: Uint8Array; + mimType: string; }; - isAuthenticatedUser?: boolean; - permissionId?: string; - emailAddress?: string; - }; - parents?: ParentResource[]; - downloadUrl?: string; - // exportLinks - indexableText?: { - text: string; - }; - userPermission?: PermissionResource; - permissions?: PermissionResource[]; - hasAugmentedPermissions?: boolean; - originalFilename?: string; - fileExtension?: string; - fullFileExtension?: string; - md5Checksum?: string; - fileSize?: number; - quotaBytesUsed?: number; - ownerNames?: string[]; - owners?: { - kind: 'drive#user'; - displayName?: string; - picture?: { - url: string; + title: string; + mimeType: string; + description: string; + labels: { + starred: boolean; + hidden: boolean; + trashed: boolean; + restricted: boolean; + viewed: boolean; + modified: boolean; }; - isAuthenticatedUser?: boolean; - permissionId?: string; - emailAddress?: string; - }[]; - teamDriveId?: string; - lastModifyingUserName?: string; - lastModifyingUser?: { - kind: 'drive#user'; - displayName?: string; - picture?: { - url: string; + createdDate: Date; + modifiedDate: Date; + modifiedByMeDate: Date; + lastViewedByMeDate: Date; + markedViewedByMeDate: Date; + sharedWithMeDate: Date; + version: number; + sharingUser: { + kind: 'drive#user'; + displayName: string; + picture: { + url: string; + }; + isAuthenticatedUser: boolean; + permissionId: string; + emailAddress: string; }; - isAuthenticatedUser?: boolean; - permissionId?: string; - emailAddress?: string; - }; - ownedByMe?: boolean; - capabilities?: { - canAddChildren?: boolean; - canChangeRestrictedDownload?: boolean; - canComment?: boolean; - canCopy?: boolean; - canDelete?: boolean; - canDownload?: boolean; - canEdit?: boolean; - canListChildren?: boolean; - canMoveItemIntoTeamDrive?: boolean; - canMoveTeamDriveItem?: boolean; - canReadRevisions?: boolean; - canReadTeamDrive?: boolean; - canRemoveChildren?: boolean; - canRename?: boolean; - canShare?: boolean; - canTrash?: boolean; - canUntrash?: boolean; - }; - editable?: boolean; - canComment?: boolean; - canReadRevisions?: boolean; - shareable?: boolean; - copyable?: boolean; - writersCanShare?: boolean; - shared?: boolean; - explicitlyTrashed?: boolean; - trashingUser?: { - kind: 'drive#user'; - displayName?: string; - picture?: { - url: string; + parents: ParentResource[]; + downloadUrl: string; + // exportLinks + indexableText: { + text: string; }; - isAuthenticatedUser?: boolean; - permissionId?: string; - emailAddress?: string; - }; - trashedDate?: Date; - appDataContents?: boolean; - headRevisionId?: string; - properties?: PropertiesResource[]; - folderColorRgb?: string; - imageMediaMetadata?: { - width?: number; - height?: number; - rotation?: number; - location?: { - latitude?: number; - longitude?: number; - altitude?: number; + userPermission: PermissionResource; + permissions: PermissionResource[]; + hasAugmentedPermissions: boolean; + originalFilename: string; + fileExtension: string; + fullFileExtension: string; + md5Checksum: string; + fileSize: number; + quotaBytesUsed: number; + ownerNames: string[]; + owners: { + kind: 'drive#user'; + displayName: string; + picture: { + url: string; + }; + isAuthenticatedUser: boolean; + permissionId: string; + emailAddress: string; + }[]; + teamDriveId: string; + lastModifyingUserName: string; + lastModifyingUser: { + kind: 'drive#user'; + displayName: string; + picture: { + url: string; + }; + isAuthenticatedUser: boolean; + permissionId: string; + emailAddress: string; }; - date?: string; - cameraMake?: string; - cameraModel?: string; - exposureTime?: number; - aperture?: number; - flashUsed?: boolean; - focalLength?: number; - isoSpeed?: number; - meteringMode?: string; - sensor?: string; - exposureMode?: string; - colorSpace?: string; - whiteBalance?: string; - exposureBias?: number; - maxApertureValue?: number; - subjectDistance?: number; - lens?: string; - }; - videoMediaMetadata?: { - width?: number; - height?: number; - durationMillis?: number; - }; - spaces?: string[]; - isAppAuthorized?: boolean; - } + ownedByMe: boolean; + capabilities: { + canAddChildren: boolean; + canChangeRestrictedDownload: boolean; + canComment: boolean; + canCopy: boolean; + canDelete: boolean; + canDownload: boolean; + canEdit: boolean; + canListChildren: boolean; + canMoveItemIntoTeamDrive: boolean; + canMoveTeamDriveItem: boolean; + canReadRevisions: boolean; + canReadTeamDrive: boolean; + canRemoveChildren: boolean; + canRename: boolean; + canShare: boolean; + canTrash: boolean; + canUntrash: boolean; + }; + editable: boolean; + canComment: boolean; + canReadRevisions: boolean; + shareable: boolean; + copyable: boolean; + writersCanShare: boolean; + shared: boolean; + explicitlyTrashed: boolean; + trashingUser: { + kind: 'drive#user'; + displayName: string; + picture: { + url: string; + }; + isAuthenticatedUser: boolean; + permissionId: string; + emailAddress: string; + }; + trashedDate: Date; + appDataContents: boolean; + headRevisionId: string; + properties: PropertiesResource[]; + folderColorRgb: string; + imageMediaMetadata: { + width: number; + height: number; + rotation: number; + location: { + latitude: number; + longitude: number; + altitude: number; + }; + date: string; + cameraMake: string; + cameraModel: string; + exposureTime: number; + aperture: number; + flashUsed: boolean; + focalLength: number; + isoSpeed: number; + meteringMode: string; + sensor: string; + exposureMode: string; + colorSpace: string; + whiteBalance: string; + exposureBias: number; + maxApertureValue: number; + subjectDistance: number; + lens: string; + }; + videoMediaMetadata: { + width: number; + height: number; + durationMillis: number; + }; + spaces: string[]; + isAppAuthorized: boolean; + } - export interface FileListResource { - kind: 'drive#fileList'; - // etag - selfLink?: string; - nextPageToken?: string; - nextLink?: string; - incompleteSearch?: boolean; - items: FileResource[]; - } + interface FileListResource { + kind: 'drive#fileList'; + etag: string; + selfLink: string; + nextPageToken: string; + nextLink: string; + incompleteSearch: boolean; + items: FileResource[]; + } - export interface ParentResource { - kind: 'drive#parentReference'; - id?: string; - selfLink?: string; - parentLink?: string; - isRoot?: boolean; - } + interface ParentResource { + kind: 'drive#parentReference'; + id: string; + selfLink: string; + parentLink: string; + isRoot: boolean; + } - export interface PermissionResource { - kind: 'drive#permission'; - // etag - id?: string; - selfLink?: string; - name?: string; - emailAddress?: string; - domain?: string; - role?: string; - additionalRoles?: string[]; - type?: string; - value?: string; - authKey?: string; - withLink?: boolean; - photoLink?: string; - expirationDate?: Date; - teamDrivePermissionDetails?: { - teamDrivePermissionType?: string; - role?: string; - additionalRoles?: string[]; - inheritedFrom?: string; - inherited?: boolean; - }[]; - deleted?: boolean; - } + interface PermissionResource { + kind: 'drive#permission'; + etag: string; + id: string; + selfLink: string; + name: string; + emailAddress: string; + domain: string; + role: string; + additionalRoles: string[]; + type: string; + value: string; + authKey: string; + withLink: boolean; + photoLink: string; + expirationDate: Date; + teamDrivePermissionDetails: { + teamDrivePermissionType: string; + role: string; + additionalRoles: string[]; + inheritedFrom: string; + inherited: boolean; + }[]; + deleted: boolean; + } - export interface PropertiesResource { - kind: 'drive$property'; - // etag - selfLink?: string; - key?: string; - visibility?: string; - value?: string; - } + interface PropertiesResource { + kind: 'drive$property'; + etag: string; + selfLink: string; + key: string; + visibility: string; + value: string; + } - export interface WatchResource { - id?: string; - expiration?: number; - token?: string; - type?: string; - address?: string; - } + interface WatchResource { + id: string; + expiration: number; + token: string; + type: string; + address: string; + } - export interface ChannelResource { - kind: 'api#channel'; - id?: string; - resourceId?: string; - resourceUri?: string; - token?: string; - expiration?: number; + interface ChannelResource { + kind: 'api#channel'; + id: string; + resourceId: string; + resourceUri: string; + token: string; + expiration: number; + } + + interface IdsResource { + kind: 'drive#generatedIds'; + space: string; + ids: string[]; + } } } From 56fe50613524f1005ec89c229bb510241137593d Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Tue, 27 Jun 2017 17:30:57 -0400 Subject: [PATCH 144/180] [angular] Remove copyright header. --- types/angular/jqlite.d.ts | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/types/angular/jqlite.d.ts b/types/angular/jqlite.d.ts index ee8eea9928..727e7718d7 100644 --- a/types/angular/jqlite.d.ts +++ b/types/angular/jqlite.d.ts @@ -22,19 +22,6 @@ // Leonard Thieu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/* ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - // Definitions copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0480c5ec87fab41aa23047a02b27f0ea71aaf975/types/jquery/v2/index.d.ts interface JQuery { From 7f6ae49875bdbdd9d2871a2c8d55319d048f3b9b Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Tue, 27 Jun 2017 14:33:28 -0700 Subject: [PATCH 145/180] Rename async.nexttick-test.ts to async.nexttick-tests.ts --- .../{async.nexttick-test.ts => async.nexttick-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename types/async.nexttick/{async.nexttick-test.ts => async.nexttick-tests.ts} (100%) diff --git a/types/async.nexttick/async.nexttick-test.ts b/types/async.nexttick/async.nexttick-tests.ts similarity index 100% rename from types/async.nexttick/async.nexttick-test.ts rename to types/async.nexttick/async.nexttick-tests.ts From 6f62d6b556029db44b7e4b527f10efb70fa3bd7c Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Tue, 27 Jun 2017 14:33:53 -0700 Subject: [PATCH 146/180] Update tsconfig.json --- types/async.nexttick/tsconfig.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/async.nexttick/tsconfig.json b/types/async.nexttick/tsconfig.json index 7bf5157ec4..16e1714611 100644 --- a/types/async.nexttick/tsconfig.json +++ b/types/async.nexttick/tsconfig.json @@ -1,4 +1,4 @@ -{ +s{ "compilerOptions": { "target": "es6", "module": "commonjs", @@ -18,7 +18,7 @@ }, "files": [ "index.d.ts", - "async.nexttick-test.ts" + "async.nexttick-tests.ts" ] } From 6524517cd50dd71dbcd297629e02d16293db329d Mon Sep 17 00:00:00 2001 From: benbayard Date: Tue, 27 Jun 2017 14:36:41 -0700 Subject: [PATCH 147/180] Use new typescript definition for exported classes --- types/react-dropzone/index.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/types/react-dropzone/index.d.ts b/types/react-dropzone/index.d.ts index 0c944b99cd..59eec06fe0 100644 --- a/types/react-dropzone/index.d.ts +++ b/types/react-dropzone/index.d.ts @@ -38,6 +38,9 @@ declare module "react-dropzone" { onFileDialogCancel?: () => void; } - let Dropzone: React.ClassicComponentClass; + export declare class Dropzone extends React.Component { + open(): void; + render(): JSX.Element; + } export = Dropzone; } From b5de291251cbf6ff2d8ceeaeefc3895efe820406 Mon Sep 17 00:00:00 2001 From: benbayard Date: Tue, 27 Jun 2017 14:46:04 -0700 Subject: [PATCH 148/180] Add self to contributors --- types/react-dropzone/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/react-dropzone/index.d.ts b/types/react-dropzone/index.d.ts index 59eec06fe0..94c6fc94b1 100644 --- a/types/react-dropzone/index.d.ts +++ b/types/react-dropzone/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for react-dropzone // Project: https://github.com/okonet/react-dropzone -// Definitions by: Mathieu Larouche Dube , Ivo Jesus , Luís Rodrigues +// Definitions by: Mathieu Larouche Dube , Ivo Jesus , Luís Rodrigues , Ben Bayard + // Definitions: https://github.com/Vooban/DefinitelyTyped // TypeScript Version: 2.3 From 40a01c220ab44433ee014cea45daf7111a1718f5 Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Tue, 27 Jun 2017 15:01:08 -0700 Subject: [PATCH 149/180] Update tsconfig.json Typing is hard.... --- types/async.nexttick/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/async.nexttick/tsconfig.json b/types/async.nexttick/tsconfig.json index 16e1714611..68011bfd96 100644 --- a/types/async.nexttick/tsconfig.json +++ b/types/async.nexttick/tsconfig.json @@ -1,4 +1,4 @@ -s{ +{ "compilerOptions": { "target": "es6", "module": "commonjs", From d8b5452ec029053a3c1ed79cb8c15625d251bc51 Mon Sep 17 00:00:00 2001 From: benbayard Date: Tue, 27 Jun 2017 15:01:43 -0700 Subject: [PATCH 150/180] Remove render declaration. --- types/react-dropzone/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/react-dropzone/index.d.ts b/types/react-dropzone/index.d.ts index 94c6fc94b1..1ef7932e0d 100644 --- a/types/react-dropzone/index.d.ts +++ b/types/react-dropzone/index.d.ts @@ -41,7 +41,6 @@ declare module "react-dropzone" { export declare class Dropzone extends React.Component { open(): void; - render(): JSX.Element; } export = Dropzone; } From 0439f1542d657c06e57e770fd2f9968a3a4cb4b6 Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Tue, 27 Jun 2017 15:14:01 -0700 Subject: [PATCH 151/180] Update tslint.json Fix up tslint.json --- types/async.nexttick/tslint.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/async.nexttick/tslint.json b/types/async.nexttick/tslint.json index 4c3a548997..d0858559ac 100644 --- a/types/async.nexttick/tslint.json +++ b/types/async.nexttick/tslint.json @@ -1,3 +1,3 @@ -{ - "extends": "dtslint/dtslint.json" +{ + "extends": "dtslint/dt.json" } From a2b40c9f1074150eccdbe6c40a98d7cf13fa0e14 Mon Sep 17 00:00:00 2001 From: codemannz Date: Wed, 28 Jun 2017 10:15:18 +1200 Subject: [PATCH 152/180] Added View variable type --- types/backbone.marionette/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/backbone.marionette/index.d.ts b/types/backbone.marionette/index.d.ts index d8ced49217..52d8c7a492 100644 --- a/types/backbone.marionette/index.d.ts +++ b/types/backbone.marionette/index.d.ts @@ -1272,7 +1272,7 @@ declare namespace Marionette { getRegion(): Region; /** Show a view in the root region */ - showView(view: any): void; + showView(view: View): void; /** Get the view from the root region*/ getView(): any; From b684f1353171aaefa3e309e27faa44b1770164c5 Mon Sep 17 00:00:00 2001 From: Kevin Leung Date: Wed, 28 Jun 2017 06:21:16 +0800 Subject: [PATCH 153/180] [fabric] Lower case Boolean --- types/fabric/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/fabric/index.d.ts b/types/fabric/index.d.ts index 1596d7d428..96c4ec4e5a 100644 --- a/types/fabric/index.d.ts +++ b/types/fabric/index.d.ts @@ -3086,7 +3086,7 @@ interface ITextOptions extends IObjectOptions { textBackgroundColor?: string; path?: string; - useNative?: Boolean; + useNative?: boolean; text?: string; } export interface Text extends ITextOptions {} From 970140449f22ee0be56a225488bafc6b4bf61e98 Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Tue, 27 Jun 2017 15:26:30 -0700 Subject: [PATCH 154/180] Update index.d.ts --- types/async.nexttick/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/async.nexttick/index.d.ts b/types/async.nexttick/index.d.ts index 8971239963..22efd68fc7 100644 --- a/types/async.nexttick/index.d.ts +++ b/types/async.nexttick/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for async.nexttick 0.5.2 +// Type definitions for async.nexttick 0.5 // Project: https://www.npmjs.com/package/async.nexttick // Definitions by: Damien "pyrho" Rajon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From d1a4134e773639eadfa6c2e3ee73283029045f02 Mon Sep 17 00:00:00 2001 From: Ben Bayard Date: Tue, 27 Jun 2017 15:29:54 -0700 Subject: [PATCH 155/180] Use correct export for generated classes - Use semicolons in interface declaration. - Use correct function syntax for onDrop methods --- types/react-dropzone/index.d.ts | 46 ++++++++-------- types/react-dropzone/react-dropzone-tests.tsx | 53 ++++++++++--------- 2 files changed, 51 insertions(+), 48 deletions(-) diff --git a/types/react-dropzone/index.d.ts b/types/react-dropzone/index.d.ts index 1ef7932e0d..dfa2a861b2 100644 --- a/types/react-dropzone/index.d.ts +++ b/types/react-dropzone/index.d.ts @@ -1,7 +1,6 @@ // Type definitions for react-dropzone // Project: https://github.com/okonet/react-dropzone // Definitions by: Mathieu Larouche Dube , Ivo Jesus , Luís Rodrigues , Ben Bayard - // Definitions: https://github.com/Vooban/DefinitelyTyped // TypeScript Version: 2.3 @@ -10,37 +9,36 @@ declare module "react-dropzone" { interface DropzoneProps { // Drop behavior - onDrop?: Function, - onDropAccepted?: Function, - onDropRejected?: Function, + onDrop?: (accepted: File[], rejected: File[]) => any; + onDropAccepted?: (accepted: File[]) => any; + onDropRejected?: (rejected: File[]) => any; // Drag behavior - onDragStart?: Function, - onDragEnter?: Function, - onDragLeave?: Function, + onDragStart?: Function; + onDragEnter?: Function; + onDragLeave?: Function; - style?: Object, // CSS styles to apply - activeStyle?: Object, // CSS styles to apply when drop will be accepted - rejectStyle?: Object, // CSS styles to apply when drop will be rejected - className?: string, // Optional className - activeClassName?: string, // className for accepted state - rejectClassName?: string, // className for rejected state + style?: React.CSSProperties; // CSS styles to apply + activeStyle?: React.CSSProperties; // CSS styles to apply when drop will be accepted + rejectStyle?: React.CSSProperties; // CSS styles to apply when drop will be rejected + className?: string; // Optional className + activeClassName?: string; // className for accepted state + rejectClassName?: string; // className for rejected state - disablePreview?: boolean, // Enable/disable preview generation - disableClick?: boolean, // Disallow clicking on the dropzone container to open file dialog + disablePreview?: boolean; // Enable/disable preview generation + disableClick?: boolean; // Disallow clicking on the dropzone container to open file dialog - inputProps?: Object, // Pass additional attributes to the tag - multiple?: boolean, // Allow dropping multiple files - accept?: string, // Allow specific types of files. See https://github.com/okonet/attr-accept for more information - name?: string, // name attribute for the input tag - maxSize?: number, - minSize?: number + inputProps?: React.ChangeTargetHTMLProps; // Pass additional attributes to the tag + multiple?: boolean; // Allow dropping multiple files + accept?: string; // Allow specific types of files. See https://github.com/okonet/attr-accept for more information + name?: string; // name attribute for the input tag + maxSize?: number; + minSize?: number; onFileDialogCancel?: () => void; } - export declare class Dropzone extends React.Component { - open(): void; - } + class Dropzone extends React.Component {} + export = Dropzone; } diff --git a/types/react-dropzone/react-dropzone-tests.tsx b/types/react-dropzone/react-dropzone-tests.tsx index aaa499a3e3..b4398b5780 100644 --- a/types/react-dropzone/react-dropzone-tests.tsx +++ b/types/react-dropzone/react-dropzone-tests.tsx @@ -1,36 +1,41 @@ import * as React from 'react'; -import * as Dropzone from 'react-dropzone'; +import Dropzone = require('react-dropzone'); class Test extends React.Component { constructor(props: any) { super(props); } + dz: Dropzone; + render() { - return (

- { e.preventDefault(); } } - onDropAccepted={(e: any) => { e.preventDefault(); } } - onDropRejected={(e: any) => { e.preventDefault(); } } - onDragStart={(e: any) => { e.preventDefault(); } } - onDragEnter={(e: any) => { e.preventDefault(); } } - onDragLeave={(e: any) => { e.preventDefault(); } } - style={{ borderStyle: "dashed" }} - activeStyle={{ borderStyle: "dotted" }} - rejectStyle={{ borderStyle: "dotted" }} - className="regular" - activeClassName="active" - rejectClassName="reject" - minSize={2000} - maxSize={Infinity} - disablePreview={true} - disableClick={true} - multiple={false} - accept="*.png" - name="dropzone" - inputProps={{ id: "dropzone" }} + return ( +
+ { this.dz = node } } + onDrop={(e: any) => { e.preventDefault(); } } + onDropAccepted={(e: any) => { e.preventDefault(); } } + onDropRejected={(e: any) => { e.preventDefault(); } } + onDragStart={(e: any) => { e.preventDefault(); } } + onDragEnter={(e: any) => { e.preventDefault(); } } + onDragLeave={(e: any) => { e.preventDefault(); } } + style={{ borderStyle: "dashed" }} + activeStyle={{ borderStyle: "dotted" }} + rejectStyle={{ borderStyle: "dotted" }} + className="regular" + activeClassName="active" + rejectClassName="reject" + minSize={2000} + maxSize={Infinity} + disablePreview={true} + disableClick={true} + multiple={false} + accept="*.png" + name="dropzone" + inputProps={{ id: "dropzone" }} /> -
); +
+ ); } } From 7dc0047930f17430a6c68e603bc9370211b12a10 Mon Sep 17 00:00:00 2001 From: Ben Bayard Date: Tue, 27 Jun 2017 15:34:17 -0700 Subject: [PATCH 156/180] Add typescript definition for open method - Include test --- types/react-dropzone/index.d.ts | 4 +++- types/react-dropzone/react-dropzone-tests.tsx | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/types/react-dropzone/index.d.ts b/types/react-dropzone/index.d.ts index dfa2a861b2..c47b64d9bc 100644 --- a/types/react-dropzone/index.d.ts +++ b/types/react-dropzone/index.d.ts @@ -38,7 +38,9 @@ declare module "react-dropzone" { onFileDialogCancel?: () => void; } - class Dropzone extends React.Component {} + class Dropzone extends React.Component { + open(): void; + } export = Dropzone; } diff --git a/types/react-dropzone/react-dropzone-tests.tsx b/types/react-dropzone/react-dropzone-tests.tsx index b4398b5780..95c3886454 100644 --- a/types/react-dropzone/react-dropzone-tests.tsx +++ b/types/react-dropzone/react-dropzone-tests.tsx @@ -8,6 +8,10 @@ class Test extends React.Component { dz: Dropzone; + open() { + this.dz.open(); + } + render() { return (
From d9d37590649a62b211bd079edef66bafc8b9ef51 Mon Sep 17 00:00:00 2001 From: Andre Wiggins Date: Tue, 27 Jun 2017 16:01:43 -0700 Subject: [PATCH 157/180] Extend Angular jqLite static interface --- types/angular/angular-tests.ts | 6 ++++-- types/angular/jqlite.d.ts | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/types/angular/angular-tests.ts b/types/angular/angular-tests.ts index 6a601910d0..20de01f71f 100644 --- a/types/angular/angular-tests.ts +++ b/types/angular/angular-tests.ts @@ -627,11 +627,13 @@ function test_angular_forEach() { } // angular.element() tests -let element = angular.element('div.myApp'); +let element = angular.element('
'); let scope: ng.IScope = element.scope(); let isolateScope: ng.IScope = element.isolateScope(); -isolateScope = element.find('div.foo').isolateScope(); +isolateScope = element.find('div').isolateScope(); isolateScope = element.children().isolateScope(); +let element2 = angular.element(element); +let elementArray = angular.element(document.querySelectorAll('div')); // $timeout signature tests namespace TestTimeout { diff --git a/types/angular/jqlite.d.ts b/types/angular/jqlite.d.ts index 727e7718d7..150c50b5dd 100644 --- a/types/angular/jqlite.d.ts +++ b/types/angular/jqlite.d.ts @@ -20,6 +20,7 @@ // Dick van den Brink // Thomas Schulz // Leonard Thieu +// Andre Wiggins // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Definitions copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0480c5ec87fab41aa23047a02b27f0ea71aaf975/types/jquery/v2/index.d.ts @@ -666,7 +667,7 @@ interface JQuery { } interface JQueryStatic { - (element: string | Element | Document): JQuery; + (element: string | Element | Document | JQuery | ArrayLike): JQuery; } /** From a70a977fe4acee57c5f5cf5a9e16575284cde81d Mon Sep 17 00:00:00 2001 From: Brian Lee Date: Tue, 27 Jun 2017 17:22:48 -0700 Subject: [PATCH 158/180] Add additional tests --- types/node/node-tests.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index aeefc2bbdc..ea177760cb 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -544,6 +544,11 @@ namespace util_tests { maxArrayLength: null, breakLength: Infinity }) + assert(typeof util.inspect.custom === 'symbol') + // util.promisify + var readPromised = util.promisify(fs.readFile) + var sampleRead: Promise = readPromised(__filename).then((data: string): void => {}).catch((error: Error): void => {}) + assert(typeof util.promisify.custom === 'symbol') } } From b6cc60050834200596b74ceb44c715e85261c24e Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Wed, 28 Jun 2017 02:23:02 +0200 Subject: [PATCH 159/180] null! => null thanks to PR #17021 --- types/react-router/test/ModalGallery.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-router/test/ModalGallery.tsx b/types/react-router/test/ModalGallery.tsx index f4b55aca20..211e62aa49 100644 --- a/types/react-router/test/ModalGallery.tsx +++ b/types/react-router/test/ModalGallery.tsx @@ -130,7 +130,7 @@ const ImageView: React.SFC> = ({ match }) => const Modal: React.SFC> = ({ match, history }) => { const image = IMAGES[parseInt(match.params.id, 10)]; if (!image) { - return null!; + return null; } const back = (e: React.MouseEvent) => { e.stopPropagation(); From 42af84cc3a5f629c4d49e896f4f80fdb16147213 Mon Sep 17 00:00:00 2001 From: Brian Lee Date: Tue, 27 Jun 2017 17:24:31 -0700 Subject: [PATCH 160/180] Add properties for util.inspect and util.promisify --- types/node/index.d.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 21d48b504a..23aceac90c 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -3938,8 +3938,17 @@ declare module "util" { export function puts(...param: any[]): void; export function print(...param: any[]): void; export function log(string: string): void; - export function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string; - export function inspect(object: any, options: InspectOptions): string; + export var inspect: { + (object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string; + (object: any, options: InspectOptions): string; + colors: { + [color: string]: [number, number] + } + styles: { + [style: string]: string + } + custom: symbol + } export function isArray(object: any): object is any[]; export function isRegExp(object: any): object is RegExp; export function isDate(object: any): object is Date; @@ -3958,7 +3967,10 @@ declare module "util" { export function isSymbol(object: any): object is symbol; export function isUndefined(object: any): object is undefined; export function deprecate(fn: Function, message: string): Function; - export function promisify(fn: Function): Function; + export var promisify: { + (fn: Function): Function; + custom: symbol + } } declare module "assert" { From 43c90a8a839851cac01c15ad1c75113647176cc5 Mon Sep 17 00:00:00 2001 From: codemannz Date: Wed, 28 Jun 2017 12:49:05 +1200 Subject: [PATCH 161/180] changed to Backbone.View --- types/backbone.marionette/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/backbone.marionette/index.d.ts b/types/backbone.marionette/index.d.ts index 52d8c7a492..9ffe1460e9 100644 --- a/types/backbone.marionette/index.d.ts +++ b/types/backbone.marionette/index.d.ts @@ -1272,7 +1272,7 @@ declare namespace Marionette { getRegion(): Region; /** Show a view in the root region */ - showView(view: View): void; + showView(view: Backbone.View): void; /** Get the view from the root region*/ getView(): any; From 13a594f24e60ef9e93aacd8ba40db18aa6fc88d8 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Wed, 28 Jun 2017 03:03:42 +0200 Subject: [PATCH 162/180] Move the official examples to directory examples-from-react-router-website --- types/react-router/test/README.md | 1 - .../Ambiguous.tsx | 0 .../Animation.tsx | 0 .../Auth.tsx | 0 .../Basic.tsx | 0 .../CustomLink.tsx | 0 .../ModalGallery.tsx | 0 .../NoMatch.tsx | 0 .../Params.tsx | 0 .../PreventingTransitions.tsx | 0 .../README.md | 5 ++++ .../Recursive.tsx | 0 .../RouteConfig.tsx | 0 .../Sidebar.tsx | 0 .../StaticRouter.tsx | 0 types/react-router/tsconfig.json | 28 ++++++++++--------- 16 files changed, 20 insertions(+), 14 deletions(-) delete mode 100644 types/react-router/test/README.md rename types/react-router/test/{ => examples-from-react-router-website}/Ambiguous.tsx (100%) rename types/react-router/test/{ => examples-from-react-router-website}/Animation.tsx (100%) rename types/react-router/test/{ => examples-from-react-router-website}/Auth.tsx (100%) rename types/react-router/test/{ => examples-from-react-router-website}/Basic.tsx (100%) rename types/react-router/test/{ => examples-from-react-router-website}/CustomLink.tsx (100%) rename types/react-router/test/{ => examples-from-react-router-website}/ModalGallery.tsx (100%) rename types/react-router/test/{ => examples-from-react-router-website}/NoMatch.tsx (100%) rename types/react-router/test/{ => examples-from-react-router-website}/Params.tsx (100%) rename types/react-router/test/{ => examples-from-react-router-website}/PreventingTransitions.tsx (100%) create mode 100644 types/react-router/test/examples-from-react-router-website/README.md rename types/react-router/test/{ => examples-from-react-router-website}/Recursive.tsx (100%) rename types/react-router/test/{ => examples-from-react-router-website}/RouteConfig.tsx (100%) rename types/react-router/test/{ => examples-from-react-router-website}/Sidebar.tsx (100%) rename types/react-router/test/{ => examples-from-react-router-website}/StaticRouter.tsx (100%) diff --git a/types/react-router/test/README.md b/types/react-router/test/README.md deleted file mode 100644 index 341bd29130..0000000000 --- a/types/react-router/test/README.md +++ /dev/null @@ -1 +0,0 @@ -Examples taken from https://github.com/ReactTraining/react-router/tree/22bd52c901ef0312348c2b02549c7102bd5653ae/packages/react-router-website/modules/examples diff --git a/types/react-router/test/Ambiguous.tsx b/types/react-router/test/examples-from-react-router-website/Ambiguous.tsx similarity index 100% rename from types/react-router/test/Ambiguous.tsx rename to types/react-router/test/examples-from-react-router-website/Ambiguous.tsx diff --git a/types/react-router/test/Animation.tsx b/types/react-router/test/examples-from-react-router-website/Animation.tsx similarity index 100% rename from types/react-router/test/Animation.tsx rename to types/react-router/test/examples-from-react-router-website/Animation.tsx diff --git a/types/react-router/test/Auth.tsx b/types/react-router/test/examples-from-react-router-website/Auth.tsx similarity index 100% rename from types/react-router/test/Auth.tsx rename to types/react-router/test/examples-from-react-router-website/Auth.tsx diff --git a/types/react-router/test/Basic.tsx b/types/react-router/test/examples-from-react-router-website/Basic.tsx similarity index 100% rename from types/react-router/test/Basic.tsx rename to types/react-router/test/examples-from-react-router-website/Basic.tsx diff --git a/types/react-router/test/CustomLink.tsx b/types/react-router/test/examples-from-react-router-website/CustomLink.tsx similarity index 100% rename from types/react-router/test/CustomLink.tsx rename to types/react-router/test/examples-from-react-router-website/CustomLink.tsx diff --git a/types/react-router/test/ModalGallery.tsx b/types/react-router/test/examples-from-react-router-website/ModalGallery.tsx similarity index 100% rename from types/react-router/test/ModalGallery.tsx rename to types/react-router/test/examples-from-react-router-website/ModalGallery.tsx diff --git a/types/react-router/test/NoMatch.tsx b/types/react-router/test/examples-from-react-router-website/NoMatch.tsx similarity index 100% rename from types/react-router/test/NoMatch.tsx rename to types/react-router/test/examples-from-react-router-website/NoMatch.tsx diff --git a/types/react-router/test/Params.tsx b/types/react-router/test/examples-from-react-router-website/Params.tsx similarity index 100% rename from types/react-router/test/Params.tsx rename to types/react-router/test/examples-from-react-router-website/Params.tsx diff --git a/types/react-router/test/PreventingTransitions.tsx b/types/react-router/test/examples-from-react-router-website/PreventingTransitions.tsx similarity index 100% rename from types/react-router/test/PreventingTransitions.tsx rename to types/react-router/test/examples-from-react-router-website/PreventingTransitions.tsx diff --git a/types/react-router/test/examples-from-react-router-website/README.md b/types/react-router/test/examples-from-react-router-website/README.md new file mode 100644 index 0000000000..6648c853d0 --- /dev/null +++ b/types/react-router/test/examples-from-react-router-website/README.md @@ -0,0 +1,5 @@ +Examples taken from react-router website. + +Please keep them in sync and as close as possible to the original ones. + +See https://github.com/ReactTraining/react-router/tree/22bd52c901ef0312348c2b02549c7102bd5653ae/packages/react-router-website/modules/examples diff --git a/types/react-router/test/Recursive.tsx b/types/react-router/test/examples-from-react-router-website/Recursive.tsx similarity index 100% rename from types/react-router/test/Recursive.tsx rename to types/react-router/test/examples-from-react-router-website/Recursive.tsx diff --git a/types/react-router/test/RouteConfig.tsx b/types/react-router/test/examples-from-react-router-website/RouteConfig.tsx similarity index 100% rename from types/react-router/test/RouteConfig.tsx rename to types/react-router/test/examples-from-react-router-website/RouteConfig.tsx diff --git a/types/react-router/test/Sidebar.tsx b/types/react-router/test/examples-from-react-router-website/Sidebar.tsx similarity index 100% rename from types/react-router/test/Sidebar.tsx rename to types/react-router/test/examples-from-react-router-website/Sidebar.tsx diff --git a/types/react-router/test/StaticRouter.tsx b/types/react-router/test/examples-from-react-router-website/StaticRouter.tsx similarity index 100% rename from types/react-router/test/StaticRouter.tsx rename to types/react-router/test/examples-from-react-router-website/StaticRouter.tsx diff --git a/types/react-router/tsconfig.json b/types/react-router/tsconfig.json index 4790f0b53d..438e3c9647 100644 --- a/types/react-router/tsconfig.json +++ b/types/react-router/tsconfig.json @@ -14,22 +14,24 @@ }, "files": [ "index.d.ts", - "test/Ambiguous.tsx", - "test/Animation.tsx", - "test/Auth.tsx", - "test/Basic.tsx", + + "test/examples-from-react-router-website/Ambiguous.tsx", + "test/examples-from-react-router-website/Animation.tsx", + "test/examples-from-react-router-website/Auth.tsx", + "test/examples-from-react-router-website/Basic.tsx", + "test/examples-from-react-router-website/CustomLink.tsx", + "test/examples-from-react-router-website/ModalGallery.tsx", + "test/examples-from-react-router-website/NoMatch.tsx", + "test/examples-from-react-router-website/Params.tsx", + "test/examples-from-react-router-website/PreventingTransitions.tsx", + "test/examples-from-react-router-website/Recursive.tsx", + "test/examples-from-react-router-website/RouteConfig.tsx", + "test/examples-from-react-router-website/Sidebar.tsx", + "test/examples-from-react-router-website/StaticRouter.tsx", + "test/Children.tsx", - "test/CustomLink.tsx", - "test/ModalGallery.tsx", "test/NavigateWithContext.tsx", "test/MemoryRouter.tsx", - "test/NoMatch.tsx", - "test/Params.tsx", - "test/PreventingTransitions.tsx", - "test/Recursive.tsx", - "test/RouteConfig.tsx", - "test/Sidebar.tsx", - "test/StaticRouter.tsx", "test/Switch.tsx", "test/WithRouter.tsx" ] From f3b410c756d251d16c1c67910ec50f27d3c65d01 Mon Sep 17 00:00:00 2001 From: codemannz Date: Wed, 28 Jun 2017 13:27:24 +1200 Subject: [PATCH 163/180] Updated to Backbone.Model --- types/backbone.marionette/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/backbone.marionette/index.d.ts b/types/backbone.marionette/index.d.ts index 9ffe1460e9..ad623aa078 100644 --- a/types/backbone.marionette/index.d.ts +++ b/types/backbone.marionette/index.d.ts @@ -1272,7 +1272,7 @@ declare namespace Marionette { getRegion(): Region; /** Show a view in the root region */ - showView(view: Backbone.View): void; + showView(view: Backbone.View): void; /** Get the view from the root region*/ getView(): any; From b66d4b85f0d72e001eb4978a6a6c5bb23bcee374 Mon Sep 17 00:00:00 2001 From: hjin-me Date: Wed, 28 Jun 2017 10:43:10 +0800 Subject: [PATCH 164/180] add missing MaterialParameters --- types/three/three-core.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 02cbe672e8..7a6a6ec9ac 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -2318,6 +2318,9 @@ export interface MaterialParameters { lights?: boolean; shading?: Shading; vertexColors?: Colors; + clippingPlanes?: Plane[]; + clipIntersection?: boolean; + clipShadows?: boolean; } /** From 1205f064bd7fc3fed402f0dd681560525a8fe2cd Mon Sep 17 00:00:00 2001 From: kimu_shu Date: Wed, 28 Jun 2017 11:58:01 +0900 Subject: [PATCH 165/180] Add fs.writeFileSync overloads and tests --- types/node/index.d.ts | 1 + types/node/node-tests.ts | 3 +++ types/node/v0/node-tests.ts | 2 ++ types/node/v4/index.d.ts | 1 + types/node/v4/node-tests.ts | 3 +++ types/node/v6/index.d.ts | 1 + types/node/v6/node-tests.ts | 3 +++ types/node/v7/index.d.ts | 1 + types/node/v7/node-tests.ts | 3 +++ 9 files changed, 18 insertions(+) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 7691c2c9af..9e69aca71e 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -2835,6 +2835,7 @@ declare module "fs" { export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFileSync(filename: string, data: any, encoding: string): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index aeefc2bbdc..0297bc375b 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -169,6 +169,9 @@ namespace fs_tests { encoding: "ascii" }, assert.ifError); + + fs.writeFileSync("testfile", "content", "utf8"); + fs.writeFileSync("testfile", "content", { encoding: "utf8" }); } { diff --git a/types/node/v0/node-tests.ts b/types/node/v0/node-tests.ts index 30dfd2bd72..8bb4ac371d 100644 --- a/types/node/v0/node-tests.ts +++ b/types/node/v0/node-tests.ts @@ -47,6 +47,8 @@ fs.writeFile("Harry Potter", }, assert.ifError); +fs.writeFileSync("testfile", "content", { encoding: "utf8" }); + var content: string, buffer: Buffer; diff --git a/types/node/v4/index.d.ts b/types/node/v4/index.d.ts index 3c5a7745e9..30b40dc2f0 100644 --- a/types/node/v4/index.d.ts +++ b/types/node/v4/index.d.ts @@ -1775,6 +1775,7 @@ declare module "fs" { export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFileSync(filename: string, data: any, encoding: string): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; diff --git a/types/node/v4/node-tests.ts b/types/node/v4/node-tests.ts index b56bb224e1..247f6969ea 100644 --- a/types/node/v4/node-tests.ts +++ b/types/node/v4/node-tests.ts @@ -151,6 +151,9 @@ namespace fs_tests { encoding: "ascii" }, assert.ifError); + + fs.writeFileSync("testfile", "content", "utf8"); + fs.writeFileSync("testfile", "content", { encoding: "utf8" }); } { diff --git a/types/node/v6/index.d.ts b/types/node/v6/index.d.ts index d0c3a44311..21c363e95a 100644 --- a/types/node/v6/index.d.ts +++ b/types/node/v6/index.d.ts @@ -2564,6 +2564,7 @@ declare module "fs" { export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFileSync(filename: string, data: any, encoding: string): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; diff --git a/types/node/v6/node-tests.ts b/types/node/v6/node-tests.ts index f7474844e8..057e0858e7 100644 --- a/types/node/v6/node-tests.ts +++ b/types/node/v6/node-tests.ts @@ -168,6 +168,9 @@ namespace fs_tests { encoding: "ascii" }, assert.ifError); + + fs.writeFileSync("testfile", "content", "utf8"); + fs.writeFileSync("testfile", "content", { encoding: "utf8" }); } { diff --git a/types/node/v7/index.d.ts b/types/node/v7/index.d.ts index 31e068cec8..b9763c08fc 100644 --- a/types/node/v7/index.d.ts +++ b/types/node/v7/index.d.ts @@ -2693,6 +2693,7 @@ declare module "fs" { export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFileSync(filename: string, data: any, encoding: string): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; diff --git a/types/node/v7/node-tests.ts b/types/node/v7/node-tests.ts index de401eb0fc..67b6d9f26f 100644 --- a/types/node/v7/node-tests.ts +++ b/types/node/v7/node-tests.ts @@ -169,6 +169,9 @@ namespace fs_tests { encoding: "ascii" }, assert.ifError); + + fs.writeFileSync("testfile", "content", "utf8"); + fs.writeFileSync("testfile", "content", { encoding: "utf8" }); } { From f8156fb34adb09aa89acb1fe67644928d745f756 Mon Sep 17 00:00:00 2001 From: Brian Lee Date: Wed, 28 Jun 2017 00:48:12 -0700 Subject: [PATCH 166/180] Add util.inspect.defaultOptions property --- types/node/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 7bc703db58..b87382f103 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -3953,7 +3953,8 @@ declare module "util" { styles: { [style: string]: string } - custom: symbol + defaultOptions: InspectOptions; + custom: symbol; } export function isArray(object: any): object is any[]; export function isRegExp(object: any): object is RegExp; From 867079b87c5da7108c945ad0e13da79e0e8673ae Mon Sep 17 00:00:00 2001 From: scarabedore Date: Wed, 28 Jun 2017 10:09:57 +0200 Subject: [PATCH 167/180] Fixed fs-extra-promise with node typings --- types/fs-extra-promise/fs-extra-promise-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/fs-extra-promise/fs-extra-promise-tests.ts b/types/fs-extra-promise/fs-extra-promise-tests.ts index 9f5a8b32bf..c50115871b 100644 --- a/types/fs-extra-promise/fs-extra-promise-tests.ts +++ b/types/fs-extra-promise/fs-extra-promise-tests.ts @@ -205,7 +205,7 @@ readStream = fs.createReadStream(path, { writeStream = fs.createWriteStream(path); writeStream = fs.createWriteStream(path, { flags: str, - encoding: str + defaultEncoding: str }); let isDirectoryCallback = (err: Error, isDirectory: boolean) => { From cd8e349fe7aa27a8445ab7c03d993dff0efdae95 Mon Sep 17 00:00:00 2001 From: Douglas Duteil Date: Wed, 28 Jun 2017 11:18:37 +0200 Subject: [PATCH 168/180] feat(globby): add typings for `globby` --- types/globby/globby-tests.ts | 27 +++++++++++++++++++++++++++ types/globby/index.d.ts | 17 +++++++++++++++++ types/globby/tsconfig.json | 22 ++++++++++++++++++++++ types/globby/tslint.json | 1 + 4 files changed, 67 insertions(+) create mode 100644 types/globby/globby-tests.ts create mode 100644 types/globby/index.d.ts create mode 100644 types/globby/tsconfig.json create mode 100644 types/globby/tslint.json diff --git a/types/globby/globby-tests.ts b/types/globby/globby-tests.ts new file mode 100644 index 0000000000..0e08024c63 --- /dev/null +++ b/types/globby/globby-tests.ts @@ -0,0 +1,27 @@ +// + +import { IOptions } from 'glob'; + +import * as globby from "globby"; + +(async () => { + let result: string[]; + result = await globby('*.tmp') + result = await globby(['a.tmp', '*.tmp', '!{c,d,e}.tmp']) + + result = globby.sync('*.tmp') + result = globby.sync(['a.tmp', '*.tmp', '!{c,d,e}.tmp']) + + result = await globby('*.tmp', Object.freeze({ignore: Object.freeze([])})) + result = globby.sync('*.tmp', Object.freeze({ignore: Object.freeze([])})) +})() + + +const tasks: Array<{ + pattern: string, + options: IOptions +}> = globby.generateGlobTasks(['*.tmp', '!b.tmp'], {ignore: ['c.tmp']}); + +console.log(globby.hasMagic('**') === true); +console.log(globby.hasMagic(['**', 'path1', 'path2']) === true); +console.log(globby.hasMagic(['path1', 'path2']) === false); diff --git a/types/globby/index.d.ts b/types/globby/index.d.ts new file mode 100644 index 0000000000..a469cc3a0b --- /dev/null +++ b/types/globby/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for globby 0.6 +// Project: https://github.com/sindresorhus/globby#readme +// Definitions by: Douglas Duteil +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { IOptions } from 'glob'; + +declare function globby(patterns: string | string[], options?: Partial): Promise; + +declare namespace globby { + function sync(patterns: string | string[], options?: Partial): string[]; + function generateGlobTasks(patterns: string | string[], options?: Partial): Array<{pattern: string, options: IOptions}>; + function hasMagic(patterns: string | string[], options?: Partial): boolean; +} + +export = globby; diff --git a/types/globby/tsconfig.json b/types/globby/tsconfig.json new file mode 100644 index 0000000000..fd75c832f1 --- /dev/null +++ b/types/globby/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "globby-tests.ts" + ] +} diff --git a/types/globby/tslint.json b/types/globby/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/globby/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 4afe9ac8321711d8258dd78520e91425e1af7054 Mon Sep 17 00:00:00 2001 From: Douglas Duteil Date: Wed, 28 Jun 2017 11:28:16 +0200 Subject: [PATCH 169/180] chore(globby): test on all TypeScript versions --- types/globby/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/globby/index.d.ts b/types/globby/index.d.ts index a469cc3a0b..8452dc36ff 100644 --- a/types/globby/index.d.ts +++ b/types/globby/index.d.ts @@ -2,7 +2,6 @@ // Project: https://github.com/sindresorhus/globby#readme // Definitions by: Douglas Duteil // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 import { IOptions } from 'glob'; From 9d37d490249c857a9a4ad191f5f5a0179dc7d7b1 Mon Sep 17 00:00:00 2001 From: Douglas Duteil Date: Wed, 28 Jun 2017 11:28:46 +0200 Subject: [PATCH 170/180] fix(globby): lint error --- types/globby/globby-tests.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/types/globby/globby-tests.ts b/types/globby/globby-tests.ts index 0e08024c63..0722b5fb37 100644 --- a/types/globby/globby-tests.ts +++ b/types/globby/globby-tests.ts @@ -1,21 +1,18 @@ -// - import { IOptions } from 'glob'; import * as globby from "globby"; (async () => { let result: string[]; - result = await globby('*.tmp') - result = await globby(['a.tmp', '*.tmp', '!{c,d,e}.tmp']) + result = await globby('*.tmp'); + result = await globby(['a.tmp', '*.tmp', '!{c,d,e}.tmp']); - result = globby.sync('*.tmp') - result = globby.sync(['a.tmp', '*.tmp', '!{c,d,e}.tmp']) - - result = await globby('*.tmp', Object.freeze({ignore: Object.freeze([])})) - result = globby.sync('*.tmp', Object.freeze({ignore: Object.freeze([])})) -})() + result = globby.sync('*.tmp'); + result = globby.sync(['a.tmp', '*.tmp', '!{c,d,e}.tmp']); + result = await globby('*.tmp', Object.freeze({ignore: Object.freeze([])})); + result = globby.sync('*.tmp', Object.freeze({ignore: Object.freeze([])})); +})(); const tasks: Array<{ pattern: string, From 23bb7eed66e50b535c4ce78e1247c59bbb0781fe Mon Sep 17 00:00:00 2001 From: Douglas Duteil Date: Wed, 28 Jun 2017 11:35:01 +0200 Subject: [PATCH 171/180] fix(globby): remove unnecessary "Partial" --- types/globby/index.d.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/types/globby/index.d.ts b/types/globby/index.d.ts index 8452dc36ff..4752b3d6ad 100644 --- a/types/globby/index.d.ts +++ b/types/globby/index.d.ts @@ -2,15 +2,17 @@ // Project: https://github.com/sindresorhus/globby#readme // Definitions by: Douglas Duteil // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import { IOptions } from 'glob'; -declare function globby(patterns: string | string[], options?: Partial): Promise; +declare function globby(patterns: string | string[], options?: IOptions): Promise; declare namespace globby { - function sync(patterns: string | string[], options?: Partial): string[]; - function generateGlobTasks(patterns: string | string[], options?: Partial): Array<{pattern: string, options: IOptions}>; - function hasMagic(patterns: string | string[], options?: Partial): boolean; + function sync(patterns: string | string[], options?: IOptions): string[]; + function generateGlobTasks(patterns: string | string[], options?: IOptions): Array<{pattern: string, options: IOptions}>; + function hasMagic(patterns: string | string[], options?: IOptions): boolean; } export = globby; + From 5e53b881264a9c9ea0f0019911bfd3aced29acd2 Mon Sep 17 00:00:00 2001 From: Douglas Duteil Date: Wed, 28 Jun 2017 11:38:23 +0200 Subject: [PATCH 172/180] style(globby): remove consecutive blank lines --- types/globby/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/globby/index.d.ts b/types/globby/index.d.ts index 4752b3d6ad..d06091551c 100644 --- a/types/globby/index.d.ts +++ b/types/globby/index.d.ts @@ -15,4 +15,3 @@ declare namespace globby { } export = globby; - From c7fcc1172979b5152f26499c197884ae74edd145 Mon Sep 17 00:00:00 2001 From: Jacob Rask Date: Wed, 28 Jun 2017 13:32:59 +0200 Subject: [PATCH 173/180] Remove references to removed section in React README setState issues were removed. --- types/react/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react/README.md b/types/react/README.md index e38ba90175..594b16d48f 100644 --- a/types/react/README.md +++ b/types/react/README.md @@ -1,7 +1,7 @@ ## Known Problems & Workarounds ### **The type of `cloneElement` is incorrect.** -This is similar to the `setState` problem, in that `cloneElement(element, props)` should should accept a `props` object with a subset of the properties on `element.props`. There is an additional complication, however—React attributes, such as `key` and `ref`, should also be accepted in `props`, but should not exist on `element.props`. The "correct" way to model this, then, is with +`cloneElement(element, props)` should should accept a `props` object with a subset of the properties on `element.props`. React attributes such as `key` and `ref` should also be accepted in `props`, but should not exist on `element.props`. The "correct" way to model this, then, is with ```ts declare function cloneElement

( element: ReactElement

, From 1b5e242876792f750dbe6af33fcae9eb107d91df Mon Sep 17 00:00:00 2001 From: kimu_shu Date: Wed, 28 Jun 2017 21:55:08 +0900 Subject: [PATCH 174/180] Add overloads for writeFile, appendFile and appendFileSync --- types/node/index.d.ts | 3 +++ types/node/node-tests.ts | 9 +++++++++ types/node/v0/node-tests.ts | 3 +++ types/node/v4/index.d.ts | 3 +++ types/node/v4/node-tests.ts | 9 +++++++++ types/node/v6/index.d.ts | 3 +++ types/node/v6/node-tests.ts | 9 +++++++++ types/node/v7/index.d.ts | 3 +++ types/node/v7/node-tests.ts | 9 +++++++++ 9 files changed, 51 insertions(+) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 9e69aca71e..acf69fefd9 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -2833,14 +2833,17 @@ declare module "fs" { */ export function readFileSync(filename: string, options?: { flag?: string; }): Buffer; export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFileSync(filename: string, data: any, encoding: string): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; + export function appendFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFileSync(filename: string, data: any, encoding: string): void; export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; export function watchFile(filename: string, listener: (curr: Stats, prev: Stats) => void): void; diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index 0297bc375b..d99b4b8030 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -170,10 +170,19 @@ namespace fs_tests { }, assert.ifError); + fs.writeFile("testfile", "content", "utf8", assert.ifError); + fs.writeFileSync("testfile", "content", "utf8"); fs.writeFileSync("testfile", "content", { encoding: "utf8" }); } + { + fs.appendFile("testfile", "foobar", "utf8", assert.ifError); + fs.appendFile("testfile", "foobar", { encoding: "utf8" }, assert.ifError); + fs.appendFileSync("testfile", "foobar", "utf8"); + fs.appendFileSync("testfile", "foobar", { encoding: "utf8" }); + } + { var content: string; var buffer: Buffer; diff --git a/types/node/v0/node-tests.ts b/types/node/v0/node-tests.ts index 8bb4ac371d..57019bfe86 100644 --- a/types/node/v0/node-tests.ts +++ b/types/node/v0/node-tests.ts @@ -49,6 +49,9 @@ fs.writeFile("Harry Potter", fs.writeFileSync("testfile", "content", { encoding: "utf8" }); +fs.appendFile("testfile", "foobar", { encoding: "utf8" }, assert.ifError); +fs.appendFileSync("testfile", "foobar", { encoding: "utf8" }); + var content: string, buffer: Buffer; diff --git a/types/node/v4/index.d.ts b/types/node/v4/index.d.ts index 30b40dc2f0..14e0a58d1a 100644 --- a/types/node/v4/index.d.ts +++ b/types/node/v4/index.d.ts @@ -1773,14 +1773,17 @@ declare module "fs" { */ export function readFileSync(filename: string, options?: { flag?: string; }): Buffer; export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFileSync(filename: string, data: any, encoding: string): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; + export function appendFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFileSync(filename: string, data: any, encoding: string): void; export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; export function watchFile(filename: string, listener: (curr: Stats, prev: Stats) => void): void; diff --git a/types/node/v4/node-tests.ts b/types/node/v4/node-tests.ts index 247f6969ea..a3e1cca18a 100644 --- a/types/node/v4/node-tests.ts +++ b/types/node/v4/node-tests.ts @@ -152,10 +152,19 @@ namespace fs_tests { }, assert.ifError); + fs.writeFile("testfile", "content", "utf8", assert.ifError); + fs.writeFileSync("testfile", "content", "utf8"); fs.writeFileSync("testfile", "content", { encoding: "utf8" }); } + { + fs.appendFile("testfile", "foobar", "utf8", assert.ifError); + fs.appendFile("testfile", "foobar", { encoding: "utf8" }, assert.ifError); + fs.appendFileSync("testfile", "foobar", "utf8"); + fs.appendFileSync("testfile", "foobar", { encoding: "utf8" }); + } + { var content: string; var buffer: Buffer; diff --git a/types/node/v6/index.d.ts b/types/node/v6/index.d.ts index 21c363e95a..f1e7cc8fdb 100644 --- a/types/node/v6/index.d.ts +++ b/types/node/v6/index.d.ts @@ -2562,14 +2562,17 @@ declare module "fs" { */ export function readFileSync(filename: string, options?: { flag?: string; }): Buffer; export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFileSync(filename: string, data: any, encoding: string): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; + export function appendFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFileSync(filename: string, data: any, encoding: string): void; export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; export function watchFile(filename: string, listener: (curr: Stats, prev: Stats) => void): void; diff --git a/types/node/v6/node-tests.ts b/types/node/v6/node-tests.ts index 057e0858e7..191f1128c2 100644 --- a/types/node/v6/node-tests.ts +++ b/types/node/v6/node-tests.ts @@ -169,10 +169,19 @@ namespace fs_tests { }, assert.ifError); + fs.writeFile("testfile", "content", "utf8", assert.ifError); + fs.writeFileSync("testfile", "content", "utf8"); fs.writeFileSync("testfile", "content", { encoding: "utf8" }); } + { + fs.appendFile("testfile", "foobar", "utf8", assert.ifError); + fs.appendFile("testfile", "foobar", { encoding: "utf8" }, assert.ifError); + fs.appendFileSync("testfile", "foobar", "utf8"); + fs.appendFileSync("testfile", "foobar", { encoding: "utf8" }); + } + { var content: string; var buffer: Buffer; diff --git a/types/node/v7/index.d.ts b/types/node/v7/index.d.ts index b9763c08fc..34a05d33f3 100644 --- a/types/node/v7/index.d.ts +++ b/types/node/v7/index.d.ts @@ -2691,14 +2691,17 @@ declare module "fs" { */ export function readFileSync(filename: string, options?: { flag?: string; }): Buffer; export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFileSync(filename: string, data: any, encoding: string): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; + export function appendFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFileSync(filename: string, data: any, encoding: string): void; export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; export function watchFile(filename: string, listener: (curr: Stats, prev: Stats) => void): void; diff --git a/types/node/v7/node-tests.ts b/types/node/v7/node-tests.ts index 67b6d9f26f..4a2f53ab67 100644 --- a/types/node/v7/node-tests.ts +++ b/types/node/v7/node-tests.ts @@ -170,10 +170,19 @@ namespace fs_tests { }, assert.ifError); + fs.writeFile("testfile", "content", "utf8", assert.ifError); + fs.writeFileSync("testfile", "content", "utf8"); fs.writeFileSync("testfile", "content", { encoding: "utf8" }); } + { + fs.appendFile("testfile", "foobar", "utf8", assert.ifError); + fs.appendFile("testfile", "foobar", { encoding: "utf8" }, assert.ifError); + fs.appendFileSync("testfile", "foobar", "utf8"); + fs.appendFileSync("testfile", "foobar", { encoding: "utf8" }); + } + { var content: string; var buffer: Buffer; From ff3da11908f963a9a3c8463f755115577b1b5468 Mon Sep 17 00:00:00 2001 From: kimu_shu Date: Wed, 28 Jun 2017 23:02:55 +0900 Subject: [PATCH 175/180] Make callback parameter mandatory --- types/node/index.d.ts | 4 ++-- types/node/v4/index.d.ts | 4 ++-- types/node/v6/index.d.ts | 4 ++-- types/node/v7/index.d.ts | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index acf69fefd9..1946277010 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -2833,13 +2833,13 @@ declare module "fs" { */ export function readFileSync(filename: string, options?: { flag?: string; }): Buffer; export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; - export function writeFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, encoding: string, callback: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFileSync(filename: string, data: any, encoding: string): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; - export function appendFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFile(filename: string, data: any, encoding: string, callback: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; diff --git a/types/node/v4/index.d.ts b/types/node/v4/index.d.ts index 14e0a58d1a..a79f49e35d 100644 --- a/types/node/v4/index.d.ts +++ b/types/node/v4/index.d.ts @@ -1773,13 +1773,13 @@ declare module "fs" { */ export function readFileSync(filename: string, options?: { flag?: string; }): Buffer; export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; - export function writeFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, encoding: string, callback: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFileSync(filename: string, data: any, encoding: string): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; - export function appendFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFile(filename: string, data: any, encoding: string, callback: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; diff --git a/types/node/v6/index.d.ts b/types/node/v6/index.d.ts index f1e7cc8fdb..b71a70e537 100644 --- a/types/node/v6/index.d.ts +++ b/types/node/v6/index.d.ts @@ -2562,13 +2562,13 @@ declare module "fs" { */ export function readFileSync(filename: string, options?: { flag?: string; }): Buffer; export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; - export function writeFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, encoding: string, callback: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFileSync(filename: string, data: any, encoding: string): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; - export function appendFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFile(filename: string, data: any, encoding: string, callback: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; diff --git a/types/node/v7/index.d.ts b/types/node/v7/index.d.ts index 34a05d33f3..f075587a95 100644 --- a/types/node/v7/index.d.ts +++ b/types/node/v7/index.d.ts @@ -2691,13 +2691,13 @@ declare module "fs" { */ export function readFileSync(filename: string, options?: { flag?: string; }): Buffer; export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; - export function writeFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, encoding: string, callback: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFileSync(filename: string, data: any, encoding: string): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; - export function appendFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFile(filename: string, data: any, encoding: string, callback: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; From 9bda5e1be0e15f988ccd28ded41212a23f78f9b2 Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Wed, 28 Jun 2017 16:09:12 +0200 Subject: [PATCH 176/180] add 'enzyme-to-json' --- types/enzyme-to-json/enzyme-to-json-tests.tsx | 6 +++++ types/enzyme-to-json/index.d.ts | 9 +++++++ types/enzyme-to-json/tsconfig.json | 24 +++++++++++++++++++ types/enzyme-to-json/tslint.json | 1 + 4 files changed, 40 insertions(+) create mode 100644 types/enzyme-to-json/enzyme-to-json-tests.tsx create mode 100644 types/enzyme-to-json/index.d.ts create mode 100644 types/enzyme-to-json/tsconfig.json create mode 100644 types/enzyme-to-json/tslint.json diff --git a/types/enzyme-to-json/enzyme-to-json-tests.tsx b/types/enzyme-to-json/enzyme-to-json-tests.tsx new file mode 100644 index 0000000000..13827a3cdb --- /dev/null +++ b/types/enzyme-to-json/enzyme-to-json-tests.tsx @@ -0,0 +1,6 @@ +import * as React from 'react'; +import { shallow } from 'enzyme'; +import toJson from 'enzyme-to-json'; + +const wrapper = shallow(Hello World!); +const result: object = toJson(wrapper); diff --git a/types/enzyme-to-json/index.d.ts b/types/enzyme-to-json/index.d.ts new file mode 100644 index 0000000000..cba4561649 --- /dev/null +++ b/types/enzyme-to-json/index.d.ts @@ -0,0 +1,9 @@ +// Type definitions for enzyme-to-json 1.5 +// Project: https://github.com/adriantoine/enzyme-to-json#readme +// Definitions by: Joscha Feth +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { ReactWrapper, ShallowWrapper } from 'enzyme'; + +export default function toJson(wrapper: ShallowWrapper | ReactWrapper | Cheerio): object; diff --git a/types/enzyme-to-json/tsconfig.json b/types/enzyme-to-json/tsconfig.json new file mode 100644 index 0000000000..257f8797e0 --- /dev/null +++ b/types/enzyme-to-json/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "dom", + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "enzyme-to-json-tests.tsx" + ] +} diff --git a/types/enzyme-to-json/tslint.json b/types/enzyme-to-json/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/enzyme-to-json/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 4a877d3484136ae8fa35b1a53bf192fccb5b45f0 Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Mon, 26 Jun 2017 11:17:38 -0400 Subject: [PATCH 177/180] [sizzle] Add type definitions. --- types/sizzle/index.d.ts | 63 ++++++++++++++++++++++++++++++++++++ types/sizzle/sizzle-tests.ts | 54 +++++++++++++++++++++++++++++++ types/sizzle/tsconfig.json | 23 +++++++++++++ types/sizzle/tslint.json | 6 ++++ 4 files changed, 146 insertions(+) create mode 100644 types/sizzle/index.d.ts create mode 100644 types/sizzle/sizzle-tests.ts create mode 100644 types/sizzle/tsconfig.json create mode 100644 types/sizzle/tslint.json diff --git a/types/sizzle/index.d.ts b/types/sizzle/index.d.ts new file mode 100644 index 0000000000..bfe24791bf --- /dev/null +++ b/types/sizzle/index.d.ts @@ -0,0 +1,63 @@ +// Type definitions for sizzle 2.3 +// Project: https://sizzlejs.com +// Definitions by: Leonard Thieu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export as namespace Sizzle; + +declare const Sizzle: SizzleStatic; +export = Sizzle; + +interface SizzleStatic { + selectors: Sizzle.Selectors; + >(selector: string, context: Element | Document | DocumentFragment, results: TArrayLike): TArrayLike; + (selector: string, context?: Element | Document | DocumentFragment): Element[]; + // tslint:disable-next-line:ban-types + compile(selector: string): Function; + matchSelector(element: Element, selector: string): boolean; + matches(selector: string, elements: Element[]): Element[]; +} + +declare namespace Sizzle { + interface Selectors { + cacheLength: number; + match: { [name: string]: RegExp; }; + find: { [name: string]: Selectors.FindFunction; }; + preFilter: { [name: string]: Selectors.PreFilterFunction; }; + filter: { [name: string]: Selectors.FilterFunction; }; + attrHandle: { [name: string]: Selectors.AttrHandleFunction; }; + pseudos: { [name: string]: Selectors.PseudoFunction; }; + setFilters: { [name: string]: Selectors.SetFilterFunction; }; + createPseudo(fn: Selectors.CreatePseudoFunction): Selectors.PseudoFunction; + } + + namespace Selectors { + interface FindFunction { + (match: RegExpMatchArray, context: Element | Document, isXML: boolean): Element[] | void; + } + + interface PreFilterFunction { + (match: RegExpMatchArray): string[]; + } + + interface FilterFunction { + (element: string, ...matches: string[]): boolean; + } + + interface AttrHandleFunction { + (elem: any, casePreservedName: string, isXML: boolean): string; + } + + interface PseudoFunction { + (elem: Element): boolean; + } + + interface CreatePseudoFunction { + (...args: any[]): PseudoFunction; + } + + interface SetFilterFunction { + (elements: Element[], argument: number, not: boolean): Element[]; + } + } +} diff --git a/types/sizzle/sizzle-tests.ts b/types/sizzle/sizzle-tests.ts new file mode 100644 index 0000000000..3c6d17dc64 --- /dev/null +++ b/types/sizzle/sizzle-tests.ts @@ -0,0 +1,54 @@ +/// + +function pseudos() { + const $test = jQuery(document); + Sizzle.selectors.pseudos['fixed'] = (elem) => { + // $test[0] = elem as HTMLElement; + return $test.css('position') === 'fixed'; + }; +} + +function createPseudos_0() { + Sizzle.selectors.pseudos['not'] = + Sizzle.selectors.createPseudo((subSelector) => { + const matcher = Sizzle.compile(subSelector); + return (elem) => { + return !matcher(elem); + }; + }); +} + +function createPseudos_1() { + // An implementation of a case-insensitive contains pseudo + // made for all versions of jQuery + (($) => { + function icontains(elem: HTMLElement, text: string) { + return ( + elem.textContent || + elem.innerText || + $(elem).text() || + '' + ).toLowerCase().indexOf((text || '').toLowerCase()) > -1; + } + + // $.expr.pseudos.icontains = $.expr.createPseudo(function(text) { + // return function(elem) { + // return icontains(elem as HTMLElement, text); + // }; + // }); + })(jQuery); +} + +function setFilters_0() { + Sizzle.selectors.setFilters['first'] = (elements, argument, not) => { + // No argument for first + return not ? elements.slice(1) : [elements[0]]; + }; +} + +function setFilters_1(oldPOS: RegExp) { + Sizzle.selectors.match['POS'] = new RegExp(oldPOS.source.replace('first', 'uno'), 'gi'); + Sizzle.selectors.setFilters['uno'] = Sizzle.selectors.setFilters['first']; + delete Sizzle.selectors.setFilters['first']; + Sizzle('div:uno'); // ==> [

] +} diff --git a/types/sizzle/tsconfig.json b/types/sizzle/tsconfig.json new file mode 100644 index 0000000000..aa10d374d5 --- /dev/null +++ b/types/sizzle/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "sizzle-tests.ts" + ] +} diff --git a/types/sizzle/tslint.json b/types/sizzle/tslint.json new file mode 100644 index 0000000000..a4bcc87748 --- /dev/null +++ b/types/sizzle/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "callable-types": false + } +} From 0d99852dfab367b2f4a3bbd639bbb627b7b0c29c Mon Sep 17 00:00:00 2001 From: cjackson234 Date: Wed, 28 Jun 2017 11:58:06 -0400 Subject: [PATCH 178/180] Update index.d.ts --- types/datatables.net/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/datatables.net/index.d.ts b/types/datatables.net/index.d.ts index 37c57198c9..68e26ee048 100644 --- a/types/datatables.net/index.d.ts +++ b/types/datatables.net/index.d.ts @@ -7,7 +7,7 @@ // missing: // - Static methods that are defined in JQueryStatic.fn are not typed. // - Plugin and extension definitions are not typed. -// - Some return types are not fully wokring +// - Some return types are not fully working /// From eff196f9ae7a329e515c911136b4dcbd0c19b383 Mon Sep 17 00:00:00 2001 From: Damien Rajon Date: Wed, 28 Jun 2017 18:27:30 +0200 Subject: [PATCH 179/180] Function is not a default export --- types/async.nexttick/async.nexttick-tests.ts | 2 +- types/async.nexttick/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/async.nexttick/async.nexttick-tests.ts b/types/async.nexttick/async.nexttick-tests.ts index 9d8acb33aa..90f6ae7f15 100644 --- a/types/async.nexttick/async.nexttick-tests.ts +++ b/types/async.nexttick/async.nexttick-tests.ts @@ -1,4 +1,4 @@ -import nextTick from 'async.nexttick'; +import {nextTick} from 'async.nexttick'; function calledOnNextTick(a: string): number { return parseInt(a, 10); diff --git a/types/async.nexttick/index.d.ts b/types/async.nexttick/index.d.ts index 22efd68fc7..a8572cc087 100644 --- a/types/async.nexttick/index.d.ts +++ b/types/async.nexttick/index.d.ts @@ -3,4 +3,4 @@ // Definitions by: Damien "pyrho" Rajon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export default function nextTick(callback: () => void, ...args: any[]): void; +export function nextTick(callback: () => void, ...args: any[]): void; From c0ec19e2d0fe3060b7dd490f74115a4e39840ba2 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Wed, 28 Jun 2017 09:50:28 -0700 Subject: [PATCH 180/180] Fix underscore tests for TS 2.4 A test in underscore mistakenly used the truthiness of _.identity as a predicate for _.every, even though the predicate is supposed to return boolean. The new code wraps _.identity in an arrow and prefixes a `!!` to coerce truthy values to true. --- types/underscore/underscore-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/underscore/underscore-tests.ts b/types/underscore/underscore-tests.ts index 11dcf477a0..f72bb3ca68 100644 --- a/types/underscore/underscore-tests.ts +++ b/types/underscore/underscore-tests.ts @@ -156,7 +156,7 @@ _.where(listOfPlays, { author: "Shakespeare", year: 1611 }); var odds = _.reject([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0); -_.every([true, 1, null, 'yes'], _.identity); +_.every([true, 1, null, 'yes'], x => !!_.identity(x)); _.any([null, 0, 'yes', false]);