diff --git a/ace/ace.d.ts b/ace/ace.d.ts index f0668da3c4..bedcfee545 100644 --- a/ace/ace.d.ts +++ b/ace/ace.d.ts @@ -18,7 +18,9 @@ declare module AceAjax { bindKey:any; - exec:Function; + exec: Function; + + readOnly?: boolean; } export interface CommandManager { diff --git a/blocks/blocks.d.ts b/blocks/blocks.d.ts index ad492333e6..6e57ec762b 100644 --- a/blocks/blocks.d.ts +++ b/blocks/blocks.d.ts @@ -579,6 +579,8 @@ interface ViewPrototype { route?: any; url?: string }; + + [propertyName: string]: any; } ///////////////////////////////////////// @@ -643,6 +645,8 @@ interface ModelPrototype { destroy?: { url?: string }; update?: { url?: string }; }; + + [propertyName: string]: string | boolean | Object | Validator; } ///////////////////////////////////////// @@ -682,6 +686,7 @@ interface CollectionPrototype { destroy?: { url?: string }; update?: { url?: string }; }; + [propertyName: string]: any; } interface Extendable { diff --git a/breeze/breeze.d.ts b/breeze/breeze.d.ts index 4821ed427e..139a306299 100644 --- a/breeze/breeze.d.ts +++ b/breeze/breeze.d.ts @@ -459,6 +459,7 @@ declare module breeze { interface EntityManagerProperties { serviceName?: string; dataService?: DataService; + metadataStore?: MetadataStore; queryOptions?: QueryOptions; saveOptions?: SaveOptions; validationOptions?: ValidationOptions; diff --git a/cordova/plugins/Globalization.d.ts b/cordova/plugins/Globalization.d.ts index bb9cd2f4ab..f49e2bf4b0 100644 --- a/cordova/plugins/Globalization.d.ts +++ b/cordova/plugins/Globalization.d.ts @@ -41,12 +41,17 @@ interface Globalization { * @param onError Called on error with a GlobalizationError object. * The error's expected code is GlobalizationError.FORMATTING_ERROR. * @param options Optional format parameters. Default {formatLength:'short', selector:'date and time'} + * - 'formatLength' can be "short", "medium", "long", or "full". + * - 'selector' can be "date", "time", or "date and time". */ dateToString( date: Date, onSuccess: (date: { value: string; }) => void, onError: (error: GlobalizationError) => void, - options?: { type?: string; item?: string; }): void; + options?: { + formatLength?: string; // "short" | "medium" | "long" | "full" + selector?: string; // "date" | "time" | "date and time" + }): void; /** * Parses a date formatted as a string, according to the client's user preferences * and calendar using the time zone of the client, and returns the corresponding date object. diff --git a/johnny-five/johnny-five.d.ts b/johnny-five/johnny-five.d.ts index 9dd1477eb4..e2c2c1c30a 100644 --- a/johnny-five/johnny-five.d.ts +++ b/johnny-five/johnny-five.d.ts @@ -251,10 +251,12 @@ declare module "johnny-five" { export interface LCDI2COption extends LCDGeneralOption{ controller: string; + backlight?: number; } export interface LCDParallelOption extends LCDGeneralOption{ pins: Array; + backlight?: number; } export class LCD{ diff --git a/joi/joi.d.ts b/joi/joi.d.ts index b784ad23d5..8c97e12162 100644 --- a/joi/joi.d.ts +++ b/joi/joi.d.ts @@ -8,61 +8,105 @@ declare module 'joi' { export interface ValidationOptions { - // when true, stops validation on the first error, otherwise returns all the errors found. Defaults to true. + /** + * when true, stops validation on the first error, otherwise returns all the errors found. Defaults to true. + */ abortEarly?: boolean; - // when true, attempts to cast values to the required types (e.g. a string to a number). Defaults to true. + /** + * when true, attempts to cast values to the required types (e.g. a string to a number). Defaults to true. + */ convert?: boolean; - // when true, allows object to contain unknown keys which are ignored. Defaults to false. + /** + * when true, allows object to contain unknown keys which are ignored. Defaults to false. + */ allowUnknown?: boolean; - // when true, ignores unknown keys with a function value. Defaults to false. + /** + * when true, ignores unknown keys with a function value. Defaults to false. + */ skipFunctions?: boolean; - // when true, unknown keys are deleted (only when value is an object). Defaults to false. + /** + * when true, unknown keys are deleted (only when value is an object). Defaults to false. + */ stripUnknown?: boolean; - // overrides individual error messages. Defaults to no override ({}). + /** + * overrides individual error messages. Defaults to no override ({}). + */ language?: Object; - // sets the default presence requirements. Supported modes: 'optional', 'required', and 'forbidden'. Defaults to 'optional'. + /** + * sets the default presence requirements. Supported modes: 'optional', 'required', and 'forbidden'. Defaults to 'optional'. + */ presence?: string; - // provides an external data set to be used in references + /** + * provides an external data set to be used in references + */ context?: Object; } export interface RenameOptions { - // if true, does not delete the old key name, keeping both the new and old keys in place. Defaults to false. + /** + * if true, does not delete the old key name, keeping both the new and old keys in place. Defaults to false. + */ alias?: boolean; - // if true, allows renaming multiple keys to the same destination where the last rename wins. Defaults to false. + /** + * if true, allows renaming multiple keys to the same destination where the last rename wins. Defaults to false. + */ multiple?: boolean; - // if true, allows renaming a key over an existing key. Defaults to false. + /** + * if true, allows renaming a key over an existing key. Defaults to false. + */ override?: boolean; + /** + * if true, skip renaming of a key if it's undefined. Defaults to false. + */ + ignoreUndefined?: boolean; } export interface EmailOptions { - // Numerical threshold at which an email address is considered invalid + /** + * Numerical threshold at which an email address is considered invalid + */ errorLevel?: number | boolean; - // Specifies a list of acceptable TLDs. + /** + * Specifies a list of acceptable TLDs. + */ tldWhitelist?: string[] | Object; - // Number of atoms required for the domain. Be careful since some domains, such as io, directly allow email. + /** + * Number of atoms required for the domain. Be careful since some domains, such as io, directly allow email. + */ minDomainAtoms?: number; } export interface IpOptions { - // One or more IP address versions to validate against. Valid values: ipv4, ipv6, ipvfuture + /** + * One or more IP address versions to validate against. Valid values: ipv4, ipv6, ipvfuture + */ version ?: string | string[]; - // Used to determine if a CIDR is allowed or not. Valid values: optional, required, forbidden + /** + * Used to determine if a CIDR is allowed or not. Valid values: optional, required, forbidden + */ cidr?: string; } export interface UriOptions { - // Specifies one or more acceptable Schemes, should only include the scheme name. - // Can be an Array or String (strings are automatically escaped for use in a Regular Expression). + /** + * Specifies one or more acceptable Schemes, should only include the scheme name. + * Can be an Array or String (strings are automatically escaped for use in a Regular Expression). + */ scheme ?: string | RegExp | Array; } export interface WhenOptions { - // the required condition joi type. + /** + * the required condition joi type. + */ is: Schema; - // the alternative schema type if the condition is true. Required if otherwise is missing. + /** + * the alternative schema type if the condition is true. Required if otherwise is missing. + */ then?: Schema; - // the alternative schema type if the condition is false. Required if then is missing + /** + * the alternative schema type if the condition is false. Required if then is missing + */ otherwise?: Schema; } diff --git a/jquery.fancytree/jquery.fancytree.d.ts b/jquery.fancytree/jquery.fancytree.d.ts index 34a9f14224..32b8d2479e 100644 --- a/jquery.fancytree/jquery.fancytree.d.ts +++ b/jquery.fancytree/jquery.fancytree.d.ts @@ -217,30 +217,6 @@ declare module Fancytree { //#endregion //#region Methods - /** - * Append (or insert) a single child node. - * - * @param child node to add - * @param insertBefore child node to insert this node before. If omitted, the new child is appended. - * @returns The child added. - */ - addChildren(child: Fancytree.NodeData, insertBefore?: FancytreeNode): FancytreeNode; - /** - * Append (or insert) a single child node. - * - * @param child node to add - * @param insertBefore key of the child node to insert this node before. If omitted, the new child is appended. - * @returns The child added. - */ - addChildren(child: Fancytree.NodeData, insertBefore?: string): FancytreeNode; - /** - * Append (or insert) a single child node. - * - * @param child node to add - * @param insertBefore index of the child node to insert this node before. If omitted, the new child is appended. - * @returns The child added. - */ - addChildren(child: Fancytree.NodeData, insertBefore?: number): FancytreeNode; /** * Append (or insert) a list of child nodes. * @@ -265,6 +241,30 @@ declare module Fancytree { * @returns The first child added. */ addChildren(children: Fancytree.NodeData[], insertBefore?: number): FancytreeNode; + /** + * Append (or insert) a single child node. + * + * @param child node to add + * @param insertBefore child node to insert this node before. If omitted, the new child is appended. + * @returns The child added. + */ + addChildren(child: Fancytree.NodeData, insertBefore?: FancytreeNode): FancytreeNode; + /** + * Append (or insert) a single child node. + * + * @param child node to add + * @param insertBefore key of the child node to insert this node before. If omitted, the new child is appended. + * @returns The child added. + */ + addChildren(child: Fancytree.NodeData, insertBefore?: string): FancytreeNode; + /** + * Append (or insert) a single child node. + * + * @param child node to add + * @param insertBefore index of the child node to insert this node before. If omitted, the new child is appended. + * @returns The child added. + */ + addChildren(child: Fancytree.NodeData, insertBefore?: number): FancytreeNode; /** Append or prepend a node, or append a child node. This a convenience function that calls addChildren() @@ -780,6 +780,7 @@ declare module Fancytree { interface NodeData { /** node text (may contain HTML tags) */ title: string; + icon?: string; /** unique key for this node (auto-generated if omitted) */ key?: string; /** (reserved) */ diff --git a/jquery.gridster/gridster-tests.ts b/jquery.gridster/gridster-tests.ts index 72c90a6f08..3672c9555f 100644 --- a/jquery.gridster/gridster-tests.ts +++ b/jquery.gridster/gridster-tests.ts @@ -16,7 +16,7 @@ var options: GridsterOptions = { } }; -var gridster = $('.gridster ul').gridster(options).data('grister'); +var gridster: Gridster = $('.gridster ul').gridster(options).data('gridster'); gridster.add_widget('
  • The HTML of the widget...
  • ', 2, 1); gridster.remove_widget($('gridster li').eq(3).get(0)); var json = gridster.serialize(); diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 3599c808fa..ad9e934551 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -1545,18 +1545,18 @@ interface JQuery { * @param value The new data value; it can be any Javascript type including Array or Object. */ data(key: string, value: any): JQuery; - /** - * Store arbitrary data associated with the matched elements. - * - * @param obj An object of key-value pairs of data to update. - */ - data(obj: { [key: string]: any; }): JQuery; /** * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. * * @param key Name of the data stored. */ data(key: string): any; + /** + * Store arbitrary data associated with the matched elements. + * + * @param obj An object of key-value pairs of data to update. + */ + data(obj: { [key: string]: any; }): JQuery; /** * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. */ diff --git a/jquerymobile/jquerymobile.d.ts b/jquerymobile/jquerymobile.d.ts index f07c73fc34..393c3d9725 100644 --- a/jquerymobile/jquerymobile.d.ts +++ b/jquerymobile/jquerymobile.d.ts @@ -161,7 +161,7 @@ interface CheckboxRadioOptions { } interface CheckboxRadioEvents { - createp?: JQueryMobileEvent; + create?: JQueryMobileEvent; } interface SelectMenuOptions { @@ -184,7 +184,11 @@ interface SelectMenuEvents { } interface ListViewOptions { + autodividers?: boolean; + autodividersSelector?: (jq?: JQuery) => string; countTheme?: string; + defaults?: boolean; + disabled?: boolean; dividerTheme?: string; filter?: boolean; filterCallback?: Function; diff --git a/js-data/js-data.d.ts b/js-data/js-data.d.ts index bec41d331d..e17c4ae0d4 100644 --- a/js-data/js-data.d.ts +++ b/js-data/js-data.d.ts @@ -115,7 +115,17 @@ declare module JSData { } interface DSAdapterOperationConfiguration extends DSConfiguration { - adapter?: string + adapter?: string; + bypassCache?: boolean; + cacheResponse?: boolean; + findStrategy?: string; + findFallbackAdapters?: string[]; + strategy?: string; + fallbackAdapters?: string[]; + + params: { + [paramName: string]: string | number | boolean; + }; } interface DSSaveConfiguration extends DSAdapterOperationConfiguration { @@ -156,7 +166,8 @@ declare module JSData { digest():void; eject(id:string | number, options?:DSConfiguration):T; ejectAll(params:DSFilterParams, options?:DSConfiguration):Array; - filter(params:DSFilterParams, options?:DSConfiguration):Array; + filter(params: DSFilterParams, options?: DSConfiguration): Array; + filter(params: DSFilterParamsForAllowSimpleWhere, options?: DSConfiguration): Array; get(id:string | number, options?:DSConfiguration):T; getAll(ids?:Array):Array; hasChanges(id:string | number):boolean; @@ -184,6 +195,10 @@ declare module JSData { sort?: string | Array | Array>; } + interface DSFilterParamsForAllowSimpleWhere { + [key: string]: string | number; + } + interface IDSResourceLifecycleValidateEventHandlers { beforeValidate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void; validate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void; diff --git a/mathjax/mathjax.d.ts b/mathjax/mathjax.d.ts index 65c10e3ad4..f49a8435bc 100644 --- a/mathjax/mathjax.d.ts +++ b/mathjax/mathjax.d.ts @@ -549,7 +549,10 @@ declare module jax { * from “Show Source” and put it into a page that uses MathJax’s MathML input jax and expect to get the same * results as the original TeX. (Without this, there may be some spacing differences.) */ - texHints?:boolean; + texHints?: boolean; + + mpContext?: boolean; + mpMouse?: boolean; } export interface IErrorSettings { @@ -582,27 +585,27 @@ declare module jax { asciimath2jax?:IAsciimath2jaxPreprocessor; mml2jax?:IMML2jaxPreprocessor; tex2jax?:ITEX2jaxPreprocessor; - /*A comma-separated list of input and output jax to initialize at startup. Their main code is loaded only when + /*A list of input and output jax to initialize at startup. Their main code is loaded only when * they are actually used, so it is not inefficient to include jax that may not actually be used on the page. * These are found in the MathJax/jax directory. */ jax?:string[]; - /*A comma-separated list of extensions to load at startup. The default directory is MathJax/extensions. The + /*A list of extensions to load at startup. The default directory is MathJax/extensions. The * tex2jax and mml2jax preprocessors can be listed here, as well as a FontWarnings extension that you can use to * inform your user that mathematics fonts are available that they can download to improve their experience of * your site. */ extensions?:string[]; - /*A comma-separated list of configuration files to load when MathJax starts up, e.g., to define local macros, + /*A list of configuration files to load when MathJax starts up, e.g., to define local macros, * etc., and there is a sample config file named config/local/local.js. The default directory is the * MathJax/config directory. The MMLorHTML.js configuration is one such configuration file, and there are a * number of other pre-defined configurations (see Using a configuration file for more details). */ config?:string[]; - /*A comma-separated list of CSS stylesheet files to be loaded when MathJax starts up. The default directory is + /*A list of CSS stylesheet files to be loaded when MathJax starts up. The default directory is * the MathJax/config directory. */ - styleSheets?:string; + styleSheets?:string[]; /*CSS styles to be defined dynamically at startup time. These are in the form selector:rules (see CSS Style * Objects for complete details). */ @@ -1272,7 +1275,14 @@ declare module jax { * of a’s in MathJax’s equation buffer, the MAXBUFFER constant is used to limit the size of the string being * processed by MathJax. It is set to 5KB, which should be sufficient for any reasonable equation. */ - MAXBUFFER?:number; + MAXBUFFER?: number; + + /*A comma-separated list of extensions to load at startup. The default directory is MathJax/extensions. The + * tex2jax and mml2jax preprocessors can be listed here, as well as a FontWarnings extension that you can use to + * inform your user that mathematics fonts are available that they can download to improve their experience of + * your site. + */ + extensions?: string[]; } export interface IEquationNumbers { diff --git a/node-azure/azure.d.ts b/node-azure/azure.d.ts index 7e52a8be3a..c7818d0b63 100644 --- a/node-azure/azure.d.ts +++ b/node-azure/azure.d.ts @@ -1627,6 +1627,7 @@ declare module "azure" { RowKey: string; Timestamp?: Date; etag?: string; + [property: string]: string | number | boolean | Date; } //#endregion //#region BlobService Interfaces diff --git a/node-polyglot/node-polyglot.d.ts b/node-polyglot/node-polyglot.d.ts index 0f5bd89229..7c29b745c7 100644 --- a/node-polyglot/node-polyglot.d.ts +++ b/node-polyglot/node-polyglot.d.ts @@ -6,8 +6,10 @@ declare module "node-polyglot" { module Polyglot { interface InterpolationOptions { - smart_count?: number; + smart_count?: number | { length: number }; _?: string; + + [interpolationKey: string]: any; } interface PolyglotOptions { diff --git a/node_redis/node_redis.d.ts b/node_redis/node_redis.d.ts index 8505556fb3..4328e299b9 100644 --- a/node_redis/node_redis.d.ts +++ b/node_redis/node_redis.d.ts @@ -17,6 +17,11 @@ declare module 'redis' { socket_nodelay?: boolean; no_ready_check?: boolean; enable_offline_queue?: boolean; + retry_max_delay?: number; + connect_timeout?: boolean; + max_attempts?: number; + auth_pass?: string; + family?: string; // "IPv4" | "IPv6" } interface Command { diff --git a/nodemailer-smtp-transport/nodemailer-smtp-transport.d.ts b/nodemailer-smtp-transport/nodemailer-smtp-transport.d.ts index a12d66991b..3a4c626b0e 100644 --- a/nodemailer-smtp-transport/nodemailer-smtp-transport.d.ts +++ b/nodemailer-smtp-transport/nodemailer-smtp-transport.d.ts @@ -18,6 +18,40 @@ declare module "nodemailer-smtp-transport" { } export interface SmtpOptions { + /** + * Fills in certain SMTP configurations options (e.g. 'host', 'port', and 'secure') for + * well-known services. Possible values: + * - '1und1' + * - 'AOL' + * - 'DebugMail.io' + * - 'DynectEmail' + * - 'FastMail' + * - 'GandiMail' + * - 'Gmail' + * - 'Godaddy' + * - 'GodaddyAsia' + * - 'GodaddyEurope' + * - 'hot.ee' + * - 'Hotmail' + * - 'iCloud' + * - 'mail.ee' + * - 'Mail.ru' + * - 'Mailgun' + * - 'Mailjet' + * - 'Mandrill' + * - 'Naver' + * - 'Postmark' + * - 'QQ' + * - 'QQex' + * - 'SendCloud' + * - 'SendGrid' + * - 'SES' + * - 'Sparkpost' + * - 'Yahoo' + * - 'Yandex' + * - 'Zoho' + */ + service?: string; /** * is the port to connect to (defaults to 25 or 465) */ diff --git a/nouislider/nouislider-tests.ts b/nouislider/nouislider-tests.ts index 837776dfa8..2739e609ce 100644 --- a/nouislider/nouislider-tests.ts +++ b/nouislider/nouislider-tests.ts @@ -49,17 +49,14 @@ noUiSlider.create(testHtmlElement, { min: 0, max: 10 }, - mode: 'steps', - density: 3, - filter: function(){return 1}, - format: wNumb({ - decimals: 2, - prefix: '$' - }), pips: { - mode: 'range', + mode: 'steps', density: 3, - values: [50, 552, 4651, 4952, 5000, 7080, 9000] + filter: function () { return 1 }, + format: wNumb({ + decimals: 2, + prefix: '$' + }), } }); diff --git a/nouislider/nouislider.d.ts b/nouislider/nouislider.d.ts index e382059fb3..e632159818 100644 --- a/nouislider/nouislider.d.ts +++ b/nouislider/nouislider.d.ts @@ -1,170 +1,176 @@ -// Type definitions for nouislider v8.0.2 -// Project: https://github.com/leongersen/noUiSlider -// Definitions by: Patrick Davies -// Definitions: https://github.com/borisyankov/DefinitelyTyped -/// - -declare module noUiSlider { - interface Static { - /** - * To create a slider, call noUiSlider.create() with an element and your options. - */ - create(target: HTMLElement, options: Options): void; - } - - interface Options { - /** - * The start option sets the number of handles and their start positions, relative to range. - */ - start: number | number[] | number[][]; - /** - * The connect setting can be used to control the bar between the handles, - * or the edges of the slider. Use "lower" to connect to the lower side, - * or "upper" to connect to the upper side. Setting true sets the bar between the handles. - */ - range: Object; - /** - * noUiSlider offers several ways to handle user interaction. - * The range can be set to drag, and handles can move to taps. - * All these effects are optional, and can be enable by adding their keyword to the behaviour option. - * This option accepts a "-" separated list of "drag", "tap", "fixed", "snap" or "none". - */ - connect?: string | boolean; - /** - * When using two handles, the minimum distance between the handles can be set using the margin option. - * The margin value is relative to the value set in 'range'. - * This option is only available on standard linear sliders. - */ - margin?: number; - /** - * The limit option is the oposite of the margin option, - * limiting the maximum distance between two handles. - * As with the margin option, the limit option can only be used on linear sliders. - */ - limit?: number; - /** - * By default, the slider slides fluently. - * In order to make the handles jump between intervals, you can use this option. - * The step option is relative to the values provided to range. - */ - step?: number; - /** - * The orientation setting can be used to set the slider to "vertical" or "horizontal". - * Set dimensions! Vertical sliders don't assume a default height, so you'll need to set one. - * You can use any unit you want, including % or px. - */ - orientation?: string; - /** - * By default the sliders are top-to-bottom and left-to-right, - * but you can change this using the direction option, - * which decides where the upper side of the slider is. - */ - direction?: string; - /** - * Set the animate option to false to prevent the slider from animating to a new value with when calling .val(). - */ - animate?: boolean; - /** - * All values on the slider are part of a range. The range has a minimum and maximum value. - */ - behaviour?: string; - /** - * To format the slider output, noUiSlider offers a format option. - * Simply specify to and from functions to encode and decode the values. - * See manual formatting to the right for usage information. - * By default, noUiSlider will format output with 2 decimals. - */ - format?: Object | ((...args:any[]) => any); - - } - - interface PipsOptions { - /** - * The range mode uses the slider range to determine where the pips should be. A pip is generated for every percentage specified. - * - * Like range, the steps mode uses the slider range. In steps mode, a pip is generated for every step. - * The filter option can be used to filter the generated pips. - * The filter function must return 0 (no value), 1 (large value) or 2 (small value). - * - * In positions mode, pips are generated at percentage-based positions on the slider. Optionally, the stepped option can be set to true to match the pips to the slider steps. - * - * The count mode can be used to generate a fixed number of pips. As with positions mode, the stepped option can be used. - * - * The values mode is similar to positions, but it accepts values instead of percentages. The stepped option can be used for this mode. - * - */ - mode: string; - /** - * Range Mode: percentage for range mode - * Step Mode: step number for steps - * Positions Mode: percentage-based positions on the slider - * Count Mode: positions between pips - */ - density?: number; - /** - * Step Mode: The filter option can be used to filter the generated pips. - * The filter function must return 0 (no value), 1 (large value) or 2 (small value). - */ - filter?: (...args:any[]) => number; - /** - * format for step mode - * see noUiSlider format - */ - format?: Object; - /** - * - * values for positions and values mode - * number pips for count mode - */ - values?: number | number[]; - /** - * stepped option for positions, values and count mode - */ - stepped?: boolean; - } - - interface Callback { - /** - * Array for both one-handle and two-handle sliders. It contains the current slider values, - * with formatting applied. - */ - (values: any[], handle: number, unencoded: number): void - } - - - interface noUiSlider { - /** - * Bind event to the slider. - */ - on(eventName: string, callback: Callback): void; - /** - * Unbind event to the slider. - */ - off(eventName: string): void; - /** - * Destroy's the slider. - */ - destroy(): void; - - /** - * To get the current slider value. For one-handle sliders, calling .get() will return the value. - * For two-handle sliders, an array[value, value] will be returned. - */ - get(): number | number[]; - /** - * noUiSlider will keep your values within the slider range, which saves you a bunch of validation. - * If you have configured the slider to use one handle, you can change the current value by passing - * a number to the .set() method. If you have two handles, pass an array. One-handled sliders - * will also accept arrays. Within an array, you can set one position to null - * if you want to leave a handle unchanged. - */ - set(value: number | number[]): void; - } - - interface Instance extends HTMLElement { - noUiSlider: noUiSlider - } -} - -declare var noUiSlider: noUiSlider.Static; - +// Type definitions for nouislider v8.0.2 +// Project: https://github.com/leongersen/noUiSlider +// Definitions by: Patrick Davies +// Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + +declare module noUiSlider { + /** + * To create a slider, call noUiSlider.create() with an element and your options. + */ + function create(target: HTMLElement, options: Options): void; + + interface Options { + /** + * The start option sets the number of handles and their start positions, relative to range. + */ + start: number | number[] | number[][]; + /** + * The connect setting can be used to control the bar between the handles, + * or the edges of the slider. Use "lower" to connect to the lower side, + * or "upper" to connect to the upper side. Setting true sets the bar between the handles. + */ + range: Object; + /** + * noUiSlider offers several ways to handle user interaction. + * The range can be set to drag, and handles can move to taps. + * All these effects are optional, and can be enable by adding their keyword to the behaviour option. + * This option accepts a "-" separated list of "drag", "tap", "fixed", "snap" or "none". + */ + connect?: string | boolean; + /** + * When using two handles, the minimum distance between the handles can be set using the margin option. + * The margin value is relative to the value set in 'range'. + * This option is only available on standard linear sliders. + */ + margin?: number; + /** + * The limit option is the oposite of the margin option, + * limiting the maximum distance between two handles. + * As with the margin option, the limit option can only be used on linear sliders. + */ + limit?: number; + /** + * By default, the slider slides fluently. + * In order to make the handles jump between intervals, you can use this option. + * The step option is relative to the values provided to range. + */ + step?: number; + /** + * The orientation setting can be used to set the slider to "vertical" or "horizontal". + * Set dimensions! Vertical sliders don't assume a default height, so you'll need to set one. + * You can use any unit you want, including % or px. + */ + orientation?: string; + /** + * By default the sliders are top-to-bottom and left-to-right, + * but you can change this using the direction option, + * which decides where the upper side of the slider is. + */ + direction?: string; + /** + * Set the animate option to false to prevent the slider from animating to a new value with when calling .val(). + */ + animate?: boolean; + /** + * All values on the slider are part of a range. The range has a minimum and maximum value. + */ + behaviour?: string; + /** + * To format the slider output, noUiSlider offers a format option. + * Simply specify to and from functions to encode and decode the values. + * See manual formatting to the right for usage information. + * By default, noUiSlider will format output with 2 decimals. + */ + format?: Object | ((...args:any[]) => any); + + /** + * Allows you to generate points along the slider. + */ + pips?: PipsOptions; + } + + interface PipsOptions { + /** + * The 'range' mode uses the slider range to determine where the pips should be. A pip is generated for every percentage specified. + * + * The 'steps', like 'range', uses the slider range. In steps mode, a pip is generated for every step. + * The 'filter' option can be used to filter the generated pips from the 'steps' options' + * The filter function must return 0 (no value), 1 (large value) or 2 (small value). + * + * In 'positions' mode, pips are generated at percentage-based positions on the slider. + * Optionally, the stepped option can be set to true to match the pips to the slider steps. + * + * The 'count' mode can be used to generate a fixed number of pips. As with positions mode, the stepped option can be used. + * + * The 'values' mode is similar to positions, but it accepts values instead of percentages. The stepped option can be used for this mode. + * + */ + mode: string; // "range" | "steps" | "positions" | "count" | "values" + /** + * Range Mode: percentage for range mode + * Step Mode: step number for steps + * Positions Mode: percentage-based positions on the slider + * Count Mode: positions between pips + */ + density?: number; + /** + * Step Mode: The filter option can be used to filter the generated pips. + * The filter function must return 0 (no value), 1 (large value) or 2 (small value). + */ + filter?: (...args: any[]) => PipFilterResult; + /** + * format for step mode + * see noUiSlider format + */ + format?: Object; + /** + * + * values for positions and values mode + * number pips for count mode + */ + values?: number | number[]; + /** + * stepped option for positions, values and count mode + */ + stepped?: boolean; + } + + const enum PipFilterResult { + NoValue, + LargeValue, + SmallValue, + } + + interface Callback { + /** + * Array for both one-handle and two-handle sliders. It contains the current slider values, + * with formatting applied. + */ + (values: any[], handle: number, unencoded: number): void + } + + + interface noUiSlider { + /** + * Bind event to the slider. + */ + on(eventName: string, callback: Callback): void; + /** + * Unbind event to the slider. + */ + off(eventName: string): void; + /** + * Destroy's the slider. + */ + destroy(): void; + + /** + * To get the current slider value. For one-handle sliders, calling .get() will return the value. + * For two-handle sliders, an array[value, value] will be returned. + */ + get(): number | number[]; + /** + * noUiSlider will keep your values within the slider range, which saves you a bunch of validation. + * If you have configured the slider to use one handle, you can change the current value by passing + * a number to the .set() method. If you have two handles, pass an array. One-handled sliders + * will also accept arrays. Within an array, you can set one position to null + * if you want to leave a handle unchanged. + */ + set(value: number | number[]): void; + } + + interface Instance extends HTMLElement { + noUiSlider: noUiSlider + } +} diff --git a/parse/parse.d.ts b/parse/parse.d.ts index 9322188af1..85d3682f5f 100644 --- a/parse/parse.d.ts +++ b/parse/parse.d.ts @@ -7,7 +7,7 @@ /// /// -declare module Parse { +declare namespace Parse { var applicationId: string; var javaScriptKey: string; @@ -15,64 +15,37 @@ declare module Parse { var serverURL: string; var VERSION: string; - interface ParseDefaultOptions { - wait?: boolean; - silent?: boolean; + interface SuccessOption { success?: Function; + } + + interface ErrorOption { error?: Function; + } + + interface SuccessFailureOptions extends SuccessOption, ErrorOption { + } + + interface WaitOption { + /** + * Set to true to wait for the server to confirm success + * before triggering an event. + */ + wait?: boolean; + } + + interface UseMasterKeyOption { + /** + * In Cloud Code and Node only, causes the Master Key to be used for this request. + */ useMasterKey?: boolean; } - interface HTTPOptions { - url: string; - body?: any; - error?: Function; - followRedirects?: boolean; - headers?: any; - method?: string; - params?: any; - success?: Function; - } - - interface CollectionOptions { - model?: Object; - query?: Query; - comparator?: string; - } - - interface CollectionAddOptions { - at?: number; - } - - interface RouterOptions { - routes: any; - } - - interface NavigateOptions { - trigger?: boolean; - } - - interface ViewOptions { - model?: any; - collection?: any; - el?: any; - id?: string; - className?: string; - tagName?: string; - attributes?: any[]; - } - - interface PushData { - channels?: string[]; - push_time?: Date; - expiration_time?: Date; - expiration_interval?: number; - where?: Query; - data?: any; - alert?: string; - badge?: string; - sound?: string; - title?: string; + interface SilentOption { + /** + * Set to true to avoid firing the event. + */ + silent?: boolean; } /** @@ -210,7 +183,7 @@ declare module Parse { constructor(name: string, data: any, type?: string); name(): string; url(): string; - save(options?: ParseDefaultOptions): Promise; + save(options?: SuccessFailureOptions): Promise; } @@ -244,7 +217,7 @@ declare module Parse { constructor(arg1?: any, arg2?: any); - current(options?: ParseDefaultOptions): GeoPoint; + current(options?: SuccessFailureOptions): GeoPoint; radiansTo(point: GeoPoint): number; kilometersTo(point: GeoPoint): number; milesTo(point: GeoPoint): number; @@ -343,10 +316,10 @@ declare module Parse { constructor(attributes?: string[], options?: any); static extend(className: string, protoProps?: any, classProps?: any): any; - static fetchAll(list: Object[], options: ParseDefaultOptions): Promise; - static fetchAllIfNeeded(list: Object[], options: ParseDefaultOptions): Promise; - static destroyAll(list: Object[], options?: ParseDefaultOptions): Promise; - static saveAll(list: Object[], options?: ParseDefaultOptions): Promise; + static fetchAll(list: Object[], options: SuccessFailureOptions): Promise; + static fetchAllIfNeeded(list: Object[], options: SuccessFailureOptions): Promise; + static destroyAll(list: Object[], options?: Object.DestroyAllOptions): Promise; + static saveAll(list: Object[], options?: Object.SaveAllOptions): Promise; initialize(): void; add(attr: string, item: any): Object; @@ -355,12 +328,12 @@ declare module Parse { changedAttributes(diff: any): boolean; clear(options: any): any; clone(): Object; - destroy(options?: ParseDefaultOptions): Promise; + destroy(options?: Object.DestroyOptions): Promise; dirty(attr: String): boolean; dirtyKeys(): string[]; escape(attr: string): string; existed(): boolean; - fetch(options?: ParseDefaultOptions): Promise; + fetch(options?: Object.FetchOptions): Promise; get(attr: string): any; getACL(): ACL; has(attr: string): boolean; @@ -372,12 +345,27 @@ declare module Parse { previousAttributes(): any; relation(attr: string): Relation; remove(attr: string, item: any): any; - save(options?: ParseDefaultOptions, arg2?: any, arg3?: any): Promise; - set(key: string, value: any, options?: ParseDefaultOptions): boolean; - setACL(acl: ACL, options?: ParseDefaultOptions): boolean; + save(options?: Object.SaveOptions, arg2?: any, arg3?: any): Promise; + set(key: string, value: any, options?: Object.SetOptions): boolean; + setACL(acl: ACL, options?: SuccessFailureOptions): boolean; unset(attr: string, options?: any): any; - validate(attrs: any, options?: ParseDefaultOptions): boolean; + validate(attrs: any, options?: SuccessFailureOptions): boolean; + } + namespace Object { + interface DestroyOptions extends SuccessFailureOptions, WaitOption, UseMasterKeyOption { } + + interface DestroyAllOptions extends SuccessFailureOptions, UseMasterKeyOption { } + + interface FetchOptions extends SuccessFailureOptions, UseMasterKeyOption { } + + interface SaveOptions extends SuccessFailureOptions, SilentOption, UseMasterKeyOption, WaitOption { } + + interface SaveAllOptions extends SuccessFailureOptions, UseMasterKeyOption { } + + interface SetOptions extends ErrorOption, SilentOption { + promise?: any; + } } /** @@ -431,24 +419,49 @@ declare module Parse { query: Query; comparator: (object: Object) => any; - constructor(models?: Object[], options?: CollectionOptions); + constructor(models?: Object[], options?: Collection.Options); static extend(instanceProps: any, classProps: any): any; initialize(): void; - add(models: any[], options?: CollectionAddOptions): Collection; + add(models: any[], options?: Collection.AddOptions): Collection; at(index: number): Object; chain(): _Chain>; - fetch(options?: ParseDefaultOptions): Promise; - create(model: Object, options?: ParseDefaultOptions): Object; + fetch(options?: Collection.FetchOptions): Promise; + create(model: Object, options?: Collection.CreateOptions): Object; get(id: string): Object; getByCid(cid: any): any; pluck(attr: string): any[]; - remove(model: any, options?: ParseDefaultOptions): Collection; - remove(models: any[], options?: ParseDefaultOptions): Collection; - reset(models: any[], options?: ParseDefaultOptions): Collection; - sort(options?: ParseDefaultOptions): Collection; + remove(model: any, options?: Collection.RemoveOptions): Collection; + remove(models: any[], options?: Collection.RemoveOptions): Collection; + reset(models: any[], options?: Collection.ResetOptions): Collection; + sort(options?: Collection.SortOptions): Collection; toJSON(): any; + } + namespace Collection { + interface Options { + model?: Object; + query?: Query; + comparator?: string; + } + + interface AddOptions extends SilentOption { + /** + * The index at which to add the models. + */ + at?: number; + } + + interface CreateOptions extends SuccessFailureOptions, WaitOption, SilentOption, UseMasterKeyOption { + } + + interface FetchOptions extends SuccessFailureOptions, SilentOption, UseMasterKeyOption { } + + interface RemoveOptions extends SilentOption { } + + interface ResetOptions extends SilentOption { } + + interface SortOptions extends SilentOption { } } /** @@ -560,23 +573,23 @@ declare module Parse { addDescending(key: string[]): Query; ascending(key: string): Query; ascending(key: string[]): Query; - collection(items?: Object[], options?: ParseDefaultOptions): Collection; + collection(items?: Object[], options?: Collection.Options): Collection; containedIn(key: string, values: any[]): Query; contains(key: string, substring: string): Query; containsAll(key: string, values: any[]): Query; - count(options?: ParseDefaultOptions): Promise; + count(options?: Query.CountOptions): Promise; descending(key: string): Query; descending(key: string[]): Query; doesNotExist(key: string): Query; doesNotMatchKeyInQuery(key: string, queryKey: string, query: Query): Query; doesNotMatchQuery(key: string, query: Query): Query; - each(callback: Function, options?: ParseDefaultOptions): Promise; + each(callback: Function, options?: SuccessFailureOptions): Promise; endsWith(key: string, suffix: string): Query; equalTo(key: string, value: any): Query; exists(key: string): Query; - find(options?: ParseDefaultOptions): Promise; - first(options?: ParseDefaultOptions): Promise; - get(objectId: string, options?: ParseDefaultOptions): Promise; + find(options?: Query.FindOptions): Promise; + first(options?: Query.FirstOptions): Promise; + get(objectId: string, options?: Query.GetOptions): Promise; greaterThan(key: string, value: any): Query; greaterThanOrEqualTo(key: string, value: any): Query; include(key: string): Query; @@ -599,6 +612,13 @@ declare module Parse { withinRadians(key: string, point: GeoPoint, maxDistance: number): Query; } + namespace Query { + interface CountOptions extends SuccessFailureOptions, UseMasterKeyOption { } + interface FindOptions extends SuccessFailureOptions, UseMasterKeyOption { } + interface FirstOptions extends SuccessFailureOptions, UseMasterKeyOption { } + interface GetOptions extends SuccessFailureOptions, UseMasterKeyOption { } + } + /** * Represents a Role on the Parse server. Roles represent groupings of * Users for the purposes of granting permissions (e.g. specifying an ACL @@ -619,7 +639,7 @@ declare module Parse { getRoles(): Relation; getUsers(): Relation; getName(): string; - setName(name: string, options?: ParseDefaultOptions): any; + setName(name: string, options?: SuccessFailureOptions): any; } /** @@ -635,17 +655,31 @@ declare module Parse { */ class Router extends Events { - routes: any[]; + routes: Router.RouteMap; - constructor(options?: RouterOptions); + constructor(options?: Router.Options); static extend(instanceProps: any, classProps: any): any; initialize(): void; - navigate(fragment: string, options?: NavigateOptions): Router; + navigate(fragment: string, options?: Router.NavigateOptions): Router; navigate(fragment: string, trigger?: boolean): Router; route(route: string, name: string, callback: Function): Router; } + namespace Router { + interface Options { + routes: RouteMap; + } + + interface RouteMap { + [url: string]: string; + } + + interface NavigateOptions { + trigger?: boolean; + } + } + /** * @class * @@ -658,27 +692,27 @@ declare module Parse { class User extends Object { static current(): User; - static signUp(username: string, password: string, attrs: any, options?: ParseDefaultOptions): Promise; - static logIn(username: string, password: string, options?: ParseDefaultOptions): Promise; + static signUp(username: string, password: string, attrs: any, options?: SuccessFailureOptions): Promise; + static logIn(username: string, password: string, options?: SuccessFailureOptions): Promise; static logOut(): Promise; static allowCustomUserClass(isAllowed: boolean): void; - static become(sessionToken: string, options?: ParseDefaultOptions): Promise; - static requestPasswordReset(email: string, options?: ParseDefaultOptions): Promise; + static become(sessionToken: string, options?: SuccessFailureOptions): Promise; + static requestPasswordReset(email: string, options?: SuccessFailureOptions): Promise; - signUp(attrs: any, options?: ParseDefaultOptions): Promise; - logIn(options?: ParseDefaultOptions): Promise; - fetch(options?: ParseDefaultOptions): Promise; + signUp(attrs: any, options?: SuccessFailureOptions): Promise; + logIn(options?: SuccessFailureOptions): Promise; + fetch(options?: SuccessFailureOptions): Promise; save(arg1: any, arg2: any, arg3: any): Promise; authenticated(): boolean; isCurrent(): boolean; getEmail(): string; - setEmail(email: string, options: ParseDefaultOptions): boolean; + setEmail(email: string, options: SuccessFailureOptions): boolean; getUsername(): string; - setUsername(username: string, options?: ParseDefaultOptions): boolean; + setUsername(username: string, options?: SuccessFailureOptions): boolean; - setPassword(password: string, options?: ParseDefaultOptions): boolean; + setPassword(password: string, options?: SuccessFailureOptions): boolean; getSessionToken(): string; } @@ -706,7 +740,7 @@ declare module Parse { $el: JQuery; attributes: any; - constructor(options?: ViewOptions); + constructor(options?: View.Options); static extend(properties: any, classProperties?: any): any; @@ -715,13 +749,29 @@ declare module Parse { setElement(element: JQuery, delegate?: boolean): View; render(): View; remove(): View; - make(tagName: any, attributes?: any, content?: any): any; + make(tagName: any, attributes?: View.Attribute[], content?: any): any; delegateEvents(events?: any): any; undelegateEvents(): any; } - module Analytics { + namespace View { + interface Options { + model?: any; + collection?: any; + el?: any; + id?: string; + className?: string; + tagName?: string; + attributes?: Attribute[]; + } + + interface Attribute { + [attributeName: string]: string | number | boolean; + } + } + + namespace Analytics { function track(name: string, dimensions: any):Promise; } @@ -731,13 +781,13 @@ declare module Parse { * @namespace * Provides a set of utilities for using Parse with Facebook. */ - module FacebookUtils { + namespace FacebookUtils { function init(options?: any): void; function isLinked(user: User): boolean; - function link(user: User, permissions: any, options?: ParseDefaultOptions): void; - function logIn(permissions: any, options?: ParseDefaultOptions): void; - function unlink(user: User, options?: ParseDefaultOptions): void; + function link(user: User, permissions: any, options?: SuccessFailureOptions): void; + function logIn(permissions: any, options?: SuccessFailureOptions): void; + function unlink(user: User, options?: SuccessFailureOptions): void; } /** @@ -747,7 +797,7 @@ declare module Parse { * Some functions are only available from Cloud Code. *

    */ - module Cloud { + namespace Cloud { interface CookieOptions { domain?: string; @@ -809,8 +859,46 @@ declare module Parse { function define(name: string, func?: (request: FunctionRequest, response: FunctionResponse) => void): void; function httpRequest(options: HTTPOptions): Promise; function job(name: string, func?: (request: JobRequest, status: JobStatus) => void): HttpResponse; - function run(name: string, data?: any, options?: ParseDefaultOptions): Promise; + function run(name: string, data?: any, options?: SuccessFailureOptions): Promise; function useMasterKey(): void; + + /** + * To use this Cloud Module in Cloud Code, you must require 'buffer' in your JavaScript file. + * + * import Buffer = require("buffer").Buffer; + */ + var HTTPOptions: new () => HTTPOptions; + interface HTTPOptions extends FunctionResponse { + /** + * The body of the request. + * If it is a JSON object, then the Content-Type set in the headers must be application/x-www-form-urlencoded or application/json. + * You can also set this to a Buffer object to send raw bytes. + * If you use a Buffer, you should also set the Content-Type header explicitly to describe what these bytes represent. + */ + body?: string | Buffer | Object; + /** + * Defaults to 'false'. + */ + followRedirects?: boolean; + /** + * The headers for the request. + */ + headers?: { + [headerName: string]: string | number | boolean; + }; + /** + *The method of the request (i.e GET, POST, etc). + */ + method?: string; + /** + * The query portion of the url. + */ + params?: any; + /** + * The url to send the request to. + */ + url: string; + } } @@ -894,7 +982,7 @@ declare module Parse { * You should not create subclasses of Parse.Op or instantiate Parse.Op * directly. */ - module Op { + namespace Op { interface BaseOperation extends IBaseObject { objects(): any[]; @@ -929,9 +1017,26 @@ declare module Parse { * @name Parse.Push * @namespace */ - module Push { + namespace Push { + function send(data: PushData, options?: SendOptions): Promise; - function send(data: PushData, options?: ParseDefaultOptions):Promise; + interface PushData { + channels?: string[]; + push_time?: Date; + expiration_time?: Date; + expiration_interval?: number; + where?: Query; + data?: any; + alert?: string; + badge?: string; + sound?: string; + title?: string; + } + + interface SendOptions { + success?: () => void; + error?: (error: Error) => void; + } } /** diff --git a/peerjs/peerjs-tests.ts b/peerjs/peerjs-tests.ts index 3b99471c78..dee76d9e2f 100644 --- a/peerjs/peerjs-tests.ts +++ b/peerjs/peerjs-tests.ts @@ -4,8 +4,10 @@ var peerByOption: PeerJs.Peer = new Peer({ key: 'peerKey', debug: 3, - logFunction: ()=>{ - } +}); + +peerByOption.on("connection", dataConnection => { + var type: string = dataConnection.type; }); peerByOption.listAllPeers(function(items){ @@ -21,9 +23,10 @@ var peerByIdAndOption: PeerJs.Peer = new Peer( { key: 'peerKey', debug: 3, - logFunction: ()=>{ - } }); +peerByIdAndOption.on("call", mediaConnection => { + var isOpen: boolean = mediaConnection.open; +}); var id = peerByOption.id; var connections = peerByOption.connections; diff --git a/peerjs/peerjs.d.ts b/peerjs/peerjs.d.ts index b87d3bc872..7db935ffbf 100644 --- a/peerjs/peerjs.d.ts +++ b/peerjs/peerjs.d.ts @@ -78,7 +78,7 @@ declare module PeerJs{ * @param id The brokering ID of the remote peer (their peer.id). * @param options for specifying details about Peer Connection */ - connect(id: string, options?: PeerJs.PeerJSOption): PeerJs.DataConnection; + connect(id: string, options?: PeerJs.PeerConnectOption): PeerJs.DataConnection; /** * Connects to the remote peer specified by id and returns a data connection. * @param id The brokering ID of the remote peer (their peer.id). diff --git a/photoswipe/photoswipe-tests.ts b/photoswipe/photoswipe-tests.ts index 79125bd05f..ca136f3a2e 100644 --- a/photoswipe/photoswipe-tests.ts +++ b/photoswipe/photoswipe-tests.ts @@ -6,13 +6,11 @@ function test_defaultUI() { src: "path/to/image.jpg", w: 100, h: 200, - specialProperty: true }, { src: "path/to/image2.jpg", w: 1000, h: 2000, - specialProperty: false } ]; diff --git a/photoswipe/photoswipe.d.ts b/photoswipe/photoswipe.d.ts index b09fe75ddf..16ce87a68c 100644 --- a/photoswipe/photoswipe.d.ts +++ b/photoswipe/photoswipe.d.ts @@ -268,6 +268,20 @@ declare module PhotoSwipe { */ mainClass?: string; + /** + * NOTE: this property will be ignored in future versions of PhotoSwipe. + * + * @deprecated + */ + mainScrollEndFriction?: number; + + /** + * NOTE: this property will be ignored in future versions of PhotoSwipe. + * + * @deprecated + */ + panEndFriction?: number; + /** * Function that should return total number of items in gallery. Don't put very complex code here, function is executed very often. * diff --git a/react/react-global.d.ts b/react/react-global.d.ts index d33d4268d4..df8aaf421c 100644 --- a/react/react-global.d.ts +++ b/react/react-global.d.ts @@ -215,6 +215,8 @@ declare module React { interface ComponentSpec extends Mixin { render(): ReactElement; + + [propertyName: string]: any; } // @@ -394,10 +396,14 @@ declare module React { zIndex?: number; zoom?: number; + fontSize?: number | string; + // SVG-related properties fillOpacity?: number; strokeOpacity?: number; strokeWidth?: number; + + [propertyName: string]: string | number | boolean; } interface HTMLAttributes extends DOMAttributes { diff --git a/react/react-tests.ts b/react/react-tests.ts index a4d2c4f7ac..6540cc9f35 100644 --- a/react/react-tests.ts +++ b/react/react-tests.ts @@ -41,24 +41,24 @@ var container: Element; var ClassicComponent: React.ClassicComponentClass = React.createClass({ - getDefaultProps: () => { + getDefaultProps() { return { hello: undefined, world: "peace", foo: undefined, - bar: undefined + bar: undefined, }; }, - getInitialState: () => { + getInitialState() { return { inputValue: this.context.someValue, seconds: this.props.foo }; }, - reset: () => { + reset() { this.replaceState(this.getInitialState()); }, - render: () => { + render() { return React.DOM.div(null, React.DOM.input({ ref: input => this._input = input, @@ -204,7 +204,7 @@ myComponent.reset(); // -------------------------------------------------------------------------- var children: any[] = ["Hello world", [null], React.DOM.span(null)]; -var divStyle = { // CSSProperties +var divStyle: React.CSSProperties = { // CSSProperties flex: "1 1 main-size", backgroundImage: "url('hello.png')" }; diff --git a/react/react.d.ts b/react/react.d.ts index f2697fd259..a124e7b50d 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -215,6 +215,8 @@ declare module __React { interface ComponentSpec extends Mixin { render(): ReactElement; + + [propertyName: string]: any; } // @@ -394,10 +396,14 @@ declare module __React { zIndex?: number; zoom?: number; + fontSize?: number | string; + // SVG-related properties fillOpacity?: number; strokeOpacity?: number; strokeWidth?: number; + + [propertyName: string]: string | number | boolean; } interface HTMLAttributes extends DOMAttributes { diff --git a/royalslider/royalslider-tests.ts b/royalslider/royalslider-tests.ts index 6cafcb6d65..4246ec90b3 100644 --- a/royalslider/royalslider-tests.ts +++ b/royalslider/royalslider-tests.ts @@ -10,10 +10,10 @@ $(".royalSlider").royalSlider({ jQuery(document).ready(function () { $(".royalSlider").royalSlider({ - // general options go gere + // general options go here autoScaleSlider: true, thumbs: { - // thumbnails options go gere + // thumbnails options go here spacing: 10, arrowsAutoHide: true } @@ -22,10 +22,10 @@ jQuery(document).ready(function () { jQuery(document).ready(function () { $(".royalSlider").royalSlider({ - // general options go gere + // general options go here autoScaleSlider: true, fullscreen: { - // fullscreen options go gere + // fullscreen options go here enabled: true, nativeFS: true } @@ -34,10 +34,10 @@ jQuery(document).ready(function () { jQuery(document).ready(function () { $(".royalSlider").royalSlider({ - // general options go gere + // general options go here autoScaleSlider: true, deeplinking: { - // deep linking options go gere + // deep linking options go here enabled: true, prefix: 'slider-' } @@ -47,10 +47,10 @@ jQuery(document).ready(function () { jQuery(document).ready(function () { $(".royalSlider").royalSlider({ - // general options go gere + // general options go here autoScaleSlider: true, autoplay: { - // autoplay options go gere + // autoplay options go here enabled: true, pauseOnHover: true } @@ -59,10 +59,10 @@ jQuery(document).ready(function () { jQuery(document).ready(function () { $(".royalSlider").royalSlider({ - // general options go gere + // general options go here autoScaleSlider: true, video: { - // video options go gere + // video options go here autoHideBlocks: true, autoHideArrows: false } @@ -71,10 +71,10 @@ jQuery(document).ready(function () { jQuery(document).ready(function () { $(".royalSlider").royalSlider({ - // general options go gere + // general options go here autoScaleSlider: true, block: { - // animated blocks options go gere + // animated blocks options go here fadeEffect: false, moveEffect: 'left' } @@ -83,7 +83,7 @@ jQuery(document).ready(function () { jQuery(document).ready(function () { $(".royalSlider").royalSlider({ - // general options go gere + // general options go here keyboardNavEnabled: true, visibleNearby: { enabled: true, @@ -174,7 +174,7 @@ slider.ev.on('rsBeforeAnimStart', function (event) { slider.ev.on('rsBeforeMove', function (event: JQueryEventObject, type?: string, userAction?: boolean) { // before any transition start (including after drag release) // "type" - can be "next", "prev", or ID of slide to move - // userAction (Boolean) - defines if action is triggered by user (e.g. will be false if movement is triggered by autoPlay) + // userAction (Boolean) - defines if action is trighered by user (e.g. will be false if movement is trighered by autoPlay) }); slider.ev.on('rsBeforeSizeSet', function (event) { // before size of slider is changed diff --git a/sipml/sipml.d.ts b/sipml/sipml.d.ts index 84a6944548..b6c77d8983 100644 --- a/sipml/sipml.d.ts +++ b/sipml/sipml.d.ts @@ -1,150 +1,252 @@ -// Type definitions for SIPml5 -// Project: http://sipml5.org/ -// Definitions by: A. Groenenboom -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare module SIPml { - class Event { - public description: string; - public type: string; - - public getContent(): Object; - public getContentString(): string; - public getContentType(): Object; - public getSipResponseCode(): number; - } - - class EventTarget { - public addEventListener(type: any, listener: Function): void; - public removeEventListener(type: any): void; - } - - class Session extends EventTarget { - public accept(configuration?: Session.Configuration): number; - public getId(): number; - public getRemoteFriendlyName(): string; - public getRemoteUri(): string; - public reject(configuration?: Session.Configuration): number; - public setConfiguration(configuration?: Session.Configuration): void; - } - - export module Session { - interface Configuration { - audio_remote?: HTMLElement; - bandwidth?: Object; - expires?: number; - from?: string; - sip_caps?: Object[]; - sip_headers?: Object[]; - video_local?: HTMLElement; - video_remote?: HTMLElement; - video_size?: Object; - } - - class Call extends Session { - public acceptTransfer(configuration?: Session.Configuration): number; - public call(to: string, configuration?: Session.Configuration): number; - public dtmf(): number; - public hangup(configuration?: Session.Configuration): number; - public hold(configuration?: Session.Configuration): number; - public info(): number; - public rejectTransfer(): number; - public resume(): number; - public transfer(): number; - } - - class Event extends SIPml.Event { - public session: Session; - - public getTransferDestinationFriendlyName(): string; - } - - class Message extends Session { - public send(to: string, content?: any, contentType?: string, configuration?: Session.Configuration): number; - } - - class Publish extends Session { - public publish(content?: any, contentType?: string, configuration?: Session.Configuration): number; - - public unpublish(configuration?: Session.Configuration): void; - } - - class Registration extends Session { - public register(configuration?: Session.Configuration): void; - public unregister(configuration?: Session.Configuration): void; - } - - class Subscribe extends Session { - public subscribe(to: string, configuration?: Session.Configuration): number; - public unsubscribe(configuration?: Session.Configuration): number; - } - } - - class Stack extends EventTarget { - public constructor(configuration?: Stack.Configuration); - public setConfiguration(configuration: Stack.Configuration): number; - public newSession(type: string, configuration?: Session.Configuration): any; - public start(): number; - public stop(timeout?: number): number; - } - - export module Stack { - interface Configuration { - bandwidth?: Object; - display_name?: string; - enable_click2call?: boolean; - enable_early_ims?: boolean; - enable_media_stream_cache?: boolean; - enable_rtcweb_breaker?: boolean; - events_listener?: Object; - ice_servers?: Object[]; - impi?: string; - impu?: string; - outbound_proxy_url?: string; - password?: string; - realm?: string; - sip_headers?: Object[]; - video_size?: Object; - websocket_proxy_url?: string; - } - - class Event extends SIPml.Event { - public description: string; - public newSession: Session; - public type: string; - } - } - - function getNavigatorFriendlyName(): string; - - function getNavigatorVersion(): string; - - function getSystemFriendlyName(): string; - - function getWebRtc4AllVersion(): string; - - function haveMediaStream(): boolean; - - function init(readyCallback?: (e:any) => any, errorCallback?: (e:any) => any): boolean; - - function isInitialized(): boolean; - - function isNavigatorOutdated(): boolean; - - function isReady(): boolean; - - function isScreenShareSupported(): boolean; - - function isWebRtcPluginOutdated(): boolean; - - function isWebRtc4AllSupported(): boolean; - - function isWebRtcSupported(): boolean; - - function isWebSocketSupported(): boolean; - - function setDebugLevel(level: string): void; - - function setWebRtcType(type: string): boolean; -} - +// Type definitions for SIPml5 +// Project: http://sipml5.org/ +// Definitions by: A. Groenenboom +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare namespace SIPml { + class Event { + public description: string; + public type: string; + + public getContent(): Object; + public getContentString(): string; + public getContentType(): Object; + public getSipResponseCode(): number; + } + + class EventTarget { + public addEventListener(type: EventSubscriptionType, listener: (e: EventType) => void): void; + public removeEventListener(type: EventSubscriptionType): void; + } + + class Session extends EventTarget { + public accept(configuration?: Session.Configuration): number; + public getId(): number; + public getRemoteFriendlyName(): string; + public getRemoteUri(): string; + public reject(configuration?: Session.Configuration): number; + public setConfiguration(configuration?: Session.Configuration): void; + } + + export namespace Session { + /** + * Should be + * + * "*" | + * "connecting" | + * "connected" | + * "terminating" | + * "terminated" | + * "i_ao_request" | + * "media_added" | + * "media_removed" | + * "i_request" | + * "o_request" | + * "cancelled_request" | + * "sent_request" | + * "transport_error" | + * "global_error" | + * "message_error" | + * "webrtc_error" | + */ + type EventSubscriptionType = string; + + interface Configuration { + audio_remote?: HTMLElement; + bandwidth?: { audio: number; video: number; }; + events_listener?: { + events: EventSubscriptionType | EventSubscriptionType[]; + listener: (e: Session.Event) => void + }; + expires?: number; + from?: string; + sip_caps?: Object[]; + sip_headers?: Object[]; + video_local?: HTMLElement; + video_remote?: HTMLElement; + video_size?: { + minWidth?: number; + maxWidth?: number; + minHeight?: number; + maxHeight?: number; + }; + } + + class Call extends Session implements EventTarget { + public acceptTransfer(configuration?: Session.Configuration): number; + public call(to: string, configuration?: Session.Configuration): number; + public dtmf(): number; + public hangup(configuration?: Session.Configuration): number; + public hold(configuration?: Session.Configuration): number; + public info(): number; + public rejectTransfer(): number; + public resume(): number; + public transfer(): number; + } + + namespace Call { + /** + * Should be + * + * Session.EventSubscriptionType | + * "m_early_media" | + * "m_local_hold_ok" | + * "m_local_hold_nok" | + * "m_local_resume_ok" | + * "m_local_resume_nok" | + * "m_remote_hold" | + * "m_remote_resume" | + * "m_stream_video_local_added" | + * "m_stream_video_local_removed" | + * "m_stream_video_remote_added" | + * "m_stream_video_remote_removed" | + * "m_stream_audio_local_added" | + * "m_stream_audio_local_removed" | + * "m_stream_audio_remote_added" | + * "m_stream_audio_remote_removed" | + * "i_ect_new_call" | + * "o_ect_trying" | + * "o_ect_accepted" | + * "o_ect_completed" | + * "i_ect_completed" | + * "o_ect_failed" | + * "i_ect_failed" | + * "o_ect_notify" | + * "i_ect_notify" | + * "i_ect_requested " | + * "m_bfcp_info" | + * "i_info" | + */ + type EventSubscriptionType = Session.EventSubscriptionType; + } + + class Event extends SIPml.Event { + public session: Session; + + public getTransferDestinationFriendlyName(): string; + } + + class Message extends Session { + public send(to: string, content?: any, contentType?: string, configuration?: Session.Configuration): number; + } + + class Publish extends Session { + public publish(content?: any, contentType?: string, configuration?: Session.Configuration): number; + + public unpublish(configuration?: Session.Configuration): void; + } + + class Registration extends Session { + public register(configuration?: Session.Configuration): void; + public unregister(configuration?: Session.Configuration): void; + } + + class Subscribe extends Session implements EventTarget { + public subscribe(to: string, configuration?: Session.Configuration): number; + public unsubscribe(configuration?: Session.Configuration): number; + } + + namespace Subscribe { + /** + * Should be + * + * Session.EventSubscriptionType | "i_notify" + */ + type EventSubscriptionType = Session.EventSubscriptionType; + } + } + + class Stack extends EventTarget { + public constructor(configuration?: Stack.Configuration); + public setConfiguration(configuration: Stack.Configuration): number; + public newSession(type: string, configuration?: Session.Configuration): any; + public start(): number; + public stop(timeout?: number): number; + } + + export namespace Stack { + /** + * Should be + * + * "*" | + * "starting" | + * "started" | + * "stopping" | + * "stopped" | + * "failed_to_start" | + * "failed_to_stop" | + * "i_new_call" | + * "i_new_message" | + * "m_permission_requested" | + * "m_permission_accepted" | + * "m_permission_refused"; + */ + type EventSubscriptionType = string; + + interface Configuration { + bandwidth?: { audio: number; video: number; }; + display_name?: string; + enable_click2call?: boolean; + enable_early_ims?: boolean; + enable_media_stream_cache?: boolean; + enable_rtcweb_breaker?: boolean; + events_listener?: { + events: EventSubscriptionType | EventSubscriptionType[]; + listener: (e: Stack.Event) => void + }; + ice_servers?: Object[]; + impi?: string; + impu?: string; + outbound_proxy_url?: string; + password?: string; + realm?: string; + sip_headers?: Object[]; + video_size?: { + minWidth?: number; + maxWidth?: number; + minHeight?: number; + maxHeight?: number; + }; + websocket_proxy_url?: string; + } + + class Event extends SIPml.Event { + public description: string; + public newSession: Session; + public type: string; + } + } + + function getNavigatorFriendlyName(): string; + + function getNavigatorVersion(): string; + + function getSystemFriendlyName(): string; + + function getWebRtc4AllVersion(): string; + + function haveMediaStream(): boolean; + + function init(readyCallback?: (e:any) => any, errorCallback?: (e:any) => any): boolean; + + function isInitialized(): boolean; + + function isNavigatorOutdated(): boolean; + + function isReady(): boolean; + + function isScreenShareSupported(): boolean; + + function isWebRtcPluginOutdated(): boolean; + + function isWebRtc4AllSupported(): boolean; + + function isWebRtcSupported(): boolean; + + function isWebSocketSupported(): boolean; + + function setDebugLevel(level: string): void; + + function setWebRtcType(type: string): boolean; +} + diff --git a/tcomb/tcomb-tests.ts b/tcomb/tcomb-tests.ts index 3a27ffc7fe..aafd5e55b2 100644 --- a/tcomb/tcomb-tests.ts +++ b/tcomb/tcomb-tests.ts @@ -577,17 +577,16 @@ describe('irreducible types constructors', function () { {T: Dat, x: new Date()} ].forEach(function (o) { - var T = o.T; - var x = o.x; + var { T, x } = o; it('should accept only valid values', function () { - eq(T(x), x); + eq((T)(x), x); }); it('should throw if used with new', function () { throwsWithMessage(function () { /* jshint ignore:start */ - var x = new (T) (); + var x = new (T) (); /* jshint ignore:end */ }, 'Operator `new` is forbidden for type `' + getTypeName(T) + '`'); }); diff --git a/tcomb/tcomb.d.ts b/tcomb/tcomb.d.ts index c189a6a0f5..c4676adfd2 100644 --- a/tcomb/tcomb.d.ts +++ b/tcomb/tcomb.d.ts @@ -16,7 +16,7 @@ declare module TComb { assert: (condition: boolean, message?: string, ...values: any[]) => void; fail: (message?: string) => void; Any: Any_Static; - Nil: Str_Static; + Nil: Nil_Static; Str: Str_Static; Num: Num_Static; Bool: Bool_Static; @@ -24,8 +24,9 @@ declare module TComb { Obj: Obj_Static; Func: Func_Static; - func: { (domain: TCombBase[], codomain: TCombBase, name?: string) : Func_Static; - (domain: TCombBase, codomain: TCombBase, name?: string) : Func_Static; + func: { + (domain: TCombBase[], codomain: TCombBase, name?: string): Func_Static; + (domain: TCombBase, codomain: TCombBase, name?: string) : Func_Static; } Err: Err_Static; Re: Re_Static; @@ -61,13 +62,13 @@ declare module TComb { export interface TCombBase { meta: { - /** - * The type kind, equal to "irreducible" for irreducible types. - */ + /** + * The type kind, equal to "irreducible" for irreducible types. + */ kind: string; - /** - * The type name. - */ + /** + * The type name. + */ name: string; }; displayName: string; @@ -107,17 +108,17 @@ declare module TComb { new (value: string): Str_Instance; (value: string): Str_Instance; meta: { - /** - * The type kind, equal to "irreducible" for irreducible types. - */ + /** + * The type kind, equal to "irreducible" for irreducible types. + */ kind: string; - /** - * The type name. - */ + /** + * The type name. + */ name: string; - /** - * The type predicate. - */ + /** + * The type predicate. + */ is: TypePredicate; }; } @@ -210,15 +211,15 @@ declare module TComb { - /** - * @param name - The type name. - * @param is - A predicate. - */ + /** + * @param name - The type name. + * @param is - A predicate. + */ - /** - * @param props - A hash whose keys are the field names and the values are the fields types. - * @param name - Useful for debugging purposes. - */ + /** + * @param props - A hash whose keys are the field names and the values are the fields types. + * @param name - Useful for debugging purposes. + */ export interface Struct_Static extends TCombBase { @@ -229,52 +230,52 @@ declare module TComb { name: string; props: any[]; }; - /** - * @param mixins - Contains the new props. - * @param name - Useful for debugging purposes. - */ + /** + * @param mixins - Contains the new props. + * @param name - Useful for debugging purposes. + */ extend(mixins: Object, name?: string): Struct_Static; - /** - * @param mixins - Contains the new props. - * @param name - Useful for debugging purposes. - */ + /** + * @param mixins - Contains the new props. + * @param name - Useful for debugging purposes. + */ extend(mixins: Struct_Static, name?: string): Struct_Static; - /** - * @param mixins - Contains the new props. - * @param name - Useful for debugging purposes. - */ + /** + * @param mixins - Contains the new props. + * @param name - Useful for debugging purposes. + */ extend(mixins: Object[], name?: string): Struct_Static; - /** - * @param mixins - Contains the new props. - * @param name - Useful for debugging purposes. - */ + /** + * @param mixins - Contains the new props. + * @param name - Useful for debugging purposes. + */ extend(mixins: Struct_Static[], name?: string): Struct_Static; } interface Struct_Instance { } - /** - * @param map - A hash whose keys are the enums (values are free). - * @param name - Useful for debugging purposes. - */ + /** + * @param map - A hash whose keys are the enums (values are free). + * @param name - Useful for debugging purposes. + */ export module enums { - /** - * @param keys - Array of enums. - * @param name - Useful for debugging purposes. - */ + /** + * @param keys - Array of enums. + * @param name - Useful for debugging purposes. + */ export function of(keys: string[], name?: string): TCombBase; - /** - * @param keys - String of enums separated by spaces. - * @param name - Useful for debugging purposes. - */ + /** + * @param keys - String of enums separated by spaces. + * @param name - Useful for debugging purposes. + */ export function of(keys: string, name?: string): TCombBase; } - /** - * @param name - Useful for debugging purposes. - */ + /** + * @param name - Useful for debugging purposes. + */ export interface Union_Static extends TCombBase { new (value: any, mutable?: boolean): Union_Instance; @@ -291,10 +292,10 @@ declare module TComb { } - /** - * @param type - The wrapped type. - * @param name - Useful for debugging purposes. - */ + /** + * @param type - The wrapped type. + * @param name - Useful for debugging purposes. + */ @@ -312,9 +313,9 @@ declare module TComb { } - /** - * @param name - Useful for debugging purposes. - */ + /** + * @param name - Useful for debugging purposes. + */ interface Tuple_Static extends TCombBase { new (value: any, mutable?: boolean): Tuple_Instance; @@ -329,11 +330,11 @@ declare module TComb { interface Tuple_Instance { } - /** - * Combines old types into a new one. - * @param type - A type already defined. - * @param name - Useful for debugging purposes. - */ + /** + * Combines old types into a new one. + * @param type - A type already defined. + * @param name - Useful for debugging purposes. + */ export interface Subtype_Static extends TCombBase { @@ -350,10 +351,10 @@ declare module TComb { interface Subtype_Instance { } - /** - * @param type - The type of list items. - * @param name - Useful for debugging purposes. - */ + /** + * @param type - The type of list items. + * @param name - Useful for debugging purposes. + */ export function list(type: TCombBase, name?: string): List_Static; interface List_Static extends TCombBase { @@ -369,11 +370,11 @@ declare module TComb { interface List_Instance { } - /** - * @param domain - The type of keys. - * @param codomain - The type of values. - * @param name - Useful for debugging purposes. - */ + /** + * @param domain - The type of keys. + * @param codomain - The type of values. + * @param name - Useful for debugging purposes. + */ interface Dict_Static extends TCombBase { @@ -390,16 +391,16 @@ declare module TComb { interface Dict_Instance { } - /** - * @param type - The type of the function's argument. - * @param codomain - The type of the function's return value. - * @param name - Useful for debugging purposes. - */ - /** - * @param type - The list of types of the function's arguments. - * @param codomain - The type of the function's return value. - * @param name - Useful for debugging purposes. - */ + /** + * @param type - The type of the function's argument. + * @param codomain - The type of the function's return value. + * @param name - Useful for debugging purposes. + */ + /** + * @param type - The list of types of the function's arguments. + * @param codomain - The type of the function's return value. + * @param name - Useful for debugging purposes. + */ interface Func_Static extends TCombBase { new (value: any, mutable?: boolean): Func_Instance;