diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 5aa6807605..bb028f3425 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -986,7 +986,8 @@ declare namespace angular { // see http://docs.angularjs.org/api/ng.$document /////////////////////////////////////////////////////////////////////////// interface IDocumentService extends JQuery { - [index: number]: Document; + // Must return intersection type for index signature compatibility with JQuery + [index: number]: HTMLElement & Document; } /////////////////////////////////////////////////////////////////////////// diff --git a/boom/boom.d.ts b/boom/boom.d.ts index 85c2e22b35..7495e3ae68 100644 --- a/boom/boom.d.ts +++ b/boom/boom.d.ts @@ -44,14 +44,17 @@ declare namespace Boom { export function rangeNotSatisfiable(message?: string, data?: any): BoomError; export function expectationFailed(message?: string, data?: any): BoomError; export function badData(message?: string, data?: any): BoomError; + export function locked(message?: string, data?: any): BoomError; + export function preconditionRequired(message?: string, data?: any): BoomError; export function tooManyRequests(message?: string, data?: any): BoomError; + export function illegal(message?: string, data?: any): BoomError; // 5xx + export function badImplementation(message?: string, data?: any): BoomError; export function notImplemented(message?: string, data?: any): BoomError; export function badGateway(message?: string, data?: any): BoomError; - export function serverTimeout(message?: string, data?: any): BoomError; + export function serverUnavailable(message?: string, data?: any): BoomError; export function gatewayTimeout(message?: string, data?: any): BoomError; - export function badImplementation(message?: string, data?: any): BoomError; } declare module "boom" { diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index d508eba8a9..7391de7824 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jQueryUI 1.9 +// Type definitions for jQueryUI 1.11 // Project: http://jqueryui.com/ // Definitions by: Boris Yankov , John Reilly // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -625,9 +625,9 @@ declare namespace JQueryUI { interface Selectable extends Widget, SelectableOptions { } - + // SelectMenu ////////////////////////////////////////////////// - + interface SelectMenuOptions extends SelectMenuEvents { appendTo?: string; disabled?: boolean; @@ -1705,7 +1705,7 @@ interface JQuery { selectable(optionLiteral: string, optionName: string): any; selectable(optionLiteral: string, options: JQueryUI.SelectableOptions): any; selectable(optionLiteral: string, optionName: string, optionValue: any): JQuery; - + selectmenu(): JQuery; selectmenu(methodName: 'close'): JQuery; selectmenu(methodName: 'destroy'): JQuery; diff --git a/jstree/jstree-tests.ts b/jstree/jstree-tests.ts index 1c8ef86c48..a6ea0eb290 100644 --- a/jstree/jstree-tests.ts +++ b/jstree/jstree-tests.ts @@ -109,3 +109,8 @@ var tree = $('a').jstree(); tree.move_node('a', 'b', 0, (node: any, new_par: any, pos: any) => { }, true, true); tree.copy_node('a', 'b', 0, (node: any, new_par: any, pos: any) => { }, true, true); +// #10271 jstree - get_path params not marked to be optional +tree.get_path('nodeId'); +tree.get_path('nodeId', '/'); +tree.get_path('nodeId', '/', true); + diff --git a/jstree/jstree.d.ts b/jstree/jstree.d.ts index f3961f7e3e..dde9a24b67 100644 --- a/jstree/jstree.d.ts +++ b/jstree/jstree.d.ts @@ -830,7 +830,7 @@ interface JSTree extends JQuery { * @param {Boolean} ids if set to true build the path using ID, otherwise node text is used * @return {mixed} */ - get_path: (obj: any, glue: string, ids: boolean) => any; + get_path: (obj: any, glue?: string, ids?: boolean) => any; /** * get the next visible node that is below the `obj` node. If `strict` is set to `true` only sibling nodes are returned. diff --git a/linq/linq.3.0.4-Beta5.d.ts b/linq/linq.3.0.4-Beta5.d.ts index a6c32690ce..b6ae876eee 100644 --- a/linq/linq.3.0.4-Beta5.d.ts +++ b/linq/linq.3.0.4-Beta5.d.ts @@ -157,7 +157,7 @@ declare module linqjs { groupBy(keySelector: (element: T) => TKey): IEnumerable>; groupBy(keySelector: (element: T) => TKey, elementSelector: (element: T) => TElement): IEnumerable>; groupBy(keySelector: (element: T) => TKey, elementSelector: (element: T) => TElement, resultSelector: (key: TKey, element: IEnumerable) => TResult): IEnumerable; - groupBy(keySelector: (element: T) => TKey, elementSelector: (element: T) => TElement, resultSelector: (key: TKey, element: IEnumerable) => TResult, compareSelector: (element: T) => TCompare): IEnumerable; + groupBy(keySelector: (element: T) => TKey, elementSelector: (element: T) => TElement, resultSelector: (key: TKey, element: IEnumerable) => TResult, compareSelector: (element: TKey) => TCompare): IEnumerable; // :IEnumerable> partitionBy(keySelector: (element: T) => TKey): IEnumerable>; // :IEnumerable> diff --git a/parse/parse.d.ts b/parse/parse.d.ts index 825eedf386..6cf51a98b4 100644 --- a/parse/parse.d.ts +++ b/parse/parse.d.ts @@ -1087,10 +1087,10 @@ declare namespace Parse { } declare module "parse/node" { - export = { Parse }; + export = Parse; } declare module "parse" { - import parse = require("parse/node"); + import * as parse from "parse/node"; export = parse } diff --git a/react-native/react-native.d.ts b/react-native/react-native.d.ts index 0ffc6763a7..0c8e96599e 100644 --- a/react-native/react-native.d.ts +++ b/react-native/react-native.d.ts @@ -24,102 +24,6 @@ import React = __React; //react-native "extends" react declare namespace __React { - /** - * Represents the completion of an asynchronous operation - * @see lib.es6.d.ts - */ - export interface Promise { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then( onfulfilled?: ( value: T ) => TResult | Promise, onrejected?: ( reason: any ) => TResult | Promise ): Promise; - - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch( onrejected?: ( reason: any ) => T | Promise ): Promise; - - - // not in lib.es6.d.ts but called by react-native - done( callback?: ( value: T ) => void ): void; - } - - export interface PromiseConstructor { - /** - * A reference to the prototype. - */ - prototype: Promise; - - /** - * Creates a new Promise. - * @param init A callback used to initialize the promise. This callback is passed two arguments: - * a resolve callback used resolve the promise with a value or the result of another promise, - * and a reject callback used to reject the promise with a provided reason or error. - */ - new ( init: ( resolve: ( value?: T | Promise ) => void, reject: ( reason?: any ) => void ) => void ): Promise; - - ( init: ( resolve: ( value?: T | Promise ) => void, reject: ( reason?: any ) => void ) => void ): Promise; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - all( values: (T | Promise)[] ): Promise; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of values. - * @returns A new Promise. - */ - all( values: Promise[] ): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race( values: (T | Promise)[] ): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject( reason: any ): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject( reason: any ): Promise; - - /** - * Creates a new resolved promise for the provided value. - * @param value A promise. - * @returns A promise whose internal state matches the provided promise. - */ - resolve( value: T | Promise ): Promise; - - /** - * Creates a new resolved promise . - * @returns A resolved promise. - */ - resolve(): Promise; - } - - // @see lib.es6.d.ts - export var Promise: PromiseConstructor; - module NativeMethodsMixin { type MeasureOnSuccessCallback = ( x: number, @@ -918,7 +822,7 @@ declare namespace __React { showWithText?: boolean } - export interface ToolbarAndroidProperties extends React.Props { + export interface ToolbarAndroidProperties extends ViewProperties, React.Props { actions?: ToolbarAndroidAction[] /** @@ -1000,6 +904,8 @@ declare namespace __React { * Sets the toolbar title color. */ titleColor?: string + + ref?: Ref } export interface ToolbarAndroidStatic extends React.ComponentClass { @@ -1479,7 +1385,7 @@ declare namespace __React { /** * @see https://facebook.github.io/react-native/docs/webview.html#props */ - export interface WebViewProperties extends WebViewPropertiesAndroid, WebViewPropertiesIOS, React.Props { + export interface WebViewProperties extends ViewProperties, WebViewPropertiesAndroid, WebViewPropertiesIOS, React.Props { automaticallyAdjustContentInsets?: boolean @@ -1553,6 +1459,8 @@ declare namespace __React { * sets whether the webpage scales to fit the view and the user can change the scale */ scalesPageToFit?: boolean + + ref?: Ref } @@ -1590,7 +1498,7 @@ declare namespace __React { target: number } - export interface SegmentedControlIOSProperties extends React.Props { + export interface SegmentedControlIOSProperties extends ViewProperties, React.Props { /** * If false the user won't be able to interact with the control. Default value is true. @@ -1630,6 +1538,8 @@ declare namespace __React { * The labels for the control's segment buttons, in order. */ values?: string[] + + ref?: Ref } export interface SegmentedControlIOSStatic extends React.ComponentClass { @@ -1744,7 +1654,7 @@ declare namespace __React { /** * @see https://facebook.github.io/react-native/docs/activityindicator.html#props */ - export interface ActivityIndicatorProperties extends React.Props { + export interface ActivityIndicatorProperties extends ViewProperties, React.Props { /** * Whether to show the indicator (true, the default) or hide it (false). @@ -1770,6 +1680,8 @@ declare namespace __React { size?: 'small' | 'large' style?: ViewStyle + + ref?: Ref } export interface ActivityIndicatorStatic extends React.ComponentClass { @@ -1779,7 +1691,7 @@ declare namespace __React { /** * @see https://facebook.github.io/react-native/docs/activityindicatorios.html#props */ - export interface ActivityIndicatorIOSProperties extends React.Props { + export interface ActivityIndicatorIOSProperties extends ViewProperties, React.Props { /** * Whether to show the indicator (true, the default) or hide it (false). @@ -1810,6 +1722,8 @@ declare namespace __React { size?: 'small' | 'large' style?: ViewStyle + + ref?: Ref } /** @@ -1819,7 +1733,7 @@ declare namespace __React { } - export interface DatePickerIOSProperties extends React.Props { + export interface DatePickerIOSProperties extends ViewProperties, React.Props { /** * The currently selected date. @@ -1865,6 +1779,7 @@ declare namespace __React { */ timeZoneOffsetInMinutes?: number + ref?: Ref } export interface DatePickerIOSStatic extends React.ComponentClass { @@ -1876,7 +1791,7 @@ declare namespace __React { /** * @see DrawerLayoutAndroid.android.js */ - export interface DrawerLayoutAndroidProperties extends React.Props { + export interface DrawerLayoutAndroidProperties extends ViewProperties, React.Props { /** * Specifies the background color of the drawer. The default value @@ -1967,6 +1882,7 @@ declare namespace __React { */ statusBarBackgroundColor?: any + ref?: Ref } export interface DrawerLayoutAndroidStatic extends React.ComponentClass { @@ -2010,18 +1926,22 @@ declare namespace __React { export interface PickerItemStatic extends React.ComponentClass { } - export interface PickerPropertiesIOS extends React.Props { + export interface PickerPropertiesIOS extends ViewProperties, React.Props { itemStyle?: ViewStyle + + ref?: Ref } - export interface PickerPropertiesAndroid extends React.Props { + export interface PickerPropertiesAndroid extends ViewProperties, React.Props { enabled?: boolean mode?: "dialog" | "dropdown" prompt?: string + + ref?: Ref } /** @@ -2052,6 +1972,8 @@ declare namespace __React { * Used to locate this view in end-to-end tests. */ testId?: string + + ref?: Ref } /** @@ -2086,7 +2008,7 @@ declare namespace __React { * @see https://facebook.github.io/react-native/docs/progressbarandroid.html * @see ProgressBarAndroid.android.js */ - export interface ProgressBarAndroidProperties extends React.Props { + export interface ProgressBarAndroidProperties extends ViewProperties, React.Props { style?: ViewStyle @@ -2122,6 +2044,8 @@ declare namespace __React { * Used to locate this view in end-to-end tests. */ testID?: string + + ref?: Ref } export interface ProgressBarAndroidStatic extends React.ComponentClass { } @@ -2130,7 +2054,7 @@ declare namespace __React { * @see https://facebook.github.io/react-native/docs/progressviewios.html * @see ProgressViewIOS.ios.js */ - export interface ProgressViewIOSProperties extends React.Props { + export interface ProgressViewIOSProperties extends ViewProperties, React.Props { style?: ViewStyle @@ -2163,11 +2087,13 @@ declare namespace __React { * A stretchable image to display behind the progress bar. */ trackImage?: any + + ref?: Ref } export interface ProgressViewIOSStatic extends React.ComponentClass { } - export interface RefreshControlPropertiesIOS extends React.Props { + export interface RefreshControlPropertiesIOS extends ViewProperties, React.Props { /** * The color of the refresh indicator. @@ -2183,9 +2109,11 @@ declare namespace __React { * Title color. */ titleColor?: string + + ref?: Ref } - export interface RefreshControlPropertiesAndroid extends React.Props { + export interface RefreshControlPropertiesAndroid extends ViewProperties, React.Props { /** * The colors (at least one) that will be used to draw the refresh indicator. @@ -2212,6 +2140,8 @@ declare namespace __React { * @platform android */ progressViewOffset?: number + + ref?: Ref } export interface RefreshControlProperties extends RefreshControlPropertiesIOS, RefreshControlPropertiesAndroid, React.Props { @@ -2225,13 +2155,15 @@ declare namespace __React { * Whether the view should be indicating an active refresh. */ refreshing?: boolean + + ref?: Ref } export interface RefreshControlStatic extends React.ComponentClass { SIZE: Object // Undocumented } - export interface SliderPropertiesIOS extends React.Props { + export interface SliderPropertiesIOS extends ViewProperties, React.Props { /** * Assigns a maximum track image. Only static images are supported. @@ -2268,6 +2200,8 @@ declare namespace __React { * to fill the track. */ trackImage?: any + + ref?: Ref } export interface SliderProperties extends SliderPropertiesIOS, React.Props { @@ -2333,7 +2267,7 @@ declare namespace __React { /** * @see https://facebook.github.io/react-native/docs/sliderios.html */ - export interface SliderIOSProperties extends React.Props { + export interface SliderIOSProperties extends ViewProperties, React.Props { /** * If true the user won't be able to move the slider. Default value is false. @@ -2393,6 +2327,8 @@ declare namespace __React { * This is not a controlled component, e.g. if you don't update the value, the component won't be reset to its inital value. */ value?: number + + ref?: Ref } export interface SliderIOSStatic extends React.ComponentClass { @@ -2721,6 +2657,8 @@ declare namespace __React { * pixels. */ scrollRenderAheadDistance?: number + + ref?: Ref } export interface ListViewStatic extends React.ComponentClass { @@ -2815,7 +2753,7 @@ declare namespace __React { active?: boolean } - export interface MapViewProperties extends MapViewPropertiesIOS, MapViewPropertiesAndroid, Touchable, React.Props { + export interface MapViewProperties extends MapViewPropertiesIOS, MapViewPropertiesAndroid, Touchable, ViewProperties, React.Props { @@ -2884,6 +2822,8 @@ declare namespace __React { * Default value is true. */ zoomEnabled?: boolean + + ref?: Ref } /** @@ -3502,7 +3442,7 @@ declare namespace __React { /** * @see https://facebook.github.io/react-native/docs/tabbarios-item.html#props */ - export interface TabBarItemProperties extends React.Props { + export interface TabBarItemProperties extends ViewProperties, React.Props { /** * Little red bubble that sits at the top right of the icon. @@ -3549,6 +3489,7 @@ declare namespace __React { */ title?: string + ref?: Ref } export interface TabBarItemStatic extends React.ComponentClass { @@ -3557,7 +3498,7 @@ declare namespace __React { /** * @see https://facebook.github.io/react-native/docs/tabbarios.html#props */ - export interface TabBarIOSProperties extends React.Props { + export interface TabBarIOSProperties extends ViewProperties, React.Props { /** * Background color of the tab bar @@ -3580,6 +3521,8 @@ declare namespace __React { * Color of text on unselected tabs */ unselectedTintColor?: string + + ref?: Ref } export interface TabBarIOSStatic extends React.ComponentClass { @@ -3959,7 +3902,7 @@ declare namespace __React { } - export interface ScrollViewProperties extends ScrollViewPropertiesIOS, ScrollViewPropertiesAndroid, Touchable { + export interface ScrollViewProperties extends ViewProperties, ScrollViewPropertiesIOS, ScrollViewPropertiesAndroid, Touchable, React.Props { /** * These styles will be applied to the scroll view content container which @@ -4043,10 +3986,12 @@ declare namespace __React { * functionality for the ScrollView. */ refreshControl?: RefreshControl + + ref?: Ref } export interface ScrollViewProps extends ScrollViewProperties, React.Props { - + ref?: Ref } interface ScrollViewStatic extends React.ComponentClass { @@ -5084,7 +5029,7 @@ declare namespace __React { LONG: number } - export interface SwitchPropertiesIOS extends React.Props { + export interface SwitchPropertiesIOS extends ViewProperties, React.Props { /** * Background color when the switch is turned on. @@ -5100,9 +5045,11 @@ declare namespace __React { * Background color when the switch is turned off. */ tintColor?: string + + ref?: Ref } - export interface SwitchProperties extends React.Props { + export interface SwitchProperties extends ViewProperties, React.Props { /** * If true the user won't be able to toggle the switch. @@ -5126,7 +5073,9 @@ declare namespace __React { */ value?: boolean - style?: ViewStyle + style?: ViewStyle + + ref?: Ref } export interface SwitchStatic extends React.ComponentClass { diff --git a/restify/restify-tests.ts b/restify/restify-tests.ts index 767530d7aa..f9b0acfae1 100644 --- a/restify/restify-tests.ts +++ b/restify/restify-tests.ts @@ -312,6 +312,7 @@ client = restify.createStringClient({ client.head('test', function(err: any, req: restify.Request, res: restify.Response) { }); client.put('path', {}, function(err: any, req: restify.Request, res: restify.Response, obj: any) { }); +client.patch('path', {}, function(err: any, req: restify.Request, res: restify.Response, obj: any) { }); client.del('path', function(err: any, req: restify.Request, res: restify.Response) { }); client.post('/foo', { hello: 'world' }, function(err: any, req: restify.Request, res: restify.Response, obj: any) { diff --git a/restify/restify.d.ts b/restify/restify.d.ts index 2da1c6e0bd..fdb64f5e34 100644 --- a/restify/restify.d.ts +++ b/restify/restify.d.ts @@ -473,6 +473,7 @@ declare module "restify" { head: (path: string, callback?: (err: any, req: Request, res: Response) => any) => any; post: (path: string, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any; put: (path: string, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any; + patch: (path: string, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any; del: (path: string, callback?: (err: any, req: Request, res: Response) => any) => any; basicAuth: (username: string, password: string) => any; } @@ -482,6 +483,7 @@ declare module "restify" { head: (path?:any, callback?: Function) => any; post: (opts?: any, callback?: Function) => any; put: (opts?: any, callback?: Function) => any; + patch: (opts?: any, callback?: Function) => any; del: (opts?: any, callback?: Function) => any; } diff --git a/webpack/webpack.d.ts b/webpack/webpack.d.ts index e2ed2d1658..96a7c710df 100644 --- a/webpack/webpack.d.ts +++ b/webpack/webpack.d.ts @@ -102,7 +102,7 @@ declare module "webpack" { /** Include comments with information about the modules. */ pathinfo?: boolean; /** If set, export the bundle as library. output.library is the name. */ - library?: boolean; + library?: string; /** * Which format to export the library: *
    diff --git a/ws/ws-tests.ts b/ws/ws-tests.ts index ec2bc431e0..a8afa8cb99 100644 --- a/ws/ws-tests.ts +++ b/ws/ws-tests.ts @@ -1,6 +1,8 @@ /// -import WebSocket = require('ws'); +import * as WebSocket from 'ws'; +import * as http from'http'; + var WebSocketServer = WebSocket.Server; { @@ -29,7 +31,7 @@ var WebSocketServer = WebSocket.Server; { var wss = new WebSocketServer({port: 8080}); - function broadcast(data: any) { + const broadcast = function(data: any) { for(var i in wss.clients) wss.clients[i].send(data); }; @@ -51,3 +53,24 @@ var WebSocketServer = WebSocket.Server; }, 500); }); } + +{ + const verifyClient = function( + info: { + origin: string + secure: boolean + req: http.ServerRequest + } + , callback: (res: boolean) => void + ): void { + callback(true) + } + + var wsv = new WebSocketServer({ + verifyClient + }) + + wsv.on('connection', function connection(ws) { + console.log(ws.protocol) + }) +} \ No newline at end of file diff --git a/ws/ws.d.ts b/ws/ws.d.ts index d9a1338d21..6b94bee19d 100644 --- a/ws/ws.d.ts +++ b/ws/ws.d.ts @@ -22,6 +22,7 @@ declare module "ws" { url: string; supports: any; upgradeReq: http.ServerRequest; + protocol: string; CONNECTING: number; OPEN: number; @@ -87,15 +88,16 @@ declare module "ws" { } namespace WebSocket { + + type VerifyClientCallbackSync = (info: {origin: string; secure: boolean; req: http.ServerRequest}) => boolean; + type VerifyClientCallbackAsync = (info: {origin: string; secure: boolean; req: http.ServerRequest} + , callback: (res: boolean) => void) => void; + export interface IServerOptions { host?: string; port?: number; server?: http.Server; - verifyClient?: { - (info: {origin: string; secure: boolean; req: http.ServerRequest}): boolean; - (info: {origin: string; secure: boolean; req: http.ServerRequest}, - callback: (res: boolean) => void): void; - }; + verifyClient?: VerifyClientCallbackAsync | VerifyClientCallbackSync; handleProtocols?: any; path?: string; noServer?: boolean;