From 4cdfbe96b666eec5e1defbb519a62abf04e96764 Mon Sep 17 00:00:00 2001 From: Jason Gallavin Date: Sun, 17 Apr 2016 17:32:36 -0400 Subject: [PATCH 01/65] add post and get overloads for JQueryAjaxSettings. add tests for each of the items --- jquery/jquery-tests.ts | 12 ++++++++++++ jquery/jquery.d.ts | 13 ++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index ecd9266b45..a3a8e6581d 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -2528,6 +2528,18 @@ function test_jQuery() { $.post('url.xml', function (data) { var $child = $(data).find('child'); }); + $.post({ + url: "test.php", + success : () => { + console.log("successfull"); + } + }); + $.get({ + url: "test.php", + success : () => { + console.log("successfull"); + } + }); var foo = { foo: 'bar', hello: 'world' }; var $foo = $(foo); var test1 = $foo.prop('foo'); diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 51a2773bf2..6478529dad 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -676,6 +676,12 @@ interface JQueryStatic { * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html). */ get(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; + /** + * Load data from the server using a HTTP GET request. + * + * @param settings The JQueryAjaxSettings to be used for the request + */ + get(settings : JQueryAjaxSettings): JQueryXHR; /** * Load JSON-encoded data from the server using a GET HTTP request. * @@ -721,7 +727,12 @@ interface JQueryStatic { * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). */ post(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; - + /** + * Load data from the server using a HTTP POST request. + * + * @param settings The JQueryAjaxSettings to be used for the request + */ + post(settings : JQueryAjaxSettings): JQueryXHR; /** * A multi-purpose callbacks list object that provides a powerful way to manage callback lists. * From e2de8d512a2174086702bf31ead2b29e95a28c31 Mon Sep 17 00:00:00 2001 From: Cody Lundquist Date: Sat, 23 Apr 2016 02:04:11 -0400 Subject: [PATCH 02/65] Allow Url type to be passed into setUrl() (#9008) --- hapi/hapi.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index 874a73a6c3..65cc044178 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -12,6 +12,7 @@ declare module "hapi" { import http = require("http"); import stream = require("stream"); import Events = require("events"); + import url = require("url"); interface IDictionary { [key: string]: T; @@ -1250,8 +1251,7 @@ declare module "hapi" { request.setUrl('/test'); return reply.continue(); });*/ - setUrl(url: string): void; - + setUrl(url: string | url.Url): void; /** request.setMethod(method) Available only in 'onRequest' extension methods. From b20485f5987087a29d68f5537bcf10007930d8e9 Mon Sep 17 00:00:00 2001 From: Evan Hahn Date: Fri, 22 Apr 2016 23:12:35 -0700 Subject: [PATCH 03/65] Add dnsPrefetchControl definition to Helmet (#9018) --- helmet/helmet-tests.ts | 9 +++++++++ helmet/helmet.d.ts | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/helmet/helmet-tests.ts b/helmet/helmet-tests.ts index 98ebb77d00..3d7298cbc3 100644 --- a/helmet/helmet-tests.ts +++ b/helmet/helmet-tests.ts @@ -115,3 +115,12 @@ function publicKeyPinsTest() { reportUri: "http://example.com" })); } + +/** + * @summary Test for {@see helmet#dnsPrefetchControl} function. + */ +function dnsPrefetchControlTest() { + app.use(helmet.dnsPrefetchControl()); + app.use(helmet.dnsPrefetchControl({ allow: false })); + app.use(helmet.dnsPrefetchControl({ allow: true })); +} diff --git a/helmet/helmet.d.ts b/helmet/helmet.d.ts index 5c34378f04..fa9c859e85 100644 --- a/helmet/helmet.d.ts +++ b/helmet/helmet.d.ts @@ -44,6 +44,10 @@ declare module "helmet" { setOnOldIE? : boolean; } + interface IHelmetDnsPrefetchControlConfiguration { + allow? : boolean; + } + /** * @summary Interface for helmet class. * @interface @@ -55,6 +59,11 @@ declare module "helmet" { */ ():express.RequestHandler; + /** + * @summary Stop browsers from doing DNS prefetching. + */ + dnsPrefetchControl(options ?: IHelmetDnsPrefetchControlConfiguration):express.RequestHandler; + /** * @summary Prevent clickjacking. * @param {string} header The header. From db57ec3afd5cd3ee559835d0453cc96f44db06ca Mon Sep 17 00:00:00 2001 From: Evan Hahn Date: Fri, 22 Apr 2016 23:12:45 -0700 Subject: [PATCH 04/65] Improve Helmet publicKeyPins definitions (#9017) `helmet.publicKeyPins` takes an object of a certain shape instead of any Object. --- helmet/helmet-tests.ts | 31 ++++++++++++++++++++++++++++++- helmet/helmet.d.ts | 15 ++++++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/helmet/helmet-tests.ts b/helmet/helmet-tests.ts index 3d7298cbc3..0223244cc0 100644 --- a/helmet/helmet-tests.ts +++ b/helmet/helmet-tests.ts @@ -110,10 +110,39 @@ function noSniffTest() { */ function publicKeyPinsTest() { app.use(helmet.publicKeyPins({ + maxAge: 7776000000, + sha256s: ["AbCdEf123=", "ZyXwVu456="], + })); + + app.use(helmet.publicKeyPins({ + maxAge: 7776000000, + sha256s: ["AbCdEf123=", "ZyXwVu456="], + includeSubdomains: false + })); + + app.use(helmet.publicKeyPins({ + maxAge: 7776000000, + sha256s: ["AbCdEf123=", "ZyXwVu456="], + includeSubdomains: true + })); + + app.use(helmet.publicKeyPins({ + maxAge: 7776000000, sha256s: ["AbCdEf123=", "ZyXwVu456="], - includeSubdomains: true, reportUri: "http://example.com" })); + + app.use(helmet.publicKeyPins({ + maxAge: 7776000000, + sha256s: ["AbCdEf123=", "ZyXwVu456="], + reportOnly: true + })); + + app.use(helmet.publicKeyPins({ + maxAge: 7776000000, + sha256s: ["AbCdEf123=", "ZyXwVu456="], + setIf: function (req, res) { return true; } + })); } /** diff --git a/helmet/helmet.d.ts b/helmet/helmet.d.ts index fa9c859e85..f32ba0a2d9 100644 --- a/helmet/helmet.d.ts +++ b/helmet/helmet.d.ts @@ -40,6 +40,19 @@ declare module "helmet" { directives? : IHelmetCspDirectives } + interface IHelmetPublicKeyPinsSetIfFunction { + (req: express.Request, res: express.Response): boolean; + } + + interface IHelmetPublicKeyPinsConfiguration { + maxAge : number; + sha256s : string[]; + includeSubdomains? : boolean; + reportUri? : string; + reportOnly? : boolean; + setIf?: IHelmetPublicKeyPinsSetIfFunction + } + interface IHelmetXssFilterConfiguration { setOnOldIE? : boolean; } @@ -107,7 +120,7 @@ declare module "helmet" { * @summary Adds the "Public-Key-Pins" header. * @return {RequestHandler} The Request handler. */ - publicKeyPins(options ?: Object):express.RequestHandler; + publicKeyPins(options ?: IHelmetPublicKeyPinsConfiguration):express.RequestHandler; /** * @summary Mitigate cross-site scripting attacks with the "X-XSS-Protection" header. From cc42f09bd1dcb1f67af59d77e53e0b06b352fd67 Mon Sep 17 00:00:00 2001 From: Abhishek Garg Date: Sat, 23 Apr 2016 11:43:50 +0530 Subject: [PATCH 05/65] Add missing option for expandable (#8989) * Add missing option for expandable Add missing grid option `expandableRowScope` for expandable grid * Added ng.IScope type for expandableRowScope --- ui-grid/ui-grid.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index 4501720b6d..4bc6569007 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -1511,6 +1511,10 @@ declare namespace uiGrid { * Defaults to 150 */ expandableRowHeight?: number; + /** + * reference to the parent grid scope (the parent scope of the sub-grid element) + */ + expandableRowScope?: ng.IScope | Object; /** * Mandatory. The template for your expanded row */ From fa4c2305803da0d32de8604f2d11ef5c48fde04c Mon Sep 17 00:00:00 2001 From: Thomas Hourlier Date: Fri, 22 Apr 2016 23:19:41 -0700 Subject: [PATCH 06/65] Add createMemoryHistory to react-router. (#8728) Since the version 2.0.0, react-router exports createMemoryHistory. --- react-router/react-router-tests.tsx | 2 +- react-router/react-router.d.ts | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/react-router/react-router-tests.tsx b/react-router/react-router-tests.tsx index 703ce4a9f6..b31924908f 100644 --- a/react-router/react-router-tests.tsx +++ b/react-router/react-router-tests.tsx @@ -8,7 +8,7 @@ import * as React from "react" import * as ReactDOM from "react-dom" -import { browserHistory, hashHistory, Router, Route, IndexRoute, Link } from "react-router" +import { browserHistory, hashHistory, createMemoryHistory, Router, Route, IndexRoute, Link } from "react-router" interface MasterContext { router: ReactRouter.RouterOnContext; diff --git a/react-router/react-router.d.ts b/react-router/react-router.d.ts index 357490e603..2209bf3408 100644 --- a/react-router/react-router.d.ts +++ b/react-router/react-router.d.ts @@ -86,6 +86,8 @@ declare namespace ReactRouter { const browserHistory: History; const hashHistory: History; + function createMemoryHistory(options?: H.HistoryOptions): H.History + /* components */ interface RouterProps extends React.Props { @@ -412,6 +414,9 @@ declare module "react-router/lib/useRouterHistory" { export default function useRouterHistory(createHistory: HistoryModule.CreateHistory): CreateRouterHistory; } +declare module "react-router/lib/createMemoryHistory" { + export default ReactRouter.createMemoryHistory; +} declare module "react-router" { @@ -453,6 +458,8 @@ declare module "react-router" { import useRouterHistory from "react-router/lib/useRouterHistory"; + import createMemoryHistory from "react-router/lib/createMemoryHistory"; + // PlainRoute is defined in the API documented at: // https://github.com/rackt/react-router/blob/master/docs/API.md // but not included in any of the .../lib modules above. @@ -492,7 +499,8 @@ declare module "react-router" { RouterContext, PropTypes, match, - useRouterHistory + useRouterHistory, + createMemoryHistory } export default Router From 0754cc639a1354a5f52df45c1fd1b0293b90224d Mon Sep 17 00:00:00 2001 From: yortus Date: Sat, 23 Apr 2016 14:21:08 +0800 Subject: [PATCH 07/65] Initial typings for babel v6 (#9031) * add babel v6 definitions (6 modules) - babel-core - babel-generator - babel-template - babel-traverse - babel-types - babylon * fix failing tests - remove nullable annotations (not supported in tsc1.8.7) - explicit 'any' - remove property type guard (not supported in tsc1.8.7) --- babel-core/babel-core-tests.ts | 32 + babel-core/babel-core.d.ts | 144 +++ babel-generator/babel-generator-tests.ts | 27 + babel-generator/babel-generator.d.ts | 102 ++ babel-template/babel-template-tests.ts | 21 + babel-template/babel-template.d.ts | 21 + babel-traverse/babel-traverse-tests.ts | 111 ++ babel-traverse/babel-traverse.d.ts | 966 +++++++++++++++ babel-types/babel-types-tests.ts | 26 + babel-types/babel-types.d.ts | 1403 ++++++++++++++++++++++ babylon/babylon-tests.ts | 24 + babylon/babylon.d.ts | 48 + 12 files changed, 2925 insertions(+) create mode 100644 babel-core/babel-core-tests.ts create mode 100644 babel-core/babel-core.d.ts create mode 100644 babel-generator/babel-generator-tests.ts create mode 100644 babel-generator/babel-generator.d.ts create mode 100644 babel-template/babel-template-tests.ts create mode 100644 babel-template/babel-template.d.ts create mode 100644 babel-traverse/babel-traverse-tests.ts create mode 100644 babel-traverse/babel-traverse.d.ts create mode 100644 babel-types/babel-types-tests.ts create mode 100644 babel-types/babel-types.d.ts create mode 100644 babylon/babylon-tests.ts create mode 100644 babylon/babylon.d.ts diff --git a/babel-core/babel-core-tests.ts b/babel-core/babel-core-tests.ts new file mode 100644 index 0000000000..e564b9d81e --- /dev/null +++ b/babel-core/babel-core-tests.ts @@ -0,0 +1,32 @@ +/// +import * as babel from "babel-core"; + + +// Example from https://github.com/babel/babel/tree/master/packages/babel-core +const code = `class Example {}`; +const result = babel.transform(code, { /* options */ }); +result.code; // Generated code +result.map; // Sourcemap +result.ast; // AST + + +// Examples from http://babeljs.io/docs/usage/api/ +let options: babel.TransformOptions = { + plugins: [ + "es2015-arrow-functions", + "es2015-block-scoped-functions", + "es2015-block-scoping", + "es2015-classes", + ], + only: /.*\.js/, + ast: false, + sourceMaps: true +}; + +babel.transformFile("filename.js", options, function (err, result) { + result.code; + result.map; + result.ast; +}); + +babel.transformFileSync("filename.js", options).code; diff --git a/babel-core/babel-core.d.ts b/babel-core/babel-core.d.ts new file mode 100644 index 0000000000..19146e65e0 --- /dev/null +++ b/babel-core/babel-core.d.ts @@ -0,0 +1,144 @@ +// Type definitions for babel-core v6.7 +// Project: https://github.com/babel/babel/tree/master/packages/babel-core +// Definitions by: Troy Gerwien +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// +/// + +declare module "babel-core" { + import * as t from 'babel-types'; + export {t as types}; + type Node = t.Node; + export import template = require('babel-template'); + export var version: string; + import traverse, {Visitor} from "babel-traverse"; + export {traverse, Visitor}; + + + /** Transforms the passed in `code`. Returning an object with the generated code, source map, and AST. */ + export function transform(code: string, opts?: TransformOptions): BabelFileResult; + + /** Asynchronously transforms the entire contents of a file. */ + export function transformFile(filename: string, opts: TransformOptions, callback: (err: any, result: BabelFileResult) => void): void; + + /** Synchronous version of `babel.transformFile`. Returns the transformed contents of the `filename`. */ + export function transformFileSync(filename: string, opts?: TransformOptions): BabelFileResult; + + export function transformFromAst(ast: Node, code?: string, opts?: TransformOptions): BabelFileResult; + + export interface TransformOptions { + + /** Filename to use when reading from stdin - this will be used in source-maps, errors etc. Default: "unknown". */ + filename?: string; + + /** Filename relative to `sourceRoot`. */ + filenameRelative?: string; + + /** A source map object that the output source map will be based on. */ + inputSourceMap?: Object; + + /** + * This is an object of keys that represent different environments. For example, you may have: + * `{ env: { production: { / * specific options * / } } }` + * which will use those options when the enviroment variable `BABEL_ENV` is set to `"production"`. + * If `BABEL_ENV` isn't set then `NODE_ENV` will be used, if it's not set then it defaults to `"development"`. + */ + env?: Object; + + /** Retain line numbers - will result in really ugly code. Default: `false` */ + retainLines?: boolean; + + /** Enable/disable ANSI syntax highlighting of code frames. Default: `true`. */ + highlightCode?: boolean; + + /** List of presets (a set of plugins) to load and use. */ + presets?: any[]; + + /** List of plugins to load and use. */ + plugins?: any[]; + + /** list of glob paths to **not** compile. Opposite to the `only` option. */ + ignore?: string[]; + + /** + * A glob, regex, or mixed array of both, matching paths to only compile. Can also be an array of arrays containing + * paths to explicitly match. When attempting to compile a non-matching file it's returned verbatim. + */ + only?: string | RegExp | Array; + + /** Enable code generation. Default: `true`. */ + code?: boolean; + + /** Include the AST in the returned object. Default: `true`. */ + ast?: boolean; + + /** A path to an .babelrc file to extend. */ + extends?: string; + + /** write comments to generated output. Default: `true`. */ + comments?: boolean; + + /** + * An optional callback that controls whether a comment should be output or not. Called as + * `shouldPrintComment(commentContents)`. **NOTE**: This overrides the `comments` option when used. + */ + shouldPrintComment?: (comment: string) => boolean; + + /** + * Do not include superfluous whitespace characters and line terminators. When set to `"auto"`, `compact` is set to + * `true` on input sizes of >100KB. + */ + compact?: boolean | "auto"; + + /** + * If truthy, adds a `map` property to returned output. If set to `"inline"`, a comment with a `sourceMappingURL` + * directive is added to the bottom of the returned code. If set to `"both"` then a map property is returned as well + * as a source map comment appended. + */ + sourceMaps?: boolean | "inline" | "both"; + + /** Set `file` on returned source map. */ + sourceMapTarget?: string; + + /** Set `sources[0]` on returned source map. */ + sourceFileName?: string; + + /** The root from which all sources are relative. */ + sourceRoot?: string; + + /** Specify whether or not to use `.babelrc` and `.babelignore` files. Default: `true`. */ + babelrc?: boolean; + + /** Attach a comment before all non-user injected code. */ + auxiliaryCommentBefore?: string; + + /** Attach a comment after all non-user injected code. */ + auxiliaryCommentAfter?: string; + + /** + * Specify a custom callback to generate a module id with. Called as `getModuleId(moduleName)`. + * If falsy value is returned then the generated module id is used. + */ + getModuleId?: (moduleName: string) => string; + + /** Optional prefix for the AMD module formatter that will be prepend to the filename on module definitions. */ + moduleRoot?: string; + + /** + * If truthy, insert an explicit id for modules. By default, all modules are anonymous. + * (Not available for `common` modules). + */ + moduleIds?: boolean; + + /** Specify a custom name for module ids. */ + moduleId?: string; + } + + export interface BabelFileResult { + ast?: Node; + code?: string; + map?: Object; + } +} diff --git a/babel-generator/babel-generator-tests.ts b/babel-generator/babel-generator-tests.ts new file mode 100644 index 0000000000..33d10b5cd9 --- /dev/null +++ b/babel-generator/babel-generator-tests.ts @@ -0,0 +1,27 @@ +/// +/// + + +// Example from https://github.com/babel/babel/tree/master/packages/babel-generator +import {parse} from 'babylon'; +import generate from 'babel-generator'; + +const code = 'class Example {}'; +const ast = parse(code); + +ast.type; +ast.loc.start; + +const output = generate(ast, { /* options */ }, code); + + +// Example from https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babel-generator +let result = generate(ast, { + retainLines: false, + compact: "auto", + concise: false, + quotes: "double", + // ... +}, code); +result.code; +result.map; diff --git a/babel-generator/babel-generator.d.ts b/babel-generator/babel-generator.d.ts new file mode 100644 index 0000000000..aa8232e8b0 --- /dev/null +++ b/babel-generator/babel-generator.d.ts @@ -0,0 +1,102 @@ +// Type definitions for babel-generator v6.7 +// Project: https://github.com/babel/babel/tree/master/packages/babel-generator +// Definitions by: Troy Gerwien +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "babel-generator" { + import * as t from 'babel-types'; + type Node = t.Node; + + /** + * Turns an AST into code, maintaining sourcemaps, user preferences, and valid output. + * @param ast - the abstract syntax tree from which to generate output code. + * @param opts - used for specifying options for code generation. + * @param code - the original source code, used for source maps. + * @returns - an object containing the output code and source map. + */ + export default function generate(ast: Node, opts?: GeneratorOptions, code?: string | {[filename: string]: string}): GeneratorResult; + + export interface GeneratorOptions { + + /** + * Optional string to add as a block comment at the start of the output file. + */ + auxiliaryCommentBefore?: string; + + /** + * Optional string to add as a block comment at the end of the output file. + */ + auxiliaryCommentAfter?: string; + + /** + * Function that takes a comment (as a string) and returns true if the comment should be included in the output. + * By default, comments are included if `opts.comments` is `true` or if `opts.minifed` is `false` and the comment + * contains `@preserve` or `@license`. + */ + shouldPrintComment?: (comment: string) => boolean; + + /** + * Attempt to use the same line numbers in the output code as in the source code (helps preserve stack traces). + * Defaults to `false`. + */ + retainLines?: boolean; + + /** + * Should comments be included in output? Defaults to `true`. + */ + comments?: boolean; + + /** + * Set to true to avoid adding whitespace for formatting. Defaults to the value of `opts.minified`. + */ + compact?: boolean | 'auto'; + + /** + * Should the output be minified. Defaults to `false`. + */ + minified?: boolean; + + /** + * Set to true to reduce whitespace (but not as much as opts.compact). Defaults to `false`. + */ + concise?: boolean; + + /** + * The type of quote to use in the output. If omitted, autodetects based on `ast.tokens`. + */ + quotes?: 'single' | 'double'; + + /** + * Used in warning messages + */ + filename?: string; + + /** + * Enable generating source maps. Defaults to `false`. + */ + sourceMaps?: boolean; + + /** + * The filename of the generated code that the source map will be associated with. + */ + sourceMapTarget?: string; + + /** + * A root for all relative URLs in the source map. + */ + sourceRoot?: string; + + /** + * The filename for the source code (i.e. the code in the `code` argument). + * This will only be used if `code` is a string. + */ + sourceFileName?: string; + } + + export interface GeneratorResult { + map: Object; + code: string; + } +} diff --git a/babel-template/babel-template-tests.ts b/babel-template/babel-template-tests.ts new file mode 100644 index 0000000000..e0ae7497ff --- /dev/null +++ b/babel-template/babel-template-tests.ts @@ -0,0 +1,21 @@ +/// +/// +/// + + +// Example from https://github.com/babel/babel/tree/master/packages/babel-template +import template = require('babel-template'); +import generate from 'babel-generator'; +import * as t from 'babel-types'; + +const buildRequire = template(` + var IMPORT_NAME = require(SOURCE); +`); + +const ast = buildRequire({ + IMPORT_NAME: t.identifier('myModule'), + SOURCE: t.stringLiteral('my-module') +}); + +console.log(generate(ast).code); +// var myModule = require('my-module'); diff --git a/babel-template/babel-template.d.ts b/babel-template/babel-template.d.ts new file mode 100644 index 0000000000..7b3cafe7f4 --- /dev/null +++ b/babel-template/babel-template.d.ts @@ -0,0 +1,21 @@ +// Type definitions for babel-template v6.7 +// Project: https://github.com/babel/babel/tree/master/packages/babel-template +// Definitions by: Troy Gerwien +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + +declare module "babel-template" { + import {BabylonOptions} from 'babylon'; + import * as t from 'babel-types'; + type Node = t.Node; + + // NB: This export doesn't match the handbook example, where `template` is the default export. + // But it does match the runtime behaviour (at least at the time of this writing). For some reason, + // babel-template/lib/index.js has this line at the bottom: module.exports = exports["default"]; + export = template; + function template(code: string, opts?: BabylonOptions): UseTemplate; + + type UseTemplate = (nodes?: {[placeholder: string]: Node}) => Node; +} diff --git a/babel-traverse/babel-traverse-tests.ts b/babel-traverse/babel-traverse-tests.ts new file mode 100644 index 0000000000..fba04dfd5d --- /dev/null +++ b/babel-traverse/babel-traverse-tests.ts @@ -0,0 +1,111 @@ +/// +/// +/// + + +import * as babylon from "babylon"; +import traverse, {Visitor} from 'babel-traverse'; +import * as t from 'babel-types'; + + +// Examples from: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md +const MyVisitor: Visitor = { + Identifier: { + enter() { + console.log("Entered!"); + }, + exit() { + console.log("Exited!"); + } + } +}; + +const MyVisitor2: Visitor = { + Identifier(path) { + console.log("Visiting: " + path.node.name); + } +}; + + +// Example from https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babel-traverse +const code = `function square(n) { + return n * n; +}`; + +const ast = babylon.parse(code); + +traverse(ast, { + enter(path) { + let node = path.node; + if (t.isIdentifier(node) && node.name === "n") { + node.name = "x"; + } + } +}); + + +// Examples from https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#writing-your-first-babel-plugin + +const v1: Visitor = { + + BinaryExpression(path) { + if (t.isIdentifier(path.node.left)) { + // ... + } + path.replaceWith( + t.binaryExpression("**", path.node.left, t.numericLiteral(2)) + ); + path.parentPath.replaceWith( + t.expressionStatement(t.stringLiteral("Anyway the wind blows, doesn't really matter to me, to me.")) + ); + path.parentPath.remove(); + }, + + Identifier(path) { + if (path.isReferencedIdentifier()) { + // ... + } + if (t.isReferenced(path.node, path.parent)) { + // ... + } + }, + + ReturnStatement(path) { + path.replaceWithMultiple([ + t.expressionStatement(t.stringLiteral("Is this the real life?")), + t.expressionStatement(t.stringLiteral("Is this just fantasy?")), + t.expressionStatement(t.stringLiteral("(Enjoy singing the rest of the song in your head)")), + ]); + }, + + FunctionDeclaration(path, state) { + path.replaceWithSourceString(`function add(a, b) { + return a + b; + }`); + + path.insertBefore(t.expressionStatement(t.stringLiteral("Because I'm easy come, easy go."))); + path.insertAfter(t.expressionStatement(t.stringLiteral("A little high, little low."))); + path.remove(); + + if (path.scope.hasBinding("n")) { + // ... + } + if (path.scope.hasOwnBinding("n")) { + // ... + } + + let id1 = path.scope.generateUidIdentifier("uid"); + id1.type; + id1.name; + let id2 = path.scope.generateUidIdentifier("uid"); + id2.type; + id2.name; + + const id = path.scope.generateUidIdentifierBasedOnNode(path.node.id); + path.remove(); + path.scope.parent.push({ id, init: path.node }); + + path.scope.rename("n", "x"); + path.scope.rename("n"); + } +}; diff --git a/babel-traverse/babel-traverse.d.ts b/babel-traverse/babel-traverse.d.ts new file mode 100644 index 0000000000..17cbda2f23 --- /dev/null +++ b/babel-traverse/babel-traverse.d.ts @@ -0,0 +1,966 @@ +// Type definitions for babel-traverse v6.7 +// Project: https://github.com/babel/babel/tree/master/packages/babel-traverse +// Definitions by: Troy Gerwien +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "babel-traverse" { + import * as t from 'babel-types'; + type Node = t.Node; + + export default function traverse(parent: Node | Node[], opts?: TraverseOptions, scope?: Scope, state?: any, parentPath?: NodePath): void; + + export interface TraverseOptions extends Visitor { + scope?: Scope; + noScope?: boolean; + } + + export class Scope { + constructor(path: NodePath, parentScope?: Scope); + path: NodePath; + block: Node; + parentBlock: Node; + parent: Scope; + hub: Hub; + bindings: { [name: string]: Binding; }; + + /** Traverse node with current scope and path. */ + traverse(node: Node | Node[], opts?: TraverseOptions, state?: any): void; + + /** Generate a unique identifier and add it to the current scope. */ + generateDeclaredUidIdentifier(name?: string): t.Identifier; + + /** Generate a unique identifier. */ + generateUidIdentifier(name?: string): t.Identifier; + + /** Generate a unique `_id1` binding. */ + generateUid(name?: string): string; + + /** Generate a unique identifier based on a node. */ + generateUidIdentifierBasedOnNode(parent: Node, defaultName?: string): t.Identifier; + + /** + * Determine whether evaluating the specific input `node` is a consequenceless reference. ie. + * evaluating it wont result in potentially arbitrary code from being ran. The following are + * whitelisted and determined not to cause side effects: + * + * - `this` expressions + * - `super` expressions + * - Bound identifiers + */ + isStatic(node: Node): boolean; + + /** Possibly generate a memoised identifier if it is not static and has consequences. */ + maybeGenerateMemoised(node: Node, dontPush?: boolean): t.Identifier; + + checkBlockScopedCollisions(local: Node, kind: string, name: string, id: Object): void; + + rename(oldName: string, newName?: string, block?: Node): void; + + dump(): void; + + toArray(node: Node, i?: number): Node; + + registerDeclaration(path: NodePath): void; + + buildUndefinedNode(): Node; + + registerConstantViolation(path: NodePath): void; + + registerBinding(kind: string, path: NodePath, bindingPath?: NodePath): void; + + addGlobal(node: Node): void; + + hasUid(name: string): boolean; + + hasGlobal(name: string): boolean; + + hasReference(name: string): boolean; + + isPure(node: Node, constantsOnly?: boolean): boolean; + + setData(key: string, val: any): any; + + getData(key: string): any; + + removeData(key: string): void; + + push(opts: any): void; + + getProgramParent(): Scope; + + getFunctionParent(): Scope; + + getBlockParent(): Scope; + + /** Walks the scope tree and gathers **all** bindings. */ + getAllBindings(...kinds: string[]): Object; + + bindingIdentifierEquals(name: string, node: Node): boolean; + + getBinding(name: string): Binding; + + getOwnBinding(name: string): Binding; + + getBindingIdentifier(name: string): t.Identifier; + + getOwnBindingIdentifier(name: string): t.Identifier; + + hasOwnBinding(name: string): boolean; + + hasBinding(name: string, noGlobals?: boolean): boolean; + + parentHasBinding(name: string, noGlobals?: boolean): boolean; + + /** Move a binding of `name` to another `scope`. */ + moveBindingTo(name: string, scope: Scope): void; + + removeOwnBinding(name: string): void; + + removeBinding(name: string): void; + } + + export class Binding { + constructor(opts: { existing: Binding; identifier: t.Identifier; scope: Scope; path: NodePath; kind: 'var' | 'let' | 'const'; }); + identifier: t.Identifier; + scope: Scope; + path: NodePath; + kind: 'var' | 'let' | 'const'; + referenced: boolean; + references: number; + referencePaths: NodePath[]; + constant: boolean; + constantViolations: NodePath[]; + } + + export interface Visitor extends VisitNodeObject { + ArrayExpression?: VisitNode; + AssignmentExpression?: VisitNode; + LVal?: VisitNode; + Expression?: VisitNode; + BinaryExpression?: VisitNode; + Directive?: VisitNode; + DirectiveLiteral?: VisitNode; + BlockStatement?: VisitNode; + BreakStatement?: VisitNode; + Identifier?: VisitNode; + CallExpression?: VisitNode; + CatchClause?: VisitNode; + ConditionalExpression?: VisitNode; + ContinueStatement?: VisitNode; + DebuggerStatement?: VisitNode; + DoWhileStatement?: VisitNode; + Statement?: VisitNode; + EmptyStatement?: VisitNode; + ExpressionStatement?: VisitNode; + File?: VisitNode; + Program?: VisitNode; + ForInStatement?: VisitNode; + VariableDeclaration?: VisitNode; + ForStatement?: VisitNode; + FunctionDeclaration?: VisitNode; + FunctionExpression?: VisitNode; + IfStatement?: VisitNode; + LabeledStatement?: VisitNode; + StringLiteral?: VisitNode; + NumericLiteral?: VisitNode; + NullLiteral?: VisitNode; + BooleanLiteral?: VisitNode; + RegExpLiteral?: VisitNode; + LogicalExpression?: VisitNode; + MemberExpression?: VisitNode; + NewExpression?: VisitNode; + ObjectExpression?: VisitNode; + ObjectMethod?: VisitNode; + ObjectProperty?: VisitNode; + RestElement?: VisitNode; + ReturnStatement?: VisitNode; + SequenceExpression?: VisitNode; + SwitchCase?: VisitNode; + SwitchStatement?: VisitNode; + ThisExpression?: VisitNode; + ThrowStatement?: VisitNode; + TryStatement?: VisitNode; + UnaryExpression?: VisitNode; + UpdateExpression?: VisitNode; + VariableDeclarator?: VisitNode; + WhileStatement?: VisitNode; + WithStatement?: VisitNode; + AssignmentPattern?: VisitNode; + ArrayPattern?: VisitNode; + ArrowFunctionExpression?: VisitNode; + ClassBody?: VisitNode; + ClassDeclaration?: VisitNode; + ClassExpression?: VisitNode; + ExportAllDeclaration?: VisitNode; + ExportDefaultDeclaration?: VisitNode; + ExportNamedDeclaration?: VisitNode; + Declaration?: VisitNode; + ExportSpecifier?: VisitNode; + ForOfStatement?: VisitNode; + ImportDeclaration?: VisitNode; + ImportDefaultSpecifier?: VisitNode; + ImportNamespaceSpecifier?: VisitNode; + ImportSpecifier?: VisitNode; + MetaProperty?: VisitNode; + ClassMethod?: VisitNode; + ObjectPattern?: VisitNode; + SpreadElement?: VisitNode; + Super?: VisitNode; + TaggedTemplateExpression?: VisitNode; + TemplateLiteral?: VisitNode; + TemplateElement?: VisitNode; + YieldExpression?: VisitNode; + AnyTypeAnnotation?: VisitNode; + ArrayTypeAnnotation?: VisitNode; + BooleanTypeAnnotation?: VisitNode; + BooleanLiteralTypeAnnotation?: VisitNode; + NullLiteralTypeAnnotation?: VisitNode; + ClassImplements?: VisitNode; + ClassProperty?: VisitNode; + DeclareClass?: VisitNode; + DeclareFunction?: VisitNode; + DeclareInterface?: VisitNode; + DeclareModule?: VisitNode; + DeclareTypeAlias?: VisitNode; + DeclareVariable?: VisitNode; + ExistentialTypeParam?: VisitNode; + FunctionTypeAnnotation?: VisitNode; + FunctionTypeParam?: VisitNode; + GenericTypeAnnotation?: VisitNode; + InterfaceExtends?: VisitNode; + InterfaceDeclaration?: VisitNode; + IntersectionTypeAnnotation?: VisitNode; + MixedTypeAnnotation?: VisitNode; + NullableTypeAnnotation?: VisitNode; + NumericLiteralTypeAnnotation?: VisitNode; + NumberTypeAnnotation?: VisitNode; + StringLiteralTypeAnnotation?: VisitNode; + StringTypeAnnotation?: VisitNode; + ThisTypeAnnotation?: VisitNode; + TupleTypeAnnotation?: VisitNode; + TypeofTypeAnnotation?: VisitNode; + TypeAlias?: VisitNode; + TypeAnnotation?: VisitNode; + TypeCastExpression?: VisitNode; + TypeParameterDeclaration?: VisitNode; + TypeParameterInstantiation?: VisitNode; + ObjectTypeAnnotation?: VisitNode; + ObjectTypeCallProperty?: VisitNode; + ObjectTypeIndexer?: VisitNode; + ObjectTypeProperty?: VisitNode; + QualifiedTypeIdentifier?: VisitNode; + UnionTypeAnnotation?: VisitNode; + VoidTypeAnnotation?: VisitNode; + JSXAttribute?: VisitNode; + JSXIdentifier?: VisitNode; + JSXNamespacedName?: VisitNode; + JSXElement?: VisitNode; + JSXExpressionContainer?: VisitNode; + JSXClosingElement?: VisitNode; + JSXMemberExpression?: VisitNode; + JSXOpeningElement?: VisitNode; + JSXEmptyExpression?: VisitNode; + JSXSpreadAttribute?: VisitNode; + JSXText?: VisitNode; + Noop?: VisitNode; + ParenthesizedExpression?: VisitNode; + AwaitExpression?: VisitNode; + BindExpression?: VisitNode; + Decorator?: VisitNode; + DoExpression?: VisitNode; + ExportDefaultSpecifier?: VisitNode; + ExportNamespaceSpecifier?: VisitNode; + RestProperty?: VisitNode; + SpreadProperty?: VisitNode; + Binary?: VisitNode; + Scopable?: VisitNode; + BlockParent?: VisitNode; + Block?: VisitNode; + Terminatorless?: VisitNode; + CompletionStatement?: VisitNode; + Conditional?: VisitNode; + Loop?: VisitNode; + While?: VisitNode; + ExpressionWrapper?: VisitNode; + For?: VisitNode; + ForXStatement?: VisitNode; + Function?: VisitNode; + FunctionParent?: VisitNode; + Pureish?: VisitNode; + Literal?: VisitNode; + Immutable?: VisitNode; + UserWhitespacable?: VisitNode; + Method?: VisitNode; + ObjectMember?: VisitNode; + Property?: VisitNode; + UnaryLike?: VisitNode; + Pattern?: VisitNode; + Class?: VisitNode; + ModuleDeclaration?: VisitNode; + ExportDeclaration?: VisitNode; + ModuleSpecifier?: VisitNode; + Flow?: VisitNode; + FlowBaseAnnotation?: VisitNode; + FlowDeclaration?: VisitNode; + JSX?: VisitNode; + } + + export type VisitNode = VisitNodeFunction | VisitNodeObject; + + export type VisitNodeFunction = (path: NodePath, state: any) => void; + + export interface VisitNodeObject { + enter?(path: NodePath, state: any): void; + exit?(path: NodePath, state: any): void; + } + + export class NodePath { + constructor(hub: Hub, parent: Node); + parent: Node; + hub: Hub; + contexts: TraversalContext[]; + data: Object; + shouldSkip: boolean; + shouldStop: boolean; + removed: boolean; + state: any; + opts: Object; + skipKeys: Object; + parentPath: NodePath; + context: TraversalContext; + container: Object | Object[]; + listKey: string; + inList: boolean; + parentKey: string; + key: string; + node: T; + scope: Scope; + type: string; + typeAnnotation: Object; + + getScope(scope: Scope): Scope; + + setData(key: string, val: any): any; + + getData(key: string, def?: any): any; + + buildCodeFrameError(msg: string, Error: Error): Error; + + traverse(visitor: Visitor, state?: any): void; + + set(key: string, node: Node): void; + + getPathLocation(): string; + + debug(buildMessage: Function): void; + + // ------------------------- ancestry ------------------------- + /** + * Call the provided `callback` with the `NodePath`s of all the parents. + * When the `callback` returns a truthy value, we return that node path. + */ + findParent(callback: (path: NodePath) => boolean): NodePath; + + find(callback: (path: NodePath) => boolean): NodePath; + + /** Get the parent function of the current path. */ + getFunctionParent(): NodePath; + + /** Walk up the tree until we hit a parent node path in a list. */ + getStatementParent(): NodePath; + + /** + * Get the deepest common ancestor and then from it, get the earliest relationship path + * to that ancestor. + * + * Earliest is defined as being "before" all the other nodes in terms of list container + * position and visiting key. + */ + getEarliestCommonAncestorFrom(paths: NodePath[]): NodePath; + + /** Get the earliest path in the tree where the provided `paths` intersect. */ + getDeepestCommonAncestorFrom(paths: NodePath[], filter?: Function): NodePath; + + /** + * Build an array of node paths containing the entire ancestry of the current node path. + * + * NOTE: The current node path is included in this. + */ + getAncestry(): NodePath[]; + + inType(...candidateTypes: string[]): boolean; + + // ------------------------- inference ------------------------- + /** Infer the type of the current `NodePath`. */ + getTypeAnnotation(): t.FlowTypeAnnotation; + + isBaseType(baseName: string, soft?: boolean): boolean; + + couldBeBaseType(name: string): boolean; + + baseTypeStrictlyMatches(right: NodePath): boolean; + + isGenericType(genericName: string): boolean; + + // ------------------------- replacement ------------------------- + /** + * Replace a node with an array of multiple. This method performs the following steps: + * + * - Inherit the comments of first provided node with that of the current node. + * - Insert the provided nodes after the current node. + * - Remove the current node. + */ + replaceWithMultiple(nodes: Node[]): void; + + /** + * Parse a string as an expression and replace the current node with the result. + * + * NOTE: This is typically not a good idea to use. Building source strings when + * transforming ASTs is an antipattern and SHOULD NOT be encouraged. Even if it's + * easier to use, your transforms will be extremely brittle. + */ + replaceWithSourceString(replacement: any): void; + + /** Replace the current node with another. */ + replaceWith(replacement: Node | NodePath): void; + + /** + * This method takes an array of statements nodes and then explodes it + * into expressions. This method retains completion records which is + * extremely important to retain original semantics. + */ + replaceExpressionWithStatements(nodes: Node[]): Node; + + replaceInline(nodes: Node | Node[]): void; + + // ------------------------- evaluation ------------------------- + /** + * Walk the input `node` and statically evaluate if it's truthy. + * + * Returning `true` when we're sure that the expression will evaluate to a + * truthy value, `false` if we're sure that it will evaluate to a falsy + * value and `undefined` if we aren't sure. Because of this please do not + * rely on coercion when using this method and check with === if it's false. + */ + evaluateTruthy(): boolean; + + /** + * Walk the input `node` and statically evaluate it. + * + * Returns an object in the form `{ confident, value }`. `confident` indicates + * whether or not we had to drop out of evaluating the expression because of + * hitting an unknown node that we couldn't confidently find the value of. + * + * Example: + * + * t.evaluate(parse("5 + 5")) // { confident: true, value: 10 } + * t.evaluate(parse("!true")) // { confident: true, value: false } + * t.evaluate(parse("foo + foo")) // { confident: false, value: undefined } + */ + evaluate(): { confident: boolean; value: any }; + + // ------------------------- introspection ------------------------- + /** + * Match the current node if it matches the provided `pattern`. + * + * For example, given the match `React.createClass` it would match the + * parsed nodes of `React.createClass` and `React["createClass"]`. + */ + matchesPattern(pattern: string, allowPartial?: boolean): boolean; + + /** + * Check whether we have the input `key`. If the `key` references an array then we check + * if the array has any items, otherwise we just check if it's falsy. + */ + has(key: string): boolean; + + isStatic(): boolean; + + /** Alias of `has`. */ + is(key: string): boolean; + + /** Opposite of `has`. */ + isnt(key: string): boolean; + + /** Check whether the path node `key` strict equals `value`. */ + equals(key: string, value: any): boolean; + + /** + * Check the type against our stored internal type of the node. This is handy when a node has + * been removed yet we still internally know the type and need it to calculate node replacement. + */ + isNodeType(type: string): boolean; + + /** + * This checks whether or not we're in one of the following positions: + * + * for (KEY in right); + * for (KEY;;); + * + * This is because these spots allow VariableDeclarations AND normal expressions so we need + * to tell the path replacement that it's ok to replace this with an expression. + */ + canHaveVariableDeclarationOrExpression(): boolean; + + /** + * This checks whether we are swapping an arrow function's body between an + * expression and a block statement (or vice versa). + * + * This is because arrow functions may implicitly return an expression, which + * is the same as containing a block statement. + */ + canSwapBetweenExpressionAndStatement(replacement: Node): boolean; + + /** Check whether the current path references a completion record */ + isCompletionRecord(allowInsideFunction?: boolean): boolean; + + /** + * Check whether or not the current `key` allows either a single statement or block statement + * so we can explode it if necessary. + */ + isStatementOrBlock(): boolean; + + /** Check if the currently assigned path references the `importName` of `moduleSource`. */ + referencesImport(moduleSource: string, importName: string): boolean; + + /** Get the source code associated with this node. */ + getSource(): string; + + // ------------------------- context ------------------------- + call(key: string): boolean; + + isBlacklisted(): boolean; + + visit(): boolean; + + skip(): void; + + skipKey(key: string): void; + + stop(): void; + + setScope(): void; + + setContext(context: TraversalContext): NodePath; + + popContext(): void; + + pushContext(context: TraversalContext): void; + + // ------------------------- removal ------------------------- + remove(): void; + + // ------------------------- modification ------------------------- + /** Insert the provided nodes before the current one. */ + insertBefore(nodes: Node | Node[]): any; + + /** + * Insert the provided nodes after the current one. When inserting nodes after an + * expression, ensure that the completion record is correct by pushing the current node. + */ + insertAfter(nodes: Node | Node[]): any; + + /** Update all sibling node paths after `fromIndex` by `incrementBy`. */ + updateSiblingKeys(fromIndex: number, incrementBy: number): void; + + /** Hoist the current node to the highest scope possible and return a UID referencing it. */ + hoist(scope: Scope): void; + + // ------------------------- family ------------------------- + getStatementParent(): NodePath; + + getOpposite(): NodePath; + + getCompletionRecords(): NodePath[]; + + getSibling(key: string): NodePath; + + get(key: string, context?: boolean | TraversalContext): NodePath; + + getBindingIdentifiers(duplicates?: boolean): Node[]; + + getOuterBindingIdentifiers(duplicates?: boolean): Node[]; + + // ------------------------- comments ------------------------- + /** Share comments amongst siblings. */ + shareCommentsWithSiblings(): void; + + addComment(type: string, content: string, line?: boolean): void; + + /** Give node `comments` of the specified `type`. */ + addComments(type: string, comments: any[]): void; + + // ------------------------- isXXX ------------------------- + isArrayExpression(opts?: Object): boolean; + isAssignmentExpression(opts?: Object): boolean; + isBinaryExpression(opts?: Object): boolean; + isDirective(opts?: Object): boolean; + isDirectiveLiteral(opts?: Object): boolean; + isBlockStatement(opts?: Object): boolean; + isBreakStatement(opts?: Object): boolean; + isCallExpression(opts?: Object): boolean; + isCatchClause(opts?: Object): boolean; + isConditionalExpression(opts?: Object): boolean; + isContinueStatement(opts?: Object): boolean; + isDebuggerStatement(opts?: Object): boolean; + isDoWhileStatement(opts?: Object): boolean; + isEmptyStatement(opts?: Object): boolean; + isExpressionStatement(opts?: Object): boolean; + isFile(opts?: Object): boolean; + isForInStatement(opts?: Object): boolean; + isForStatement(opts?: Object): boolean; + isFunctionDeclaration(opts?: Object): boolean; + isFunctionExpression(opts?: Object): boolean; + isIdentifier(opts?: Object): boolean; + isIfStatement(opts?: Object): boolean; + isLabeledStatement(opts?: Object): boolean; + isStringLiteral(opts?: Object): boolean; + isNumericLiteral(opts?: Object): boolean; + isNullLiteral(opts?: Object): boolean; + isBooleanLiteral(opts?: Object): boolean; + isRegExpLiteral(opts?: Object): boolean; + isLogicalExpression(opts?: Object): boolean; + isMemberExpression(opts?: Object): boolean; + isNewExpression(opts?: Object): boolean; + isProgram(opts?: Object): boolean; + isObjectExpression(opts?: Object): boolean; + isObjectMethod(opts?: Object): boolean; + isObjectProperty(opts?: Object): boolean; + isRestElement(opts?: Object): boolean; + isReturnStatement(opts?: Object): boolean; + isSequenceExpression(opts?: Object): boolean; + isSwitchCase(opts?: Object): boolean; + isSwitchStatement(opts?: Object): boolean; + isThisExpression(opts?: Object): boolean; + isThrowStatement(opts?: Object): boolean; + isTryStatement(opts?: Object): boolean; + isUnaryExpression(opts?: Object): boolean; + isUpdateExpression(opts?: Object): boolean; + isVariableDeclaration(opts?: Object): boolean; + isVariableDeclarator(opts?: Object): boolean; + isWhileStatement(opts?: Object): boolean; + isWithStatement(opts?: Object): boolean; + isAssignmentPattern(opts?: Object): boolean; + isArrayPattern(opts?: Object): boolean; + isArrowFunctionExpression(opts?: Object): boolean; + isClassBody(opts?: Object): boolean; + isClassDeclaration(opts?: Object): boolean; + isClassExpression(opts?: Object): boolean; + isExportAllDeclaration(opts?: Object): boolean; + isExportDefaultDeclaration(opts?: Object): boolean; + isExportNamedDeclaration(opts?: Object): boolean; + isExportSpecifier(opts?: Object): boolean; + isForOfStatement(opts?: Object): boolean; + isImportDeclaration(opts?: Object): boolean; + isImportDefaultSpecifier(opts?: Object): boolean; + isImportNamespaceSpecifier(opts?: Object): boolean; + isImportSpecifier(opts?: Object): boolean; + isMetaProperty(opts?: Object): boolean; + isClassMethod(opts?: Object): boolean; + isObjectPattern(opts?: Object): boolean; + isSpreadElement(opts?: Object): boolean; + isSuper(opts?: Object): boolean; + isTaggedTemplateExpression(opts?: Object): boolean; + isTemplateElement(opts?: Object): boolean; + isTemplateLiteral(opts?: Object): boolean; + isYieldExpression(opts?: Object): boolean; + isAnyTypeAnnotation(opts?: Object): boolean; + isArrayTypeAnnotation(opts?: Object): boolean; + isBooleanTypeAnnotation(opts?: Object): boolean; + isBooleanLiteralTypeAnnotation(opts?: Object): boolean; + isNullLiteralTypeAnnotation(opts?: Object): boolean; + isClassImplements(opts?: Object): boolean; + isClassProperty(opts?: Object): boolean; + isDeclareClass(opts?: Object): boolean; + isDeclareFunction(opts?: Object): boolean; + isDeclareInterface(opts?: Object): boolean; + isDeclareModule(opts?: Object): boolean; + isDeclareTypeAlias(opts?: Object): boolean; + isDeclareVariable(opts?: Object): boolean; + isExistentialTypeParam(opts?: Object): boolean; + isFunctionTypeAnnotation(opts?: Object): boolean; + isFunctionTypeParam(opts?: Object): boolean; + isGenericTypeAnnotation(opts?: Object): boolean; + isInterfaceExtends(opts?: Object): boolean; + isInterfaceDeclaration(opts?: Object): boolean; + isIntersectionTypeAnnotation(opts?: Object): boolean; + isMixedTypeAnnotation(opts?: Object): boolean; + isNullableTypeAnnotation(opts?: Object): boolean; + isNumericLiteralTypeAnnotation(opts?: Object): boolean; + isNumberTypeAnnotation(opts?: Object): boolean; + isStringLiteralTypeAnnotation(opts?: Object): boolean; + isStringTypeAnnotation(opts?: Object): boolean; + isThisTypeAnnotation(opts?: Object): boolean; + isTupleTypeAnnotation(opts?: Object): boolean; + isTypeofTypeAnnotation(opts?: Object): boolean; + isTypeAlias(opts?: Object): boolean; + isTypeAnnotation(opts?: Object): boolean; + isTypeCastExpression(opts?: Object): boolean; + isTypeParameterDeclaration(opts?: Object): boolean; + isTypeParameterInstantiation(opts?: Object): boolean; + isObjectTypeAnnotation(opts?: Object): boolean; + isObjectTypeCallProperty(opts?: Object): boolean; + isObjectTypeIndexer(opts?: Object): boolean; + isObjectTypeProperty(opts?: Object): boolean; + isQualifiedTypeIdentifier(opts?: Object): boolean; + isUnionTypeAnnotation(opts?: Object): boolean; + isVoidTypeAnnotation(opts?: Object): boolean; + isJSXAttribute(opts?: Object): boolean; + isJSXClosingElement(opts?: Object): boolean; + isJSXElement(opts?: Object): boolean; + isJSXEmptyExpression(opts?: Object): boolean; + isJSXExpressionContainer(opts?: Object): boolean; + isJSXIdentifier(opts?: Object): boolean; + isJSXMemberExpression(opts?: Object): boolean; + isJSXNamespacedName(opts?: Object): boolean; + isJSXOpeningElement(opts?: Object): boolean; + isJSXSpreadAttribute(opts?: Object): boolean; + isJSXText(opts?: Object): boolean; + isNoop(opts?: Object): boolean; + isParenthesizedExpression(opts?: Object): boolean; + isAwaitExpression(opts?: Object): boolean; + isBindExpression(opts?: Object): boolean; + isDecorator(opts?: Object): boolean; + isDoExpression(opts?: Object): boolean; + isExportDefaultSpecifier(opts?: Object): boolean; + isExportNamespaceSpecifier(opts?: Object): boolean; + isRestProperty(opts?: Object): boolean; + isSpreadProperty(opts?: Object): boolean; + isExpression(opts?: Object): boolean; + isBinary(opts?: Object): boolean; + isScopable(opts?: Object): boolean; + isBlockParent(opts?: Object): boolean; + isBlock(opts?: Object): boolean; + isStatement(opts?: Object): boolean; + isTerminatorless(opts?: Object): boolean; + isCompletionStatement(opts?: Object): boolean; + isConditional(opts?: Object): boolean; + isLoop(opts?: Object): boolean; + isWhile(opts?: Object): boolean; + isExpressionWrapper(opts?: Object): boolean; + isFor(opts?: Object): boolean; + isForXStatement(opts?: Object): boolean; + isFunction(opts?: Object): boolean; + isFunctionParent(opts?: Object): boolean; + isPureish(opts?: Object): boolean; + isDeclaration(opts?: Object): boolean; + isLVal(opts?: Object): boolean; + isLiteral(opts?: Object): boolean; + isImmutable(opts?: Object): boolean; + isUserWhitespacable(opts?: Object): boolean; + isMethod(opts?: Object): boolean; + isObjectMember(opts?: Object): boolean; + isProperty(opts?: Object): boolean; + isUnaryLike(opts?: Object): boolean; + isPattern(opts?: Object): boolean; + isClass(opts?: Object): boolean; + isModuleDeclaration(opts?: Object): boolean; + isExportDeclaration(opts?: Object): boolean; + isModuleSpecifier(opts?: Object): boolean; + isFlow(opts?: Object): boolean; + isFlowBaseAnnotation(opts?: Object): boolean; + isFlowDeclaration(opts?: Object): boolean; + isJSX(opts?: Object): boolean; + isNumberLiteral(opts?: Object): boolean; + isRegexLiteral(opts?: Object): boolean; + isReferencedIdentifier(opts?: Object): boolean; + isReferencedMemberExpression(opts?: Object): boolean; + isBindingIdentifier(opts?: Object): boolean; + isScope(opts?: Object): boolean; + isReferenced(opts?: Object): boolean; + isBlockScoped(opts?: Object): boolean; + isVar(opts?: Object): boolean; + isUser(opts?: Object): boolean; + isGenerated(opts?: Object): boolean; + isPure(opts?: Object): boolean; + + // ------------------------- assertXXX ------------------------- + assertArrayExpression(opts?: Object): void; + assertAssignmentExpression(opts?: Object): void; + assertBinaryExpression(opts?: Object): void; + assertDirective(opts?: Object): void; + assertDirectiveLiteral(opts?: Object): void; + assertBlockStatement(opts?: Object): void; + assertBreakStatement(opts?: Object): void; + assertCallExpression(opts?: Object): void; + assertCatchClause(opts?: Object): void; + assertConditionalExpression(opts?: Object): void; + assertContinueStatement(opts?: Object): void; + assertDebuggerStatement(opts?: Object): void; + assertDoWhileStatement(opts?: Object): void; + assertEmptyStatement(opts?: Object): void; + assertExpressionStatement(opts?: Object): void; + assertFile(opts?: Object): void; + assertForInStatement(opts?: Object): void; + assertForStatement(opts?: Object): void; + assertFunctionDeclaration(opts?: Object): void; + assertFunctionExpression(opts?: Object): void; + assertIdentifier(opts?: Object): void; + assertIfStatement(opts?: Object): void; + assertLabeledStatement(opts?: Object): void; + assertStringLiteral(opts?: Object): void; + assertNumericLiteral(opts?: Object): void; + assertNullLiteral(opts?: Object): void; + assertBooleanLiteral(opts?: Object): void; + assertRegExpLiteral(opts?: Object): void; + assertLogicalExpression(opts?: Object): void; + assertMemberExpression(opts?: Object): void; + assertNewExpression(opts?: Object): void; + assertProgram(opts?: Object): void; + assertObjectExpression(opts?: Object): void; + assertObjectMethod(opts?: Object): void; + assertObjectProperty(opts?: Object): void; + assertRestElement(opts?: Object): void; + assertReturnStatement(opts?: Object): void; + assertSequenceExpression(opts?: Object): void; + assertSwitchCase(opts?: Object): void; + assertSwitchStatement(opts?: Object): void; + assertThisExpression(opts?: Object): void; + assertThrowStatement(opts?: Object): void; + assertTryStatement(opts?: Object): void; + assertUnaryExpression(opts?: Object): void; + assertUpdateExpression(opts?: Object): void; + assertVariableDeclaration(opts?: Object): void; + assertVariableDeclarator(opts?: Object): void; + assertWhileStatement(opts?: Object): void; + assertWithStatement(opts?: Object): void; + assertAssignmentPattern(opts?: Object): void; + assertArrayPattern(opts?: Object): void; + assertArrowFunctionExpression(opts?: Object): void; + assertClassBody(opts?: Object): void; + assertClassDeclaration(opts?: Object): void; + assertClassExpression(opts?: Object): void; + assertExportAllDeclaration(opts?: Object): void; + assertExportDefaultDeclaration(opts?: Object): void; + assertExportNamedDeclaration(opts?: Object): void; + assertExportSpecifier(opts?: Object): void; + assertForOfStatement(opts?: Object): void; + assertImportDeclaration(opts?: Object): void; + assertImportDefaultSpecifier(opts?: Object): void; + assertImportNamespaceSpecifier(opts?: Object): void; + assertImportSpecifier(opts?: Object): void; + assertMetaProperty(opts?: Object): void; + assertClassMethod(opts?: Object): void; + assertObjectPattern(opts?: Object): void; + assertSpreadElement(opts?: Object): void; + assertSuper(opts?: Object): void; + assertTaggedTemplateExpression(opts?: Object): void; + assertTemplateElement(opts?: Object): void; + assertTemplateLiteral(opts?: Object): void; + assertYieldExpression(opts?: Object): void; + assertAnyTypeAnnotation(opts?: Object): void; + assertArrayTypeAnnotation(opts?: Object): void; + assertBooleanTypeAnnotation(opts?: Object): void; + assertBooleanLiteralTypeAnnotation(opts?: Object): void; + assertNullLiteralTypeAnnotation(opts?: Object): void; + assertClassImplements(opts?: Object): void; + assertClassProperty(opts?: Object): void; + assertDeclareClass(opts?: Object): void; + assertDeclareFunction(opts?: Object): void; + assertDeclareInterface(opts?: Object): void; + assertDeclareModule(opts?: Object): void; + assertDeclareTypeAlias(opts?: Object): void; + assertDeclareVariable(opts?: Object): void; + assertExistentialTypeParam(opts?: Object): void; + assertFunctionTypeAnnotation(opts?: Object): void; + assertFunctionTypeParam(opts?: Object): void; + assertGenericTypeAnnotation(opts?: Object): void; + assertInterfaceExtends(opts?: Object): void; + assertInterfaceDeclaration(opts?: Object): void; + assertIntersectionTypeAnnotation(opts?: Object): void; + assertMixedTypeAnnotation(opts?: Object): void; + assertNullableTypeAnnotation(opts?: Object): void; + assertNumericLiteralTypeAnnotation(opts?: Object): void; + assertNumberTypeAnnotation(opts?: Object): void; + assertStringLiteralTypeAnnotation(opts?: Object): void; + assertStringTypeAnnotation(opts?: Object): void; + assertThisTypeAnnotation(opts?: Object): void; + assertTupleTypeAnnotation(opts?: Object): void; + assertTypeofTypeAnnotation(opts?: Object): void; + assertTypeAlias(opts?: Object): void; + assertTypeAnnotation(opts?: Object): void; + assertTypeCastExpression(opts?: Object): void; + assertTypeParameterDeclaration(opts?: Object): void; + assertTypeParameterInstantiation(opts?: Object): void; + assertObjectTypeAnnotation(opts?: Object): void; + assertObjectTypeCallProperty(opts?: Object): void; + assertObjectTypeIndexer(opts?: Object): void; + assertObjectTypeProperty(opts?: Object): void; + assertQualifiedTypeIdentifier(opts?: Object): void; + assertUnionTypeAnnotation(opts?: Object): void; + assertVoidTypeAnnotation(opts?: Object): void; + assertJSXAttribute(opts?: Object): void; + assertJSXClosingElement(opts?: Object): void; + assertJSXElement(opts?: Object): void; + assertJSXEmptyExpression(opts?: Object): void; + assertJSXExpressionContainer(opts?: Object): void; + assertJSXIdentifier(opts?: Object): void; + assertJSXMemberExpression(opts?: Object): void; + assertJSXNamespacedName(opts?: Object): void; + assertJSXOpeningElement(opts?: Object): void; + assertJSXSpreadAttribute(opts?: Object): void; + assertJSXText(opts?: Object): void; + assertNoop(opts?: Object): void; + assertParenthesizedExpression(opts?: Object): void; + assertAwaitExpression(opts?: Object): void; + assertBindExpression(opts?: Object): void; + assertDecorator(opts?: Object): void; + assertDoExpression(opts?: Object): void; + assertExportDefaultSpecifier(opts?: Object): void; + assertExportNamespaceSpecifier(opts?: Object): void; + assertRestProperty(opts?: Object): void; + assertSpreadProperty(opts?: Object): void; + assertExpression(opts?: Object): void; + assertBinary(opts?: Object): void; + assertScopable(opts?: Object): void; + assertBlockParent(opts?: Object): void; + assertBlock(opts?: Object): void; + assertStatement(opts?: Object): void; + assertTerminatorless(opts?: Object): void; + assertCompletionStatement(opts?: Object): void; + assertConditional(opts?: Object): void; + assertLoop(opts?: Object): void; + assertWhile(opts?: Object): void; + assertExpressionWrapper(opts?: Object): void; + assertFor(opts?: Object): void; + assertForXStatement(opts?: Object): void; + assertFunction(opts?: Object): void; + assertFunctionParent(opts?: Object): void; + assertPureish(opts?: Object): void; + assertDeclaration(opts?: Object): void; + assertLVal(opts?: Object): void; + assertLiteral(opts?: Object): void; + assertImmutable(opts?: Object): void; + assertUserWhitespacable(opts?: Object): void; + assertMethod(opts?: Object): void; + assertObjectMember(opts?: Object): void; + assertProperty(opts?: Object): void; + assertUnaryLike(opts?: Object): void; + assertPattern(opts?: Object): void; + assertClass(opts?: Object): void; + assertModuleDeclaration(opts?: Object): void; + assertExportDeclaration(opts?: Object): void; + assertModuleSpecifier(opts?: Object): void; + assertFlow(opts?: Object): void; + assertFlowBaseAnnotation(opts?: Object): void; + assertFlowDeclaration(opts?: Object): void; + assertJSX(opts?: Object): void; + assertNumberLiteral(opts?: Object): void; + assertRegexLiteral(opts?: Object): void; + } + + export class Hub { + constructor(file: any, options: any); + file: any; + options: any; + } + + interface TraversalContext { + parentPath: NodePath; + scope: Scope; + state: any; + opts: any; + } +} diff --git a/babel-types/babel-types-tests.ts b/babel-types/babel-types-tests.ts new file mode 100644 index 0000000000..2a8a25a961 --- /dev/null +++ b/babel-types/babel-types-tests.ts @@ -0,0 +1,26 @@ +/// +/// + + +// Examples from https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babel-types +import traverse from "babel-traverse"; +import * as t from "babel-types"; + +let ast: t.Node; + +traverse(ast, { + enter(path) { + let node = path.node; + if (t.isIdentifier(node, { name: "n" })) { + node.name = "x"; + } + } +}); + +if (t.isBinaryExpression(ast)) { + ast.left; + ast.right; + ast.operator; +} +t.assertBinaryExpression(ast); +t.assertBinaryExpression(ast, { operator: "*" }); diff --git a/babel-types/babel-types.d.ts b/babel-types/babel-types.d.ts new file mode 100644 index 0000000000..d10302370a --- /dev/null +++ b/babel-types/babel-types.d.ts @@ -0,0 +1,1403 @@ +// Type definitions for babel-types v6.7 +// Project: https://github.com/babel/babel/tree/master/packages/babel-types +// Definitions by: Troy Gerwien +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "babel-types" { + + export interface Comment { + value: string; + start: number; + end: number; + loc: SourceLocation; + } + + export interface CommentBlock extends Comment { + type: "CommentBlock"; + } + + export interface CommentLine extends Comment { + type: "CommentLine"; + } + + export interface SourceLocation { + start: { + line: number; + column: number; + }; + + end: { + line: number; + column: number; + }; + } + + export interface Node { + type: string; + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: number; + end: number; + loc: SourceLocation; + } + + export interface ArrayExpression extends Node { + type: "ArrayExpression"; + elements: Array; + } + + export interface AssignmentExpression extends Node { + type: "AssignmentExpression"; + operator: "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&="; + left: LVal; + right: Expression; + } + + export interface BinaryExpression extends Node { + type: "BinaryExpression"; + operator: "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<="; + left: Expression; + right: Expression; + } + + export interface Directive extends Node { + type: "Directive"; + value: DirectiveLiteral; + } + + export interface DirectiveLiteral extends Node { + type: "DirectiveLiteral"; + value: string; + } + + export interface BlockStatement extends Node { + type: "BlockStatement"; + directives?: Directive[]; + body: Statement[]; + } + + export interface BreakStatement extends Node { + type: "BreakStatement"; + label: Identifier; + } + + export interface CallExpression extends Node { + type: "CallExpression"; + callee: Expression | Super; + arguments: Array; + } + + export interface CatchClause extends Node { + type: "CatchClause"; + param: Pattern; + body: BlockStatement; + } + + export interface ConditionalExpression extends Node { + type: "ConditionalExpression"; + test: Expression; + consequent: Expression; + alternate: Expression; + } + + export interface ContinueStatement extends Node { + type: "ContinueStatement"; + label: Identifier; + } + + export interface DebuggerStatement extends Node { + type: "DebuggerStatement"; + } + + export interface DoWhileStatement extends Node { + type: "DoWhileStatement"; + test: Expression; + body: Statement; + } + + export interface EmptyStatement extends Node { + type: "EmptyStatement"; + } + + export interface ExpressionStatement extends Node { + type: "ExpressionStatement"; + expression: Expression; + } + + export interface File extends Node { + type: "File"; + program: Program; + comments: Comment[]; + tokens: any[]; + } + + export interface ForInStatement extends Node { + type: "ForInStatement"; + left: VariableDeclaration | LVal; + right: Expression; + body: Statement; + } + + export interface ForStatement extends Node { + type: "ForStatement"; + init: VariableDeclaration | Expression; + test: Expression; + update: Expression; + body: Statement; + } + + export interface FunctionDeclaration extends Node { + type: "FunctionDeclaration"; + id: Identifier; + params: Pattern[]; + body: BlockStatement; + generator: boolean; + async: boolean; + returnType?: TypeAnnotation; + typeParameters?: TypeParameterDeclaration; + } + + export interface FunctionExpression extends Node { + type: "FunctionExpression"; + id: Identifier; + params: Pattern[]; + body: BlockStatement; + generator: boolean; + async: boolean; + returnType?: TypeAnnotation; + typeParameters?: TypeParameterDeclaration; + } + + export interface Identifier extends Node { + type: "Identifier"; + name: string; + typeAnnotation?: TypeAnnotation; + } + + export interface IfStatement extends Node { + type: "IfStatement"; + test: Expression; + consequent: Statement; + alternate: Statement; + } + + export interface LabeledStatement extends Node { + type: "LabeledStatement"; + label: Identifier; + body: Statement; + } + + export interface StringLiteral extends Node { + type: "StringLiteral"; + value: string; + } + + export interface NumericLiteral extends Node { + type: "NumericLiteral"; + value: number; + } + + export interface NullLiteral extends Node { + type: "NullLiteral"; + } + + export interface BooleanLiteral extends Node { + type: "BooleanLiteral"; + value: boolean; + } + + export interface RegExpLiteral extends Node { + type: "RegExpLiteral"; + pattern: string; + flags?: string; + } + + export interface LogicalExpression extends Node { + type: "LogicalExpression"; + operator: "||" | "&&"; + left: Expression; + right: Expression; + } + + export interface MemberExpression extends Node { + type: "MemberExpression"; + object: Expression | Super; + property: Expression; + computed: boolean; + } + + export interface NewExpression extends Node { + type: "NewExpression"; + callee: Expression | Super; + arguments: Array; + } + + export interface Program extends Node { + type: "Program"; + sourceType: "script" | "module"; + directives?: Directive[]; + body: Array; + } + + export interface ObjectExpression extends Node { + type: "ObjectExpression"; + properties: Array; + } + + export interface ObjectMethod extends Node { + type: "ObjectMethod"; + key: Expression; + kind: "get" | "set" | "method"; + shorthand: boolean; + computed: boolean; + value: Expression; + decorators?: Decorator[]; + id: Identifier; + params: Pattern[]; + body: BlockStatement; + generator: boolean; + async: boolean; + returnType?: TypeAnnotation; + typeParameters?: TypeParameterDeclaration; + } + + export interface ObjectProperty extends Node { + type: "ObjectProperty"; + key: Expression; + computed: boolean; + value: Expression; + decorators?: Decorator[]; + shorthand: boolean; + } + + export interface RestElement extends Node { + type: "RestElement"; + argument: LVal; + typeAnnotation?: TypeAnnotation; + } + + export interface ReturnStatement extends Node { + type: "ReturnStatement"; + argument: Expression; + } + + export interface SequenceExpression extends Node { + type: "SequenceExpression"; + expressions: Expression[]; + } + + export interface SwitchCase extends Node { + type: "SwitchCase"; + test: Expression; + consequent: Statement[]; + } + + export interface SwitchStatement extends Node { + type: "SwitchStatement"; + discriminant: Expression; + cases: SwitchCase[]; + } + + export interface ThisExpression extends Node { + type: "ThisExpression"; + } + + export interface ThrowStatement extends Node { + type: "ThrowStatement"; + argument: Expression; + } + + export interface TryStatement extends Node { + type: "TryStatement"; + block: BlockStatement; + handler: CatchClause; + finalizer: BlockStatement; + } + + export interface UnaryExpression extends Node { + type: "UnaryExpression"; + operator: "-" | "+" | "!" | "~" | "typeof" | "void" | "delete"; + prefix: boolean; + argument: Expression; + } + + export interface UpdateExpression extends Node { + type: "UpdateExpression"; + operator: "++" | "--"; + prefix: boolean; + argument: Expression; + } + + export interface VariableDeclaration extends Node { + type: "VariableDeclaration"; + declarations: VariableDeclarator[]; + kind: "var" | "let" | "const"; + } + + export interface VariableDeclarator extends Node { + type: "VariableDeclarator"; + id: LVal; + init: Expression; + } + + export interface WhileStatement extends Node { + type: "WhileStatement"; + test: Expression; + body: Statement; + } + + export interface WithStatement extends Node { + type: "WithStatement"; + object: Expression; + body: BlockStatement | Statement; + } + + export interface AssignmentPattern extends Node { + type: "AssignmentPattern"; + left: Pattern; + right: Expression; + } + + export interface ArrayPattern extends Node { + type: "ArrayPattern"; + elements: Array; + typeAnnotation?: TypeAnnotation; + } + + export interface ArrowFunctionExpression extends Node { + type: "ArrowFunctionExpression"; + id: Identifier; + params: Pattern[]; + body: BlockStatement | Expression; + generator: boolean; + async: boolean; + expression: boolean; + returnType?: TypeAnnotation; + typeParameters?: TypeParameterDeclaration; + } + + export interface ClassBody extends Node { + type: "ClassBody"; + body: Array; + } + + export interface ClassDeclaration extends Node { + type: "ClassDeclaration"; + id: Identifier; + superClass: Expression; + body: ClassBody; + decorators?: Decorator[]; + implements?: ClassImplements[]; + mixins?: any[]; + typeParameters?: TypeParameterDeclaration; + superTypeParameters?: TypeParameterInstantiation; + } + + export interface ClassExpression extends Node { + type: "ClassExpression"; + id: Identifier; + superClass: Expression; + body: ClassBody; + decorators?: Decorator[]; + implements?: ClassImplements[]; + mixins?: any[]; + typeParameters?: TypeParameterDeclaration; + superTypeParameters?: TypeParameterInstantiation; + } + + export interface ExportAllDeclaration extends Node { + type: "ExportAllDeclaration"; + source: StringLiteral; + } + + export interface ExportDefaultDeclaration extends Node { + type: "ExportDefaultDeclaration"; + declaration: Declaration | Expression; + } + + export interface ExportNamedDeclaration extends Node { + type: "ExportNamedDeclaration"; + declaration: Declaration; + specifiers: ExportSpecifier[]; + source: StringLiteral; + } + + export interface ExportSpecifier extends Node { + type: "ExportSpecifier"; + local: Identifier; + imported: Identifier; + exported: Identifier; + } + + export interface ForOfStatement extends Node { + type: "ForOfStatement"; + left: VariableDeclaration | LVal; + right: Expression; + body: Statement; + } + + export interface ImportDeclaration extends Node { + type: "ImportDeclaration"; + specifiers: Array; + source: StringLiteral; + } + + export interface ImportDefaultSpecifier extends Node { + type: "ImportDefaultSpecifier"; + local: Identifier; + } + + export interface ImportNamespaceSpecifier extends Node { + type: "ImportNamespaceSpecifier"; + local: Identifier; + } + + export interface ImportSpecifier extends Node { + type: "ImportSpecifier"; + local: Identifier; + imported: Identifier; + } + + export interface MetaProperty extends Node { + type: "MetaProperty"; + meta: Identifier; + property: Identifier; + } + + export interface ClassMethod extends Node { + type: "ClassMethod"; + key: Expression; + value?: FunctionExpression; + kind: "constructor" | "method" | "get" | "set"; + computed: boolean; + static: boolean; + decorators?: Decorator[]; + id: Identifier; + params: Pattern[]; + body: BlockStatement; + generator: boolean; + async: boolean; + expression: boolean; + returnType?: TypeAnnotation; + typeParameters?: TypeParameterDeclaration; + } + + // See: https://github.com/babel/babel/blob/master/doc/ast/spec.md#objectpattern + export interface AssignmentProperty extends Node { + type: "ObjectProperty"; + key: Expression; + computed: boolean; + value: Pattern; + decorators?: Decorator[]; + shorthand: boolean; + } + + export interface ObjectPattern extends Node { + type: "ObjectPattern"; + properties: Array; + typeAnnotation?: TypeAnnotation; + } + + export interface SpreadElement extends Node { + type: "SpreadElement"; + argument: Expression; + } + + export interface Super extends Node { + type: "Super"; + } + + export interface TaggedTemplateExpression extends Node { + type: "TaggedTemplateExpression"; + tag: Expression; + quasi: TemplateLiteral; + } + + export interface TemplateElement extends Node { + type: "TemplateElement"; + tail: boolean; + value: { + cooked: string; + raw: string; + }; + } + + export interface TemplateLiteral extends Node { + type: "TemplateLiteral"; + quasis: TemplateElement[]; + expressions: Expression[]; + } + + export interface YieldExpression extends Node { + type: "YieldExpression"; + argument: Expression; + delegate: boolean; + } + + export interface AnyTypeAnnotation extends Node { + type: "AnyTypeAnnotation"; + } + + export interface ArrayTypeAnnotation extends Node { + type: "ArrayTypeAnnotation"; + elementType: FlowTypeAnnotation; + } + + export interface BooleanTypeAnnotation extends Node { + type: "BooleanTypeAnnotation"; + } + + export interface BooleanLiteralTypeAnnotation extends Node { + type: "BooleanLiteralTypeAnnotation"; + } + + export interface NullLiteralTypeAnnotation extends Node { + type: "NullLiteralTypeAnnotation"; + } + + export interface ClassImplements extends Node { + type: "ClassImplements"; + id: Identifier; + typeParameters: TypeParameterInstantiation; + } + + export interface ClassProperty extends Node { + type: "ClassProperty"; + key: Identifier; + value: Expression; + decorators?: Decorator[]; + typeAnnotation?: TypeAnnotation; + } + + export interface DeclareClass extends Node { + type: "DeclareClass"; + id: Identifier; + typeParameters: TypeParameterDeclaration; + extends: InterfaceExtends[]; + body: ObjectTypeAnnotation; + } + + export interface DeclareFunction extends Node { + type: "DeclareFunction"; + id: Identifier; + } + + export interface DeclareInterface extends Node { + type: "DeclareInterface"; + id: Identifier; + typeParameters: TypeParameterDeclaration; + extends: InterfaceExtends[]; + body: ObjectTypeAnnotation; + } + + export interface DeclareModule extends Node { + type: "DeclareModule"; + id: StringLiteral | Identifier; + body: BlockStatement; + } + + export interface DeclareTypeAlias extends Node { + type: "DeclareTypeAlias"; + id: Identifier; + typeParameters: TypeParameterDeclaration; + right: FlowTypeAnnotation; + } + + export interface DeclareVariable extends Node { + type: "DeclareVariable"; + id: Identifier; + } + + export interface ExistentialTypeParam extends Node { + type: "ExistentialTypeParam"; + } + + export interface FunctionTypeAnnotation extends Node { + type: "FunctionTypeAnnotation"; + typeParameters: TypeParameterDeclaration; + params: FunctionTypeParam[]; + rest: FunctionTypeParam; + returnType: FlowTypeAnnotation; + } + + export interface FunctionTypeParam extends Node { + type: "FunctionTypeParam"; + name: Identifier; + typeAnnotation: FlowTypeAnnotation; + } + + export interface GenericTypeAnnotation extends Node { + type: "GenericTypeAnnotation"; + id: Identifier; + typeParameters: TypeParameterInstantiation; + } + + export interface InterfaceExtends extends Node { + type: "InterfaceExtends"; + id: Identifier; + typeParameters: TypeParameterInstantiation; + } + + export interface InterfaceDeclaration extends Node { + type: "InterfaceDeclaration"; + id: Identifier; + typeParameters: TypeParameterDeclaration; + extends: InterfaceExtends[]; + mixins?: any[]; + body: ObjectTypeAnnotation; + } + + export interface IntersectionTypeAnnotation extends Node { + type: "IntersectionTypeAnnotation"; + types: FlowTypeAnnotation[]; + } + + export interface MixedTypeAnnotation extends Node { + type: "MixedTypeAnnotation"; + } + + export interface NullableTypeAnnotation extends Node { + type: "NullableTypeAnnotation"; + typeAnnotation: FlowTypeAnnotation; + } + + export interface NumericLiteralTypeAnnotation extends Node { + type: "NumericLiteralTypeAnnotation"; + } + + export interface NumberTypeAnnotation extends Node { + type: "NumberTypeAnnotation"; + } + + export interface StringLiteralTypeAnnotation extends Node { + type: "StringLiteralTypeAnnotation"; + } + + export interface StringTypeAnnotation extends Node { + type: "StringTypeAnnotation"; + } + + export interface ThisTypeAnnotation extends Node { + type: "ThisTypeAnnotation"; + } + + export interface TupleTypeAnnotation extends Node { + type: "TupleTypeAnnotation"; + types: FlowTypeAnnotation[]; + } + + export interface TypeofTypeAnnotation extends Node { + type: "TypeofTypeAnnotation"; + argument: FlowTypeAnnotation; + } + + export interface TypeAlias extends Node { + type: "TypeAlias"; + id: Identifier; + typeParameters: TypeParameterDeclaration; + right: FlowTypeAnnotation; + } + + export interface TypeAnnotation extends Node { + type: "TypeAnnotation"; + typeAnnotation: FlowTypeAnnotation; + } + + export interface TypeCastExpression extends Node { + type: "TypeCastExpression"; + expression: Expression; + typeAnnotation: FlowTypeAnnotation; + } + + export interface TypeParameterDeclaration extends Node { + type: "TypeParameterDeclaration"; + params: Identifier[]; + } + + export interface TypeParameterInstantiation extends Node { + type: "TypeParameterInstantiation"; + params: FlowTypeAnnotation[]; + } + + export interface ObjectTypeAnnotation extends Node { + type: "ObjectTypeAnnotation"; + properties: ObjectTypeProperty[]; + indexers: ObjectTypeIndexer[]; + callProperties: ObjectTypeCallProperty[]; + } + + export interface ObjectTypeCallProperty extends Node { + type: "ObjectTypeCallProperty"; + value: FlowTypeAnnotation; + } + + export interface ObjectTypeIndexer extends Node { + type: "ObjectTypeIndexer"; + id: Expression; + key: FlowTypeAnnotation; + value: FlowTypeAnnotation; + } + + export interface ObjectTypeProperty extends Node { + type: "ObjectTypeProperty"; + key: Expression; + value: FlowTypeAnnotation; + } + + export interface QualifiedTypeIdentifier extends Node { + type: "QualifiedTypeIdentifier"; + id: Identifier; + qualification: Identifier | QualifiedTypeIdentifier; + } + + export interface UnionTypeAnnotation extends Node { + type: "UnionTypeAnnotation"; + types: FlowTypeAnnotation[]; + } + + export interface VoidTypeAnnotation extends Node { + type: "VoidTypeAnnotation"; + } + + export interface JSXAttribute extends Node { + type: "JSXAttribute"; + name: JSXIdentifier | JSXNamespacedName; + value: JSXElement | StringLiteral | JSXExpressionContainer; + } + + export interface JSXClosingElement extends Node { + type: "JSXClosingElement"; + name: JSXIdentifier | JSXMemberExpression; + } + + export interface JSXElement extends Node { + type: "JSXElement"; + openingElement: JSXOpeningElement; + closingElement: JSXClosingElement; + children: Array; + selfClosing?: boolean; + } + + export interface JSXEmptyExpression extends Node { + type: "JSXEmptyExpression"; + } + + export interface JSXExpressionContainer extends Node { + type: "JSXExpressionContainer"; + expression: Expression; + } + + export interface JSXIdentifier extends Node { + type: "JSXIdentifier"; + name: string; + } + + export interface JSXMemberExpression extends Node { + type: "JSXMemberExpression"; + object: JSXMemberExpression | JSXIdentifier; + property: JSXIdentifier; + } + + export interface JSXNamespacedName extends Node { + type: "JSXNamespacedName"; + namespace: JSXIdentifier; + name: JSXIdentifier; + } + + export interface JSXOpeningElement extends Node { + type: "JSXOpeningElement"; + name: JSXIdentifier | JSXMemberExpression; + selfClosing: boolean; + attributes: JSXAttribute[]; + } + + export interface JSXSpreadAttribute extends Node { + type: "JSXSpreadAttribute"; + argument: Expression; + } + + export interface JSXText extends Node { + type: "JSXText"; + value: string; + } + + export interface Noop extends Node { + type: "Noop"; + } + + export interface ParenthesizedExpression extends Node { + type: "ParenthesizedExpression"; + expression: Expression; + } + + export interface AwaitExpression extends Node { + type: "AwaitExpression"; + argument: Expression; + } + + export interface BindExpression extends Node { + type: "BindExpression"; + object: Expression; + callee: Expression; + } + + export interface Decorator extends Node { + type: "Decorator"; + expression: Expression; + } + + export interface DoExpression extends Node { + type: "DoExpression"; + body: BlockStatement; + } + + export interface ExportDefaultSpecifier extends Node { + type: "ExportDefaultSpecifier"; + exported: Identifier; + } + + export interface ExportNamespaceSpecifier extends Node { + type: "ExportNamespaceSpecifier"; + exported: Identifier; + } + + export interface RestProperty extends Node { + type: "RestProperty"; + argument: LVal; + } + + export interface SpreadProperty extends Node { + type: "SpreadProperty"; + argument: Expression; + } + + export type Expression = ArrayExpression | AssignmentExpression | BinaryExpression | CallExpression | ConditionalExpression | FunctionExpression | Identifier | StringLiteral | NumericLiteral | BooleanLiteral | RegExpLiteral | LogicalExpression | MemberExpression | NewExpression | ObjectExpression | SequenceExpression | ThisExpression | UnaryExpression | UpdateExpression | ArrowFunctionExpression | ClassExpression | MetaProperty | Super | TaggedTemplateExpression | TemplateLiteral | YieldExpression | TypeCastExpression | JSXElement | JSXEmptyExpression | JSXIdentifier | JSXMemberExpression | ParenthesizedExpression | AwaitExpression | BindExpression | DoExpression; + export type Binary = BinaryExpression | LogicalExpression; + export type Scopable = BlockStatement | CatchClause | DoWhileStatement | ForInStatement | ForStatement | FunctionDeclaration | FunctionExpression | Program | ObjectMethod | SwitchStatement | WhileStatement | ArrowFunctionExpression | ClassDeclaration | ClassExpression | ForOfStatement | ClassMethod; + export type BlockParent = BlockStatement | DoWhileStatement | ForInStatement | ForStatement | FunctionDeclaration | FunctionExpression | Program | ObjectMethod | SwitchStatement | WhileStatement | ArrowFunctionExpression | ForOfStatement | ClassMethod; + export type Block = BlockStatement | Program; + export type Statement = BlockStatement | BreakStatement | ContinueStatement | DebuggerStatement | DoWhileStatement | EmptyStatement | ExpressionStatement | ForInStatement | ForStatement | FunctionDeclaration | IfStatement | LabeledStatement | ReturnStatement | SwitchStatement | ThrowStatement | TryStatement | VariableDeclaration | WhileStatement | WithStatement | ClassDeclaration | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ForOfStatement | ImportDeclaration | DeclareClass | DeclareFunction | DeclareInterface | DeclareModule | DeclareTypeAlias | DeclareVariable | InterfaceDeclaration | TypeAlias; + export type Terminatorless = BreakStatement | ContinueStatement | ReturnStatement | ThrowStatement | YieldExpression | AwaitExpression; + export type CompletionStatement = BreakStatement | ContinueStatement | ReturnStatement | ThrowStatement; + export type Conditional = ConditionalExpression | IfStatement; + export type Loop = DoWhileStatement | ForInStatement | ForStatement | WhileStatement | ForOfStatement; + export type While = DoWhileStatement | WhileStatement; + export type ExpressionWrapper = ExpressionStatement | TypeCastExpression | ParenthesizedExpression; + export type For = ForInStatement | ForStatement | ForOfStatement; + export type ForXStatement = ForInStatement | ForOfStatement; + export type Function = FunctionDeclaration | FunctionExpression | ObjectMethod | ArrowFunctionExpression | ClassMethod; + export type FunctionParent = FunctionDeclaration | FunctionExpression | Program | ObjectMethod | ArrowFunctionExpression | ClassMethod; + export type Pureish = FunctionDeclaration | FunctionExpression | StringLiteral | NumericLiteral | BooleanLiteral | ArrowFunctionExpression | ClassDeclaration | ClassExpression; + export type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ImportDeclaration | DeclareClass | DeclareFunction | DeclareInterface | DeclareModule | DeclareTypeAlias | DeclareVariable | InterfaceDeclaration | TypeAlias; + export type LVal = Identifier | MemberExpression | RestElement | AssignmentPattern | ArrayPattern | ObjectPattern; + export type Literal = StringLiteral | NumericLiteral | BooleanLiteral | RegExpLiteral | TemplateLiteral; + export type Immutable = StringLiteral | NumericLiteral | BooleanLiteral | JSXAttribute | JSXClosingElement | JSXElement | JSXExpressionContainer | JSXOpeningElement; + export type UserWhitespacable = ObjectMethod | ObjectProperty | ObjectTypeCallProperty | ObjectTypeIndexer | ObjectTypeProperty; + export type Method = ObjectMethod | ClassMethod; + export type ObjectMember = ObjectMethod | ObjectProperty; + export type Property = ObjectProperty | ClassProperty; + export type UnaryLike = UnaryExpression | SpreadElement | RestProperty | SpreadProperty; + export type Pattern = AssignmentPattern | ArrayPattern | ObjectPattern; + export type Class = ClassDeclaration | ClassExpression; + export type ModuleDeclaration = ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ImportDeclaration; + export type ExportDeclaration = ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration; + export type ModuleSpecifier = ExportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportSpecifier | ExportDefaultSpecifier | ExportNamespaceSpecifier; + export type Flow = AnyTypeAnnotation | ArrayTypeAnnotation | BooleanTypeAnnotation | BooleanLiteralTypeAnnotation | ClassImplements | ClassProperty | DeclareClass | DeclareFunction | DeclareInterface | DeclareModule | DeclareTypeAlias | DeclareVariable | ExistentialTypeParam | FunctionTypeAnnotation | FunctionTypeParam | GenericTypeAnnotation | InterfaceExtends | InterfaceDeclaration | IntersectionTypeAnnotation | MixedTypeAnnotation | NullableTypeAnnotation | NumericLiteralTypeAnnotation | NumberTypeAnnotation | StringLiteralTypeAnnotation | StringTypeAnnotation | ThisTypeAnnotation | TupleTypeAnnotation | TypeofTypeAnnotation | TypeAlias | TypeAnnotation | TypeCastExpression | TypeParameterDeclaration | TypeParameterInstantiation | ObjectTypeAnnotation | ObjectTypeCallProperty | ObjectTypeIndexer | ObjectTypeProperty | QualifiedTypeIdentifier | UnionTypeAnnotation | VoidTypeAnnotation; + export type FlowTypeAnnotation = AnyTypeAnnotation | ArrayTypeAnnotation | BooleanTypeAnnotation | BooleanLiteralTypeAnnotation | FunctionTypeAnnotation | GenericTypeAnnotation | IntersectionTypeAnnotation | MixedTypeAnnotation | NullableTypeAnnotation | NumericLiteralTypeAnnotation | NumberTypeAnnotation | StringLiteralTypeAnnotation | StringTypeAnnotation | ThisTypeAnnotation | TupleTypeAnnotation | TypeofTypeAnnotation | TypeAnnotation | ObjectTypeAnnotation | UnionTypeAnnotation | VoidTypeAnnotation; + export type FlowBaseAnnotation = AnyTypeAnnotation | BooleanTypeAnnotation | MixedTypeAnnotation | NumberTypeAnnotation | StringTypeAnnotation | ThisTypeAnnotation | VoidTypeAnnotation; + export type FlowDeclaration = DeclareClass | DeclareFunction | DeclareInterface | DeclareModule | DeclareTypeAlias | DeclareVariable | InterfaceDeclaration | TypeAlias; + export type JSX = JSXAttribute | JSXClosingElement | JSXElement | JSXEmptyExpression | JSXExpressionContainer | JSXIdentifier | JSXMemberExpression | JSXNamespacedName | JSXOpeningElement | JSXSpreadAttribute | JSXText; + + export function arrayExpression(elements?: Array): ArrayExpression; + export function assignmentExpression(operator?: string, left?: LVal, right?: Expression): AssignmentExpression; + export function binaryExpression(operator?: "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<=", left?: Expression, right?: Expression): BinaryExpression; + export function directive(value?: DirectiveLiteral): Directive; + export function directiveLiteral(value?: string): DirectiveLiteral; + export function blockStatement(body?: Statement[], directives?: Directive[]): BlockStatement; + export function breakStatement(label?: Identifier): BreakStatement; + export function callExpression(callee?: Expression, _arguments?: Array): CallExpression; + export function catchClause(param?: Identifier, body?: BlockStatement): CatchClause; + export function conditionalExpression(test?: Expression, consequent?: Expression, alternate?: Expression): ConditionalExpression; + export function continueStatement(label?: Identifier): ContinueStatement; + export function debuggerStatement(): DebuggerStatement; + export function doWhileStatement(test?: Expression, body?: Statement): DoWhileStatement; + export function emptyStatement(): EmptyStatement; + export function expressionStatement(expression?: Expression): ExpressionStatement; + export function file(program?: Program, comments?: Comment[], tokens?: any[]): File; + export function forInStatement(left?: VariableDeclaration | LVal, right?: Expression, body?: Statement): ForInStatement; + export function forStatement(init?: VariableDeclaration | Expression, test?: Expression, update?: Expression, body?: Statement): ForStatement; + export function functionDeclaration(id?: Identifier, params?: Pattern[], body?: BlockStatement, generator?: boolean, async?: boolean): FunctionDeclaration; + export function functionExpression(id?: Identifier, params?: Pattern[], body?: BlockStatement, generator?: boolean, async?: boolean): FunctionExpression; + export function identifier(name?: string): Identifier; + export function ifStatement(test?: Expression, consequent?: Statement, alternate?: Statement): IfStatement; + export function labeledStatement(label?: Identifier, body?: Statement): LabeledStatement; + export function stringLiteral(value?: string): StringLiteral; + export function numericLiteral(value?: number): NumericLiteral; + export function nullLiteral(): NullLiteral; + export function booleanLiteral(value?: boolean): BooleanLiteral; + export function regExpLiteral(pattern?: string, flags?: string): RegExpLiteral; + export function logicalExpression(operator?: "||" | "&&", left?: Expression, right?: Expression): LogicalExpression; + export function memberExpression(object?: Expression | Super, property?: Expression, computed?: boolean): MemberExpression; + export function newExpression(callee?: Expression | Super, _arguments?: Array): NewExpression; + export function program(body?: Array, directives?: Directive[]): Program; + export function objectExpression(properties?: Array): ObjectExpression; + export function objectMethod(kind?: "get" | "set" | "method", key?: Expression, params?: Pattern[], body?: BlockStatement, computed?: boolean): ObjectMethod; + export function objectProperty(key?: Expression, value?: Expression, computed?: boolean, shorthand?: boolean, decorators?: Decorator[]): ObjectProperty; + export function restElement(argument?: LVal, typeAnnotation?: TypeAnnotation): RestElement; + export function returnStatement(argument?: Expression): ReturnStatement; + export function sequenceExpression(expressions?: Expression[]): SequenceExpression; + export function switchCase(test?: Expression, consequent?: Statement[]): SwitchCase; + export function switchStatement(discriminant?: Expression, cases?: SwitchCase[]): SwitchStatement; + export function thisExpression(): ThisExpression; + export function throwStatement(argument?: Expression): ThrowStatement; + export function tryStatement(block?: BlockStatement, handler?: CatchClause, finalizer?: BlockStatement): TryStatement; + export function unaryExpression(operator?: "void" | "delete" | "!" | "+" | "-" | "++" | "--" | "~" | "typeof", argument?: Expression, prefix?: boolean): UnaryExpression; + export function updateExpression(operator?: "++" | "--", argument?: Expression, prefix?: boolean): UpdateExpression; + export function variableDeclaration(kind?: "var" | "let" | "const", declarations?: VariableDeclarator[]): VariableDeclaration; + export function variableDeclarator(id?: LVal, init?: Expression): VariableDeclarator; + export function whileStatement(test?: Expression, body?: BlockStatement | Statement): WhileStatement; + export function withStatement(object?: Expression, body?: BlockStatement | Statement): WithStatement; + export function assignmentPattern(left?: Identifier, right?: Expression): AssignmentPattern; + export function arrayPattern(elements?: Array, typeAnnotation?: TypeAnnotation): ArrayPattern; + export function arrowFunctionExpression(params?: Pattern[], body?: BlockStatement | Expression, async?: boolean): ArrowFunctionExpression; + export function classBody(body?: Array): ClassBody; + export function classDeclaration(id?: Identifier, superClass?: Expression, body?: ClassBody, decorators?: Decorator[]): ClassDeclaration; + export function classExpression(id?: Identifier, superClass?: Expression, body?: ClassBody, decorators?: Decorator[]): ClassExpression; + export function exportAllDeclaration(source?: StringLiteral): ExportAllDeclaration; + export function exportDefaultDeclaration(declaration?: FunctionDeclaration | ClassDeclaration | Expression): ExportDefaultDeclaration; + export function exportNamedDeclaration(declaration?: Declaration, specifiers?: ExportSpecifier[], source?: StringLiteral): ExportNamedDeclaration; + export function exportSpecifier(local?: Identifier, exported?: Identifier): ExportSpecifier; + export function forOfStatement(left?: VariableDeclaration | LVal, right?: Expression, body?: Statement): ForOfStatement; + export function importDeclaration(specifiers?: Array, source?: StringLiteral): ImportDeclaration; + export function importDefaultSpecifier(local?: Identifier): ImportDefaultSpecifier; + export function importNamespaceSpecifier(local?: Identifier): ImportNamespaceSpecifier; + export function importSpecifier(local?: Identifier, imported?: Identifier): ImportSpecifier; + export function metaProperty(meta?: string, property?: string): MetaProperty; + export function classMethod(kind?: "constructor" | "method" | "get" | "set", key?: Expression, params?: Pattern[], body?: BlockStatement, computed?: boolean, _static?: boolean): ClassMethod; + export function objectPattern(properties?: Array, typeAnnotation?: TypeAnnotation): ObjectPattern; + export function spreadElement(argument?: Expression): SpreadElement; + export function taggedTemplateExpression(tag?: Expression, quasi?: TemplateLiteral): TaggedTemplateExpression; + export function templateElement(value?: {cooked?: string; raw?: string;}, tail?: boolean): TemplateElement; + export function templateLiteral(quasis?: TemplateElement[], expressions?: Expression[]): TemplateLiteral; + export function yieldExpression(argument?: Expression, delegate?: boolean): YieldExpression; + export function anyTypeAnnotation(): AnyTypeAnnotation; + export function arrayTypeAnnotation(elementType?: FlowTypeAnnotation): ArrayTypeAnnotation; + export function booleanTypeAnnotation(): BooleanTypeAnnotation; + export function booleanLiteralTypeAnnotation(): BooleanLiteralTypeAnnotation; + export function nullLiteralTypeAnnotation(): NullLiteralTypeAnnotation; + export function classImplements(id?: Identifier, typeParameters?: TypeParameterInstantiation): ClassImplements; + export function classProperty(key?: Identifier, value?: Expression, typeAnnotation?: TypeAnnotation, decorators?: Decorator[]): ClassProperty; + export function declareClass(id?: Identifier, typeParameters?: TypeParameterDeclaration, _extends?: InterfaceExtends[], body?: ObjectTypeAnnotation): DeclareClass; + export function declareFunction(id?: Identifier): DeclareFunction; + export function declareInterface(id?: Identifier, typeParameters?: TypeParameterDeclaration, _extends?: InterfaceExtends[], body?: ObjectTypeAnnotation): DeclareInterface; + export function declareModule(id?: StringLiteral | Identifier, body?: BlockStatement): DeclareModule; + export function declareTypeAlias(id?: Identifier, typeParameters?: TypeParameterDeclaration, right?: FlowTypeAnnotation): DeclareTypeAlias; + export function declareVariable(id?: Identifier): DeclareVariable; + export function existentialTypeParam(): ExistentialTypeParam; + export function functionTypeAnnotation(typeParameters?: TypeParameterDeclaration, params?: FunctionTypeParam[], rest?: FunctionTypeParam, returnType?: FlowTypeAnnotation): FunctionTypeAnnotation; + export function functionTypeParam(name?: Identifier, typeAnnotation?: FlowTypeAnnotation): FunctionTypeParam; + export function genericTypeAnnotation(id?: Identifier, typeParameters?: TypeParameterInstantiation): GenericTypeAnnotation; + export function interfaceExtends(id?: Identifier, typeParameters?: TypeParameterInstantiation): InterfaceExtends; + export function interfaceDeclaration(id?: Identifier, typeParameters?: TypeParameterDeclaration, _extends?: InterfaceExtends[], body?: ObjectTypeAnnotation): InterfaceDeclaration; + export function intersectionTypeAnnotation(types?: FlowTypeAnnotation[]): IntersectionTypeAnnotation; + export function mixedTypeAnnotation(): MixedTypeAnnotation; + export function nullableTypeAnnotation(typeAnnotation?: FlowTypeAnnotation): NullableTypeAnnotation; + export function numericLiteralTypeAnnotation(): NumericLiteralTypeAnnotation; + export function numberTypeAnnotation(): NumberTypeAnnotation; + export function stringLiteralTypeAnnotation(): StringLiteralTypeAnnotation; + export function stringTypeAnnotation(): StringTypeAnnotation; + export function thisTypeAnnotation(): ThisTypeAnnotation; + export function tupleTypeAnnotation(types?: FlowTypeAnnotation[]): TupleTypeAnnotation; + export function typeofTypeAnnotation(argument?: FlowTypeAnnotation): TypeofTypeAnnotation; + export function typeAlias(id?: Identifier, typeParameters?: TypeParameterDeclaration, right?: FlowTypeAnnotation): TypeAlias; + export function typeAnnotation(typeAnnotation?: FlowTypeAnnotation): TypeAnnotation; + export function typeCastExpression(expression?: Expression, typeAnnotation?: FlowTypeAnnotation): TypeCastExpression; + export function typeParameterDeclaration(params?: Identifier[]): TypeParameterDeclaration; + export function typeParameterInstantiation(params?: FlowTypeAnnotation[]): TypeParameterInstantiation; + export function objectTypeAnnotation(properties?: ObjectTypeProperty[], indexers?: ObjectTypeIndexer[], callProperties?: ObjectTypeCallProperty[]): ObjectTypeAnnotation; + export function objectTypeCallProperty(value?: FlowTypeAnnotation): ObjectTypeCallProperty; + export function objectTypeIndexer(id?: Expression, key?: FlowTypeAnnotation, value?: FlowTypeAnnotation): ObjectTypeIndexer; + export function objectTypeProperty(key?: Expression, value?: FlowTypeAnnotation): ObjectTypeProperty; + export function qualifiedTypeIdentifier(id?: Identifier, qualification?: Identifier | QualifiedTypeIdentifier): QualifiedTypeIdentifier; + export function unionTypeAnnotation(types?: FlowTypeAnnotation[]): UnionTypeAnnotation; + export function voidTypeAnnotation(): VoidTypeAnnotation; + export function jSXAttribute(name?: JSXIdentifier | JSXNamespacedName, value?: JSXElement | StringLiteral | JSXExpressionContainer): JSXAttribute; + export function jSXClosingElement(name?: JSXIdentifier | JSXMemberExpression): JSXClosingElement; + export function jSXElement(openingElement?: JSXOpeningElement, closingElement?: JSXClosingElement, children?: Array, selfClosing?: boolean): JSXElement; + export function jSXEmptyExpression(): JSXEmptyExpression; + export function jSXExpressionContainer(expression?: Expression): JSXExpressionContainer; + export function jSXIdentifier(name?: string): JSXIdentifier; + export function jSXMemberExpression(object?: JSXMemberExpression | JSXIdentifier, property?: JSXIdentifier): JSXMemberExpression; + export function jSXNamespacedName(namespace?: JSXIdentifier, name?: JSXIdentifier): JSXNamespacedName; + export function jSXOpeningElement(name?: JSXIdentifier | JSXMemberExpression, attributes?: JSXAttribute[], selfClosing?: boolean): JSXOpeningElement; + export function jSXSpreadAttribute(argument?: Expression): JSXSpreadAttribute; + export function jSXText(value?: string): JSXText; + export function noop(): Noop; + export function parenthesizedExpression(expression?: Expression): ParenthesizedExpression; + export function awaitExpression(argument?: Expression): AwaitExpression; + export function bindExpression(object?: Expression, callee?: Expression): BindExpression; + export function decorator(expression?: Expression): Decorator; + export function doExpression(body?: BlockStatement): DoExpression; + export function exportDefaultSpecifier(exported?: Identifier): ExportDefaultSpecifier; + export function exportNamespaceSpecifier(exported?: Identifier): ExportNamespaceSpecifier; + export function restProperty(argument?: LVal): RestProperty; + export function spreadProperty(argument?: Expression): SpreadProperty; + + export function isArrayExpression(node: Object, opts?: Object): node is ArrayExpression; + export function isAssignmentExpression(node: Object, opts?: Object): node is AssignmentExpression; + export function isBinaryExpression(node: Object, opts?: Object): node is BinaryExpression; + export function isDirective(node: Object, opts?: Object): node is Directive; + export function isDirectiveLiteral(node: Object, opts?: Object): node is DirectiveLiteral; + export function isBlockStatement(node: Object, opts?: Object): node is BlockStatement; + export function isBreakStatement(node: Object, opts?: Object): node is BreakStatement; + export function isCallExpression(node: Object, opts?: Object): node is CallExpression; + export function isCatchClause(node: Object, opts?: Object): node is CatchClause; + export function isConditionalExpression(node: Object, opts?: Object): node is ConditionalExpression; + export function isContinueStatement(node: Object, opts?: Object): node is ContinueStatement; + export function isDebuggerStatement(node: Object, opts?: Object): node is DebuggerStatement; + export function isDoWhileStatement(node: Object, opts?: Object): node is DoWhileStatement; + export function isEmptyStatement(node: Object, opts?: Object): node is EmptyStatement; + export function isExpressionStatement(node: Object, opts?: Object): node is ExpressionStatement; + export function isFile(node: Object, opts?: Object): node is File; + export function isForInStatement(node: Object, opts?: Object): node is ForInStatement; + export function isForStatement(node: Object, opts?: Object): node is ForStatement; + export function isFunctionDeclaration(node: Object, opts?: Object): node is FunctionDeclaration; + export function isFunctionExpression(node: Object, opts?: Object): node is FunctionExpression; + export function isIdentifier(node: Object, opts?: Object): node is Identifier; + export function isIfStatement(node: Object, opts?: Object): node is IfStatement; + export function isLabeledStatement(node: Object, opts?: Object): node is LabeledStatement; + export function isStringLiteral(node: Object, opts?: Object): node is StringLiteral; + export function isNumericLiteral(node: Object, opts?: Object): node is NumericLiteral; + export function isNullLiteral(node: Object, opts?: Object): node is NullLiteral; + export function isBooleanLiteral(node: Object, opts?: Object): node is BooleanLiteral; + export function isRegExpLiteral(node: Object, opts?: Object): node is RegExpLiteral; + export function isLogicalExpression(node: Object, opts?: Object): node is LogicalExpression; + export function isMemberExpression(node: Object, opts?: Object): node is MemberExpression; + export function isNewExpression(node: Object, opts?: Object): node is NewExpression; + export function isProgram(node: Object, opts?: Object): node is Program; + export function isObjectExpression(node: Object, opts?: Object): node is ObjectExpression; + export function isObjectMethod(node: Object, opts?: Object): node is ObjectMethod; + export function isObjectProperty(node: Object, opts?: Object): node is ObjectProperty; + export function isRestElement(node: Object, opts?: Object): node is RestElement; + export function isReturnStatement(node: Object, opts?: Object): node is ReturnStatement; + export function isSequenceExpression(node: Object, opts?: Object): node is SequenceExpression; + export function isSwitchCase(node: Object, opts?: Object): node is SwitchCase; + export function isSwitchStatement(node: Object, opts?: Object): node is SwitchStatement; + export function isThisExpression(node: Object, opts?: Object): node is ThisExpression; + export function isThrowStatement(node: Object, opts?: Object): node is ThrowStatement; + export function isTryStatement(node: Object, opts?: Object): node is TryStatement; + export function isUnaryExpression(node: Object, opts?: Object): node is UnaryExpression; + export function isUpdateExpression(node: Object, opts?: Object): node is UpdateExpression; + export function isVariableDeclaration(node: Object, opts?: Object): node is VariableDeclaration; + export function isVariableDeclarator(node: Object, opts?: Object): node is VariableDeclarator; + export function isWhileStatement(node: Object, opts?: Object): node is WhileStatement; + export function isWithStatement(node: Object, opts?: Object): node is WithStatement; + export function isAssignmentPattern(node: Object, opts?: Object): node is AssignmentPattern; + export function isArrayPattern(node: Object, opts?: Object): node is ArrayPattern; + export function isArrowFunctionExpression(node: Object, opts?: Object): node is ArrowFunctionExpression; + export function isClassBody(node: Object, opts?: Object): node is ClassBody; + export function isClassDeclaration(node: Object, opts?: Object): node is ClassDeclaration; + export function isClassExpression(node: Object, opts?: Object): node is ClassExpression; + export function isExportAllDeclaration(node: Object, opts?: Object): node is ExportAllDeclaration; + export function isExportDefaultDeclaration(node: Object, opts?: Object): node is ExportDefaultDeclaration; + export function isExportNamedDeclaration(node: Object, opts?: Object): node is ExportNamedDeclaration; + export function isExportSpecifier(node: Object, opts?: Object): node is ExportSpecifier; + export function isForOfStatement(node: Object, opts?: Object): node is ForOfStatement; + export function isImportDeclaration(node: Object, opts?: Object): node is ImportDeclaration; + export function isImportDefaultSpecifier(node: Object, opts?: Object): node is ImportDefaultSpecifier; + export function isImportNamespaceSpecifier(node: Object, opts?: Object): node is ImportNamespaceSpecifier; + export function isImportSpecifier(node: Object, opts?: Object): node is ImportSpecifier; + export function isMetaProperty(node: Object, opts?: Object): node is MetaProperty; + export function isClassMethod(node: Object, opts?: Object): node is ClassMethod; + export function isObjectPattern(node: Object, opts?: Object): node is ObjectPattern; + export function isSpreadElement(node: Object, opts?: Object): node is SpreadElement; + export function isSuper(node: Object, opts?: Object): node is Super; + export function isTaggedTemplateExpression(node: Object, opts?: Object): node is TaggedTemplateExpression; + export function isTemplateElement(node: Object, opts?: Object): node is TemplateElement; + export function isTemplateLiteral(node: Object, opts?: Object): node is TemplateLiteral; + export function isYieldExpression(node: Object, opts?: Object): node is YieldExpression; + export function isAnyTypeAnnotation(node: Object, opts?: Object): node is AnyTypeAnnotation; + export function isArrayTypeAnnotation(node: Object, opts?: Object): node is ArrayTypeAnnotation; + export function isBooleanTypeAnnotation(node: Object, opts?: Object): node is BooleanTypeAnnotation; + export function isBooleanLiteralTypeAnnotation(node: Object, opts?: Object): node is BooleanLiteralTypeAnnotation; + export function isNullLiteralTypeAnnotation(node: Object, opts?: Object): node is NullLiteralTypeAnnotation; + export function isClassImplements(node: Object, opts?: Object): node is ClassImplements; + export function isClassProperty(node: Object, opts?: Object): node is ClassProperty; + export function isDeclareClass(node: Object, opts?: Object): node is DeclareClass; + export function isDeclareFunction(node: Object, opts?: Object): node is DeclareFunction; + export function isDeclareInterface(node: Object, opts?: Object): node is DeclareInterface; + export function isDeclareModule(node: Object, opts?: Object): node is DeclareModule; + export function isDeclareTypeAlias(node: Object, opts?: Object): node is DeclareTypeAlias; + export function isDeclareVariable(node: Object, opts?: Object): node is DeclareVariable; + export function isExistentialTypeParam(node: Object, opts?: Object): node is ExistentialTypeParam; + export function isFunctionTypeAnnotation(node: Object, opts?: Object): node is FunctionTypeAnnotation; + export function isFunctionTypeParam(node: Object, opts?: Object): node is FunctionTypeParam; + export function isGenericTypeAnnotation(node: Object, opts?: Object): node is GenericTypeAnnotation; + export function isInterfaceExtends(node: Object, opts?: Object): node is InterfaceExtends; + export function isInterfaceDeclaration(node: Object, opts?: Object): node is InterfaceDeclaration; + export function isIntersectionTypeAnnotation(node: Object, opts?: Object): node is IntersectionTypeAnnotation; + export function isMixedTypeAnnotation(node: Object, opts?: Object): node is MixedTypeAnnotation; + export function isNullableTypeAnnotation(node: Object, opts?: Object): node is NullableTypeAnnotation; + export function isNumericLiteralTypeAnnotation(node: Object, opts?: Object): node is NumericLiteralTypeAnnotation; + export function isNumberTypeAnnotation(node: Object, opts?: Object): node is NumberTypeAnnotation; + export function isStringLiteralTypeAnnotation(node: Object, opts?: Object): node is StringLiteralTypeAnnotation; + export function isStringTypeAnnotation(node: Object, opts?: Object): node is StringTypeAnnotation; + export function isThisTypeAnnotation(node: Object, opts?: Object): node is ThisTypeAnnotation; + export function isTupleTypeAnnotation(node: Object, opts?: Object): node is TupleTypeAnnotation; + export function isTypeofTypeAnnotation(node: Object, opts?: Object): node is TypeofTypeAnnotation; + export function isTypeAlias(node: Object, opts?: Object): node is TypeAlias; + export function isTypeAnnotation(node: Object, opts?: Object): node is TypeAnnotation; + export function isTypeCastExpression(node: Object, opts?: Object): node is TypeCastExpression; + export function isTypeParameterDeclaration(node: Object, opts?: Object): node is TypeParameterDeclaration; + export function isTypeParameterInstantiation(node: Object, opts?: Object): node is TypeParameterInstantiation; + export function isObjectTypeAnnotation(node: Object, opts?: Object): node is ObjectTypeAnnotation; + export function isObjectTypeCallProperty(node: Object, opts?: Object): node is ObjectTypeCallProperty; + export function isObjectTypeIndexer(node: Object, opts?: Object): node is ObjectTypeIndexer; + export function isObjectTypeProperty(node: Object, opts?: Object): node is ObjectTypeProperty; + export function isQualifiedTypeIdentifier(node: Object, opts?: Object): node is QualifiedTypeIdentifier; + export function isUnionTypeAnnotation(node: Object, opts?: Object): node is UnionTypeAnnotation; + export function isVoidTypeAnnotation(node: Object, opts?: Object): node is VoidTypeAnnotation; + export function isJSXAttribute(node: Object, opts?: Object): node is JSXAttribute; + export function isJSXClosingElement(node: Object, opts?: Object): node is JSXClosingElement; + export function isJSXElement(node: Object, opts?: Object): node is JSXElement; + export function isJSXEmptyExpression(node: Object, opts?: Object): node is JSXEmptyExpression; + export function isJSXExpressionContainer(node: Object, opts?: Object): node is JSXExpressionContainer; + export function isJSXIdentifier(node: Object, opts?: Object): node is JSXIdentifier; + export function isJSXMemberExpression(node: Object, opts?: Object): node is JSXMemberExpression; + export function isJSXNamespacedName(node: Object, opts?: Object): node is JSXNamespacedName; + export function isJSXOpeningElement(node: Object, opts?: Object): node is JSXOpeningElement; + export function isJSXSpreadAttribute(node: Object, opts?: Object): node is JSXSpreadAttribute; + export function isJSXText(node: Object, opts?: Object): node is JSXText; + export function isNoop(node: Object, opts?: Object): node is Noop; + export function isParenthesizedExpression(node: Object, opts?: Object): node is ParenthesizedExpression; + export function isAwaitExpression(node: Object, opts?: Object): node is AwaitExpression; + export function isBindExpression(node: Object, opts?: Object): node is BindExpression; + export function isDecorator(node: Object, opts?: Object): node is Decorator; + export function isDoExpression(node: Object, opts?: Object): node is DoExpression; + export function isExportDefaultSpecifier(node: Object, opts?: Object): node is ExportDefaultSpecifier; + export function isExportNamespaceSpecifier(node: Object, opts?: Object): node is ExportNamespaceSpecifier; + export function isRestProperty(node: Object, opts?: Object): node is RestProperty; + export function isSpreadProperty(node: Object, opts?: Object): node is SpreadProperty; + export function isExpression(node: Object, opts?: Object): node is Expression; + export function isBinary(node: Object, opts?: Object): node is Binary; + export function isScopable(node: Object, opts?: Object): node is Scopable; + export function isBlockParent(node: Object, opts?: Object): node is BlockParent; + export function isBlock(node: Object, opts?: Object): node is Block; + export function isStatement(node: Object, opts?: Object): node is Statement; + export function isTerminatorless(node: Object, opts?: Object): node is Terminatorless; + export function isCompletionStatement(node: Object, opts?: Object): node is CompletionStatement; + export function isConditional(node: Object, opts?: Object): node is Conditional; + export function isLoop(node: Object, opts?: Object): node is Loop; + export function isWhile(node: Object, opts?: Object): node is While; + export function isExpressionWrapper(node: Object, opts?: Object): node is ExpressionWrapper; + export function isFor(node: Object, opts?: Object): node is For; + export function isForXStatement(node: Object, opts?: Object): node is ForXStatement; + export function isFunction(node: Object, opts?: Object): node is Function; + export function isFunctionParent(node: Object, opts?: Object): node is FunctionParent; + export function isPureish(node: Object, opts?: Object): node is Pureish; + export function isDeclaration(node: Object, opts?: Object): node is Declaration; + export function isLVal(node: Object, opts?: Object): node is LVal; + export function isLiteral(node: Object, opts?: Object): node is Literal; + export function isImmutable(node: Object, opts?: Object): node is Immutable; + export function isUserWhitespacable(node: Object, opts?: Object): node is UserWhitespacable; + export function isMethod(node: Object, opts?: Object): node is Method; + export function isObjectMember(node: Object, opts?: Object): node is ObjectMember; + export function isProperty(node: Object, opts?: Object): node is Property; + export function isUnaryLike(node: Object, opts?: Object): node is UnaryLike; + export function isPattern(node: Object, opts?: Object): node is Pattern; + export function isClass(node: Object, opts?: Object): node is Class; + export function isModuleDeclaration(node: Object, opts?: Object): node is ModuleDeclaration; + export function isExportDeclaration(node: Object, opts?: Object): node is ExportDeclaration; + export function isModuleSpecifier(node: Object, opts?: Object): node is ModuleSpecifier; + export function isFlow(node: Object, opts?: Object): node is Flow; + export function isFlowBaseAnnotation(node: Object, opts?: Object): node is FlowBaseAnnotation; + export function isFlowDeclaration(node: Object, opts?: Object): node is FlowDeclaration; + export function isJSX(node: Object, opts?: Object): node is JSX; + export function isNumberLiteral(node: Object, opts?: Object): node is NumericLiteral; + export function isRegexLiteral(node: Object, opts?: Object): node is RegExpLiteral; + + export function isReferencedIdentifier(node: Object, opts?: Object): boolean; + export function isReferencedMemberExpression(node: Object, opts?: Object): boolean; + export function isBindingIdentifier(node: Object, opts?: Object): boolean; + export function isScope(node: Object, opts?: Object): boolean; + export function isReferenced(node: Object, opts?: Object): boolean; + export function isBlockScoped(node: Object, opts?: Object): boolean; + export function isVar(node: Object, opts?: Object): boolean; + export function isUser(node: Object, opts?: Object): boolean; + export function isGenerated(node: Object, opts?: Object): boolean; + export function isPure(node: Object, opts?: Object): boolean; + + export function assertArrayExpression(node: Object, opts?: Object): void; + export function assertAssignmentExpression(node: Object, opts?: Object): void; + export function assertBinaryExpression(node: Object, opts?: Object): void; + export function assertDirective(node: Object, opts?: Object): void; + export function assertDirectiveLiteral(node: Object, opts?: Object): void; + export function assertBlockStatement(node: Object, opts?: Object): void; + export function assertBreakStatement(node: Object, opts?: Object): void; + export function assertCallExpression(node: Object, opts?: Object): void; + export function assertCatchClause(node: Object, opts?: Object): void; + export function assertConditionalExpression(node: Object, opts?: Object): void; + export function assertContinueStatement(node: Object, opts?: Object): void; + export function assertDebuggerStatement(node: Object, opts?: Object): void; + export function assertDoWhileStatement(node: Object, opts?: Object): void; + export function assertEmptyStatement(node: Object, opts?: Object): void; + export function assertExpressionStatement(node: Object, opts?: Object): void; + export function assertFile(node: Object, opts?: Object): void; + export function assertForInStatement(node: Object, opts?: Object): void; + export function assertForStatement(node: Object, opts?: Object): void; + export function assertFunctionDeclaration(node: Object, opts?: Object): void; + export function assertFunctionExpression(node: Object, opts?: Object): void; + export function assertIdentifier(node: Object, opts?: Object): void; + export function assertIfStatement(node: Object, opts?: Object): void; + export function assertLabeledStatement(node: Object, opts?: Object): void; + export function assertStringLiteral(node: Object, opts?: Object): void; + export function assertNumericLiteral(node: Object, opts?: Object): void; + export function assertNullLiteral(node: Object, opts?: Object): void; + export function assertBooleanLiteral(node: Object, opts?: Object): void; + export function assertRegExpLiteral(node: Object, opts?: Object): void; + export function assertLogicalExpression(node: Object, opts?: Object): void; + export function assertMemberExpression(node: Object, opts?: Object): void; + export function assertNewExpression(node: Object, opts?: Object): void; + export function assertProgram(node: Object, opts?: Object): void; + export function assertObjectExpression(node: Object, opts?: Object): void; + export function assertObjectMethod(node: Object, opts?: Object): void; + export function assertObjectProperty(node: Object, opts?: Object): void; + export function assertRestElement(node: Object, opts?: Object): void; + export function assertReturnStatement(node: Object, opts?: Object): void; + export function assertSequenceExpression(node: Object, opts?: Object): void; + export function assertSwitchCase(node: Object, opts?: Object): void; + export function assertSwitchStatement(node: Object, opts?: Object): void; + export function assertThisExpression(node: Object, opts?: Object): void; + export function assertThrowStatement(node: Object, opts?: Object): void; + export function assertTryStatement(node: Object, opts?: Object): void; + export function assertUnaryExpression(node: Object, opts?: Object): void; + export function assertUpdateExpression(node: Object, opts?: Object): void; + export function assertVariableDeclaration(node: Object, opts?: Object): void; + export function assertVariableDeclarator(node: Object, opts?: Object): void; + export function assertWhileStatement(node: Object, opts?: Object): void; + export function assertWithStatement(node: Object, opts?: Object): void; + export function assertAssignmentPattern(node: Object, opts?: Object): void; + export function assertArrayPattern(node: Object, opts?: Object): void; + export function assertArrowFunctionExpression(node: Object, opts?: Object): void; + export function assertClassBody(node: Object, opts?: Object): void; + export function assertClassDeclaration(node: Object, opts?: Object): void; + export function assertClassExpression(node: Object, opts?: Object): void; + export function assertExportAllDeclaration(node: Object, opts?: Object): void; + export function assertExportDefaultDeclaration(node: Object, opts?: Object): void; + export function assertExportNamedDeclaration(node: Object, opts?: Object): void; + export function assertExportSpecifier(node: Object, opts?: Object): void; + export function assertForOfStatement(node: Object, opts?: Object): void; + export function assertImportDeclaration(node: Object, opts?: Object): void; + export function assertImportDefaultSpecifier(node: Object, opts?: Object): void; + export function assertImportNamespaceSpecifier(node: Object, opts?: Object): void; + export function assertImportSpecifier(node: Object, opts?: Object): void; + export function assertMetaProperty(node: Object, opts?: Object): void; + export function assertClassMethod(node: Object, opts?: Object): void; + export function assertObjectPattern(node: Object, opts?: Object): void; + export function assertSpreadElement(node: Object, opts?: Object): void; + export function assertSuper(node: Object, opts?: Object): void; + export function assertTaggedTemplateExpression(node: Object, opts?: Object): void; + export function assertTemplateElement(node: Object, opts?: Object): void; + export function assertTemplateLiteral(node: Object, opts?: Object): void; + export function assertYieldExpression(node: Object, opts?: Object): void; + export function assertAnyTypeAnnotation(node: Object, opts?: Object): void; + export function assertArrayTypeAnnotation(node: Object, opts?: Object): void; + export function assertBooleanTypeAnnotation(node: Object, opts?: Object): void; + export function assertBooleanLiteralTypeAnnotation(node: Object, opts?: Object): void; + export function assertNullLiteralTypeAnnotation(node: Object, opts?: Object): void; + export function assertClassImplements(node: Object, opts?: Object): void; + export function assertClassProperty(node: Object, opts?: Object): void; + export function assertDeclareClass(node: Object, opts?: Object): void; + export function assertDeclareFunction(node: Object, opts?: Object): void; + export function assertDeclareInterface(node: Object, opts?: Object): void; + export function assertDeclareModule(node: Object, opts?: Object): void; + export function assertDeclareTypeAlias(node: Object, opts?: Object): void; + export function assertDeclareVariable(node: Object, opts?: Object): void; + export function assertExistentialTypeParam(node: Object, opts?: Object): void; + export function assertFunctionTypeAnnotation(node: Object, opts?: Object): void; + export function assertFunctionTypeParam(node: Object, opts?: Object): void; + export function assertGenericTypeAnnotation(node: Object, opts?: Object): void; + export function assertInterfaceExtends(node: Object, opts?: Object): void; + export function assertInterfaceDeclaration(node: Object, opts?: Object): void; + export function assertIntersectionTypeAnnotation(node: Object, opts?: Object): void; + export function assertMixedTypeAnnotation(node: Object, opts?: Object): void; + export function assertNullableTypeAnnotation(node: Object, opts?: Object): void; + export function assertNumericLiteralTypeAnnotation(node: Object, opts?: Object): void; + export function assertNumberTypeAnnotation(node: Object, opts?: Object): void; + export function assertStringLiteralTypeAnnotation(node: Object, opts?: Object): void; + export function assertStringTypeAnnotation(node: Object, opts?: Object): void; + export function assertThisTypeAnnotation(node: Object, opts?: Object): void; + export function assertTupleTypeAnnotation(node: Object, opts?: Object): void; + export function assertTypeofTypeAnnotation(node: Object, opts?: Object): void; + export function assertTypeAlias(node: Object, opts?: Object): void; + export function assertTypeAnnotation(node: Object, opts?: Object): void; + export function assertTypeCastExpression(node: Object, opts?: Object): void; + export function assertTypeParameterDeclaration(node: Object, opts?: Object): void; + export function assertTypeParameterInstantiation(node: Object, opts?: Object): void; + export function assertObjectTypeAnnotation(node: Object, opts?: Object): void; + export function assertObjectTypeCallProperty(node: Object, opts?: Object): void; + export function assertObjectTypeIndexer(node: Object, opts?: Object): void; + export function assertObjectTypeProperty(node: Object, opts?: Object): void; + export function assertQualifiedTypeIdentifier(node: Object, opts?: Object): void; + export function assertUnionTypeAnnotation(node: Object, opts?: Object): void; + export function assertVoidTypeAnnotation(node: Object, opts?: Object): void; + export function assertJSXAttribute(node: Object, opts?: Object): void; + export function assertJSXClosingElement(node: Object, opts?: Object): void; + export function assertJSXElement(node: Object, opts?: Object): void; + export function assertJSXEmptyExpression(node: Object, opts?: Object): void; + export function assertJSXExpressionContainer(node: Object, opts?: Object): void; + export function assertJSXIdentifier(node: Object, opts?: Object): void; + export function assertJSXMemberExpression(node: Object, opts?: Object): void; + export function assertJSXNamespacedName(node: Object, opts?: Object): void; + export function assertJSXOpeningElement(node: Object, opts?: Object): void; + export function assertJSXSpreadAttribute(node: Object, opts?: Object): void; + export function assertJSXText(node: Object, opts?: Object): void; + export function assertNoop(node: Object, opts?: Object): void; + export function assertParenthesizedExpression(node: Object, opts?: Object): void; + export function assertAwaitExpression(node: Object, opts?: Object): void; + export function assertBindExpression(node: Object, opts?: Object): void; + export function assertDecorator(node: Object, opts?: Object): void; + export function assertDoExpression(node: Object, opts?: Object): void; + export function assertExportDefaultSpecifier(node: Object, opts?: Object): void; + export function assertExportNamespaceSpecifier(node: Object, opts?: Object): void; + export function assertRestProperty(node: Object, opts?: Object): void; + export function assertSpreadProperty(node: Object, opts?: Object): void; + export function assertExpression(node: Object, opts?: Object): void; + export function assertBinary(node: Object, opts?: Object): void; + export function assertScopable(node: Object, opts?: Object): void; + export function assertBlockParent(node: Object, opts?: Object): void; + export function assertBlock(node: Object, opts?: Object): void; + export function assertStatement(node: Object, opts?: Object): void; + export function assertTerminatorless(node: Object, opts?: Object): void; + export function assertCompletionStatement(node: Object, opts?: Object): void; + export function assertConditional(node: Object, opts?: Object): void; + export function assertLoop(node: Object, opts?: Object): void; + export function assertWhile(node: Object, opts?: Object): void; + export function assertExpressionWrapper(node: Object, opts?: Object): void; + export function assertFor(node: Object, opts?: Object): void; + export function assertForXStatement(node: Object, opts?: Object): void; + export function assertFunction(node: Object, opts?: Object): void; + export function assertFunctionParent(node: Object, opts?: Object): void; + export function assertPureish(node: Object, opts?: Object): void; + export function assertDeclaration(node: Object, opts?: Object): void; + export function assertLVal(node: Object, opts?: Object): void; + export function assertLiteral(node: Object, opts?: Object): void; + export function assertImmutable(node: Object, opts?: Object): void; + export function assertUserWhitespacable(node: Object, opts?: Object): void; + export function assertMethod(node: Object, opts?: Object): void; + export function assertObjectMember(node: Object, opts?: Object): void; + export function assertProperty(node: Object, opts?: Object): void; + export function assertUnaryLike(node: Object, opts?: Object): void; + export function assertPattern(node: Object, opts?: Object): void; + export function assertClass(node: Object, opts?: Object): void; + export function assertModuleDeclaration(node: Object, opts?: Object): void; + export function assertExportDeclaration(node: Object, opts?: Object): void; + export function assertModuleSpecifier(node: Object, opts?: Object): void; + export function assertFlow(node: Object, opts?: Object): void; + export function assertFlowBaseAnnotation(node: Object, opts?: Object): void; + export function assertFlowDeclaration(node: Object, opts?: Object): void; + export function assertJSX(node: Object, opts?: Object): void; + export function assertNumberLiteral(node: Object, opts?: Object): void; + export function assertRegexLiteral(node: Object, opts?: Object): void; +} diff --git a/babylon/babylon-tests.ts b/babylon/babylon-tests.ts new file mode 100644 index 0000000000..16a6998037 --- /dev/null +++ b/babylon/babylon-tests.ts @@ -0,0 +1,24 @@ +/// +/// +/// + + +// Example from https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babylon +import * as babylon from "babylon"; +declare function assert(expr: boolean): void; + +const code = `function square(n) { + return n * n; +}`; + +let node = babylon.parse(code); +assert(node.type === "File"); +assert(node.start === 0); +assert(node.end === 38); +assert(node.loc.start > node.loc.end); + + +babylon.parse(code, { + sourceType: "module", // default: "script" + plugins: ["jsx"] // default: [] +}); diff --git a/babylon/babylon.d.ts b/babylon/babylon.d.ts new file mode 100644 index 0000000000..88be6dab84 --- /dev/null +++ b/babylon/babylon.d.ts @@ -0,0 +1,48 @@ +// Type definitions for babylon v6.7 +// Project: https://github.com/babel/babylon +// Definitions by: Troy Gerwien +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "babylon" { + import * as t from 'babel-types'; + type Node = t.Node; + + export function parse(code: string, opts?: BabylonOptions): Node; + + export interface BabylonOptions { + /** + * By default, import and export declarations can only appear at a program's top level. + * Setting this option to true allows them anywhere where a statement is allowed. + */ + allowImportExportEverywhere?: boolean; + + /** + * By default, a return statement at the top level raises an error. Set this to true to accept such code. + */ + allowReturnOutsideFunction?: boolean; + + allowSuperOutsideMethod?: boolean; + + /** + * Indicate the mode the code should be parsed in. Can be either "script" or "module". + */ + sourceType?: 'script' | 'module'; + + /** + * Correlate output AST nodes with their source filename. Useful when + * generating code and source maps from the ASTs of multiple input files. + */ + sourceFilename?: string; + + /** + * Array containing the plugins that you want to enable. + */ + plugins?: PluginName[]; + } + + export type PluginName = 'jsx' | 'flow' | 'asyncFunctions' | 'classConstructorCall' | 'doExpressions' + | 'trailingFunctionCommas' | 'objectRestSpread' | 'decorators' | 'classProperties' | 'exportExtensions' + | 'exponentiationOperator' | 'asyncGenerators' | 'functionBind' | 'functionSent'; +} From b56b92096d905075413bf0b42f1618ece50770b6 Mon Sep 17 00:00:00 2001 From: "Prasanna V. Loganathar" Date: Sat, 23 Apr 2016 11:51:33 +0530 Subject: [PATCH 08/65] MatchArgs can also take a string (#8221) MatchArgs `location` is either a HistoryModule.Location, or a url string, which is converted to location automatically. --- react-router/react-router.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-router/react-router.d.ts b/react-router/react-router.d.ts index 2209bf3408..07acd52b9e 100644 --- a/react-router/react-router.d.ts +++ b/react-router/react-router.d.ts @@ -247,7 +247,7 @@ declare namespace ReactRouter { interface MatchArgs { routes?: RouteConfig history?: H.History - location?: H.Location + location?: H.Location | string parseQueryString?: ParseQueryString stringifyQuery?: StringifyQuery } From 47363c7222db63b18e7ca6ccab2623cf01e03802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Babcs=C3=A1ny?= Date: Sat, 23 Apr 2016 08:22:08 +0200 Subject: [PATCH 09/65] Update restangular.IProvider.setErrorInterceptor method signature to be compatible with Restangular 1.5 (#9032) --- restangular/restangular.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/restangular/restangular.d.ts b/restangular/restangular.d.ts index d0f7353667..410713e938 100644 --- a/restangular/restangular.d.ts +++ b/restangular/restangular.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Restangular v1.4.0 +// Type definitions for Restangular v1.5.0 // Project: https://github.com/mgonto/restangular // Definitions by: Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -56,7 +56,7 @@ declare namespace restangular { addRequestInterceptor(requestInterceptor: (element: any, operation: string, what: string, url: string) => any): void; setFullRequestInterceptor(fullRequestInterceptor: (element: any, operation: string, what: string, url: string, headers: any, params: any, httpConfig: angular.IRequestShortcutConfig) => {element: any; headers: any; params: any}): void; addFullRequestInterceptor(requestInterceptor: (element: any, operation: string, what: string, url: string, headers: any, params: any, httpConfig: angular.IRequestShortcutConfig) => {headers: any; params: any; element: any; httpConfig: angular.IRequestShortcutConfig}): void; - setErrorInterceptor(errorInterceptor: (response: IResponse, deferred: angular.IDeferred) => any): void; + setErrorInterceptor(errorInterceptor: (response: IResponse, deferred: angular.IDeferred, responseHandler: (response: restangular.IResponse) => any) => any): void; setRestangularFields(fields: {[fieldName: string]: string}): void; setMethodOverriders(overriders: string[]): void; setJsonp(jsonp: boolean): void; From c8714d2d2b658530af4018f522c4bf36ff773e61 Mon Sep 17 00:00:00 2001 From: Riccardo Volonterio Date: Sat, 23 Apr 2016 08:24:30 +0200 Subject: [PATCH 10/65] Update turf.d.ts (#9035) Exported as module, so can be used like a module. --- turf/turf.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/turf/turf.d.ts b/turf/turf.d.ts index 6ed1d617a3..c85d8aa393 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -574,3 +574,7 @@ declare namespace turf { */ function reclass(input: GeoJSON.FeatureCollection, inField: string, outField: string, translations: Array): GeoJSON.FeatureCollection; } + +declare module 'turf' { + export= turf; +} From 7492a4ca9f5658230e05ef97cf2a9fcb09b0677d Mon Sep 17 00:00:00 2001 From: Isman Usoh Date: Sat, 23 Apr 2016 13:38:49 +0700 Subject: [PATCH 11/65] declare ReactHelmet namespace and fix error (#8929) * declare ReactHelmet namespace and fix error * Update react-helmet-tests.tsx --- react-helmet/react-helmet-tests.tsx | 2 +- react-helmet/react-helmet.d.ts | 27 ++++++++++++++++----------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/react-helmet/react-helmet-tests.tsx b/react-helmet/react-helmet-tests.tsx index c50bdf2e17..a9f89d74c9 100644 --- a/react-helmet/react-helmet-tests.tsx +++ b/react-helmet/react-helmet-tests.tsx @@ -2,7 +2,7 @@ /// import * as React from 'react'; -import Helmet from 'react-helmet'; +import * as Helmet from 'react-helmet'; diff --git a/react-helmet/react-helmet.d.ts b/react-helmet/react-helmet.d.ts index 8cae272f98..b5b69411ee 100644 --- a/react-helmet/react-helmet.d.ts +++ b/react-helmet/react-helmet.d.ts @@ -1,13 +1,13 @@ // Type definitions for react-helmet // Project: https://github.com/nfl/react-helmet -// Definitions by: Evan Bremer +// Definitions by: Evan Bremer , Isman Usoh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -declare module 'react-helmet' { - import { Component } from 'react'; - +declare namespace ReactHelmet { + import React = __React; + interface HelmetProps { title?: string; titleTemplate?: string; @@ -25,15 +25,20 @@ declare module 'react-helmet' { meta: HelmetDatum; script: HelmetDatum; } - + interface HelmetDatum { toString(): string; - toComponent(): Component; + toComponent(): React.Component; } - class Helmet extends Component { - static rewind(): HelmetData - } - - export default Helmet; + class HelmetComponent extends React.Component {} +} + +declare module "react-helmet" { + var Helmet: { + (): ReactHelmet.HelmetComponent + rewind(): ReactHelmet.HelmetData + } + + export = Helmet; } From 35cd1dc5e7b956cb9f794d3436b25b5ca3a1f388 Mon Sep 17 00:00:00 2001 From: ToastHawaii Date: Sat, 23 Apr 2016 08:48:23 +0200 Subject: [PATCH 12/65] Add typedefinition for normalizr. (#9040) * Create normalizr.d.ts * Added files via upload --- normalizr/normalizr-tests.ts | 270 +++++++++++++++++++++++++++++++++++ normalizr/normalizr.d.ts | 111 ++++++++++++++ 2 files changed, 381 insertions(+) create mode 100644 normalizr/normalizr-tests.ts create mode 100644 normalizr/normalizr.d.ts diff --git a/normalizr/normalizr-tests.ts b/normalizr/normalizr-tests.ts new file mode 100644 index 0000000000..ae40f196b1 --- /dev/null +++ b/normalizr/normalizr-tests.ts @@ -0,0 +1,270 @@ +/// + +import { normalize, Schema, arrayOf, unionOf, valuesOf } from 'normalizr'; + +// First, define a schema for our entities: + +const article1 = new Schema('articles'); +const user1 = new Schema('users'); + +// Then we define nesting rules: + +article1.define({ + author: user1, + contributors: arrayOf(user1) +}); + +// Now we can use this schema in our API response handlers: + +const ServerActionCreators = { + // These are two different XHR endpoints with different response schemas. + // We can use the schema objects defined earlier to express both of them: + + receiveOneArticle(response: any) { + // Here, the response is an object containing data about one article. + // Passing the article schema as second parameter to normalize() lets it + // correctly traverse the response tree and gather all entities: + + // BEFORE: + // { + // id: 1, + // title: 'Some Article', + // author: { + // id: 7, + // name: 'Dan' + // }, + // contributors: [{ + // id: 10, + // name: 'Abe' + // }, { + // id: 15, + // name: 'Fred' + // }] + // } + // + // AFTER: + // { + // result: 1, // <--- Note object is referenced by ID + // entities: { + // articles: { + // 1: { + // author: 7, // <--- Same happens for references to + // contributors: [10, 15] // <--- other entities in the schema + // ...} + // }, + // users: { + // 7: { ... }, + // 10: { ... }, + // 15: { ... } + // } + // } + // } + + response = normalize(response, article1); + }, + + receiveAllArticles(response: any) { + // Here, the response is an object with the key 'articles' referencing + // an array of article objects. Passing { articles: arrayOf(article) } as + // second parameter to normalize() lets it correctly traverse the response + // tree and gather all entities: + + // BEFORE: + // { + // articles: [{ + // id: 1, + // title: 'Some Article', + // author: { + // id: 7, + // name: 'Dan' + // }, + // ... + // }, + // ... + // ] + // } + // + // AFTER: + // { + // result: { + // articles: [1, 2, ...] // <--- Note how object array turned into ID array + // }, + // entities: { + // articles: { + // 1: { author: 7, ... }, // <--- Same happens for references to other entities in the schema + // 2: { ... }, + // ... + // }, + // users: { + // 7: { ... }, + // .. + // } + // } + // } + + response = normalize(response, { + articles: arrayOf(article1) + }); + } +} + +// new Schema(key, [options]) + +const article2 = new Schema('articles'); + +// You can use a custom id attribute +const article3 = new Schema('articles', { idAttribute: 'slug' }); + +// Or you can specify a function to infer it +function generateSlug(entity: any) { /* ... */ } +const article4 = new Schema('articles', { idAttribute: generateSlug }); + +// Schema.prototype.define(nestedSchema) + +const article5 = new Schema('articles'); +const user5 = new Schema('users'); + +article5.define({ + author: user5 +}); + +// Schema.prototype.getKey() + +const article6 = new Schema('articles'); + +article6.getKey(); +// articles + +// Schema.prototype.getIdAttribute() + +const article7 = new Schema('articles'); +const slugArticle7 = new Schema('articles', { idAttribute: 'slug' }); + +article7.getIdAttribute(); +// id +slugArticle7.getIdAttribute(); +// slug + +// arrayOf(schema, [options]) + +const article8 = new Schema('articles'); +const user8 = new Schema('users'); + +article8.define({ + author: user8, + contributors: arrayOf(user8) +}); + +const article9 = new Schema('articles'); +const image9 = new Schema('images'); +const video9 = new Schema('videos'); +const asset9 = { + images: image9, + videos: video9 +}; + +// You can specify the name of the attribute that determines the schema +article9.define({ + assets: arrayOf(asset9, { schemaAttribute: 'type' }) +}); + +// Or you can specify a function to infer it +function inferSchema9(entity: any) { /* ... */ } +article9.define({ + assets: arrayOf(asset9, { schemaAttribute: inferSchema9 }) +}); + +// valuesOf(schema, [options]) + +const article10 = new Schema('articles'); +const user10 = new Schema('users'); + +article10.define({ + collaboratorsByRole: valuesOf(user10) +}); + +const article11 = new Schema('articles'); +const user11 = new Schema('users'); +const group11 = new Schema('groups'); +const collaborator11 = { + users: user11, + groups: group11 +}; + +// You can specify the name of the attribute that determines the schema +article11.define({ + collaboratorsByRole: valuesOf(collaborator11, { schemaAttribute: 'type' }) +}); + +// Or you can specify a function to infer it +function inferSchema11(entity: any) { /* ... */ } +article11.define({ + collaboratorsByRole: valuesOf(collaborator11, { schemaAttribute: inferSchema }) +}); + +// unionOf(schemaMap, [options]) + +const group12 = new Schema('groups'); +const user12 = new Schema('users'); + +// a member can be either a user or a group +const member12 = { + users: user12, + groups: group12 +}; + +// You can specify the name of the attribute that determines the schema +group12.define({ + owner: unionOf(member12, { schemaAttribute: 'type' }) +}); + +// Or you can specify a function to infer it +function inferSchema(entity: any) { /* ... */ } +group12.define({ + creator: unionOf(member12, { schemaAttribute: inferSchema }) +}); + +const group13 = new Schema('groups'); +const user13 = new Schema('users'); + +const member13 = unionOf({ + users: user13, + groups: group13 +}, { schemaAttribute: 'type' }); + +group13.define({ + owner: member13, + members: arrayOf(member13), + relationships: valuesOf(member13) +}); + +// normalize(obj, schema, [options]) + +const article14 = new Schema('articles'); +const user14 = new Schema('users'); + +article14.define({ + author: user14, + contributors: arrayOf(user14), + meta: { + likes: arrayOf({ + user: user14 + }) + } +}); + +// ... + +// Normalize one article object +const json = { id: 1, author: /*...*/{} }; +const normalized1 = normalize(json, article14); + +// Normalize an array of article objects +const arr = [{ id: 1, author: /*...*/{} }/*, ...*/] +const normalized2 = normalize(arr, arrayOf(article14)); + +// Normalize an array of article objects, referenced by an object key: +const wrappedArr = { articles: [{ id: 1, author: /*...*/{} }/*, ...*/] } +const normalized3 = normalize(wrappedArr, { + articles: arrayOf(article14) +}); \ No newline at end of file diff --git a/normalizr/normalizr.d.ts b/normalizr/normalizr.d.ts new file mode 100644 index 0000000000..77d2f86648 --- /dev/null +++ b/normalizr/normalizr.d.ts @@ -0,0 +1,111 @@ +// Type definitions for normalizr 2.0.1 +// Project: https://github.com/gaearon/normalizr/ +// Definitions by: Markus Peloso +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "normalizr" { + export = Normalizr; +} + +declare namespace Normalizr { + type AttributeSetting = string | ((entity: any) => any); + + type SchemaClass = Schema | ArraySchema | UnionSchema; + + type SchemaObject = { [property: string]: SchemaClass | SchemaObject }; + + type SchemaType = SchemaClass | SchemaObject | Object; + + export class Schema { + /** + * Schema lets you define a type of entity returned by your API. + * This should correspond to model in your server code. + * @param key The key parameter lets you specify the name of the dictionary for this kind of entity. + * @param options + */ + constructor(key: string, options?: { idAttribute: AttributeSetting; }); + + /** + * Lets you specify relationships between different entities. + * @param nestedSchema + */ + define(nestedSchema: SchemaObject): void; + + /** + * Returns the key of the schema. + */ + getKey(): string; + + /** + * Returns the idAttribute of the schema. + */ + getIdAttribute(): AttributeSetting; + } + + interface UnionSchema { + getItemSchema(): SchemaType; + getSchemaKey(item: any): string; + } + + interface ArraySchema { + getItemSchema(): SchemaType; + } + + /** + * Describes an array of the schema passed as argument. + * @param schema + * @param options + */ + export function arrayOf(schema: SchemaType, options?: { + /** + * If the array contains entities with different schemas, you can use the schemaAttribute option to specify which schema to use for each entity. + */ + schemaAttribute: AttributeSetting + }): ArraySchema; + + /** + * Describes a map whose values follow the schema passed as argument. + * @param schema + * @param options + */ + export function valuesOf(schema: SchemaType, options?: { + /** + * If the map contains entities with different schemas, you can use the schemaAttribute option to specify which schema to use for each entity. + */ + schemaAttribute: AttributeSetting + }): ArraySchema; + + /** + * Describe a schema which is a union of multiple schemas. This is useful if you need the polymorphic behavior provided by arrayOf or valuesOf but for non-collection fields. + * @param schemaMap + * @param options + */ + export function unionOf(schemaMap: SchemaType, options?: { + /** + * Use the required schemaAttribute option to specify which schema to use for each entity. + */ + schemaAttribute: AttributeSetting + }): UnionSchema; + + /** + * Normalizes object according to schema. + * Passed schema should be a nested object reflecting the structure of API response. + * @param obj + * @param schema + * @param options + */ + export function normalize(obj: any | Array, schema: SchemaType, options?: { + /** + * This is useful if your backend emits additional fields, such as separate ID fields, you'd like to delete in the normalized entity. + */ + assignEntity?: (normalized: any, key: string, entity: any) => any; + + /** + * You can use this to resolve conflicts when merging entities with the same key. + */ + mergeIntoEntity?: (stored: any, normalized: any, entityKey: string) => any; + }): { + entites: any; + result: any; + }; +} From 3a44f976ba58e05adb666295d59168ef5e99ae17 Mon Sep 17 00:00:00 2001 From: Long Lazuli Date: Sat, 23 Apr 2016 08:59:14 +0200 Subject: [PATCH 13/65] Update React - Adds SVG & to the JSX IntrinsicElements (#9012) * Adds SVG USE & SYMBOL to the JSX IntrinsicElements * Reverse ReactDom changes --- react/react-0.13.3.d.ts | 4 ++++ react/react.d.ts | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/react/react-0.13.3.d.ts b/react/react-0.13.3.d.ts index a723320141..738b745133 100644 --- a/react/react-0.13.3.d.ts +++ b/react/react-0.13.3.d.ts @@ -730,8 +730,10 @@ declare namespace __React { radialGradient: SVGFactory; rect: SVGFactory; stop: SVGFactory; + symbol: SVGFactory; text: SVGFactory; tspan: SVGFactory; + use: SVGFactory; } // @@ -1538,8 +1540,10 @@ declare module "react/addons" { radialGradient: SVGFactory; rect: SVGFactory; stop: SVGFactory; + symbol: SVGFactory; text: SVGFactory; tspan: SVGFactory; + use: SVGFactory; } // diff --git a/react/react.d.ts b/react/react.d.ts index bfc465c86f..efe8d8c2e8 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -2234,8 +2234,10 @@ declare namespace __React { radialGradient: SVGFactory; rect: SVGFactory; stop: SVGFactory; + symbol: SVGFactory; text: SVGFactory; tspan: SVGFactory; + use: SVGFactory; } // @@ -2464,7 +2466,9 @@ declare namespace JSX { radialGradient: React.SVGProps; rect: React.SVGProps; stop: React.SVGProps; + symbol: React.SVGProps; text: React.SVGProps; tspan: React.SVGProps; + use: React.SVGProps; } } From 44d3872606d28420221c7e1f9920aa8eb27abe25 Mon Sep 17 00:00:00 2001 From: J08nY Date: Sat, 23 Apr 2016 08:59:44 +0200 Subject: [PATCH 14/65] fix: Physijs.d.ts Scene.setGravity() accepts Vector3 (#9042) --- physijs/physijs.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/physijs/physijs.d.ts b/physijs/physijs.d.ts index 035f1da389..d70eadad2b 100644 --- a/physijs/physijs.d.ts +++ b/physijs/physijs.d.ts @@ -147,7 +147,7 @@ declare namespace Physijs { add(object:THREE.Object3D):void; remove(object:THREE.Object3D):void; setFixedTimeStep(fixedTimeStep:number):void; - setGravity(gravity:number):void; + setGravity(gravity:THREE.Vector3):void; simulate(timeStep?:number, maxSubSteps?:number):boolean; From 2a83c342f769534a010cf91bbaf57583098fa327 Mon Sep 17 00:00:00 2001 From: Ivan Vasilov Date: Sat, 23 Apr 2016 09:03:04 +0200 Subject: [PATCH 15/65] Add all keyword to chai-as-promised (#9041) * Add all to promised assertions. * Changed the definitions to match chai.d.ts. --- chai-as-promised/chai-as-promised.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/chai-as-promised/chai-as-promised.d.ts b/chai-as-promised/chai-as-promised.d.ts index 91a46f9033..6b2882b338 100644 --- a/chai-as-promised/chai-as-promised.d.ts +++ b/chai-as-promised/chai-as-promised.d.ts @@ -36,6 +36,7 @@ declare namespace Chai { // From chai not: PromisedAssertion; deep: PromisedDeep; + all: PromisedKeyFilter; a: PromisedTypeComparison; an: PromisedTypeComparison; include: PromisedInclude; @@ -129,6 +130,10 @@ declare namespace Chai { property: PromisedProperty; } + interface PromisedKeyFilter { + keys: PromisedKeys; + } + interface PromisedEqual { (value: any, message?: string): PromisedAssertion; } @@ -151,6 +156,7 @@ declare namespace Chai { (value: number, message?: string): PromisedAssertion; keys: PromisedKeys; members: PromisedMembers; + all: PromisedKeyFilter; } interface PromisedKeys { From 7c32a54894969ba4c5d621dbed95821d0b156645 Mon Sep 17 00:00:00 2001 From: Sean Kelley Date: Sat, 23 Apr 2016 00:09:20 -0700 Subject: [PATCH 16/65] Lodash: update mapvalues, frompairs, pickby (#8783) * Make the predicate parameter to _.pickBy optional. * Add explicit typings for _.mapValues. * Repair dummy typings for _.fromPairs to be more correct and add implicit/explicit versions. * Remove non-existent 2-iteratee versions of _.mapValues. * Preemtively remove thisArg from ONLY the added _.mapValues so the merge with #8781 goes well. --- lodash/lodash-tests.ts | 18 ++++++++++++++++ lodash/lodash.d.ts | 48 +++++++++++++++++++++++++++++++++++------- 2 files changed, 58 insertions(+), 8 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 7931acb2b2..628dd9821e 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1019,6 +1019,24 @@ namespace TestFlattenDeep { } } +// _.fromPairs +namespace TestFromPairs { + let array: string[][]; + let result: _.Dictionary; + + { + result = _.fromPairs(array); + } + + { + result = _(array).fromPairs().value(); + } + + { + result = _.chain(array).fromPairs().value(); + } +} + // _.head namespace TestHead { let array: TResult[]; diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index bd996b9638..9503670267 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2058,7 +2058,23 @@ declare module _ { */ fromPairs( array: any[]|List - ): any[]; + ): Dictionary; + } + + //_.fromPairs DUMMY + interface LoDashImplicitArrayWrapper { + /** + * @see _.fromPairs + */ + fromPairs(): LoDashImplicitObjectWrapper; + } + + //_.fromPairs DUMMY + interface LoDashExplicitArrayWrapper { + /** + * @see _.fromPairs + */ + fromPairs(): LoDashExplicitObjectWrapper; } //_.head @@ -16174,17 +16190,33 @@ declare module _ { /** * @see _.mapValues - * TResult is the type of the properties on the object specified by pluck. - * T should be a Dictionary>> + * TResult is the type of the properties of each object in the values of T + * T should be a Dictionary> */ - mapValues(pluck: string, where: Dictionary): LoDashImplicitArrayWrapper>; + mapValues(where: Dictionary): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.mapValues + * TValue is the type of the property values of T. + * TResult is the type output by the ObjectIterator function + */ + mapValues(callback: ObjectIterator): LoDashExplicitObjectWrapper>; + + /** + * @see _.mapValues + * TResult is the type of the property specified by pluck. + * T should be a Dictionary> + */ + mapValues(pluck: string): LoDashExplicitObjectWrapper>; /** * @see _.mapValues * TResult is the type of the properties of each object in the values of T * T should be a Dictionary> */ - mapValues(where: Dictionary): LoDashImplicitArrayWrapper; + mapValues(where: Dictionary): LoDashExplicitObjectWrapper; } //_.merge @@ -16635,7 +16667,7 @@ declare module _ { */ pickBy( object: T, - predicate: ObjectIterator + predicate?: ObjectIterator ): TResult; } @@ -16644,7 +16676,7 @@ declare module _ { * @see _.pickBy */ pickBy( - predicate: ObjectIterator + predicate?: ObjectIterator ): LoDashImplicitObjectWrapper; } @@ -16653,7 +16685,7 @@ declare module _ { * @see _.pickBy */ pickBy( - predicate: ObjectIterator + predicate?: ObjectIterator ): LoDashExplicitObjectWrapper; } From fc4a666145cc02bfb858d4b670f9a4d9dd070191 Mon Sep 17 00:00:00 2001 From: Sean Kelley Date: Sat, 23 Apr 2016 00:17:43 -0700 Subject: [PATCH 17/65] Lodash: Remove thisArg from everything except _.bind. (#8781) * Remove thisArg from everything except _.bind. * Fix most of the tests: in most cases, deletethe thisArg version, in a few, just delete the thisArg parameter and leave the rest. * Fix last _.reduce test. This one was probably actually wrong: `{}` was failing to match `TResult` so it was instead matching the `any` from the `thisArgs` signature and compiling, even though that was not the intent of the test. Casting the accumulator to `ABC` selects the correct overload. --- lodash/lodash-tests.ts | 454 ++----------------- lodash/lodash.d.ts | 985 ++++++++++++++--------------------------- 2 files changed, 363 insertions(+), 1076 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 628dd9821e..2d5f5b50f3 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -527,16 +527,12 @@ namespace TestDropRightWhile { result = _.dropRightWhile(array); result = _.dropRightWhile(array, predicateFn); - result = _.dropRightWhile(array, predicateFn, any); result = _.dropRightWhile(array, ''); - result = _.dropRightWhile(array, '', any); result = _.dropRightWhile<{a: number;}, TResult>(array, {a: 42}); result = _.dropRightWhile(list); result = _.dropRightWhile(list, predicateFn); - result = _.dropRightWhile(list, predicateFn, any); result = _.dropRightWhile(list, ''); - result = _.dropRightWhile(list, '', any); result = _.dropRightWhile<{a: number;}, TResult>(list, {a: 42}); } @@ -545,16 +541,12 @@ namespace TestDropRightWhile { result = _(array).dropRightWhile(); result = _(array).dropRightWhile(predicateFn); - result = _(array).dropRightWhile(predicateFn, any); result = _(array).dropRightWhile(''); - result = _(array).dropRightWhile('', any); result = _(array).dropRightWhile<{a: number;}>({a: 42}); result = _(list).dropRightWhile(); result = _(list).dropRightWhile(predicateFn); - result = _(list).dropRightWhile(predicateFn, any); result = _(list).dropRightWhile(''); - result = _(list).dropRightWhile('', any); result = _(list).dropRightWhile<{a: number;}, TResult>({a: 42}); } @@ -563,16 +555,12 @@ namespace TestDropRightWhile { result = _(array).chain().dropRightWhile(); result = _(array).chain().dropRightWhile(predicateFn); - result = _(array).chain().dropRightWhile(predicateFn, any); result = _(array).chain().dropRightWhile(''); - result = _(array).chain().dropRightWhile('', any); result = _(array).chain().dropRightWhile<{a: number;}>({a: 42}); result = _(list).chain().dropRightWhile(); result = _(list).chain().dropRightWhile(predicateFn); - result = _(list).chain().dropRightWhile(predicateFn, any); result = _(list).chain().dropRightWhile(''); - result = _(list).chain().dropRightWhile('', any); result = _(list).chain().dropRightWhile<{a: number;}, TResult>({a: 42}); } } @@ -588,16 +576,12 @@ namespace TestDropWhile { result = _.dropWhile(array); result = _.dropWhile(array, predicateFn); - result = _.dropWhile(array, predicateFn, any); result = _.dropWhile(array, ''); - result = _.dropWhile(array, '', any); result = _.dropWhile<{a: number;}, TResult>(array, {a: 42}); result = _.dropWhile(list); result = _.dropWhile(list, predicateFn); - result = _.dropWhile(list, predicateFn, any); result = _.dropWhile(list, ''); - result = _.dropWhile(list, '', any); result = _.dropWhile<{a: number;}, TResult>(list, {a: 42}); } @@ -606,16 +590,12 @@ namespace TestDropWhile { result = _(array).dropWhile(); result = _(array).dropWhile(predicateFn); - result = _(array).dropWhile(predicateFn, any); result = _(array).dropWhile(''); - result = _(array).dropWhile('', any); result = _(array).dropWhile<{a: number;}>({a: 42}); result = _(list).dropWhile(); result = _(list).dropWhile(predicateFn); - result = _(list).dropWhile(predicateFn, any); result = _(list).dropWhile(''); - result = _(list).dropWhile('', any); result = _(list).dropWhile<{a: number;}, TResult>({a: 42}); } @@ -624,16 +604,12 @@ namespace TestDropWhile { result = _(array).chain().dropWhile(); result = _(array).chain().dropWhile(predicateFn); - result = _(array).chain().dropWhile(predicateFn, any); result = _(array).chain().dropWhile(''); - result = _(array).chain().dropWhile('', any); result = _(array).chain().dropWhile<{a: number;}>({a: 42}); result = _(list).chain().dropWhile(); result = _(list).chain().dropWhile(predicateFn); - result = _(list).chain().dropWhile(predicateFn, any); result = _(list).chain().dropWhile(''); - result = _(list).chain().dropWhile('', any); result = _(list).chain().dropWhile<{a: number;}, TResult>({a: 42}); } } @@ -703,30 +679,22 @@ namespace TestFindIndex { result = _.findIndex(array); result = _.findIndex(array, predicateFn); - result = _.findIndex(array, predicateFn, any); result = _.findIndex(array, ''); - result = _.findIndex(array, '', any); result = _.findIndex<{a: number}, TResult>(array, {a: 42}); result = _.findIndex(list); result = _.findIndex(list, predicateFn); - result = _.findIndex(list, predicateFn, any); result = _.findIndex(list, ''); - result = _.findIndex(list, '', any); result = _.findIndex<{a: number}, TResult>(list, {a: 42}); result = _(array).findIndex(); result = _(array).findIndex(predicateFn); - result = _(array).findIndex(predicateFn, any); result = _(array).findIndex(''); - result = _(array).findIndex('', any); result = _(array).findIndex<{a: number}>({a: 42}); result = _(list).findIndex(); result = _(list).findIndex(predicateFn); - result = _(list).findIndex(predicateFn, any); result = _(list).findIndex(''); - result = _(list).findIndex('', any); result = _(list).findIndex<{a: number}>({a: 42}); } @@ -735,16 +703,12 @@ namespace TestFindIndex { result = _(array).chain().findIndex(); result = _(array).chain().findIndex(predicateFn); - result = _(array).chain().findIndex(predicateFn, any); result = _(array).chain().findIndex(''); - result = _(array).chain().findIndex('', any); result = _(array).chain().findIndex<{a: number}>({a: 42}); result = _(list).chain().findIndex(); result = _(list).chain().findIndex(predicateFn); - result = _(list).chain().findIndex(predicateFn, any); result = _(list).chain().findIndex(''); - result = _(list).chain().findIndex('', any); result = _(list).chain().findIndex<{a: number}>({a: 42}); } } @@ -761,30 +725,22 @@ namespace TestFindLastIndex { result = _.findLastIndex(array); result = _.findLastIndex(array, predicateFn); - result = _.findLastIndex(array, predicateFn, any); result = _.findLastIndex(array, ''); - result = _.findLastIndex(array, '', any); result = _.findLastIndex<{a: number}, TResult>(array, {a: 42}); result = _.findLastIndex(list); result = _.findLastIndex(list, predicateFn); - result = _.findLastIndex(list, predicateFn, any); result = _.findLastIndex(list, ''); - result = _.findLastIndex(list, '', any); result = _.findLastIndex<{a: number}, TResult>(list, {a: 42}); result = _(array).findLastIndex(); result = _(array).findLastIndex(predicateFn); - result = _(array).findLastIndex(predicateFn, any); result = _(array).findLastIndex(''); - result = _(array).findLastIndex('', any); result = _(array).findLastIndex<{a: number}>({a: 42}); result = _(list).findLastIndex(); result = _(list).findLastIndex(predicateFn); - result = _(list).findLastIndex(predicateFn, any); result = _(list).findLastIndex(''); - result = _(list).findLastIndex('', any); result = _(list).findLastIndex<{a: number}>({a: 42}); } @@ -793,16 +749,12 @@ namespace TestFindLastIndex { result = _(array).chain().findLastIndex(); result = _(array).chain().findLastIndex(predicateFn); - result = _(array).chain().findLastIndex(predicateFn, any); result = _(array).chain().findLastIndex(''); - result = _(array).chain().findLastIndex('', any); result = _(array).chain().findLastIndex<{a: number}>({a: 42}); result = _(list).chain().findLastIndex(); result = _(list).chain().findLastIndex(predicateFn); - result = _(list).chain().findLastIndex(predicateFn, any); result = _(list).chain().findLastIndex(''); - result = _(list).chain().findLastIndex('', any); result = _(list).chain().findLastIndex<{a: number}>({a: 42}); } } @@ -1430,16 +1382,12 @@ namespace TestRemove { result = _.remove(array); result = _.remove(array, predicateFn); - result = _.remove(array, predicateFn, any); result = _.remove(array, ''); - result = _.remove(array, '', any); result = _.remove<{a: number}, TResult>(array, {a: 42}); result = _.remove(list); result = _.remove(list, predicateFn); - result = _.remove(list, predicateFn, any); result = _.remove(list, ''); - result = _.remove(list, '', any); result = _.remove<{a: number}, TResult>(list, {a: 42}); } @@ -1448,16 +1396,12 @@ namespace TestRemove { result = _(array).remove(); result = _(array).remove(predicateFn); - result = _(array).remove(predicateFn, any); result = _(array).remove(''); - result = _(array).remove('', any); result = _(array).remove<{a: number}>({a: 42}); result = _(list).remove(); result = _(list).remove(predicateFn); - result = _(list).remove(predicateFn, any); result = _(list).remove(''); - result = _(list).remove('', any); result = _(list).remove<{a: number}, TResult>({a: 42}); } @@ -1466,16 +1410,12 @@ namespace TestRemove { result = _(array).chain().remove(); result = _(array).chain().remove(predicateFn); - result = _(array).chain().remove(predicateFn, any); result = _(array).chain().remove(''); - result = _(array).chain().remove('', any); result = _(array).chain().remove<{a: number}>({a: 42}); result = _(list).chain().remove(); result = _(list).chain().remove(predicateFn); - result = _(list).chain().remove(predicateFn, any); result = _(list).chain().remove(''); - result = _(list).chain().remove('', any); result = _(list).chain().remove<{a: number}, TResult>({a: 42}); } } @@ -1852,16 +1792,12 @@ namespace TestTakeRightWhile { result = _.takeRightWhile(array); result = _.takeRightWhile(array, predicateFn); - result = _.takeRightWhile(array, predicateFn, any); result = _.takeRightWhile(array, ''); - result = _.takeRightWhile(array, '', any); result = _.takeRightWhile<{a: number;}, TResult>(array, {a: 42}); result = _.takeRightWhile(list); result = _.takeRightWhile(list, predicateFn); - result = _.takeRightWhile(list, predicateFn, any); result = _.takeRightWhile(list, ''); - result = _.takeRightWhile(list, '', any); result = _.takeRightWhile<{a: number;}, TResult>(list, {a: 42}); } @@ -1870,16 +1806,12 @@ namespace TestTakeRightWhile { result = _(array).takeRightWhile(); result = _(array).takeRightWhile(predicateFn); - result = _(array).takeRightWhile(predicateFn, any); result = _(array).takeRightWhile(''); - result = _(array).takeRightWhile('', any); result = _(array).takeRightWhile<{a: number;}>({a: 42}); result = _(list).takeRightWhile(); result = _(list).takeRightWhile(predicateFn); - result = _(list).takeRightWhile(predicateFn, any); result = _(list).takeRightWhile(''); - result = _(list).takeRightWhile('', any); result = _(list).takeRightWhile<{a: number;}, TResult>({a: 42}); } @@ -1888,16 +1820,12 @@ namespace TestTakeRightWhile { result = _(array).chain().takeRightWhile(); result = _(array).chain().takeRightWhile(predicateFn); - result = _(array).chain().takeRightWhile(predicateFn, any); result = _(array).chain().takeRightWhile(''); - result = _(array).chain().takeRightWhile('', any); result = _(array).chain().takeRightWhile<{a: number;}>({a: 42}); result = _(list).chain().takeRightWhile(); result = _(list).chain().takeRightWhile(predicateFn); - result = _(list).chain().takeRightWhile(predicateFn, any); result = _(list).chain().takeRightWhile(''); - result = _(list).chain().takeRightWhile('', any); result = _(list).chain().takeRightWhile<{a: number;}, TResult>({a: 42}); } } @@ -1913,16 +1841,12 @@ namespace TestTakeWhile { result = _.takeWhile(array); result = _.takeWhile(array, predicateFn); - result = _.takeWhile(array, predicateFn, any); result = _.takeWhile(array, ''); - result = _.takeWhile(array, '', any); result = _.takeWhile<{a: number;}, TResult>(array, {a: 42}); result = _.takeWhile(list); result = _.takeWhile(list, predicateFn); - result = _.takeWhile(list, predicateFn, any); result = _.takeWhile(list, ''); - result = _.takeWhile(list, '', any); result = _.takeWhile<{a: number;}, TResult>(list, {a: 42}); } @@ -1931,16 +1855,12 @@ namespace TestTakeWhile { result = _(array).takeWhile(); result = _(array).takeWhile(predicateFn); - result = _(array).takeWhile(predicateFn, any); result = _(array).takeWhile(''); - result = _(array).takeWhile('', any); result = _(array).takeWhile<{a: number;}>({a: 42}); result = _(list).takeWhile(); result = _(list).takeWhile(predicateFn); - result = _(list).takeWhile(predicateFn, any); result = _(list).takeWhile(''); - result = _(list).takeWhile('', any); result = _(list).takeWhile<{a: number;}, TResult>({a: 42}); } @@ -1949,16 +1869,12 @@ namespace TestTakeWhile { result = _(array).chain().takeWhile(); result = _(array).chain().takeWhile(predicateFn); - result = _(array).chain().takeWhile(predicateFn, any); result = _(array).chain().takeWhile(''); - result = _(array).chain().takeWhile('', any); result = _(array).chain().takeWhile<{a: number;}>({a: 42}); result = _(list).chain().takeWhile(); result = _(list).chain().takeWhile(predicateFn); - result = _(list).chain().takeWhile(predicateFn, any); result = _(list).chain().takeWhile(''); - result = _(list).chain().takeWhile('', any); result = _(list).chain().takeWhile<{a: number;}, TResult>({a: 42}); } } @@ -2461,14 +2377,10 @@ namespace TestUnzip { let result: TResult[]; result = _.unzipWith(testUnzipWithArray); result = _.unzipWith(testUnzipWithArray, testUnzipWithIterator); - result = _.unzipWith(testUnzipWithArray, testUnzipWithIterator, any); result = _.unzipWith(testUnzipWithList); result = _.unzipWith(testUnzipWithList, testUnzipWithIterator); - result = _.unzipWith(testUnzipWithList, testUnzipWithIterator, any); result = _(testUnzipWithArray).unzipWith(testUnzipWithIterator).value(); - result = _(testUnzipWithArray).unzipWith(testUnzipWithIterator, any).value(); result = _(testUnzipWithList).unzipWith(testUnzipWithIterator).value(); - result = _(testUnzipWithList).unzipWith(testUnzipWithIterator, any).value(); } // _.without @@ -2735,14 +2647,12 @@ interface TestZipWithFn { var testZipWithFn: TestZipWithFn; result = _.zipWith([1, 2]); result = _.zipWith([1, 2], testZipWithFn); -result = _.zipWith([1, 2], testZipWithFn, any); -result = _.zipWith([1, 2], [1, 2], testZipWithFn, any); -result = _.zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], testZipWithFn, any); +result = _.zipWith([1, 2], [1, 2], testZipWithFn); +result = _.zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], [1, 2], testZipWithFn); result = _([1, 2]).zipWith().value(); result = _([1, 2]).zipWith(testZipWithFn).value(); -result = _([1, 2]).zipWith(testZipWithFn, any).value(); -result = _([1, 2]).zipWith([1, 2], testZipWithFn, any).value(); -result = _([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], testZipWithFn, any).value(); +result = _([1, 2]).zipWith([1, 2], testZipWithFn).value(); +result = _([1, 2]).zipWith([1, 2], [1, 2], [1, 2], [1, 2], [1, 2], testZipWithFn).value(); /********* * Chain * @@ -2796,7 +2706,6 @@ namespace TestTap { let result: string; _.tap('', interceptor); - _.tap('', interceptor, any); } { @@ -2804,7 +2713,6 @@ namespace TestTap { let result: _.LoDashImplicitArrayWrapper; _.tap([''], interceptor); - _.tap([''], interceptor, any); } { @@ -2812,18 +2720,15 @@ namespace TestTap { let result: _.LoDashImplicitObjectWrapper<{a: string}>; _.tap({a: ''}, interceptor); - _.tap({a: ''}, interceptor, any); } { let interceptor: (value: string) => void; let result: _.LoDashImplicitWrapper; - _.chain('').tap(interceptor, any); - _.chain('').tap(interceptor, any); + _.chain('').tap(interceptor); _('').tap(interceptor); - _('').tap(interceptor, any); } { @@ -2831,10 +2736,8 @@ namespace TestTap { let result: _.LoDashImplicitArrayWrapper; _.chain(['']).tap(interceptor); - _.chain(['']).tap(interceptor, any); _(['']).tap(interceptor); - _(['']).tap(interceptor, any); } { @@ -2842,21 +2745,17 @@ namespace TestTap { let result: _.LoDashImplicitObjectWrapper<{a: string}>; _.chain({a: ''}).tap(interceptor); - _.chain({a: ''}).tap(interceptor, any); _({a: ''}).tap(interceptor); - _({a: ''}).tap(interceptor, any); } { let interceptor: (value: string) => void; let result: _.LoDashExplicitWrapper; - _.chain('').tap(interceptor, any); - _.chain('').tap(interceptor, any); + _.chain('').tap(interceptor); _('').chain().tap(interceptor); - _('').chain().tap(interceptor, any); } { @@ -2864,10 +2763,8 @@ namespace TestTap { let result: _.LoDashExplicitArrayWrapper; _.chain(['']).tap(interceptor); - _.chain(['']).tap(interceptor, any); _(['']).chain().tap(interceptor); - _(['']).chain().tap(interceptor, any); } { @@ -2875,10 +2772,8 @@ namespace TestTap { let result: _.LoDashExplicitObjectWrapper<{a: string}>; _.chain({a: ''}).tap(interceptor); - _.chain({a: ''}).tap(interceptor, any); _({a: ''}).chain().tap(interceptor); - _({a: ''}).chain().tap(interceptor, any); } } @@ -2893,7 +2788,6 @@ namespace TestThru { let result: number; result = _.thru(1, interceptor); - result = _.thru(1, interceptor, any); } { @@ -2901,7 +2795,6 @@ namespace TestThru { let result: _.LoDashImplicitWrapper; result = _(1).thru(interceptor); - result = _(1).thru(interceptor, any); } { @@ -2909,7 +2802,6 @@ namespace TestThru { let result: _.LoDashImplicitWrapper; result = _('').thru(interceptor); - result = _('').thru(interceptor, any); } { @@ -2917,7 +2809,6 @@ namespace TestThru { let result: _.LoDashImplicitWrapper; result = _(true).thru(interceptor); - result = _(true).thru(interceptor, any); } { @@ -2925,7 +2816,6 @@ namespace TestThru { let result: _.LoDashImplicitObjectWrapper<{a: string}>; result = _({a: ''}).thru<{a: string}>(interceptor); - result = _({a: ''}).thru<{a: string}>(interceptor, any); } { @@ -2933,7 +2823,6 @@ namespace TestThru { let result: _.LoDashImplicitArrayWrapper; result = _([1, 2, 3]).thru(interceptor); - result = _([1, 2, 3]).thru(interceptor, any); } { @@ -2941,7 +2830,6 @@ namespace TestThru { let result: _.LoDashExplicitWrapper; result = _(1).chain().thru(interceptor); - result = _(1).chain().thru(interceptor, any); } { @@ -2949,7 +2837,6 @@ namespace TestThru { let result: _.LoDashExplicitWrapper; result = _('').chain().thru(interceptor); - result = _('').chain().thru(interceptor, any); } { @@ -2957,7 +2844,6 @@ namespace TestThru { let result: _.LoDashExplicitWrapper; result = _(true).chain().thru(interceptor); - result = _(true).chain().thru(interceptor, any); } { @@ -2965,7 +2851,6 @@ namespace TestThru { let result: _.LoDashExplicitObjectWrapper<{a: string}>; result = _({a: ''}).chain().thru<{a: string}>(interceptor); - result = _({a: ''}).chain().thru<{a: string}>(interceptor, any); } { @@ -2973,7 +2858,6 @@ namespace TestThru { let result: _.LoDashExplicitArrayWrapper; result = _([1, 2, 3]).chain().thru(interceptor); - result = _([1, 2, 3]).chain().thru(interceptor, any); } } @@ -3152,12 +3036,12 @@ namespace TestPlant { namespace TestReverse { { let result: _.LoDashImplicitArrayWrapper; - result: _([42]).reverse(); + result = _([42]).reverse(); } { let result: _.LoDashExplicitArrayWrapper; - result: _([42]).chain().reverse(); + result = _([42]).chain().reverse(); } } @@ -3344,37 +3228,28 @@ namespace TestCountBy { result = _.countBy(''); result = _.countBy('', stringIterator); - result = _.countBy('', stringIterator, any); result = _.countBy(array); result = _.countBy(array, listIterator); - result = _.countBy(array, listIterator, any); result = _.countBy(array, ''); - result = _.countBy(array, '', any); result = _.countBy<{a: number}, TResult>(array, {a: 42}); result = _.countBy(array, {a: 42}); result = _.countBy(list); result = _.countBy(list, listIterator); - result = _.countBy(list, listIterator, any); result = _.countBy(list, ''); - result = _.countBy(list, '', any); result = _.countBy<{a: number}, TResult>(list, {a: 42}); result = _.countBy(list, {a: 42}); result = _.countBy(dictionary); result = _.countBy(dictionary, dictionaryIterator); - result = _.countBy(dictionary, dictionaryIterator, any); result = _.countBy(dictionary, ''); - result = _.countBy(dictionary, '', any); result = _.countBy<{a: number}, TResult>(dictionary, {a: 42}); result = _.countBy(dictionary, {a: 42}); result = _.countBy(numericDictionary); result = _.countBy(numericDictionary, numericDictionaryIterator); - result = _.countBy(numericDictionary, numericDictionaryIterator, any); result = _.countBy(numericDictionary, ''); - result = _.countBy(numericDictionary, '', any); result = _.countBy<{a: number}, TResult>(numericDictionary, {a: 42}); result = _.countBy(numericDictionary, {a: 42}); } @@ -3384,37 +3259,28 @@ namespace TestCountBy { result = _('').countBy(); result = _('').countBy(stringIterator); - result = _('').countBy(stringIterator, any); result = _(array).countBy(); result = _(array).countBy(listIterator); - result = _(array).countBy(listIterator, any); result = _(array).countBy(''); - result = _(array).countBy('', any); result = _(array).countBy<{a: number}>({a: 42}); result = _(array).countBy({a: 42}); result = _(list).countBy(); result = _(list).countBy(listIterator); - result = _(list).countBy(listIterator, any); result = _(list).countBy(''); - result = _(list).countBy('', any); result = _(list).countBy<{a: number}>({a: 42}); result = _(list).countBy({a: 42}); result = _(dictionary).countBy(); result = _(dictionary).countBy(dictionaryIterator); - result = _(dictionary).countBy(dictionaryIterator, any); result = _(dictionary).countBy(''); - result = _(dictionary).countBy('', any); result = _(dictionary).countBy<{a: number}>({a: 42}); result = _(dictionary).countBy({a: 42}); result = _(numericDictionary).countBy(); result = _(numericDictionary).countBy(numericDictionaryIterator); - result = _(numericDictionary).countBy(numericDictionaryIterator, any); result = _(numericDictionary).countBy(''); - result = _(numericDictionary).countBy('', any); result = _(numericDictionary).countBy<{a: number}>({a: 42}); result = _(numericDictionary).countBy({a: 42}); } @@ -3424,37 +3290,28 @@ namespace TestCountBy { result = _('').chain().countBy(); result = _('').chain().countBy(stringIterator); - result = _('').chain().countBy(stringIterator, any); result = _(array).chain().countBy(); result = _(array).chain().countBy(listIterator); - result = _(array).chain().countBy(listIterator, any); result = _(array).chain().countBy(''); - result = _(array).chain().countBy('', any); result = _(array).chain().countBy<{a: number}>({a: 42}); result = _(array).chain().countBy({a: 42}); result = _(list).chain().countBy(); result = _(list).chain().countBy(listIterator); - result = _(list).chain().countBy(listIterator, any); result = _(list).chain().countBy(''); - result = _(list).chain().countBy('', any); result = _(list).chain().countBy<{a: number}>({a: 42}); result = _(list).chain().countBy({a: 42}); result = _(dictionary).chain().countBy(); result = _(dictionary).chain().countBy(dictionaryIterator); - result = _(dictionary).chain().countBy(dictionaryIterator, any); result = _(dictionary).chain().countBy(''); - result = _(dictionary).chain().countBy('', any); result = _(dictionary).chain().countBy<{a: number}>({a: 42}); result = _(dictionary).chain().countBy({a: 42}); result = _(numericDictionary).chain().countBy(); result = _(numericDictionary).chain().countBy(numericDictionaryIterator); - result = _(numericDictionary).chain().countBy(numericDictionaryIterator, any); result = _(numericDictionary).chain().countBy(''); - result = _(numericDictionary).chain().countBy('', any); result = _(numericDictionary).chain().countBy<{a: number}>({a: 42}); result = _(numericDictionary).chain().countBy({a: 42}); } @@ -3474,84 +3331,72 @@ namespace TestEach { let result: string; _.each('', stringIterator); - _.each('', stringIterator, any); } { let result: TResult[]; _.each(array, listIterator); - _.each(array, listIterator, any); } { let result: _.List; _.each(list, listIterator); - _.each(list, listIterator, any); } { let result: _.Dictionary; _.each(dictionary, dictionaryIterator); - _.each(dictionary, dictionaryIterator, any); } { let result: _.LoDashImplicitWrapper; _('').each(stringIterator); - _('').each(stringIterator, any); } { let result: _.LoDashImplicitArrayWrapper; _(array).each(listIterator); - _(array).each(listIterator, any); } { let result: _.LoDashImplicitObjectWrapper<_.List>; _(list).each(listIterator); - _(list).each(listIterator, any); } { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; _(dictionary).each(dictionaryIterator); - _(dictionary).each(dictionaryIterator, any); } { let result: _.LoDashExplicitWrapper; _('').chain().each(stringIterator); - _('').chain().each(stringIterator, any); } { let result: _.LoDashExplicitArrayWrapper; _(array).chain().each(listIterator); - _(array).chain().each(listIterator, any); } { let result: _.LoDashExplicitObjectWrapper<_.List>; _(list).chain().each(listIterator); - _(list).chain().each(listIterator, any); } { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; _(dictionary).chain().each(dictionaryIterator); - _(dictionary).chain().each(dictionaryIterator, any); } } @@ -3569,84 +3414,72 @@ namespace TestEachRight { let result: string; _.eachRight('', stringIterator); - _.eachRight('', stringIterator, any); } { let result: TResult[]; _.eachRight(array, listIterator); - _.eachRight(array, listIterator, any); } { let result: _.List; _.eachRight(list, listIterator); - _.eachRight(list, listIterator, any); } { let result: _.Dictionary; _.eachRight(dictionary, dictionaryIterator); - _.eachRight(dictionary, dictionaryIterator, any); } { let result: _.LoDashImplicitWrapper; _('').eachRight(stringIterator); - _('').eachRight(stringIterator, any); } { let result: _.LoDashImplicitArrayWrapper; _(array).eachRight(listIterator); - _(array).eachRight(listIterator, any); } { let result: _.LoDashImplicitObjectWrapper<_.List>; _(list).eachRight(listIterator); - _(list).eachRight(listIterator, any); } { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; _(dictionary).eachRight(dictionaryIterator); - _(dictionary).eachRight(dictionaryIterator, any); } { let result: _.LoDashExplicitWrapper; _('').chain().eachRight(stringIterator); - _('').chain().eachRight(stringIterator, any); } { let result: _.LoDashExplicitArrayWrapper; _(array).chain().eachRight(listIterator); - _(array).chain().eachRight(listIterator, any); } { let result: _.LoDashExplicitObjectWrapper<_.List>; _(list).chain().eachRight(listIterator); - _(list).chain().eachRight(listIterator, any); } { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; _(dictionary).chain().eachRight(dictionaryIterator); - _(dictionary).chain().eachRight(dictionaryIterator, any); } } @@ -3758,28 +3591,21 @@ namespace TestFilter { let result: string[]; result = _.filter('', stringIterator); - result = _.filter('', stringIterator, any); } { let result: TResult[]; result = _.filter(array, listIterator); - result = _.filter(array, listIterator, any); result = _.filter(array, ''); - result = _.filter(array, '', any); result = _.filter<{a: number}, TResult>(array, {a: 42}); result = _.filter(list, listIterator); - result = _.filter(list, listIterator, any); result = _.filter(list, ''); - result = _.filter(list, '', any); result = _.filter<{a: number}, TResult>(list, {a: 42}); result = _.filter(dictionary, dictionaryIterator); - result = _.filter(dictionary, dictionaryIterator, any); result = _.filter(dictionary, ''); - result = _.filter(dictionary, '', any); result = _.filter<{a: number}, TResult>(dictionary, {a: 42}); } @@ -3787,28 +3613,21 @@ namespace TestFilter { let result: _.LoDashImplicitArrayWrapper; result = _('').filter(stringIterator); - result = _('').filter(stringIterator, any); } { let result: _.LoDashImplicitArrayWrapper; result = _(array).filter(listIterator); - result = _(array).filter(listIterator, any); result = _(array).filter(''); - result = _(array).filter('', any); result = _(array).filter<{a: number}>({a: 42}); result = _(list).filter(listIterator); - result = _(list).filter(listIterator, any); result = _(list).filter(''); - result = _(list).filter('', any); result = _(list).filter<{a: number}, TResult>({a: 42}); result = _(dictionary).filter(dictionaryIterator); - result = _(dictionary).filter(dictionaryIterator, any); result = _(dictionary).filter(''); - result = _(dictionary).filter('', any); result = _(dictionary).filter<{a: number}, TResult>({a: 42}); } @@ -3816,28 +3635,21 @@ namespace TestFilter { let result: _.LoDashExplicitArrayWrapper; result = _('').chain().filter(stringIterator); - result = _('').chain().filter(stringIterator, any); } { let result: _.LoDashExplicitArrayWrapper; result = _(array).chain().filter(listIterator); - result = _(array).chain().filter(listIterator, any); result = _(array).chain().filter(''); - result = _(array).chain().filter('', any); result = _(array).chain().filter<{a: number}>({a: 42}); result = _(list).chain().filter(listIterator); - result = _(list).chain().filter(listIterator, any); result = _(list).chain().filter(''); - result = _(list).chain().filter('', any); result = _(list).chain().filter<{a: number}, TResult>({a: 42}); result = _(dictionary).chain().filter(dictionaryIterator); - result = _(dictionary).chain().filter(dictionaryIterator, any); result = _(dictionary).chain().filter(''); - result = _(dictionary).chain().filter('', any); result = _(dictionary).chain().filter<{a: number}, TResult>({a: 42}); } } @@ -3855,37 +3667,31 @@ namespace TestFind { result = _.find(array); result = _.find(array, listIterator); - result = _.find(array, listIterator, any); result = _.find(array, ''); result = _.find<{a: number}, TResult>(array, {a: 42}); result = _.find(list); result = _.find(list, listIterator); - result = _.find(list, listIterator, any); result = _.find(list, ''); result = _.find<{a: number}, TResult>(list, {a: 42}); result = _.find(dictionary); result = _.find(dictionary, dictionaryIterator); - result = _.find(dictionary, dictionaryIterator, any); result = _.find(dictionary, ''); result = _.find<{a: number}, TResult>(dictionary, {a: 42}); result = _(array).find(); result = _(array).find(listIterator); - result = _(array).find(listIterator, any); result = _(array).find(''); result = _(array).find<{a: number}>({a: 42}); result = _(list).find(); result = _(list).find(listIterator); - result = _(list).find(listIterator, any); result = _(list).find(''); result = _(list).find<{a: number}, TResult>({a: 42}); result = _(dictionary).find(); result = _(dictionary).find(dictionaryIterator); - result = _(dictionary).find(dictionaryIterator, any); result = _(dictionary).find(''); result = _(dictionary).find<{a: number}, TResult>({a: 42}); } @@ -4107,84 +3913,72 @@ namespace TestForEach { let result: string; _.forEach('', stringIterator); - _.forEach('', stringIterator, any); } { let result: TResult[]; _.forEach(array, listIterator); - _.forEach(array, listIterator, any); } { let result: _.List; _.forEach(list, listIterator); - _.forEach(list, listIterator, any); } { let result: _.Dictionary; _.forEach(dictionary, dictionaryIterator); - _.forEach(dictionary, dictionaryIterator, any); } { let result: _.LoDashImplicitWrapper; _('').forEach(stringIterator); - _('').forEach(stringIterator, any); } { let result: _.LoDashImplicitArrayWrapper; _(array).forEach(listIterator); - _(array).forEach(listIterator, any); } { let result: _.LoDashImplicitObjectWrapper<_.List>; _(list).forEach(listIterator); - _(list).forEach(listIterator, any); } { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; _(dictionary).forEach(dictionaryIterator); - _(dictionary).forEach(dictionaryIterator, any); } { let result: _.LoDashExplicitWrapper; _('').chain().forEach(stringIterator); - _('').chain().forEach(stringIterator, any); } { let result: _.LoDashExplicitArrayWrapper; _(array).chain().forEach(listIterator); - _(array).chain().forEach(listIterator, any); } { let result: _.LoDashExplicitObjectWrapper<_.List>; _(list).chain().forEach(listIterator); - _(list).chain().forEach(listIterator, any); } { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; _(dictionary).chain().forEach(dictionaryIterator); - _(dictionary).chain().forEach(dictionaryIterator, any); } } @@ -4202,84 +3996,72 @@ namespace TestForEachRight { let result: string; _.forEachRight('', stringIterator); - _.forEachRight('', stringIterator, any); } { let result: TResult[]; _.forEachRight(array, listIterator); - _.forEachRight(array, listIterator, any); } { let result: _.List; _.forEachRight(list, listIterator); - _.forEachRight(list, listIterator, any); } { let result: _.Dictionary; _.forEachRight(dictionary, dictionaryIterator); - _.forEachRight(dictionary, dictionaryIterator, any); } { let result: _.LoDashImplicitWrapper; _('').forEachRight(stringIterator); - _('').forEachRight(stringIterator, any); } { let result: _.LoDashImplicitArrayWrapper; _(array).forEachRight(listIterator); - _(array).forEachRight(listIterator, any); } { let result: _.LoDashImplicitObjectWrapper<_.List>; _(list).forEachRight(listIterator); - _(list).forEachRight(listIterator, any); } { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; _(dictionary).forEachRight(dictionaryIterator); - _(dictionary).forEachRight(dictionaryIterator, any); } { let result: _.LoDashExplicitWrapper; _('').chain().forEachRight(stringIterator); - _('').chain().forEachRight(stringIterator, any); } { let result: _.LoDashExplicitArrayWrapper; _(array).chain().forEachRight(listIterator); - _(array).chain().forEachRight(listIterator, any); } { let result: _.LoDashExplicitObjectWrapper<_.List>; _(list).chain().forEachRight(listIterator); - _(list).chain().forEachRight(listIterator, any); } { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; _(dictionary).chain().forEachRight(dictionaryIterator); - _(dictionary).chain().forEachRight(dictionaryIterator, any); } } @@ -4300,9 +4082,7 @@ namespace TestGroupBy { result = _.groupBy(''); result = _.groupBy('', stringIterator); - result = _.groupBy('', stringIterator, any); result = _.groupBy('', stringIterator); - result = _.groupBy('', stringIterator, any); } { @@ -4310,38 +4090,29 @@ namespace TestGroupBy { result = _.groupBy(array); result = _.groupBy(array, listIterator); - result = _.groupBy(array, listIterator, any); result = _.groupBy(array, ''); - result = _.groupBy(array, '', any); result = _.groupBy(array, {a: 42}); result = _.groupBy(array, listIterator); - result = _.groupBy(array, listIterator, any); - result = _.groupBy(array, '', true); + result = _.groupBy(array, ''); result = _.groupBy<{a: number}, SampleType>(array, {a: 42}); result = _.groupBy(list); result = _.groupBy(list, listIterator); - result = _.groupBy(list, listIterator, any); result = _.groupBy(list, ''); - result = _.groupBy(list, '', any); result = _.groupBy(list, {a: 42}); result = _.groupBy(list, listIterator); - result = _.groupBy(list, listIterator, any); - result = _.groupBy(list, '', true); + result = _.groupBy(list, ''); result = _.groupBy<{a: number}, SampleType>(list, {a: 42}); result = _.groupBy(dictionary); result = _.groupBy(dictionary, dictionaryIterator); - result = _.groupBy(dictionary, dictionaryIterator, any); result = _.groupBy(dictionary, ''); - result = _.groupBy(dictionary, '', any); result = _.groupBy(dictionary, {a: 42}); result = _.groupBy(dictionary, dictionaryIterator); - result = _.groupBy(dictionary, dictionaryIterator, any); - result = _.groupBy(dictionary, '', true); + result = _.groupBy(dictionary, ''); result = _.groupBy<{a: number}, SampleType>(dictionary, {a: 42}); } @@ -4350,7 +4121,6 @@ namespace TestGroupBy { result = _('').groupBy(); result = _('').groupBy(stringIterator); - result = _('').groupBy(stringIterator, any); } { @@ -4358,33 +4128,26 @@ namespace TestGroupBy { result = _(array).groupBy(); result = _(array).groupBy(listIterator); - result = _(array).groupBy(listIterator, any); result = _(array).groupBy(''); - result = _(array).groupBy('', true); + result = _(array).groupBy(''); result = _(array).groupBy<{a: number}>({a: 42}); result = _(list).groupBy(); result = _(list).groupBy(listIterator); - result = _(list).groupBy(listIterator, any); result = _(list).groupBy(''); - result = _(list).groupBy('', any); result = _(list).groupBy({a: 42}); result = _(list).groupBy(listIterator); - result = _(list).groupBy(listIterator, any); - result = _(list).groupBy('', true); + result = _(list).groupBy(''); result = _(list).groupBy<{a: number}, SampleType>({a: 42}); result = _(dictionary).groupBy(); result = _(dictionary).groupBy(dictionaryIterator); - result = _(dictionary).groupBy(dictionaryIterator, any); result = _(dictionary).groupBy(''); - result = _(dictionary).groupBy('', any); result = _(dictionary).groupBy({a: 42}); result = _(dictionary).groupBy(dictionaryIterator); - result = _(dictionary).groupBy(dictionaryIterator, any); - result = _(dictionary).groupBy('', true); + result = _(dictionary).groupBy(''); result = _(dictionary).groupBy<{a: number}, SampleType>({a: 42}); } @@ -4393,7 +4156,6 @@ namespace TestGroupBy { result = _('').chain().groupBy(); result = _('').chain().groupBy(stringIterator); - result = _('').chain().groupBy(stringIterator, any); } { @@ -4401,33 +4163,26 @@ namespace TestGroupBy { result = _(array).chain().groupBy(); result = _(array).chain().groupBy(listIterator); - result = _(array).chain().groupBy(listIterator, any); result = _(array).chain().groupBy(''); - result = _(array).chain().groupBy('', true); + result = _(array).chain().groupBy(''); result = _(array).chain().groupBy<{a: number}>({a: 42}); result = _(list).chain().groupBy(); result = _(list).chain().groupBy(listIterator); - result = _(list).chain().groupBy(listIterator, any); result = _(list).chain().groupBy(''); - result = _(list).chain().groupBy('', any); result = _(list).chain().groupBy({a: 42}); result = _(list).chain().groupBy(listIterator); - result = _(list).chain().groupBy(listIterator, any); - result = _(list).chain().groupBy('', true); + result = _(list).chain().groupBy(''); result = _(list).chain().groupBy<{a: number}, SampleType>({a: 42}); result = _(dictionary).chain().groupBy(); result = _(dictionary).chain().groupBy(dictionaryIterator); - result = _(dictionary).chain().groupBy(dictionaryIterator, any); result = _(dictionary).chain().groupBy(''); - result = _(dictionary).chain().groupBy('', any); result = _(dictionary).chain().groupBy({a: 42}); result = _(dictionary).chain().groupBy(dictionaryIterator); - result = _(dictionary).chain().groupBy(dictionaryIterator, any); - result = _(dictionary).chain().groupBy('', true); + result = _(dictionary).chain().groupBy(''); result = _(dictionary).chain().groupBy<{a: number}, SampleType>({a: 42}); } } @@ -4497,7 +4252,6 @@ namespace TestKeyBy { result = _.keyBy('abcd'); result = _.keyBy('abcd', stringIterator); - result = _.keyBy('abcd', stringIterator, any); } { @@ -4505,33 +4259,25 @@ namespace TestKeyBy { result = _.keyBy(array); result = _.keyBy(array, listIterator); - result = _.keyBy(array, listIterator, any); result = _.keyBy(array, 'a'); - result = _.keyBy(array, 'a', any); result = _.keyBy<{a: number}, SampleObject>(array, {a: 42}); result = _.keyBy(array, {a: 42}); result = _.keyBy(list); result = _.keyBy(list, listIterator); - result = _.keyBy(list, listIterator, any); result = _.keyBy(list, 'a'); - result = _.keyBy(list, 'a', any); result = _.keyBy<{a: number}, SampleObject>(list, {a: 42}); result = _.keyBy(list, {a: 42}); result = _.keyBy(numericDictionary); result = _.keyBy(numericDictionary, numericDictionaryIterator); - result = _.keyBy(numericDictionary, numericDictionaryIterator, any); result = _.keyBy(numericDictionary, 'a'); - result = _.keyBy(numericDictionary, 'a', any); result = _.keyBy<{a: number}, SampleObject>(numericDictionary, {a: 42}); result = _.keyBy(numericDictionary, {a: 42}); result = _.keyBy(dictionary); result = _.keyBy(dictionary, dictionaryIterator); - result = _.keyBy(dictionary, dictionaryIterator, any); result = _.keyBy(dictionary, 'a'); - result = _.keyBy(dictionary, 'a', any); result = _.keyBy<{a: number}, SampleObject>(dictionary, {a: 42}); result = _.keyBy(dictionary, {a: 42}); } @@ -4541,7 +4287,6 @@ namespace TestKeyBy { result = _('abcd').keyBy(); result = _('abcd').keyBy(stringIterator); - result = _('abcd').keyBy(stringIterator, any); } { @@ -4549,32 +4294,24 @@ namespace TestKeyBy { result = _(array).keyBy(); result = _(array).keyBy(listIterator); - result = _(array).keyBy(listIterator, any); result = _(array).keyBy('a'); - result = _(array).keyBy('a', any); result = _(array).keyBy<{a: number}>({a: 42}); result = _(list).keyBy(); result = _(list).keyBy(listIterator); - result = _(list).keyBy(listIterator, any); result = _(list).keyBy('a'); - result = _(list).keyBy('a', any); result = _(list).keyBy<{a: number}, SampleObject>({a: 42}); result = _(list).keyBy({a: 42}); result = _(numericDictionary).keyBy(); result = _(numericDictionary).keyBy(numericDictionaryIterator); - result = _(numericDictionary).keyBy(numericDictionaryIterator, any); result = _(numericDictionary).keyBy('a'); - result = _(numericDictionary).keyBy('a', any); result = _(numericDictionary).keyBy<{a: number}, SampleObject>({a: 42}); result = _(numericDictionary).keyBy({a: 42}); result = _(dictionary).keyBy(); result = _(dictionary).keyBy(dictionaryIterator); - result = _(dictionary).keyBy(dictionaryIterator, any); result = _(dictionary).keyBy('a'); - result = _(dictionary).keyBy('a', any); result = _(dictionary).keyBy<{a: number}, SampleObject>({a: 42}); result = _(dictionary).keyBy({a: 42}); } @@ -4584,7 +4321,6 @@ namespace TestKeyBy { result = _('abcd').chain().keyBy(); result = _('abcd').chain().keyBy(stringIterator); - result = _('abcd').chain().keyBy(stringIterator, any); } { @@ -4592,32 +4328,24 @@ namespace TestKeyBy { result = _(array).chain().keyBy(); result = _(array).chain().keyBy(listIterator); - result = _(array).chain().keyBy(listIterator, any); result = _(array).chain().keyBy('a'); - result = _(array).chain().keyBy('a', any); result = _(array).chain().keyBy<{a: number}>({a: 42}); result = _(list).chain().keyBy(); result = _(list).chain().keyBy(listIterator); - result = _(list).chain().keyBy(listIterator, any); result = _(list).chain().keyBy('a'); - result = _(list).chain().keyBy('a', any); result = _(list).chain().keyBy<{a: number}, SampleObject>({a: 42}); result = _(list).chain().keyBy({a: 42}); result = _(numericDictionary).chain().keyBy(); result = _(numericDictionary).chain().keyBy(numericDictionaryIterator); - result = _(numericDictionary).chain().keyBy(numericDictionaryIterator, any); result = _(numericDictionary).chain().keyBy('a'); - result = _(numericDictionary).chain().keyBy('a', any); result = _(numericDictionary).chain().keyBy<{a: number}, SampleObject>({a: 42}); result = _(numericDictionary).chain().keyBy({a: 42}); result = _(dictionary).chain().keyBy(); result = _(dictionary).chain().keyBy(dictionaryIterator); - result = _(dictionary).chain().keyBy(dictionaryIterator, any); result = _(dictionary).chain().keyBy('a'); - result = _(dictionary).chain().keyBy('a', any); result = _(dictionary).chain().keyBy<{a: number}, SampleObject>({a: 42}); result = _(dictionary).chain().keyBy({a: 42}); } @@ -4767,17 +4495,14 @@ namespace TestMap { result = _.map(array); result = _.map(array, listIterator); - result = _.map(array, listIterator, any); result = _.map(array, ''); result = _.map(list); result = _.map(list, listIterator); - result = _.map(list, listIterator, any); result = _.map(list, ''); result = _.map(dictionary); result = _.map(dictionary, dictionaryIterator); - result = _.map(dictionary, dictionaryIterator, any); result = _.map(dictionary, ''); } @@ -4794,17 +4519,14 @@ namespace TestMap { result = _(array).map(); result = _(array).map(listIterator); - result = _(array).map(listIterator, any); result = _(array).map(''); result = _(list).map(); result = _(list).map(listIterator); - result = _(list).map(listIterator, any); result = _(list).map(''); result = _(dictionary).map(); result = _(dictionary).map(dictionaryIterator); - result = _(dictionary).map(dictionaryIterator, any); result = _(dictionary).map(''); } @@ -4821,17 +4543,14 @@ namespace TestMap { result = _(array).chain().map(); result = _(array).chain().map(listIterator); - result = _(array).chain().map(listIterator, any); result = _(array).chain().map(''); result = _(list).chain().map(); result = _(list).chain().map(listIterator); - result = _(list).chain().map(listIterator, any); result = _(list).chain().map(''); result = _(dictionary).chain().map(); result = _(dictionary).chain().map(dictionaryIterator); - result = _(dictionary).chain().map(dictionaryIterator, any); result = _(dictionary).chain().map(''); } @@ -4957,7 +4676,7 @@ result = _([1, 2, 3]).reduce(function (sum: number, num: number) result = _({ 'a': 1, 'b': 2, 'c': 3 }).reduce(function (r: ABC, num: number, key: string) { r[key] = num * 3; return r; -}, {}); +}, {}); result = _.reduceRight([[0, 1], [2, 3], [4, 5]], function (a: number[], b: number[]) { return a.concat(b); }, []); @@ -4975,28 +4694,21 @@ namespace TestReject { let result: string[]; result = _.reject('', stringIterator); - result = _.reject('', stringIterator, any); } { let result: TResult[]; result = _.reject(array, listIterator); - result = _.reject(array, listIterator, any); result = _.reject(array, ''); - result = _.reject(array, '', any); result = _.reject<{a: number}, TResult>(array, {a: 42}); result = _.reject(list, listIterator); - result = _.reject(list, listIterator, any); result = _.reject(list, ''); - result = _.reject(list, '', any); result = _.reject<{a: number}, TResult>(list, {a: 42}); result = _.reject(dictionary, dictionaryIterator); - result = _.reject(dictionary, dictionaryIterator, any); result = _.reject(dictionary, ''); - result = _.reject(dictionary, '', any); result = _.reject<{a: number}, TResult>(dictionary, {a: 42}); } @@ -5004,28 +4716,21 @@ namespace TestReject { let result: _.LoDashImplicitArrayWrapper; result = _('').reject(stringIterator); - result = _('').reject(stringIterator, any); } { let result: _.LoDashImplicitArrayWrapper; result = _(array).reject(listIterator); - result = _(array).reject(listIterator, any); result = _(array).reject(''); - result = _(array).reject('', any); result = _(array).reject<{a: number}>({a: 42}); result = _(list).reject(listIterator); - result = _(list).reject(listIterator, any); result = _(list).reject(''); - result = _(list).reject('', any); result = _(list).reject<{a: number}, TResult>({a: 42}); result = _(dictionary).reject(dictionaryIterator); - result = _(dictionary).reject(dictionaryIterator, any); result = _(dictionary).reject(''); - result = _(dictionary).reject('', any); result = _(dictionary).reject<{a: number}, TResult>({a: 42}); } @@ -5033,28 +4738,21 @@ namespace TestReject { let result: _.LoDashExplicitArrayWrapper; result = _('').chain().reject(stringIterator); - result = _('').chain().reject(stringIterator, any); } { let result: _.LoDashExplicitArrayWrapper; result = _(array).chain().reject(listIterator); - result = _(array).chain().reject(listIterator, any); result = _(array).chain().reject(''); - result = _(array).chain().reject('', any); result = _(array).chain().reject<{a: number}>({a: 42}); result = _(list).chain().reject(listIterator); - result = _(list).chain().reject(listIterator, any); result = _(list).chain().reject(''); - result = _(list).chain().reject('', any); result = _(list).chain().reject<{a: number}, TResult>({a: 42}); result = _(dictionary).chain().reject(dictionaryIterator); - result = _(dictionary).chain().reject(dictionaryIterator, any); result = _(dictionary).chain().reject(''); - result = _(dictionary).chain().reject('', any); result = _(dictionary).chain().reject<{a: number}, TResult>({a: 42}); } } @@ -8988,7 +8686,6 @@ namespace TestExtend { result = _.extend(obj, s1); result = _.extend(obj, s1, customizer); - result = _.extend(obj, s1, customizer, any); } { @@ -8996,7 +8693,6 @@ namespace TestExtend { result = _.extend(obj, s1, s2); result = _.extend(obj, s1, s2, customizer); - result = _.extend(obj, s1, s2, customizer, any); } { @@ -9004,7 +8700,6 @@ namespace TestExtend { result = _.extend(obj, s1, s2, s3); result = _.extend(obj, s1, s2, s3, customizer); - result = _.extend(obj, s1, s2, s3, customizer, any); } { @@ -9012,7 +8707,6 @@ namespace TestExtend { result = _.extend(obj, s1, s2, s3, s4); result = _.extend(obj, s1, s2, s3, s4, customizer); - result = _.extend(obj, s1, s2, s3, s4, customizer, any); } { @@ -9020,7 +8714,6 @@ namespace TestExtend { result = _.extend(obj, s1, s2, s3, s4, s5); result = _.extend(obj, s1, s2, s3, s4, s5, customizer); - result = _.extend(obj, s1, s2, s3, s4, s5, customizer, any); } { @@ -9034,7 +8727,6 @@ namespace TestExtend { result = _(obj).extend(s1); result = _(obj).extend(s1, customizer); - result = _(obj).extend(s1, customizer, any); } { @@ -9042,7 +8734,6 @@ namespace TestExtend { result = _(obj).extend(s1, s2); result = _(obj).extend(s1, s2, customizer); - result = _(obj).extend(s1, s2, customizer, any); } { @@ -9050,7 +8741,6 @@ namespace TestExtend { result = _(obj).extend(s1, s2, s3); result = _(obj).extend(s1, s2, s3, customizer); - result = _(obj).extend(s1, s2, s3, customizer, any); } { @@ -9058,7 +8748,6 @@ namespace TestExtend { result = _(obj).extend(s1, s2, s3, s4); result = _(obj).extend(s1, s2, s3, s4, customizer); - result = _(obj).extend(s1, s2, s3, s4, customizer, any); } { @@ -9066,7 +8755,6 @@ namespace TestExtend { result = _(obj).extend(s1, s2, s3, s4, s5); result = _(obj).extend(s1, s2, s3, s4, s5, customizer); - result = _(obj).extend(s1, s2, s3, s4, s5, customizer, any); } { @@ -9080,7 +8768,6 @@ namespace TestExtend { result = _(obj).chain().extend(s1); result = _(obj).chain().extend(s1, customizer); - result = _(obj).chain().extend(s1, customizer, any); } { @@ -9088,7 +8775,6 @@ namespace TestExtend { result = _(obj).chain().extend(s1, s2); result = _(obj).chain().extend(s1, s2, customizer); - result = _(obj).chain().extend(s1, s2, customizer, any); } { @@ -9096,7 +8782,6 @@ namespace TestExtend { result = _(obj).chain().extend(s1, s2, s3); result = _(obj).chain().extend(s1, s2, s3, customizer); - result = _(obj).chain().extend(s1, s2, s3, customizer, any); } { @@ -9104,7 +8789,6 @@ namespace TestExtend { result = _(obj).chain().extend(s1, s2, s3, s4); result = _(obj).chain().extend(s1, s2, s3, s4, customizer); - result = _(obj).chain().extend(s1, s2, s3, s4, customizer, any); } { @@ -9112,7 +8796,6 @@ namespace TestExtend { result = _(obj).chain().extend(s1, s2, s3, s4, s5); result = _(obj).chain().extend(s1, s2, s3, s4, s5, customizer); - result = _(obj).chain().extend(s1, s2, s3, s4, s5, customizer, any); } } @@ -9125,22 +8808,18 @@ namespace TestFindKey { result = _.findKey<{a: string;}>({a: ''}); result = _.findKey<{a: string;}>({a: ''}, predicateFn); - result = _.findKey<{a: string;}>({a: ''}, predicateFn, any); result = _.findKey<{a: string;}>({a: ''}, ''); - result = _.findKey<{a: string;}>({a: ''}, '', any); result = _.findKey<{a: number;}, {a: string;}>({a: ''}, {a: 42}); result = _<{a: string;}>({a: ''}).findKey(); result = _<{a: string;}>({a: ''}).findKey(predicateFn); - result = _<{a: string;}>({a: ''}).findKey(predicateFn, any); result = _<{a: string;}>({a: ''}).findKey(''); - result = _<{a: string;}>({a: ''}).findKey('', any); result = _<{a: string;}>({a: ''}).findKey<{a: number;}>({a: 42}); } @@ -9150,10 +8829,8 @@ namespace TestFindKey { let result: string; result = _.findKey({a: ''}, predicateFn); - result = _.findKey({a: ''}, predicateFn, any); result = _<{a: string;}>({a: ''}).findKey(predicateFn); - result = _<{a: string;}>({a: ''}).findKey(predicateFn, any); } { @@ -9163,11 +8840,9 @@ namespace TestFindKey { result = _<{a: string;}>({a: ''}).chain().findKey(); result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn); - result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn, any); result = _<{a: string;}>({a: ''}).chain().findKey(''); - result = _<{a: string;}>({a: ''}).chain().findKey('', any); result = _<{a: string;}>({a: ''}).chain().findKey<{a: number;}>({a: 42}); } @@ -9177,7 +8852,6 @@ namespace TestFindKey { let result: _.LoDashExplicitWrapper; result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn); - result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn, any); } } @@ -9190,22 +8864,18 @@ namespace TestFindLastKey { result = _.findLastKey<{a: string;}>({a: ''}); result = _.findLastKey<{a: string;}>({a: ''}, predicateFn); - result = _.findLastKey<{a: string;}>({a: ''}, predicateFn, any); result = _.findLastKey<{a: string;}>({a: ''}, ''); - result = _.findLastKey<{a: string;}>({a: ''}, '', any); result = _.findLastKey<{a: number;}, {a: string;}>({a: ''}, {a: 42}); result = _<{a: string;}>({a: ''}).findLastKey(); result = _<{a: string;}>({a: ''}).findLastKey(predicateFn); - result = _<{a: string;}>({a: ''}).findLastKey(predicateFn, any); result = _<{a: string;}>({a: ''}).findLastKey(''); - result = _<{a: string;}>({a: ''}).findLastKey('', any); result = _<{a: string;}>({a: ''}).findLastKey<{a: number;}>({a: 42}); } @@ -9215,10 +8885,8 @@ namespace TestFindLastKey { let result: string; result = _.findLastKey({a: ''}, predicateFn); - result = _.findLastKey({a: ''}, predicateFn, any); result = _<{a: string;}>({a: ''}).findLastKey(predicateFn); - result = _<{a: string;}>({a: ''}).findLastKey(predicateFn, any); } { @@ -9228,11 +8896,9 @@ namespace TestFindLastKey { result = _<{a: string;}>({a: ''}).chain().findLastKey(); result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn); - result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn, any); result = _<{a: string;}>({a: ''}).chain().findLastKey(''); - result = _<{a: string;}>({a: ''}).chain().findLastKey('', any); result = _<{a: string;}>({a: ''}).chain().findLastKey<{a: number;}>({a: 42}); } @@ -9242,7 +8908,6 @@ namespace TestFindLastKey { let result: _.LoDashExplicitWrapper; result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn); - result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn, any); } } @@ -9261,7 +8926,6 @@ namespace TestForIn { result = _.forIn(dictionary); result = _.forIn(dictionary, dictionaryIterator); - result = _.forIn(dictionary, dictionaryIterator, any); } { @@ -9269,7 +8933,6 @@ namespace TestForIn { result = _.forIn(object); result = _.forIn(object, objectIterator); - result = _.forIn(object, objectIterator, any); } { @@ -9277,7 +8940,6 @@ namespace TestForIn { result = _(dictionary).forIn(); result = _(dictionary).forIn(dictionaryIterator); - result = _(dictionary).forIn(dictionaryIterator, any); } { @@ -9285,7 +8947,6 @@ namespace TestForIn { result = _(dictionary).chain().forIn(); result = _(dictionary).chain().forIn(dictionaryIterator); - result = _(dictionary).chain().forIn(dictionaryIterator, any); } } @@ -9304,7 +8965,6 @@ namespace TestForInRight { result = _.forInRight(dictionary); result = _.forInRight(dictionary, dictionaryIterator); - result = _.forInRight(dictionary, dictionaryIterator, any); } { @@ -9312,7 +8972,6 @@ namespace TestForInRight { result = _.forInRight(object); result = _.forInRight(object, objectIterator); - result = _.forInRight(object, objectIterator, any); } { @@ -9320,7 +8979,6 @@ namespace TestForInRight { result = _(dictionary).forInRight(); result = _(dictionary).forInRight(dictionaryIterator); - result = _(dictionary).forInRight(dictionaryIterator, any); } { @@ -9328,7 +8986,6 @@ namespace TestForInRight { result = _(dictionary).chain().forInRight(); result = _(dictionary).chain().forInRight(dictionaryIterator); - result = _(dictionary).chain().forInRight(dictionaryIterator, any); } } @@ -9347,7 +9004,6 @@ namespace TestForOwn { result = _.forOwn(dictionary); result = _.forOwn(dictionary, dictionaryIterator); - result = _.forOwn(dictionary, dictionaryIterator, any); } { @@ -9355,7 +9011,6 @@ namespace TestForOwn { result = _.forOwn(object); result = _.forOwn(object, objectIterator); - result = _.forOwn(object, objectIterator, any); } { @@ -9363,7 +9018,6 @@ namespace TestForOwn { result = _(dictionary).forOwn(); result = _(dictionary).forOwn(dictionaryIterator); - result = _(dictionary).forOwn(dictionaryIterator, any); } { @@ -9371,7 +9025,6 @@ namespace TestForOwn { result = _(dictionary).chain().forOwn(); result = _(dictionary).chain().forOwn(dictionaryIterator); - result = _(dictionary).chain().forOwn(dictionaryIterator, any); } } @@ -9390,7 +9043,6 @@ namespace TestForOwnRight { result = _.forOwnRight(dictionary); result = _.forOwnRight(dictionary, dictionaryIterator); - result = _.forOwnRight(dictionary, dictionaryIterator, any); } { @@ -9398,7 +9050,6 @@ namespace TestForOwnRight { result = _.forOwnRight(object); result = _.forOwnRight(object, objectIterator); - result = _.forOwnRight(object, objectIterator, any); } { @@ -9406,7 +9057,6 @@ namespace TestForOwnRight { result = _(dictionary).forOwnRight(); result = _(dictionary).forOwnRight(dictionaryIterator); - result = _(dictionary).forOwnRight(dictionaryIterator, any); } { @@ -9414,7 +9064,6 @@ namespace TestForOwnRight { result = _(dictionary).chain().forOwnRight(); result = _(dictionary).chain().forOwnRight(dictionaryIterator); - result = _(dictionary).chain().forOwnRight(dictionaryIterator, any); } } @@ -9797,23 +9446,17 @@ namespace TestMapKeys { result = _.mapKeys(array); result = _.mapKeys(array, listIterator); - result = _.mapKeys(array, listIterator, any); result = _.mapKeys(array, ''); - result = _.mapKeys(array, '', any); result = _.mapKeys(array, {}); result = _.mapKeys(list); result = _.mapKeys(list, listIterator); - result = _.mapKeys(list, listIterator, any); result = _.mapKeys(list, ''); - result = _.mapKeys(list, '', any); result = _.mapKeys(list, {}); result = _.mapKeys(dictionary); result = _.mapKeys(dictionary, dictionaryIterator); - result = _.mapKeys(dictionary, dictionaryIterator, any); result = _.mapKeys(dictionary, ''); - result = _.mapKeys(dictionary, '', any); result = _.mapKeys(dictionary, {}); } @@ -9822,23 +9465,17 @@ namespace TestMapKeys { result = _(array).mapKeys(); result = _(array).mapKeys(listIterator); - result = _(array).mapKeys(listIterator, any); result = _(array).mapKeys(''); - result = _(array).mapKeys('', any); result = _(array).mapKeys<{}>({}); result = _(list).mapKeys(); result = _(list).mapKeys(listIterator); - result = _(list).mapKeys(listIterator, any); result = _(list).mapKeys(''); - result = _(list).mapKeys('', any); result = _(list).mapKeys({}); result = _(dictionary).mapKeys(); result = _(dictionary).mapKeys(dictionaryIterator); - result = _(dictionary).mapKeys(dictionaryIterator, any); result = _(dictionary).mapKeys(''); - result = _(dictionary).mapKeys('', any); result = _(dictionary).mapKeys({}); } @@ -9847,23 +9484,17 @@ namespace TestMapKeys { result = _(array).chain().mapKeys(); result = _(array).chain().mapKeys(listIterator); - result = _(array).chain().mapKeys(listIterator, any); result = _(array).chain().mapKeys(''); - result = _(array).chain().mapKeys('', any); result = _(array).chain().mapKeys<{}>({}); result = _(list).chain().mapKeys(); result = _(list).chain().mapKeys(listIterator); - result = _(list).chain().mapKeys(listIterator, any); result = _(list).chain().mapKeys(''); - result = _(list).chain().mapKeys('', any); result = _(list).chain().mapKeys({}); result = _(dictionary).chain().mapKeys(); result = _(dictionary).chain().mapKeys(dictionaryIterator); - result = _(dictionary).chain().mapKeys(dictionaryIterator, any); result = _(dictionary).chain().mapKeys(''); - result = _(dictionary).chain().mapKeys('', any); result = _(dictionary).chain().mapKeys({}); } } @@ -10406,12 +10037,10 @@ namespace TestTransform { result = _.transform(array); result = _.transform(array, iterator); result = _.transform(array, iterator, accumulator); - result = _.transform(array, iterator, accumulator, any); result = _(array).transform().value(); result = _(array).transform(iterator).value(); result = _(array).transform(iterator, accumulator).value(); - result = _(array).transform(iterator, accumulator, any).value(); } { @@ -10421,11 +10050,9 @@ namespace TestTransform { result = _.transform(array, iterator); result = _.transform(array, iterator, accumulator); - result = _.transform(array, iterator, accumulator, any); result = _(array).transform(iterator).value(); result = _(array).transform(iterator, accumulator).value(); - result = _(array).transform(iterator, accumulator, any).value(); } { @@ -10436,12 +10063,10 @@ namespace TestTransform { result = _.transform(dictionary); result = _.transform(dictionary, iterator); result = _.transform(dictionary, iterator, accumulator); - result = _.transform(dictionary, iterator, accumulator, any); result = _(dictionary).transform().value(); result = _(dictionary).transform(iterator).value(); result = _(dictionary).transform(iterator, accumulator).value(); - result = _(dictionary).transform(iterator, accumulator, any).value(); } { @@ -10451,11 +10076,9 @@ namespace TestTransform { result = _.transform(dictionary, iterator); result = _.transform(dictionary, iterator, accumulator); - result = _.transform(dictionary, iterator, accumulator, any); result = _(dictionary).transform(iterator).value(); result = _(dictionary).transform(iterator, accumulator).value(); - result = _(dictionary).transform(iterator, accumulator, any).value(); } } @@ -11225,77 +10848,77 @@ namespace TestAttempt { namespace TestConstant { { let result: () => number; - result: _.constant(42); + result = _.constant(42); } { let result: () => string; - result: _.constant('a'); + result = _.constant('a'); } { let result: () => boolean; - result: _.constant(true); + result = _.constant(true); } { let result: () => string[]; - result: _.constant(['a']); + result = _.constant(['a']); } { let result: () => {a: string}; - result: _.constant<{a: string}>({a: 'a'}); + result = _.constant<{a: string}>({a: 'a'}); } { let result: _.LoDashImplicitObjectWrapper<() => number>; - result: _(42).constant(); + result = _(42).constant(); } { let result: _.LoDashImplicitObjectWrapper<() => string>; - result: _('a').constant(); + result = _('a').constant(); } { let result: _.LoDashImplicitObjectWrapper<() => boolean>; - result: _(true).constant(); + result = _(true).constant(); } { let result: _.LoDashImplicitObjectWrapper<() => string[]>; - result: _(['a']).constant(); + result = _(['a']).constant(); } { let result: _.LoDashImplicitObjectWrapper<() => {a: string}>; - result: _({a: 'a'}).constant<{a: string}>(); + result = _({a: 'a'}).constant<{a: string}>(); } { let result: _.LoDashExplicitObjectWrapper<() => number>; - result: _(42).chain().constant(); + result = _(42).chain().constant(); } { let result: _.LoDashExplicitObjectWrapper<() => string>; - result: _('a').chain().constant(); + result = _('a').chain().constant(); } { let result: _.LoDashExplicitObjectWrapper<() => boolean>; - result: _(true).chain().constant(); + result = _(true).chain().constant(); } { let result: _.LoDashExplicitObjectWrapper<() => string[]>; - result: _(['a']).chain().constant(); + result = _(['a']).chain().constant(); } { let result: _.LoDashExplicitObjectWrapper<() => {a: string}>; - result: _({a: 'a'}).chain().constant<{a: string}>(); + result = _({a: 'a'}).chain().constant<{a: string}>(); } } @@ -11347,63 +10970,54 @@ namespace TestIteratee { let result: (...args: any[]) => TResult; result = _.iteratee(Function); - result = _.iteratee(Function, any); } { let result: (object: any) => TResult; result = _.iteratee(''); - result = _.iteratee('', any); } { let result: (object: any) => boolean; result = _.iteratee({}); - result = _.iteratee({}, any); } { let result: _.LoDashImplicitObjectWrapper<(...args: any[]) => TResult>; result = _(Function).iteratee(); - result = _(Function).iteratee(any); } { let result: _.LoDashImplicitObjectWrapper<(object: any) => TResult>; result = _('').iteratee(); - result = _('').iteratee(any); } { let result: _.LoDashImplicitObjectWrapper<(object: any) => boolean>; result = _({}).iteratee(); - result = _({}).iteratee(any); } { let result: _.LoDashExplicitObjectWrapper<(...args: any[]) => TResult>; result = _(Function).chain().iteratee(); - result = _(Function).chain().iteratee(any); } { let result: _.LoDashExplicitObjectWrapper<(object: any) => TResult>; result = _('').chain().iteratee(); - result = _('').chain().iteratee(any); } { let result: _.LoDashExplicitObjectWrapper<(object: any) => boolean>; result = _({}).chain().iteratee(); - result = _({}).chain().iteratee(any); } } @@ -11480,7 +11094,6 @@ namespace TestMethod { let result: (object: any) => {a: string}; result = _.method<{a: string}>('a.0'); - result = _.method<{a: string}>('a.0', any); result = _.method<{a: string}>('a.0', any, any); result = _.method<{a: string}>('a.0', any, any, any); @@ -11494,7 +11107,6 @@ namespace TestMethod { let result: (object: {a: string}) => {b: string}; result = _.method<{a: string}, {b: string}>('a.0'); - result = _.method<{a: string}, {b: string}>('a.0', any); result = _.method<{a: string}, {b: string}>('a.0', any, any); result = _.method<{a: string}, {b: string}>('a.0', any, any, any); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 9503670267..0e506e9597 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1241,8 +1241,7 @@ declare module _ { */ dropRightWhile( array: List, - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): TValue[]; /** @@ -1250,8 +1249,7 @@ declare module _ { */ dropRightWhile( array: List, - predicate?: string, - thisArg?: any + predicate?: string ): TValue[]; /** @@ -1268,16 +1266,14 @@ declare module _ { * @see _.dropRightWhile */ dropRightWhile( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): LoDashImplicitArrayWrapper; /** * @see _.dropRightWhile */ dropRightWhile( - predicate?: string, - thisArg?: any + predicate?: string ): LoDashImplicitArrayWrapper; /** @@ -1293,16 +1289,14 @@ declare module _ { * @see _.dropRightWhile */ dropRightWhile( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): LoDashImplicitArrayWrapper; /** * @see _.dropRightWhile */ dropRightWhile( - predicate?: string, - thisArg?: any + predicate?: string ): LoDashImplicitArrayWrapper; /** @@ -1318,16 +1312,14 @@ declare module _ { * @see _.dropRightWhile */ dropRightWhile( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): LoDashExplicitArrayWrapper; /** * @see _.dropRightWhile */ dropRightWhile( - predicate?: string, - thisArg?: any + predicate?: string ): LoDashExplicitArrayWrapper; /** @@ -1343,16 +1335,14 @@ declare module _ { * @see _.dropRightWhile */ dropRightWhile( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): LoDashExplicitArrayWrapper; /** * @see _.dropRightWhile */ dropRightWhile( - predicate?: string, - thisArg?: any + predicate?: string ): LoDashExplicitArrayWrapper; /** @@ -1385,8 +1375,7 @@ declare module _ { */ dropWhile( array: List, - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): TValue[]; /** @@ -1394,8 +1383,7 @@ declare module _ { */ dropWhile( array: List, - predicate?: string, - thisArg?: any + predicate?: string ): TValue[]; /** @@ -1412,16 +1400,14 @@ declare module _ { * @see _.dropWhile */ dropWhile( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): LoDashImplicitArrayWrapper; /** * @see _.dropWhile */ dropWhile( - predicate?: string, - thisArg?: any + predicate?: string ): LoDashImplicitArrayWrapper; /** @@ -1437,16 +1423,14 @@ declare module _ { * @see _.dropWhile */ dropWhile( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): LoDashImplicitArrayWrapper; /** * @see _.dropWhile */ dropWhile( - predicate?: string, - thisArg?: any + predicate?: string ): LoDashImplicitArrayWrapper; /** @@ -1462,16 +1446,14 @@ declare module _ { * @see _.dropWhile */ dropWhile( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): LoDashExplicitArrayWrapper; /** * @see _.dropWhile */ dropWhile( - predicate?: string, - thisArg?: any + predicate?: string ): LoDashExplicitArrayWrapper; /** @@ -1487,16 +1469,14 @@ declare module _ { * @see _.dropWhile */ dropWhile( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): LoDashExplicitArrayWrapper; /** * @see _.dropWhile */ dropWhile( - predicate?: string, - thisArg?: any + predicate?: string ): LoDashExplicitArrayWrapper; /** @@ -1604,8 +1584,7 @@ declare module _ { */ findIndex( array: List, - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): number; /** @@ -1613,8 +1592,7 @@ declare module _ { */ findIndex( array: List, - predicate?: string, - thisArg?: any + predicate?: string ): number; /** @@ -1631,16 +1609,14 @@ declare module _ { * @see _.findIndex */ findIndex( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): number; /** * @see _.findIndex */ findIndex( - predicate?: string, - thisArg?: any + predicate?: string ): number; /** @@ -1656,16 +1632,14 @@ declare module _ { * @see _.findIndex */ findIndex( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): number; /** * @see _.findIndex */ findIndex( - predicate?: string, - thisArg?: any + predicate?: string ): number; /** @@ -1681,16 +1655,14 @@ declare module _ { * @see _.findIndex */ findIndex( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): LoDashExplicitWrapper; /** * @see _.findIndex */ findIndex( - predicate?: string, - thisArg?: any + predicate?: string ): LoDashExplicitWrapper; /** @@ -1706,16 +1678,14 @@ declare module _ { * @see _.findIndex */ findIndex( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): LoDashExplicitWrapper; /** * @see _.findIndex */ findIndex( - predicate?: string, - thisArg?: any + predicate?: string ): LoDashExplicitWrapper; /** @@ -1747,8 +1717,7 @@ declare module _ { */ findLastIndex( array: List, - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): number; /** @@ -1756,8 +1725,7 @@ declare module _ { */ findLastIndex( array: List, - predicate?: string, - thisArg?: any + predicate?: string ): number; /** @@ -1774,16 +1742,14 @@ declare module _ { * @see _.findLastIndex */ findLastIndex( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): number; /** * @see _.findLastIndex */ findLastIndex( - predicate?: string, - thisArg?: any + predicate?: string ): number; /** @@ -1799,16 +1765,14 @@ declare module _ { * @see _.findLastIndex */ findLastIndex( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): number; /** * @see _.findLastIndex */ findLastIndex( - predicate?: string, - thisArg?: any + predicate?: string ): number; /** @@ -1824,16 +1788,14 @@ declare module _ { * @see _.findLastIndex */ findLastIndex( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): LoDashExplicitWrapper; /** * @see _.findLastIndex */ findLastIndex( - predicate?: string, - thisArg?: any + predicate?: string ): LoDashExplicitWrapper; /** @@ -1849,16 +1811,14 @@ declare module _ { * @see _.findLastIndex */ findLastIndex( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): LoDashExplicitWrapper; /** * @see _.findLastIndex */ findLastIndex( - predicate?: string, - thisArg?: any + predicate?: string ): LoDashExplicitWrapper; /** @@ -2772,8 +2732,7 @@ declare module _ { */ remove( array: List, - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): T[]; /** @@ -2781,8 +2740,7 @@ declare module _ { */ remove( array: List, - predicate?: string, - thisArg?: any + predicate?: string ): T[]; /** @@ -2799,16 +2757,14 @@ declare module _ { * @see _.remove */ remove( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): LoDashImplicitArrayWrapper; /** * @see _.remove */ remove( - predicate?: string, - thisArg?: any + predicate?: string ): LoDashImplicitArrayWrapper; /** @@ -2824,16 +2780,14 @@ declare module _ { * @see _.remove */ remove( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): LoDashImplicitArrayWrapper; /** * @see _.remove */ remove( - predicate?: string, - thisArg?: any + predicate?: string ): LoDashImplicitArrayWrapper; /** @@ -2849,16 +2803,14 @@ declare module _ { * @see _.remove */ remove( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): LoDashExplicitArrayWrapper; /** * @see _.remove */ remove( - predicate?: string, - thisArg?: any + predicate?: string ): LoDashExplicitArrayWrapper; /** @@ -2874,16 +2826,14 @@ declare module _ { * @see _.remove */ remove( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): LoDashExplicitArrayWrapper; /** * @see _.remove */ remove( - predicate?: string, - thisArg?: any + predicate?: string ): LoDashExplicitArrayWrapper; /** @@ -3904,8 +3854,7 @@ declare module _ { */ takeRightWhile( array: List, - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): TValue[]; /** @@ -3913,8 +3862,7 @@ declare module _ { */ takeRightWhile( array: List, - predicate?: string, - thisArg?: any + predicate?: string ): TValue[]; /** @@ -3931,16 +3879,14 @@ declare module _ { * @see _.takeRightWhile */ takeRightWhile( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): LoDashImplicitArrayWrapper; /** * @see _.takeRightWhile */ takeRightWhile( - predicate?: string, - thisArg?: any + predicate?: string ): LoDashImplicitArrayWrapper; /** @@ -3956,16 +3902,14 @@ declare module _ { * @see _.takeRightWhile */ takeRightWhile( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): LoDashImplicitArrayWrapper; /** * @see _.takeRightWhile */ takeRightWhile( - predicate?: string, - thisArg?: any + predicate?: string ): LoDashImplicitArrayWrapper; /** @@ -3981,16 +3925,14 @@ declare module _ { * @see _.takeRightWhile */ takeRightWhile( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): LoDashExplicitArrayWrapper; /** * @see _.takeRightWhile */ takeRightWhile( - predicate?: string, - thisArg?: any + predicate?: string ): LoDashExplicitArrayWrapper; /** @@ -4006,16 +3948,14 @@ declare module _ { * @see _.takeRightWhile */ takeRightWhile( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): LoDashExplicitArrayWrapper; /** * @see _.takeRightWhile */ takeRightWhile( - predicate?: string, - thisArg?: any + predicate?: string ): LoDashExplicitArrayWrapper; /** @@ -4048,8 +3988,7 @@ declare module _ { */ takeWhile( array: List, - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): TValue[]; /** @@ -4057,8 +3996,7 @@ declare module _ { */ takeWhile( array: List, - predicate?: string, - thisArg?: any + predicate?: string ): TValue[]; /** @@ -4075,16 +4013,14 @@ declare module _ { * @see _.takeWhile */ takeWhile( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): LoDashImplicitArrayWrapper; /** * @see _.takeWhile */ takeWhile( - predicate?: string, - thisArg?: any + predicate?: string ): LoDashImplicitArrayWrapper; /** @@ -4100,16 +4036,14 @@ declare module _ { * @see _.takeWhile */ takeWhile( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): LoDashImplicitArrayWrapper; /** * @see _.takeWhile */ takeWhile( - predicate?: string, - thisArg?: any + predicate?: string ): LoDashImplicitArrayWrapper; /** @@ -4125,16 +4059,14 @@ declare module _ { * @see _.takeWhile */ takeWhile( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): LoDashExplicitArrayWrapper; /** * @see _.takeWhile */ takeWhile( - predicate?: string, - thisArg?: any + predicate?: string ): LoDashExplicitArrayWrapper; /** @@ -4150,16 +4082,14 @@ declare module _ { * @see _.takeWhile */ takeWhile( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): LoDashExplicitArrayWrapper; /** * @see _.takeWhile */ takeWhile( - predicate?: string, - thisArg?: any + predicate?: string ): LoDashExplicitArrayWrapper; /** @@ -5407,8 +5337,7 @@ declare module _ { */ unzipWith( array: List>, - iteratee?: MemoIterator, - thisArg?: any + iteratee?: MemoIterator ): TResult[]; } @@ -5417,8 +5346,7 @@ declare module _ { * @see _.unzipWith */ unzipWith( - iteratee?: MemoIterator, - thisArg?: any + iteratee?: MemoIterator ): LoDashImplicitArrayWrapper; } @@ -5427,8 +5355,7 @@ declare module _ { * @see _.unzipWith */ unzipWith( - iteratee?: MemoIterator, - thisArg?: any + iteratee?: MemoIterator ): LoDashImplicitArrayWrapper; } @@ -5817,8 +5744,7 @@ declare module _ { **/ tap( value: T, - interceptor: (value: T) => void, - thisArg?: any + interceptor: (value: T) => void ): T; } @@ -5827,8 +5753,7 @@ declare module _ { * @see _.tap */ tap( - interceptor: (value: T) => void, - thisArg?: any + interceptor: (value: T) => void ): TWrapper; } @@ -5837,8 +5762,7 @@ declare module _ { * @see _.tap */ tap( - interceptor: (value: T) => void, - thisArg?: any + interceptor: (value: T) => void ): TWrapper; } @@ -5854,8 +5778,7 @@ declare module _ { */ thru( value: T, - interceptor: (value: T) => TResult, - thisArg?: any + interceptor: (value: T) => TResult ): TResult; } @@ -5864,36 +5787,31 @@ declare module _ { * @see _.thru */ thru( - interceptor: (value: T) => TResult, - thisArg?: any): LoDashImplicitWrapper; + interceptor: (value: T) => TResult): LoDashImplicitWrapper; /** * @see _.thru */ thru( - interceptor: (value: T) => TResult, - thisArg?: any): LoDashImplicitWrapper; + interceptor: (value: T) => TResult): LoDashImplicitWrapper; /** * @see _.thru */ thru( - interceptor: (value: T) => TResult, - thisArg?: any): LoDashImplicitWrapper; + interceptor: (value: T) => TResult): LoDashImplicitWrapper; /** * @see _.thru */ thru( - interceptor: (value: T) => TResult, - thisArg?: any): LoDashImplicitObjectWrapper; + interceptor: (value: T) => TResult): LoDashImplicitObjectWrapper; /** * @see _.thru */ thru( - interceptor: (value: T) => TResult[], - thisArg?: any): LoDashImplicitArrayWrapper; + interceptor: (value: T) => TResult[]): LoDashImplicitArrayWrapper; } interface LoDashExplicitWrapperBase { @@ -5901,40 +5819,35 @@ declare module _ { * @see _.thru */ thru( - interceptor: (value: T) => TResult, - thisArg?: any + interceptor: (value: T) => TResult ): LoDashExplicitWrapper; /** * @see _.thru */ thru( - interceptor: (value: T) => TResult, - thisArg?: any + interceptor: (value: T) => TResult ): LoDashExplicitWrapper; /** * @see _.thru */ thru( - interceptor: (value: T) => TResult, - thisArg?: any + interceptor: (value: T) => TResult ): LoDashExplicitWrapper; /** * @see _.thru */ thru( - interceptor: (value: T) => TResult, - thisArg?: any + interceptor: (value: T) => TResult ): LoDashExplicitObjectWrapper; /** * @see _.thru */ thru( - interceptor: (value: T) => TResult[], - thisArg?: any + interceptor: (value: T) => TResult[] ): LoDashExplicitArrayWrapper; } @@ -6190,8 +6103,7 @@ declare module _ { */ countBy( collection: List, - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): Dictionary; /** @@ -6199,8 +6111,7 @@ declare module _ { */ countBy( collection: Dictionary, - iteratee?: DictionaryIterator, - thisArg?: any + iteratee?: DictionaryIterator ): Dictionary; /** @@ -6208,8 +6119,7 @@ declare module _ { */ countBy( collection: NumericDictionary, - iteratee?: NumericDictionaryIterator, - thisArg?: any + iteratee?: NumericDictionaryIterator ): Dictionary; /** @@ -6217,8 +6127,7 @@ declare module _ { */ countBy( collection: List|Dictionary|NumericDictionary, - iteratee?: string, - thisArg?: any + iteratee?: string ): Dictionary; /** @@ -6243,8 +6152,7 @@ declare module _ { * @see _.countBy */ countBy( - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): LoDashImplicitObjectWrapper>; } @@ -6253,16 +6161,14 @@ declare module _ { * @see _.countBy */ countBy( - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): LoDashImplicitObjectWrapper>; /** * @see _.countBy */ countBy( - iteratee?: string, - thisArg?: any + iteratee?: string ): LoDashImplicitObjectWrapper>; /** @@ -6278,16 +6184,14 @@ declare module _ { * @see _.countBy */ countBy( - iteratee?: ListIterator|DictionaryIterator|NumericDictionaryIterator, - thisArg?: any + iteratee?: ListIterator|DictionaryIterator|NumericDictionaryIterator ): LoDashImplicitObjectWrapper>; /** * @see _.countBy */ countBy( - iteratee?: string, - thisArg?: any + iteratee?: string ): LoDashImplicitObjectWrapper>; /** @@ -6303,8 +6207,7 @@ declare module _ { * @see _.countBy */ countBy( - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): LoDashExplicitObjectWrapper>; } @@ -6313,16 +6216,14 @@ declare module _ { * @see _.countBy */ countBy( - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): LoDashExplicitObjectWrapper>; /** * @see _.countBy */ countBy( - iteratee?: string, - thisArg?: any + iteratee?: string ): LoDashExplicitObjectWrapper>; /** @@ -6338,16 +6239,14 @@ declare module _ { * @see _.countBy */ countBy( - iteratee?: ListIterator|DictionaryIterator|NumericDictionaryIterator, - thisArg?: any + iteratee?: ListIterator|DictionaryIterator|NumericDictionaryIterator ): LoDashExplicitObjectWrapper>; /** * @see _.countBy */ countBy( - iteratee?: string, - thisArg?: any + iteratee?: string ): LoDashExplicitObjectWrapper>; /** @@ -6365,8 +6264,7 @@ declare module _ { */ each( collection: T[], - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): T[]; /** @@ -6374,8 +6272,7 @@ declare module _ { */ each( collection: List, - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): List; /** @@ -6383,8 +6280,7 @@ declare module _ { */ each( collection: Dictionary, - iteratee?: DictionaryIterator, - thisArg?: any + iteratee?: DictionaryIterator ): Dictionary; /** @@ -6392,8 +6288,7 @@ declare module _ { */ each( collection: T, - iteratee?: ObjectIterator, - thisArgs?: any + iteratee?: ObjectIterator ): T; /** @@ -6401,8 +6296,7 @@ declare module _ { */ each( collection: T, - iteratee?: ObjectIterator, - thisArgs?: any + iteratee?: ObjectIterator ): T; } @@ -6411,8 +6305,7 @@ declare module _ { * @see _.forEach */ each( - iteratee: ListIterator, - thisArg?: any + iteratee: ListIterator ): LoDashImplicitWrapper; } @@ -6421,8 +6314,7 @@ declare module _ { * @see _.forEach */ each( - iteratee: ListIterator, - thisArg?: any + iteratee: ListIterator ): LoDashImplicitArrayWrapper; } @@ -6431,8 +6323,7 @@ declare module _ { * @see _.forEach */ each( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any + iteratee?: ListIterator|DictionaryIterator ): LoDashImplicitObjectWrapper; } @@ -6441,8 +6332,7 @@ declare module _ { * @see _.forEach */ each( - iteratee: ListIterator, - thisArg?: any + iteratee: ListIterator ): LoDashExplicitWrapper; } @@ -6451,8 +6341,7 @@ declare module _ { * @see _.forEach */ each( - iteratee: ListIterator, - thisArg?: any + iteratee: ListIterator ): LoDashExplicitArrayWrapper; } @@ -6461,8 +6350,7 @@ declare module _ { * @see _.forEach */ each( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any + iteratee?: ListIterator|DictionaryIterator ): LoDashExplicitObjectWrapper; } @@ -6473,8 +6361,7 @@ declare module _ { */ eachRight( collection: T[], - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): T[]; /** @@ -6482,8 +6369,7 @@ declare module _ { */ eachRight( collection: List, - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): List; /** @@ -6491,8 +6377,7 @@ declare module _ { */ eachRight( collection: Dictionary, - iteratee?: DictionaryIterator, - thisArg?: any + iteratee?: DictionaryIterator ): Dictionary; /** @@ -6500,8 +6385,7 @@ declare module _ { */ eachRight( collection: T, - iteratee?: ObjectIterator, - thisArgs?: any + iteratee?: ObjectIterator ): T; /** @@ -6509,8 +6393,7 @@ declare module _ { */ eachRight( collection: T, - iteratee?: ObjectIterator, - thisArgs?: any + iteratee?: ObjectIterator ): T; } @@ -6519,8 +6402,7 @@ declare module _ { * @see _.forEachRight */ eachRight( - iteratee: ListIterator, - thisArg?: any + iteratee: ListIterator ): LoDashImplicitWrapper; } @@ -6529,8 +6411,7 @@ declare module _ { * @see _.forEachRight */ eachRight( - iteratee: ListIterator, - thisArg?: any + iteratee: ListIterator ): LoDashImplicitArrayWrapper; } @@ -6539,8 +6420,7 @@ declare module _ { * @see _.forEachRight */ eachRight( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any + iteratee?: ListIterator|DictionaryIterator ): LoDashImplicitObjectWrapper; } @@ -6549,8 +6429,7 @@ declare module _ { * @see _.forEachRight */ eachRight( - iteratee: ListIterator, - thisArg?: any + iteratee: ListIterator ): LoDashExplicitWrapper; } @@ -6559,8 +6438,7 @@ declare module _ { * @see _.forEachRight */ eachRight( - iteratee: ListIterator, - thisArg?: any + iteratee: ListIterator ): LoDashExplicitArrayWrapper; } @@ -6569,8 +6447,7 @@ declare module _ { * @see _.forEachRight */ eachRight( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any + iteratee?: ListIterator|DictionaryIterator ): LoDashExplicitObjectWrapper; } @@ -6736,8 +6613,7 @@ declare module _ { */ filter( collection: List, - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): T[]; /** @@ -6745,8 +6621,7 @@ declare module _ { */ filter( collection: Dictionary, - predicate?: DictionaryIterator, - thisArg?: any + predicate?: DictionaryIterator ): T[]; /** @@ -6754,8 +6629,7 @@ declare module _ { */ filter( collection: string, - predicate?: StringIterator, - thisArg?: any + predicate?: StringIterator ): string[]; /** @@ -6763,8 +6637,7 @@ declare module _ { */ filter( collection: List|Dictionary, - predicate: string, - thisArg?: any + predicate: string ): T[]; /** @@ -6781,8 +6654,7 @@ declare module _ { * @see _.filter */ filter( - predicate?: StringIterator, - thisArg?: any + predicate?: StringIterator ): LoDashImplicitArrayWrapper; } @@ -6791,16 +6663,14 @@ declare module _ { * @see _.filter */ filter( - predicate: ListIterator, - thisArg?: any + predicate: ListIterator ): LoDashImplicitArrayWrapper; /** * @see _.filter */ filter( - predicate: string, - thisArg?: any + predicate: string ): LoDashImplicitArrayWrapper; /** @@ -6814,16 +6684,14 @@ declare module _ { * @see _.filter */ filter( - predicate: ListIterator|DictionaryIterator, - thisArg?: any + predicate: ListIterator|DictionaryIterator ): LoDashImplicitArrayWrapper; /** * @see _.filter */ filter( - predicate: string, - thisArg?: any + predicate: string ): LoDashImplicitArrayWrapper; /** @@ -6837,8 +6705,7 @@ declare module _ { * @see _.filter */ filter( - predicate?: StringIterator, - thisArg?: any + predicate?: StringIterator ): LoDashExplicitArrayWrapper; } @@ -6847,16 +6714,14 @@ declare module _ { * @see _.filter */ filter( - predicate: ListIterator, - thisArg?: any + predicate: ListIterator ): LoDashExplicitArrayWrapper; /** * @see _.filter */ filter( - predicate: string, - thisArg?: any + predicate: string ): LoDashExplicitArrayWrapper; /** @@ -6870,16 +6735,14 @@ declare module _ { * @see _.filter */ filter( - predicate: ListIterator|DictionaryIterator, - thisArg?: any + predicate: ListIterator|DictionaryIterator ): LoDashExplicitArrayWrapper; /** * @see _.filter */ filter( - predicate: string, - thisArg?: any + predicate: string ): LoDashExplicitArrayWrapper; /** @@ -6910,8 +6773,7 @@ declare module _ { */ find( collection: List, - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): T; /** @@ -6919,8 +6781,7 @@ declare module _ { */ find( collection: Dictionary, - predicate?: DictionaryIterator, - thisArg?: any + predicate?: DictionaryIterator ): T; /** @@ -6928,8 +6789,7 @@ declare module _ { */ find( collection: List|Dictionary, - predicate?: string, - thisArg?: any + predicate?: string ): T; /** @@ -6946,16 +6806,14 @@ declare module _ { * @see _.find */ find( - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): T; /** * @see _.find */ find( - predicate?: string, - thisArg?: any + predicate?: string ): T; /** @@ -6971,16 +6829,14 @@ declare module _ { * @see _.find */ find( - predicate?: ListIterator|DictionaryIterator, - thisArg?: any + predicate?: ListIterator|DictionaryIterator ): TResult; /** * @see _.find */ find( - predicate?: string, - thisArg?: any + predicate?: string ): TResult; /** @@ -7003,24 +6859,21 @@ declare module _ { **/ findLast( collection: Array, - callback: ListIterator, - thisArg?: any): T; + callback: ListIterator): T; /** * @see _.find **/ findLast( collection: List, - callback: ListIterator, - thisArg?: any): T; + callback: ListIterator): T; /** * @see _.find **/ findLast( collection: Dictionary, - callback: DictionaryIterator, - thisArg?: any): T; + callback: DictionaryIterator): T; /** * @see _.find @@ -7076,8 +6929,7 @@ declare module _ { * @see _.findLast */ findLast( - callback: ListIterator, - thisArg?: any): T; + callback: ListIterator): T; /** * @see _.findLast * @param _.where style callback @@ -7377,8 +7229,7 @@ declare module _ { */ forEach( collection: T[], - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): T[]; /** @@ -7386,8 +7237,7 @@ declare module _ { */ forEach( collection: List, - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): List; /** @@ -7395,8 +7245,7 @@ declare module _ { */ forEach( collection: Dictionary, - iteratee?: DictionaryIterator, - thisArg?: any + iteratee?: DictionaryIterator ): Dictionary; /** @@ -7404,8 +7253,7 @@ declare module _ { */ forEach( collection: T, - iteratee?: ObjectIterator, - thisArgs?: any + iteratee?: ObjectIterator ): T; /** @@ -7413,8 +7261,7 @@ declare module _ { */ forEach( collection: T, - iteratee?: ObjectIterator, - thisArgs?: any + iteratee?: ObjectIterator ): T; } @@ -7423,8 +7270,7 @@ declare module _ { * @see _.forEach */ forEach( - iteratee: ListIterator, - thisArg?: any + iteratee: ListIterator ): LoDashImplicitWrapper; } @@ -7433,8 +7279,7 @@ declare module _ { * @see _.forEach */ forEach( - iteratee: ListIterator, - thisArg?: any + iteratee: ListIterator ): LoDashImplicitArrayWrapper; } @@ -7443,8 +7288,7 @@ declare module _ { * @see _.forEach */ forEach( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any + iteratee?: ListIterator|DictionaryIterator ): LoDashImplicitObjectWrapper; } @@ -7453,8 +7297,7 @@ declare module _ { * @see _.forEach */ forEach( - iteratee: ListIterator, - thisArg?: any + iteratee: ListIterator ): LoDashExplicitWrapper; } @@ -7463,8 +7306,7 @@ declare module _ { * @see _.forEach */ forEach( - iteratee: ListIterator, - thisArg?: any + iteratee: ListIterator ): LoDashExplicitArrayWrapper; } @@ -7473,8 +7315,7 @@ declare module _ { * @see _.forEach */ forEach( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any + iteratee?: ListIterator|DictionaryIterator ): LoDashExplicitObjectWrapper; } @@ -7491,8 +7332,7 @@ declare module _ { */ forEachRight( collection: T[], - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): T[]; /** @@ -7500,8 +7340,7 @@ declare module _ { */ forEachRight( collection: List, - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): List; /** @@ -7509,8 +7348,7 @@ declare module _ { */ forEachRight( collection: Dictionary, - iteratee?: DictionaryIterator, - thisArg?: any + iteratee?: DictionaryIterator ): Dictionary; /** @@ -7518,8 +7356,7 @@ declare module _ { */ forEachRight( collection: T, - iteratee?: ObjectIterator, - thisArgs?: any + iteratee?: ObjectIterator ): T; /** @@ -7527,8 +7364,7 @@ declare module _ { */ forEachRight( collection: T, - iteratee?: ObjectIterator, - thisArgs?: any + iteratee?: ObjectIterator ): T; } @@ -7537,8 +7373,7 @@ declare module _ { * @see _.forEachRight */ forEachRight( - iteratee: ListIterator, - thisArg?: any + iteratee: ListIterator ): LoDashImplicitWrapper; } @@ -7547,8 +7382,7 @@ declare module _ { * @see _.forEachRight */ forEachRight( - iteratee: ListIterator, - thisArg?: any + iteratee: ListIterator ): LoDashImplicitArrayWrapper; } @@ -7557,8 +7391,7 @@ declare module _ { * @see _.forEachRight */ forEachRight( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any + iteratee?: ListIterator|DictionaryIterator ): LoDashImplicitObjectWrapper; } @@ -7567,8 +7400,7 @@ declare module _ { * @see _.forEachRight */ forEachRight( - iteratee: ListIterator, - thisArg?: any + iteratee: ListIterator ): LoDashExplicitWrapper; } @@ -7577,8 +7409,7 @@ declare module _ { * @see _.forEachRight */ forEachRight( - iteratee: ListIterator, - thisArg?: any + iteratee: ListIterator ): LoDashExplicitArrayWrapper; } @@ -7587,8 +7418,7 @@ declare module _ { * @see _.forEachRight */ forEachRight( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any + iteratee?: ListIterator|DictionaryIterator ): LoDashExplicitObjectWrapper; } @@ -7616,8 +7446,7 @@ declare module _ { */ groupBy( collection: List, - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): Dictionary; /** @@ -7625,8 +7454,7 @@ declare module _ { */ groupBy( collection: List, - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): Dictionary; /** @@ -7634,8 +7462,7 @@ declare module _ { */ groupBy( collection: Dictionary, - iteratee?: DictionaryIterator, - thisArg?: any + iteratee?: DictionaryIterator ): Dictionary; /** @@ -7643,8 +7470,7 @@ declare module _ { */ groupBy( collection: Dictionary, - iteratee?: DictionaryIterator, - thisArg?: any + iteratee?: DictionaryIterator ): Dictionary; /** @@ -7652,8 +7478,7 @@ declare module _ { */ groupBy( collection: List|Dictionary, - iteratee?: string, - thisArg?: TValue + iteratee?: string ): Dictionary; /** @@ -7661,8 +7486,7 @@ declare module _ { */ groupBy( collection: List|Dictionary, - iteratee?: string, - thisArg?: any + iteratee?: string ): Dictionary; /** @@ -7687,8 +7511,7 @@ declare module _ { * @see _.groupBy */ groupBy( - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): LoDashImplicitObjectWrapper>; } @@ -7697,16 +7520,14 @@ declare module _ { * @see _.groupBy */ groupBy( - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): LoDashImplicitObjectWrapper>; /** * @see _.groupBy */ groupBy( - iteratee?: string, - thisArg?: TValue + iteratee?: string ): LoDashImplicitObjectWrapper>; /** @@ -7722,32 +7543,28 @@ declare module _ { * @see _.groupBy */ groupBy( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any + iteratee?: ListIterator|DictionaryIterator ): LoDashImplicitObjectWrapper>; /** * @see _.groupBy */ groupBy( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any + iteratee?: ListIterator|DictionaryIterator ): LoDashImplicitObjectWrapper>; /** * @see _.groupBy */ groupBy( - iteratee?: string, - thisArg?: TValue + iteratee?: string ): LoDashImplicitObjectWrapper>; /** * @see _.groupBy */ groupBy( - iteratee?: string, - thisArg?: any + iteratee?: string ): LoDashImplicitObjectWrapper>; /** @@ -7770,8 +7587,7 @@ declare module _ { * @see _.groupBy */ groupBy( - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): LoDashExplicitObjectWrapper>; } @@ -7780,16 +7596,14 @@ declare module _ { * @see _.groupBy */ groupBy( - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): LoDashExplicitObjectWrapper>; /** * @see _.groupBy */ groupBy( - iteratee?: string, - thisArg?: TValue + iteratee?: string ): LoDashExplicitObjectWrapper>; /** @@ -7805,32 +7619,28 @@ declare module _ { * @see _.groupBy */ groupBy( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any + iteratee?: ListIterator|DictionaryIterator ): LoDashExplicitObjectWrapper>; /** * @see _.groupBy */ groupBy( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any + iteratee?: ListIterator|DictionaryIterator ): LoDashExplicitObjectWrapper>; /** * @see _.groupBy */ groupBy( - iteratee?: string, - thisArg?: TValue + iteratee?: string ): LoDashExplicitObjectWrapper>; /** * @see _.groupBy */ groupBy( - iteratee?: string, - thisArg?: any + iteratee?: string ): LoDashExplicitObjectWrapper>; /** @@ -7959,8 +7769,7 @@ declare module _ { */ keyBy( collection: List, - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): Dictionary; /** @@ -7968,8 +7777,7 @@ declare module _ { */ keyBy( collection: NumericDictionary, - iteratee?: NumericDictionaryIterator, - thisArg?: any + iteratee?: NumericDictionaryIterator ): Dictionary; /** @@ -7977,8 +7785,7 @@ declare module _ { */ keyBy( collection: Dictionary, - iteratee?: DictionaryIterator, - thisArg?: any + iteratee?: DictionaryIterator ): Dictionary; /** @@ -7986,8 +7793,7 @@ declare module _ { */ keyBy( collection: List|NumericDictionary|Dictionary, - iteratee?: string, - thisArg?: any + iteratee?: string ): Dictionary; /** @@ -8012,8 +7818,7 @@ declare module _ { * @see _.keyBy */ keyBy( - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): LoDashImplicitObjectWrapper>; } @@ -8022,16 +7827,14 @@ declare module _ { * @see _.keyBy */ keyBy( - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): LoDashImplicitObjectWrapper>; /** * @see _.keyBy */ keyBy( - iteratee?: string, - thisArg?: any + iteratee?: string ): LoDashImplicitObjectWrapper>; /** @@ -8047,16 +7850,14 @@ declare module _ { * @see _.keyBy */ keyBy( - iteratee?: ListIterator|NumericDictionaryIterator|DictionaryIterator, - thisArg?: any + iteratee?: ListIterator|NumericDictionaryIterator|DictionaryIterator ): LoDashImplicitObjectWrapper>; /** * @see _.keyBy */ keyBy( - iteratee?: string, - thisArg?: any + iteratee?: string ): LoDashImplicitObjectWrapper>; /** @@ -8079,8 +7880,7 @@ declare module _ { * @see _.keyBy */ keyBy( - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): LoDashExplicitObjectWrapper>; } @@ -8089,16 +7889,14 @@ declare module _ { * @see _.keyBy */ keyBy( - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): LoDashExplicitObjectWrapper>; /** * @see _.keyBy */ keyBy( - iteratee?: string, - thisArg?: any + iteratee?: string ): LoDashExplicitObjectWrapper>; /** @@ -8114,16 +7912,14 @@ declare module _ { * @see _.keyBy */ keyBy( - iteratee?: ListIterator|NumericDictionaryIterator|DictionaryIterator, - thisArg?: any + iteratee?: ListIterator|NumericDictionaryIterator|DictionaryIterator ): LoDashExplicitObjectWrapper>; /** * @see _.keyBy */ keyBy( - iteratee?: string, - thisArg?: any + iteratee?: string ): LoDashExplicitObjectWrapper>; /** @@ -8374,8 +8170,7 @@ declare module _ { */ map( collection: List, - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): TResult[]; /** @@ -8383,14 +8178,12 @@ declare module _ { */ map( collection: Dictionary, - iteratee?: DictionaryIterator, - thisArg?: any + iteratee?: DictionaryIterator ): TResult[]; map( collection: NumericDictionary, - iteratee?: NumericDictionaryIterator, - thisArg?: any + iteratee?: NumericDictionaryIterator ): TResult[]; /** @@ -8415,8 +8208,7 @@ declare module _ { * @see _.map */ map( - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): LoDashImplicitArrayWrapper; /** @@ -8439,8 +8231,7 @@ declare module _ { * @see _.map */ map( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any + iteratee?: ListIterator|DictionaryIterator ): LoDashImplicitArrayWrapper; /** @@ -8463,8 +8254,7 @@ declare module _ { * @see _.map */ map( - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): LoDashExplicitArrayWrapper; /** @@ -8487,8 +8277,7 @@ declare module _ { * @see _.map */ map( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any + iteratee?: ListIterator|DictionaryIterator ): LoDashExplicitArrayWrapper; /** @@ -8529,16 +8318,14 @@ declare module _ { **/ partition( collection: List, - callback: ListIterator, - thisArg?: any): T[][]; + callback: ListIterator): T[][]; /** * @see _.partition **/ partition( collection: Dictionary, - callback: DictionaryIterator, - thisArg?: any): T[][]; + callback: DictionaryIterator): T[][]; /** * @see _.partition @@ -8590,8 +8377,7 @@ declare module _ { * @see _.partition */ partition( - callback: ListIterator, - thisArg?: any): LoDashImplicitArrayWrapper; + callback: ListIterator): LoDashImplicitArrayWrapper; } interface LoDashImplicitArrayWrapper { @@ -8599,8 +8385,7 @@ declare module _ { * @see _.partition */ partition( - callback: ListIterator, - thisArg?: any): LoDashImplicitArrayWrapper; + callback: ListIterator): LoDashImplicitArrayWrapper; /** * @see _.partition */ @@ -8624,15 +8409,13 @@ declare module _ { * @see _.partition */ partition( - callback: ListIterator, - thisArg?: any): LoDashImplicitArrayWrapper; + callback: ListIterator): LoDashImplicitArrayWrapper; /** * @see _.partition */ partition( - callback: DictionaryIterator, - thisArg?: any): LoDashImplicitArrayWrapper; + callback: DictionaryIterator): LoDashImplicitArrayWrapper; /** * @see _.partition @@ -8671,8 +8454,7 @@ declare module _ { reduce( collection: Array, callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; + accumulator: TResult): TResult; /** * @see _.reduce @@ -8680,8 +8462,7 @@ declare module _ { reduce( collection: List, callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; + accumulator: TResult): TResult; /** * @see _.reduce @@ -8689,8 +8470,7 @@ declare module _ { reduce( collection: Dictionary, callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; + accumulator: TResult): TResult; /** * @see _.reduce @@ -8698,40 +8478,35 @@ declare module _ { reduce( collection: NumericDictionary, callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; + accumulator: TResult): TResult; /** * @see _.reduce **/ reduce( collection: Array, - callback: MemoIterator, - thisArg?: any): TResult; + callback: MemoIterator): TResult; /** * @see _.reduce **/ reduce( collection: List, - callback: MemoIterator, - thisArg?: any): TResult; + callback: MemoIterator): TResult; /** * @see _.reduce **/ reduce( collection: Dictionary, - callback: MemoIterator, - thisArg?: any): TResult; + callback: MemoIterator): TResult; /** * @see _.reduce **/ reduce( collection: NumericDictionary, - callback: MemoIterator, - thisArg?: any): TResult; + callback: MemoIterator): TResult; } @@ -8741,15 +8516,13 @@ declare module _ { **/ reduce( callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; + accumulator: TResult): TResult; /** * @see _.reduce **/ reduce( - callback: MemoIterator, - thisArg?: any): TResult; + callback: MemoIterator): TResult; } interface LoDashImplicitObjectWrapper { @@ -8758,15 +8531,13 @@ declare module _ { **/ reduce( callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; + accumulator: TResult): TResult; /** * @see _.reduce **/ reduce( - callback: MemoIterator, - thisArg?: any): TResult; + callback: MemoIterator): TResult; } //_.reduceRight @@ -8783,8 +8554,7 @@ declare module _ { reduceRight( collection: Array, callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; + accumulator: TResult): TResult; /** * @see _.reduceRight @@ -8792,8 +8562,7 @@ declare module _ { reduceRight( collection: List, callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; + accumulator: TResult): TResult; /** * @see _.reduceRight @@ -8801,32 +8570,28 @@ declare module _ { reduceRight( collection: Dictionary, callback: MemoIterator, - accumulator: TResult, - thisArg?: any): TResult; + accumulator: TResult): TResult; /** * @see _.reduceRight **/ reduceRight( collection: Array, - callback: MemoIterator, - thisArg?: any): TResult; + callback: MemoIterator): TResult; /** * @see _.reduceRight **/ reduceRight( collection: List, - callback: MemoIterator, - thisArg?: any): TResult; + callback: MemoIterator): TResult; /** * @see _.reduceRight **/ reduceRight( collection: Dictionary, - callback: MemoIterator, - thisArg?: any): TResult; + callback: MemoIterator): TResult; } //_.reject @@ -8842,8 +8607,7 @@ declare module _ { */ reject( collection: List, - predicate?: ListIterator, - thisArg?: any + predicate?: ListIterator ): T[]; /** @@ -8851,8 +8615,7 @@ declare module _ { */ reject( collection: Dictionary, - predicate?: DictionaryIterator, - thisArg?: any + predicate?: DictionaryIterator ): T[]; /** @@ -8860,8 +8623,7 @@ declare module _ { */ reject( collection: string, - predicate?: StringIterator, - thisArg?: any + predicate?: StringIterator ): string[]; /** @@ -8869,8 +8631,7 @@ declare module _ { */ reject( collection: List|Dictionary, - predicate: string, - thisArg?: any + predicate: string ): T[]; /** @@ -8887,8 +8648,7 @@ declare module _ { * @see _.reject */ reject( - predicate?: StringIterator, - thisArg?: any + predicate?: StringIterator ): LoDashImplicitArrayWrapper; } @@ -8897,16 +8657,14 @@ declare module _ { * @see _.reject */ reject( - predicate: ListIterator, - thisArg?: any + predicate: ListIterator ): LoDashImplicitArrayWrapper; /** * @see _.reject */ reject( - predicate: string, - thisArg?: any + predicate: string ): LoDashImplicitArrayWrapper; /** @@ -8920,16 +8678,14 @@ declare module _ { * @see _.reject */ reject( - predicate: ListIterator|DictionaryIterator, - thisArg?: any + predicate: ListIterator|DictionaryIterator ): LoDashImplicitArrayWrapper; /** * @see _.reject */ reject( - predicate: string, - thisArg?: any + predicate: string ): LoDashImplicitArrayWrapper; /** @@ -8943,8 +8699,7 @@ declare module _ { * @see _.reject */ reject( - predicate?: StringIterator, - thisArg?: any + predicate?: StringIterator ): LoDashExplicitArrayWrapper; } @@ -8953,16 +8708,14 @@ declare module _ { * @see _.reject */ reject( - predicate: ListIterator, - thisArg?: any + predicate: ListIterator ): LoDashExplicitArrayWrapper; /** * @see _.reject */ reject( - predicate: string, - thisArg?: any + predicate: string ): LoDashExplicitArrayWrapper; /** @@ -8976,16 +8729,14 @@ declare module _ { * @see _.reject */ reject( - predicate: ListIterator|DictionaryIterator, - thisArg?: any + predicate: ListIterator|DictionaryIterator ): LoDashExplicitArrayWrapper; /** * @see _.reject */ reject( - predicate: string, - thisArg?: any + predicate: string ): LoDashExplicitArrayWrapper; /** @@ -10136,7 +9887,6 @@ declare module _ { **/ createCallback( func: string, - thisArg?: any, argCount?: number): () => any; /** @@ -10144,7 +9894,6 @@ declare module _ { **/ createCallback( func: Dictionary, - thisArg?: any, argCount?: number): () => boolean; } @@ -10153,7 +9902,6 @@ declare module _ { * @see _.createCallback **/ createCallback( - thisArg?: any, argCount?: number): LoDashImplicitObjectWrapper<() => any>; } @@ -10162,7 +9910,6 @@ declare module _ { * @see _.createCallback **/ createCallback( - thisArg?: any, argCount?: number): LoDashImplicitObjectWrapper<() => any>; } @@ -13365,16 +13112,14 @@ declare module _ { * @see _.maxBy */ maxBy( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any + iteratee?: ListIterator|DictionaryIterator ): T; /** * @see _.maxBy */ maxBy( - iteratee?: string, - thisArg?: any + iteratee?: string ): T; /** @@ -13530,16 +13275,14 @@ declare module _ { * @see _.minBy */ minBy( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any + iteratee?: ListIterator|DictionaryIterator ): T; /** * @see _.minBy */ minBy( - iteratee?: string, - thisArg?: any + iteratee?: string ): T; /** @@ -14933,8 +14676,7 @@ declare module _ { extend( object: TObject, source: TSource, - customizer?: AssignCustomizer, - thisArg?: any + customizer?: AssignCustomizer ): TResult; /** @@ -14944,8 +14686,7 @@ declare module _ { object: TObject, source1: TSource1, source2: TSource2, - customizer?: AssignCustomizer, - thisArg?: any + customizer?: AssignCustomizer ): TResult; /** @@ -14956,8 +14697,7 @@ declare module _ { source1: TSource1, source2: TSource2, source3: TSource3, - customizer?: AssignCustomizer, - thisArg?: any + customizer?: AssignCustomizer ): TResult; /** @@ -14971,8 +14711,7 @@ declare module _ { source2: TSource2, source3: TSource3, source4: TSource4, - customizer?: AssignCustomizer, - thisArg?: any + customizer?: AssignCustomizer ): TResult; /** @@ -14994,8 +14733,7 @@ declare module _ { */ extend( source: TSource, - customizer?: AssignCustomizer, - thisArg?: any + customizer?: AssignCustomizer ): LoDashImplicitObjectWrapper; /** @@ -15004,8 +14742,7 @@ declare module _ { extend( source1: TSource1, source2: TSource2, - customizer?: AssignCustomizer, - thisArg?: any + customizer?: AssignCustomizer ): LoDashImplicitObjectWrapper; /** @@ -15015,8 +14752,7 @@ declare module _ { source1: TSource1, source2: TSource2, source3: TSource3, - customizer?: AssignCustomizer, - thisArg?: any + customizer?: AssignCustomizer ): LoDashImplicitObjectWrapper; /** @@ -15027,8 +14763,7 @@ declare module _ { source2: TSource2, source3: TSource3, source4: TSource4, - customizer?: AssignCustomizer, - thisArg?: any + customizer?: AssignCustomizer ): LoDashImplicitObjectWrapper; /** @@ -15048,8 +14783,7 @@ declare module _ { */ extend( source: TSource, - customizer?: AssignCustomizer, - thisArg?: any + customizer?: AssignCustomizer ): LoDashExplicitObjectWrapper; /** @@ -15058,8 +14792,7 @@ declare module _ { extend( source1: TSource1, source2: TSource2, - customizer?: AssignCustomizer, - thisArg?: any + customizer?: AssignCustomizer ): LoDashExplicitObjectWrapper; /** @@ -15069,8 +14802,7 @@ declare module _ { source1: TSource1, source2: TSource2, source3: TSource3, - customizer?: AssignCustomizer, - thisArg?: any + customizer?: AssignCustomizer ): LoDashExplicitObjectWrapper; /** @@ -15081,8 +14813,7 @@ declare module _ { source2: TSource2, source3: TSource3, source4: TSource4, - customizer?: AssignCustomizer, - thisArg?: any + customizer?: AssignCustomizer ): LoDashExplicitObjectWrapper; /** @@ -15118,8 +14849,7 @@ declare module _ { */ findKey( object: TObject, - predicate?: DictionaryIterator, - thisArg?: any + predicate?: DictionaryIterator ): string; /** @@ -15127,8 +14857,7 @@ declare module _ { */ findKey( object: TObject, - predicate?: ObjectIterator, - thisArg?: any + predicate?: ObjectIterator ): string; /** @@ -15136,8 +14865,7 @@ declare module _ { */ findKey( object: TObject, - predicate?: string, - thisArg?: any + predicate?: string ): string; /** @@ -15154,24 +14882,21 @@ declare module _ { * @see _.findKey */ findKey( - predicate?: DictionaryIterator, - thisArg?: any + predicate?: DictionaryIterator ): string; /** * @see _.findKey */ findKey( - predicate?: ObjectIterator, - thisArg?: any + predicate?: ObjectIterator ): string; /** * @see _.findKey */ findKey( - predicate?: string, - thisArg?: any + predicate?: string ): string; /** @@ -15187,24 +14912,21 @@ declare module _ { * @see _.findKey */ findKey( - predicate?: DictionaryIterator, - thisArg?: any + predicate?: DictionaryIterator ): LoDashExplicitWrapper; /** * @see _.findKey */ findKey( - predicate?: ObjectIterator, - thisArg?: any + predicate?: ObjectIterator ): LoDashExplicitWrapper; /** * @see _.findKey */ findKey( - predicate?: string, - thisArg?: any + predicate?: string ): LoDashExplicitWrapper; /** @@ -15236,8 +14958,7 @@ declare module _ { */ findLastKey( object: TObject, - predicate?: DictionaryIterator, - thisArg?: any + predicate?: DictionaryIterator ): string; /** @@ -15245,8 +14966,7 @@ declare module _ { */ findLastKey( object: TObject, - predicate?: ObjectIterator, - thisArg?: any + predicate?: ObjectIterator ): string; /** @@ -15254,8 +14974,7 @@ declare module _ { */ findLastKey( object: TObject, - predicate?: string, - thisArg?: any + predicate?: string ): string; /** @@ -15272,24 +14991,21 @@ declare module _ { * @see _.findLastKey */ findLastKey( - predicate?: DictionaryIterator, - thisArg?: any + predicate?: DictionaryIterator ): string; /** * @see _.findLastKey */ findLastKey( - predicate?: ObjectIterator, - thisArg?: any + predicate?: ObjectIterator ): string; /** * @see _.findLastKey */ findLastKey( - predicate?: string, - thisArg?: any + predicate?: string ): string; /** @@ -15305,24 +15021,21 @@ declare module _ { * @see _.findLastKey */ findLastKey( - predicate?: DictionaryIterator, - thisArg?: any + predicate?: DictionaryIterator ): LoDashExplicitWrapper; /** * @see _.findLastKey */ findLastKey( - predicate?: ObjectIterator, - thisArg?: any + predicate?: ObjectIterator ): LoDashExplicitWrapper; /** * @see _.findLastKey */ findLastKey( - predicate?: string, - thisArg?: any + predicate?: string ): LoDashExplicitWrapper; /** @@ -15347,8 +15060,7 @@ declare module _ { */ forIn( object: Dictionary, - iteratee?: DictionaryIterator, - thisArg?: any + iteratee?: DictionaryIterator ): Dictionary; /** @@ -15356,8 +15068,7 @@ declare module _ { */ forIn( object: T, - iteratee?: ObjectIterator, - thisArg?: any + iteratee?: ObjectIterator ): T; } @@ -15366,8 +15077,7 @@ declare module _ { * @see _.forIn */ forIn( - iteratee?: DictionaryIterator, - thisArg?: any + iteratee?: DictionaryIterator ): _.LoDashImplicitObjectWrapper; } @@ -15376,8 +15086,7 @@ declare module _ { * @see _.forIn */ forIn( - iteratee?: DictionaryIterator, - thisArg?: any + iteratee?: DictionaryIterator ): _.LoDashExplicitObjectWrapper; } @@ -15393,8 +15102,7 @@ declare module _ { */ forInRight( object: Dictionary, - iteratee?: DictionaryIterator, - thisArg?: any + iteratee?: DictionaryIterator ): Dictionary; /** @@ -15402,8 +15110,7 @@ declare module _ { */ forInRight( object: T, - iteratee?: ObjectIterator, - thisArg?: any + iteratee?: ObjectIterator ): T; } @@ -15412,8 +15119,7 @@ declare module _ { * @see _.forInRight */ forInRight( - iteratee?: DictionaryIterator, - thisArg?: any + iteratee?: DictionaryIterator ): _.LoDashImplicitObjectWrapper; } @@ -15422,8 +15128,7 @@ declare module _ { * @see _.forInRight */ forInRight( - iteratee?: DictionaryIterator, - thisArg?: any + iteratee?: DictionaryIterator ): _.LoDashExplicitObjectWrapper; } @@ -15441,8 +15146,7 @@ declare module _ { */ forOwn( object: Dictionary, - iteratee?: DictionaryIterator, - thisArg?: any + iteratee?: DictionaryIterator ): Dictionary; /** @@ -15450,8 +15154,7 @@ declare module _ { */ forOwn( object: T, - iteratee?: ObjectIterator, - thisArg?: any + iteratee?: ObjectIterator ): T; } @@ -15460,8 +15163,7 @@ declare module _ { * @see _.forOwn */ forOwn( - iteratee?: DictionaryIterator, - thisArg?: any + iteratee?: DictionaryIterator ): _.LoDashImplicitObjectWrapper; } @@ -15470,8 +15172,7 @@ declare module _ { * @see _.forOwn */ forOwn( - iteratee?: DictionaryIterator, - thisArg?: any + iteratee?: DictionaryIterator ): _.LoDashExplicitObjectWrapper; } @@ -15487,8 +15188,7 @@ declare module _ { */ forOwnRight( object: Dictionary, - iteratee?: DictionaryIterator, - thisArg?: any + iteratee?: DictionaryIterator ): Dictionary; /** @@ -15496,8 +15196,7 @@ declare module _ { */ forOwnRight( object: T, - iteratee?: ObjectIterator, - thisArg?: any + iteratee?: ObjectIterator ): T; } @@ -15506,8 +15205,7 @@ declare module _ { * @see _.forOwnRight */ forOwnRight( - iteratee?: DictionaryIterator, - thisArg?: any + iteratee?: DictionaryIterator ): _.LoDashImplicitObjectWrapper; } @@ -15516,8 +15214,7 @@ declare module _ { * @see _.forOwnRight */ forOwnRight( - iteratee?: DictionaryIterator, - thisArg?: any + iteratee?: DictionaryIterator ): _.LoDashExplicitObjectWrapper; } @@ -16015,8 +15712,7 @@ declare module _ { */ mapKeys( object: List, - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): Dictionary; /** @@ -16024,8 +15720,7 @@ declare module _ { */ mapKeys( object: Dictionary, - iteratee?: DictionaryIterator, - thisArg?: any + iteratee?: DictionaryIterator ): Dictionary; /** @@ -16041,8 +15736,7 @@ declare module _ { */ mapKeys( object: List|Dictionary, - iteratee?: string, - thisArg?: any + iteratee?: string ): Dictionary; } @@ -16051,8 +15745,7 @@ declare module _ { * @see _.mapKeys */ mapKeys( - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): LoDashImplicitObjectWrapper>; /** @@ -16066,8 +15759,7 @@ declare module _ { * @see _.mapKeys */ mapKeys( - iteratee?: string, - thisArg?: any + iteratee?: string ): LoDashImplicitObjectWrapper>; } @@ -16076,8 +15768,7 @@ declare module _ { * @see _.mapKeys */ mapKeys( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any + iteratee?: ListIterator|DictionaryIterator ): LoDashImplicitObjectWrapper>; /** @@ -16091,8 +15782,7 @@ declare module _ { * @see _.mapKeys */ mapKeys( - iteratee?: string, - thisArg?: any + iteratee?: string ): LoDashImplicitObjectWrapper>; } @@ -16101,8 +15791,7 @@ declare module _ { * @see _.mapKeys */ mapKeys( - iteratee?: ListIterator, - thisArg?: any + iteratee?: ListIterator ): LoDashExplicitObjectWrapper>; /** @@ -16116,8 +15805,7 @@ declare module _ { * @see _.mapKeys */ mapKeys( - iteratee?: string, - thisArg?: any + iteratee?: string ): LoDashExplicitObjectWrapper>; } @@ -16126,8 +15814,7 @@ declare module _ { * @see _.mapKeys */ mapKeys( - iteratee?: ListIterator|DictionaryIterator, - thisArg?: any + iteratee?: ListIterator|DictionaryIterator ): LoDashExplicitObjectWrapper>; /** @@ -16141,8 +15828,7 @@ declare module _ { * @see _.mapKeys */ mapKeys( - iteratee?: string, - thisArg?: any + iteratee?: string ): LoDashExplicitObjectWrapper>; } @@ -16167,10 +15853,10 @@ declare module _ { * @param {Object} [thisArg] The `this` binding of `iteratee`. * @return {Object} Returns the new mapped object. */ - mapValues(obj: Dictionary, callback: ObjectIterator, thisArg?: any): Dictionary; + mapValues(obj: Dictionary, callback: ObjectIterator): Dictionary; mapValues(obj: Dictionary, where: Dictionary): Dictionary; mapValues(obj: T, pluck: string): TMapped; - mapValues(obj: T, callback: ObjectIterator, thisArg?: any): T; + mapValues(obj: T, callback: ObjectIterator): T; } interface LoDashImplicitObjectWrapper { @@ -16179,7 +15865,7 @@ declare module _ { * TValue is the type of the property values of T. * TResult is the type output by the ObjectIterator function */ - mapValues(callback: ObjectIterator, thisArg?: any): LoDashImplicitObjectWrapper>; + mapValues(callback: ObjectIterator): LoDashImplicitObjectWrapper>; /** * @see _.mapValues @@ -17005,8 +16691,7 @@ declare module _ { transform( object: T[], iteratee?: MemoVoidArrayIterator, - accumulator?: TResult[], - thisArg?: any + accumulator?: TResult[] ): TResult[]; /** @@ -17015,8 +16700,7 @@ declare module _ { transform( object: T[], iteratee?: MemoVoidArrayIterator>, - accumulator?: Dictionary, - thisArg?: any + accumulator?: Dictionary ): Dictionary; /** @@ -17025,8 +16709,7 @@ declare module _ { transform( object: Dictionary, iteratee?: MemoVoidDictionaryIterator>, - accumulator?: Dictionary, - thisArg?: any + accumulator?: Dictionary ): Dictionary; /** @@ -17035,8 +16718,7 @@ declare module _ { transform( object: Dictionary, iteratee?: MemoVoidDictionaryIterator, - accumulator?: TResult[], - thisArg?: any + accumulator?: TResult[] ): TResult[]; } @@ -17046,8 +16728,7 @@ declare module _ { */ transform( iteratee?: MemoVoidArrayIterator, - accumulator?: TResult[], - thisArg?: any + accumulator?: TResult[] ): LoDashImplicitArrayWrapper; /** @@ -17055,8 +16736,7 @@ declare module _ { */ transform( iteratee?: MemoVoidArrayIterator>, - accumulator?: Dictionary, - thisArg?: any + accumulator?: Dictionary ): LoDashImplicitObjectWrapper>; } @@ -17066,8 +16746,7 @@ declare module _ { */ transform( iteratee?: MemoVoidDictionaryIterator>, - accumulator?: Dictionary, - thisArg?: any + accumulator?: Dictionary ): LoDashImplicitObjectWrapper>; /** @@ -17075,8 +16754,7 @@ declare module _ { */ transform( iteratee?: MemoVoidDictionaryIterator, - accumulator?: TResult[], - thisArg?: any + accumulator?: TResult[] ): LoDashImplicitArrayWrapper; } @@ -18376,24 +18054,21 @@ declare module _ { * // => [{ 'user': 'fred', 'age': 40 }] */ iteratee( - func: Function, - thisArg?: any + func: Function ): (...args: any[]) => TResult; /** * @see _.iteratee */ iteratee( - func: string, - thisArg?: any + func: string ): (object: any) => TResult; /** * @see _.iteratee */ iteratee( - func: Object, - thisArg?: any + func: Object ): (object: any) => boolean; /** @@ -18406,38 +18081,38 @@ declare module _ { /** * @see _.iteratee */ - iteratee(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => TResult>; + iteratee(): LoDashImplicitObjectWrapper<(object: any) => TResult>; } interface LoDashImplicitObjectWrapper { /** * @see _.iteratee */ - iteratee(thisArg?: any): LoDashImplicitObjectWrapper<(object: any) => boolean>; + iteratee(): LoDashImplicitObjectWrapper<(object: any) => boolean>; /** * @see _.iteratee */ - iteratee(thisArg?: any): LoDashImplicitObjectWrapper<(...args: any[]) => TResult>; + iteratee(): LoDashImplicitObjectWrapper<(...args: any[]) => TResult>; } interface LoDashExplicitWrapper { /** * @see _.iteratee */ - iteratee(thisArg?: any): LoDashExplicitObjectWrapper<(object: any) => TResult>; + iteratee(): LoDashExplicitObjectWrapper<(object: any) => TResult>; } interface LoDashExplicitObjectWrapper { /** * @see _.iteratee */ - iteratee(thisArg?: any): LoDashExplicitObjectWrapper<(object: any) => boolean>; + iteratee(): LoDashExplicitObjectWrapper<(object: any) => boolean>; /** * @see _.iteratee */ - iteratee(thisArg?: any): LoDashExplicitObjectWrapper<(...args: any[]) => TResult>; + iteratee(): LoDashExplicitObjectWrapper<(...args: any[]) => TResult>; } //_.matches From 5c5c3d26a1f30c4c29eeccbf318d44e844327ca4 Mon Sep 17 00:00:00 2001 From: Dmytro Kulyk Date: Sat, 23 Apr 2016 10:37:25 +0300 Subject: [PATCH 18/65] Add jquery-backstretch definitions. (#9046) * Add jquery-backstretch definitions. * Fix jquery-backstretch definitions. * Fix jquery-backstretch definitions header. --- .../jquery-backstretch-tests.ts | 19 ++++ jquery-backstretch/jquery-backstretch.d.ts | 92 +++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 jquery-backstretch/jquery-backstretch-tests.ts create mode 100644 jquery-backstretch/jquery-backstretch.d.ts diff --git a/jquery-backstretch/jquery-backstretch-tests.ts b/jquery-backstretch/jquery-backstretch-tests.ts new file mode 100644 index 0000000000..b658c6aaeb --- /dev/null +++ b/jquery-backstretch/jquery-backstretch-tests.ts @@ -0,0 +1,19 @@ +/// +/// + +var backstretch = jQuery.backstretch(['image.png'], { + centeredX: false, + centeredY: false, + duration: 'normal', + fade: 1000 +}); + +backstretch.next(); +backstretch.prev(); +backstretch.pause(); +backstretch.resize(); +backstretch.resume(); +backstretch.destroy(true); + +jQuery('body').backstretch(['image.png']).pause(); +jQuery('body').backstretch('resume'); diff --git a/jquery-backstretch/jquery-backstretch.d.ts b/jquery-backstretch/jquery-backstretch.d.ts new file mode 100644 index 0000000000..5c951beeee --- /dev/null +++ b/jquery-backstretch/jquery-backstretch.d.ts @@ -0,0 +1,92 @@ +// Type definitions for backstretch v 2.0.4 +// Project: https://github.com/srobbin/jquery-backstretch +// Definitions by: Dmytro Kulyk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace JQueryBackStretch { + + interface BackStretchOptions { + /** + * The ratio of the width/height of the image doesn't always jive with the + * width/height of the window. This parameter controls whether or not we + * center the image on the X axis to account for the discrepancy. + */ + centeredX?:boolean; + + /** + * This parameter controls whether or not we center the image on the Y axis + * to account for the aforementioned discrepancy. + */ + centeredY?:boolean; + + /** + * This is the speed at which the image will fade in. Integers in + * milliseconds are accepted, as well as standard jQuery speed strings + * (slow, normal, fast). + */ + duration?:number | string; + + /** + * The amount of time in between slides, when using Backstretch as a + * slideshow, expressed as the number of milliseconds. + */ + fade?:number; + } + + interface BackStretch { + /** + * This method is called automatically when the container (window or + * block-level element) is resized, however you can always call this + * manually if needed. + */ + resize():BackStretch; + + /** + * Jump to the slide at a given index, where n is the number of the + * image that you'd like to display. Slide number starts at 0. + * + * @param {number} newIndex + */ + show(newIndex:number):BackStretch; + + /** + * Advance to the next image in a slideshow. + */ + next():BackStretch; + + /** + * Display the previous image in a slideshow. + */ + prev():BackStretch; + + /** + * Pause the slideshow. + */ + pause():BackStretch; + + /** + * Resume a paused slideshow. + */ + resume():BackStretch; + + /** + * Destroy the Backstretch instance. Optionally, you can pass in a Boolean + * parameter, preserveBackground, to determine whether or not you'd like + * to keep the current image stretched as the background image. + * + * @param {boolean} preserveBackground + */ + destroy(preserveBackground?:boolean):void; + } +} + +interface JQueryStatic { + backstretch(images:string[], config?:JQueryBackStretch.BackStretchOptions):JQueryBackStretch.BackStretch; +} + +interface JQuery { + backstretch(images:string[], config?:JQueryBackStretch.BackStretchOptions):JQueryBackStretch.BackStretch; + backstretch(method:string):JQuery; +} \ No newline at end of file From 71b4d6f6087f49891a01c937d2a86eee6f6c9b3a Mon Sep 17 00:00:00 2001 From: Ville Orkas Date: Sat, 23 Apr 2016 10:43:04 +0300 Subject: [PATCH 19/65] Fix es6-promise all generic type overloads (#9050) --- es6-promise/es6-promise-tests.ts | 3 +-- es6-promise/es6-promise.d.ts | 11 ++++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/es6-promise/es6-promise-tests.ts b/es6-promise/es6-promise-tests.ts index ac4f92d3d5..ee88cbc96f 100644 --- a/es6-promise/es6-promise-tests.ts +++ b/es6-promise/es6-promise-tests.ts @@ -80,9 +80,8 @@ promiseNumber = catchWithSimpleResult; var catchWithPromiseResult = promiseString.catch(error => Promise.resolve(10)); promiseNumber = catchWithPromiseResult; -promiseString = promiseString.catch(function () { +promiseString = promiseString.catch(function (): string { throw new Error('Better error msg'); - return null; }); //examples coming from http://www.html5rocks.com/en/tutorials/es6/promises/ diff --git a/es6-promise/es6-promise.d.ts b/es6-promise/es6-promise.d.ts index ec0c222385..001330fd24 100644 --- a/es6-promise/es6-promise.d.ts +++ b/es6-promise/es6-promise.d.ts @@ -58,7 +58,16 @@ declare namespace Promise { * the array passed to all can be a mixture of promise-like objects and other objects. * The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value. */ - function all(promises: (T | Thenable)[]): Promise; + function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable, T8 | Thenable, T9 | Thenable, T10 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; + function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable, T8 | Thenable, T9 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; + function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable, T8 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; + function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; + function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6]>; + function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable]): Promise<[T1, T2, T3, T4, T5]>; + function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable ]): Promise<[T1, T2, T3, T4]>; + function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable]): Promise<[T1, T2, T3]>; + function all(values: [T1 | Thenable, T2 | Thenable]): Promise<[T1, T2]>; + function all(values: (T | Thenable)[]): Promise; /** * Make a Promise that fulfills when any item fulfills, and rejects if any item rejects. From eef739049cdd4509bb02f6b71e1b7cc7bacd7c2b Mon Sep 17 00:00:00 2001 From: Paul Chen Date: Sat, 23 Apr 2016 15:43:21 +0800 Subject: [PATCH 20/65] Add strongly typed overload to CodeMirror.defineMode (#9025) --- codemirror/codemirror.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/codemirror/codemirror.d.ts b/codemirror/codemirror.d.ts index 6196d015c6..bade422821 100644 --- a/codemirror/codemirror.d.ts +++ b/codemirror/codemirror.d.ts @@ -1063,6 +1063,12 @@ declare namespace CodeMirror { */ function defineMode(id: string, modefactory: ModeFactory): void; + /** + * id will be the id for the defined mode. Typically, you should use this second argument to defineMode as your module scope function + * (modes should not leak anything into the global scope!), i.e. write your whole mode inside this function. + */ + function defineMode(id: string, modefactory: ModeFactory): void; + /** * The first argument is a configuration object as passed to the mode constructor function, and the second argument * is a mode specification as in the EditorConfiguration mode option. From 477643b46bc24e9b76420ac658e87e1ff2b1f197 Mon Sep 17 00:00:00 2001 From: AmirSaber Sharifi Date: Sat, 23 Apr 2016 03:43:36 -0400 Subject: [PATCH 21/65] add koa-mount (#9055) --- koa-mount/koa-mount-tests.ts | 26 ++++++++++++++++++++++++++ koa-mount/koa-mount.d.ts | 23 +++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 koa-mount/koa-mount-tests.ts create mode 100644 koa-mount/koa-mount.d.ts diff --git a/koa-mount/koa-mount-tests.ts b/koa-mount/koa-mount-tests.ts new file mode 100644 index 0000000000..560938b22f --- /dev/null +++ b/koa-mount/koa-mount-tests.ts @@ -0,0 +1,26 @@ +/// +/// + +import * as Koa from "koa"; +import mount = require("koa-mount"); + +const a = new Koa(); + +a.use((next) => { + this.body = "Hello"; +}) + +const b = new Koa(); + +b.use((next) => { + this.body = "World"; +}); + +const app = new Koa(); + +app.use(mount("/hello", a)); +app.use(mount("/world", b)); + +app.listen(3000); +console.log("listening on port 3000"); + diff --git a/koa-mount/koa-mount.d.ts b/koa-mount/koa-mount.d.ts new file mode 100644 index 0000000000..6c9c83bb73 --- /dev/null +++ b/koa-mount/koa-mount.d.ts @@ -0,0 +1,23 @@ +// Type definitions for koa-mount v2.0.0 +// Project: https://github.com/koajs/mount +// Definitions by: AmirSaber Sharifi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "koa-mount" { + + import * as Koa from "koa"; + + interface Function { (ctx: Koa.Context, next?: () => any): any } + + function mount(app: Function): Function; + + function mount(app: Koa): Function; + + function mount(prefix: string, app: Function): Function; + + function mount(prefix: string, app: Koa): Function; + + export = mount; +} From a7b9b1adbfebf0d3725e81ca25fb8079f9d33f6b Mon Sep 17 00:00:00 2001 From: vvakame Date: Sat, 23 Apr 2016 16:47:04 +0900 Subject: [PATCH 22/65] fix line ending about normalizr/normalizr-tests.ts --- normalizr/normalizr-tests.ts | 540 +++++++++++++++++------------------ 1 file changed, 270 insertions(+), 270 deletions(-) diff --git a/normalizr/normalizr-tests.ts b/normalizr/normalizr-tests.ts index ae40f196b1..0da5a8aa0b 100644 --- a/normalizr/normalizr-tests.ts +++ b/normalizr/normalizr-tests.ts @@ -1,270 +1,270 @@ -/// - -import { normalize, Schema, arrayOf, unionOf, valuesOf } from 'normalizr'; - -// First, define a schema for our entities: - -const article1 = new Schema('articles'); -const user1 = new Schema('users'); - -// Then we define nesting rules: - -article1.define({ - author: user1, - contributors: arrayOf(user1) -}); - -// Now we can use this schema in our API response handlers: - -const ServerActionCreators = { - // These are two different XHR endpoints with different response schemas. - // We can use the schema objects defined earlier to express both of them: - - receiveOneArticle(response: any) { - // Here, the response is an object containing data about one article. - // Passing the article schema as second parameter to normalize() lets it - // correctly traverse the response tree and gather all entities: - - // BEFORE: - // { - // id: 1, - // title: 'Some Article', - // author: { - // id: 7, - // name: 'Dan' - // }, - // contributors: [{ - // id: 10, - // name: 'Abe' - // }, { - // id: 15, - // name: 'Fred' - // }] - // } - // - // AFTER: - // { - // result: 1, // <--- Note object is referenced by ID - // entities: { - // articles: { - // 1: { - // author: 7, // <--- Same happens for references to - // contributors: [10, 15] // <--- other entities in the schema - // ...} - // }, - // users: { - // 7: { ... }, - // 10: { ... }, - // 15: { ... } - // } - // } - // } - - response = normalize(response, article1); - }, - - receiveAllArticles(response: any) { - // Here, the response is an object with the key 'articles' referencing - // an array of article objects. Passing { articles: arrayOf(article) } as - // second parameter to normalize() lets it correctly traverse the response - // tree and gather all entities: - - // BEFORE: - // { - // articles: [{ - // id: 1, - // title: 'Some Article', - // author: { - // id: 7, - // name: 'Dan' - // }, - // ... - // }, - // ... - // ] - // } - // - // AFTER: - // { - // result: { - // articles: [1, 2, ...] // <--- Note how object array turned into ID array - // }, - // entities: { - // articles: { - // 1: { author: 7, ... }, // <--- Same happens for references to other entities in the schema - // 2: { ... }, - // ... - // }, - // users: { - // 7: { ... }, - // .. - // } - // } - // } - - response = normalize(response, { - articles: arrayOf(article1) - }); - } -} - -// new Schema(key, [options]) - -const article2 = new Schema('articles'); - -// You can use a custom id attribute -const article3 = new Schema('articles', { idAttribute: 'slug' }); - -// Or you can specify a function to infer it -function generateSlug(entity: any) { /* ... */ } -const article4 = new Schema('articles', { idAttribute: generateSlug }); - -// Schema.prototype.define(nestedSchema) - -const article5 = new Schema('articles'); -const user5 = new Schema('users'); - -article5.define({ - author: user5 -}); - -// Schema.prototype.getKey() - -const article6 = new Schema('articles'); - -article6.getKey(); -// articles - -// Schema.prototype.getIdAttribute() - -const article7 = new Schema('articles'); -const slugArticle7 = new Schema('articles', { idAttribute: 'slug' }); - -article7.getIdAttribute(); -// id -slugArticle7.getIdAttribute(); -// slug - -// arrayOf(schema, [options]) - -const article8 = new Schema('articles'); -const user8 = new Schema('users'); - -article8.define({ - author: user8, - contributors: arrayOf(user8) -}); - -const article9 = new Schema('articles'); -const image9 = new Schema('images'); -const video9 = new Schema('videos'); -const asset9 = { - images: image9, - videos: video9 -}; - -// You can specify the name of the attribute that determines the schema -article9.define({ - assets: arrayOf(asset9, { schemaAttribute: 'type' }) -}); - -// Or you can specify a function to infer it -function inferSchema9(entity: any) { /* ... */ } -article9.define({ - assets: arrayOf(asset9, { schemaAttribute: inferSchema9 }) -}); - -// valuesOf(schema, [options]) - -const article10 = new Schema('articles'); -const user10 = new Schema('users'); - -article10.define({ - collaboratorsByRole: valuesOf(user10) -}); - -const article11 = new Schema('articles'); -const user11 = new Schema('users'); -const group11 = new Schema('groups'); -const collaborator11 = { - users: user11, - groups: group11 -}; - -// You can specify the name of the attribute that determines the schema -article11.define({ - collaboratorsByRole: valuesOf(collaborator11, { schemaAttribute: 'type' }) -}); - -// Or you can specify a function to infer it -function inferSchema11(entity: any) { /* ... */ } -article11.define({ - collaboratorsByRole: valuesOf(collaborator11, { schemaAttribute: inferSchema }) -}); - -// unionOf(schemaMap, [options]) - -const group12 = new Schema('groups'); -const user12 = new Schema('users'); - -// a member can be either a user or a group -const member12 = { - users: user12, - groups: group12 -}; - -// You can specify the name of the attribute that determines the schema -group12.define({ - owner: unionOf(member12, { schemaAttribute: 'type' }) -}); - -// Or you can specify a function to infer it -function inferSchema(entity: any) { /* ... */ } -group12.define({ - creator: unionOf(member12, { schemaAttribute: inferSchema }) -}); - -const group13 = new Schema('groups'); -const user13 = new Schema('users'); - -const member13 = unionOf({ - users: user13, - groups: group13 -}, { schemaAttribute: 'type' }); - -group13.define({ - owner: member13, - members: arrayOf(member13), - relationships: valuesOf(member13) -}); - -// normalize(obj, schema, [options]) - -const article14 = new Schema('articles'); -const user14 = new Schema('users'); - -article14.define({ - author: user14, - contributors: arrayOf(user14), - meta: { - likes: arrayOf({ - user: user14 - }) - } -}); - -// ... - -// Normalize one article object -const json = { id: 1, author: /*...*/{} }; -const normalized1 = normalize(json, article14); - -// Normalize an array of article objects -const arr = [{ id: 1, author: /*...*/{} }/*, ...*/] -const normalized2 = normalize(arr, arrayOf(article14)); - -// Normalize an array of article objects, referenced by an object key: -const wrappedArr = { articles: [{ id: 1, author: /*...*/{} }/*, ...*/] } -const normalized3 = normalize(wrappedArr, { - articles: arrayOf(article14) -}); \ No newline at end of file +/// + +import { normalize, Schema, arrayOf, unionOf, valuesOf } from 'normalizr'; + +// First, define a schema for our entities: + +const article1 = new Schema('articles'); +const user1 = new Schema('users'); + +// Then we define nesting rules: + +article1.define({ + author: user1, + contributors: arrayOf(user1) +}); + +// Now we can use this schema in our API response handlers: + +const ServerActionCreators = { + // These are two different XHR endpoints with different response schemas. + // We can use the schema objects defined earlier to express both of them: + + receiveOneArticle(response: any) { + // Here, the response is an object containing data about one article. + // Passing the article schema as second parameter to normalize() lets it + // correctly traverse the response tree and gather all entities: + + // BEFORE: + // { + // id: 1, + // title: 'Some Article', + // author: { + // id: 7, + // name: 'Dan' + // }, + // contributors: [{ + // id: 10, + // name: 'Abe' + // }, { + // id: 15, + // name: 'Fred' + // }] + // } + // + // AFTER: + // { + // result: 1, // <--- Note object is referenced by ID + // entities: { + // articles: { + // 1: { + // author: 7, // <--- Same happens for references to + // contributors: [10, 15] // <--- other entities in the schema + // ...} + // }, + // users: { + // 7: { ... }, + // 10: { ... }, + // 15: { ... } + // } + // } + // } + + response = normalize(response, article1); + }, + + receiveAllArticles(response: any) { + // Here, the response is an object with the key 'articles' referencing + // an array of article objects. Passing { articles: arrayOf(article) } as + // second parameter to normalize() lets it correctly traverse the response + // tree and gather all entities: + + // BEFORE: + // { + // articles: [{ + // id: 1, + // title: 'Some Article', + // author: { + // id: 7, + // name: 'Dan' + // }, + // ... + // }, + // ... + // ] + // } + // + // AFTER: + // { + // result: { + // articles: [1, 2, ...] // <--- Note how object array turned into ID array + // }, + // entities: { + // articles: { + // 1: { author: 7, ... }, // <--- Same happens for references to other entities in the schema + // 2: { ... }, + // ... + // }, + // users: { + // 7: { ... }, + // .. + // } + // } + // } + + response = normalize(response, { + articles: arrayOf(article1) + }); + } +} + +// new Schema(key, [options]) + +const article2 = new Schema('articles'); + +// You can use a custom id attribute +const article3 = new Schema('articles', { idAttribute: 'slug' }); + +// Or you can specify a function to infer it +function generateSlug(entity: any) { /* ... */ } +const article4 = new Schema('articles', { idAttribute: generateSlug }); + +// Schema.prototype.define(nestedSchema) + +const article5 = new Schema('articles'); +const user5 = new Schema('users'); + +article5.define({ + author: user5 +}); + +// Schema.prototype.getKey() + +const article6 = new Schema('articles'); + +article6.getKey(); +// articles + +// Schema.prototype.getIdAttribute() + +const article7 = new Schema('articles'); +const slugArticle7 = new Schema('articles', { idAttribute: 'slug' }); + +article7.getIdAttribute(); +// id +slugArticle7.getIdAttribute(); +// slug + +// arrayOf(schema, [options]) + +const article8 = new Schema('articles'); +const user8 = new Schema('users'); + +article8.define({ + author: user8, + contributors: arrayOf(user8) +}); + +const article9 = new Schema('articles'); +const image9 = new Schema('images'); +const video9 = new Schema('videos'); +const asset9 = { + images: image9, + videos: video9 +}; + +// You can specify the name of the attribute that determines the schema +article9.define({ + assets: arrayOf(asset9, { schemaAttribute: 'type' }) +}); + +// Or you can specify a function to infer it +function inferSchema9(entity: any) { /* ... */ } +article9.define({ + assets: arrayOf(asset9, { schemaAttribute: inferSchema9 }) +}); + +// valuesOf(schema, [options]) + +const article10 = new Schema('articles'); +const user10 = new Schema('users'); + +article10.define({ + collaboratorsByRole: valuesOf(user10) +}); + +const article11 = new Schema('articles'); +const user11 = new Schema('users'); +const group11 = new Schema('groups'); +const collaborator11 = { + users: user11, + groups: group11 +}; + +// You can specify the name of the attribute that determines the schema +article11.define({ + collaboratorsByRole: valuesOf(collaborator11, { schemaAttribute: 'type' }) +}); + +// Or you can specify a function to infer it +function inferSchema11(entity: any) { /* ... */ } +article11.define({ + collaboratorsByRole: valuesOf(collaborator11, { schemaAttribute: inferSchema }) +}); + +// unionOf(schemaMap, [options]) + +const group12 = new Schema('groups'); +const user12 = new Schema('users'); + +// a member can be either a user or a group +const member12 = { + users: user12, + groups: group12 +}; + +// You can specify the name of the attribute that determines the schema +group12.define({ + owner: unionOf(member12, { schemaAttribute: 'type' }) +}); + +// Or you can specify a function to infer it +function inferSchema(entity: any) { /* ... */ } +group12.define({ + creator: unionOf(member12, { schemaAttribute: inferSchema }) +}); + +const group13 = new Schema('groups'); +const user13 = new Schema('users'); + +const member13 = unionOf({ + users: user13, + groups: group13 +}, { schemaAttribute: 'type' }); + +group13.define({ + owner: member13, + members: arrayOf(member13), + relationships: valuesOf(member13) +}); + +// normalize(obj, schema, [options]) + +const article14 = new Schema('articles'); +const user14 = new Schema('users'); + +article14.define({ + author: user14, + contributors: arrayOf(user14), + meta: { + likes: arrayOf({ + user: user14 + }) + } +}); + +// ... + +// Normalize one article object +const json = { id: 1, author: /*...*/{} }; +const normalized1 = normalize(json, article14); + +// Normalize an array of article objects +const arr = [{ id: 1, author: /*...*/{} }/*, ...*/] +const normalized2 = normalize(arr, arrayOf(article14)); + +// Normalize an array of article objects, referenced by an object key: +const wrappedArr = { articles: [{ id: 1, author: /*...*/{} }/*, ...*/] } +const normalized3 = normalize(wrappedArr, { + articles: arrayOf(article14) +}); From 49bc73bf551fb964a75519a776f03e33cee8c436 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Sat, 23 Apr 2016 15:53:58 +0300 Subject: [PATCH 23/65] added Platform.is method (#9047) * added * change definition of "is" method Platform -> platformName bool -> boolean * add test for "is" method not sure if it works :) --- ionic/ionic-tests.ts | 1 + ionic/ionic.d.ts | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/ionic/ionic-tests.ts b/ionic/ionic-tests.ts index 8491fc13f8..1790e542f1 100644 --- a/ionic/ionic-tests.ts +++ b/ionic/ionic-tests.ts @@ -387,6 +387,7 @@ class IonicTestController { ready = ionic.Platform.ready(callbackWithReturn); var setGrade: void = ionic.Platform.setGrade('iOS'); var deviceInformation: string = ionic.Platform.device(); + var isBrowser: boolean = ionic.Platform.is('browser'); var isWebView: boolean = ionic.Platform.isWebView(); var isIPad: boolean = ionic.Platform.isIPad(); var isIOS: boolean = ionic.Platform.isIOS(); diff --git a/ionic/ionic.d.ts b/ionic/ionic.d.ts index 994b7ae27e..e2cbc195b7 100644 --- a/ionic/ionic.d.ts +++ b/ionic/ionic.d.ts @@ -32,6 +32,10 @@ interface IonicStatic { * Return the current device (given by cordova). */ device(): any; + /** + * Check if the platform name provided is detected. + */ + is(platformName: string): boolean; /** * Check if we are running within a WebView (such as Cordova). */ From 362675c31df7733a530e4fbfe454f4c55f28b05e Mon Sep 17 00:00:00 2001 From: Howard Yeh Date: Sat, 23 Apr 2016 05:56:20 -0700 Subject: [PATCH 24/65] Add Dimensions module to react-native (#9056) --- react-native/react-native-tests.tsx | 20 +++++++++++++++- react-native/react-native.d.ts | 36 ++++++++++++++++++----------- 2 files changed, 41 insertions(+), 15 deletions(-) diff --git a/react-native/react-native-tests.tsx b/react-native/react-native-tests.tsx index ffb127b6cc..8bed3c8be3 100644 --- a/react-native/react-native-tests.tsx +++ b/react-native/react-native-tests.tsx @@ -27,9 +27,27 @@ import { View, AppState, AppStateIOS, - ViewPagerAndroid + ViewPagerAndroid, + Dimensions, } from 'react-native'; +function testDimensions() { + var { + width, + height, + scale, + fontScale, + } = Dimensions.get("window"); + + var { + width, + height, + scale, + fontScale, + } = Dimensions.get("screen"); +} + + var styles = StyleSheet.create( { container: { diff --git a/react-native/react-native.d.ts b/react-native/react-native.d.ts index b7f19c4489..a6cab25ff0 100644 --- a/react-native/react-native.d.ts +++ b/react-native/react-native.d.ts @@ -2499,8 +2499,28 @@ declare namespace __React { width: number; height: number; scale: number; + fontScale: number; } + /** + * Initial dimensions are set before `runApplication` is called so they should + * be available before any other require's are run, but may be updated later. + * + * Note: Although dimensions are available immediately, they may change (e.g + * due to device rotation) so any rendering logic or styles that depend on + * these constants should try to call this function on every render, rather + * than caching the value (for example, using inline styles rather than + * setting a value in a `StyleSheet`). + * + * Example: `var {height, width} = Dimensions.get('window');` + * + * @param {string} dim Name of dimension as defined when calling `set`. + * @returns {Object?} Value for the dimension. + * @see https://facebook.github.io/react-native/docs/dimensions.html#content + */ + export interface Dimensions { + get( what: "window" | "screen" ): React.ScaledSize; + } export interface InteractionManagerStatic { runAfterInteractions( fn: () => void ): void; @@ -3447,6 +3467,7 @@ declare namespace __React { export var VibrationIOS: VibrationIOSStatic export type VibrationIOS = VibrationIOSStatic + export var Dimensions: Dimensions; // // /TODO: BGR: These are leftovers of the initial port that must be revisited @@ -3509,17 +3530,4 @@ declare module "react-native" { declare var global: __React.GlobalStatic -declare function require( name: string ): any - - -//TODO: BGR: this is a left-over from the initial port. Not sure it makes any sense -declare module "Dimensions" { - import * as React from 'react-native'; - - interface Dimensions { - get( what: string ): React.ScaledSize; - } - - var ExportDimensions: Dimensions; - export = ExportDimensions; -} +declare function require( name: string ): any \ No newline at end of file From e735ebe1d3f922c3f1b03c64e00b49b1bf185314 Mon Sep 17 00:00:00 2001 From: Jon Sheppard Date: Sat, 23 Apr 2016 20:55:14 +0700 Subject: [PATCH 25/65] react-bootstrap: add missing function props to Modal (#9063) * react-bootstrap: add missing function props to Modal * Updated type definition as requested. --- react-bootstrap/react-bootstrap-tests.tsx | 2 +- react-bootstrap/react-bootstrap.d.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/react-bootstrap/react-bootstrap-tests.tsx b/react-bootstrap/react-bootstrap-tests.tsx index 4198e62320..cad2242a38 100644 --- a/react-bootstrap/react-bootstrap-tests.tsx +++ b/react-bootstrap/react-bootstrap-tests.tsx @@ -281,7 +281,7 @@ export class ReactBootstrapTest extends Component {
- + Modal title diff --git a/react-bootstrap/react-bootstrap.d.ts b/react-bootstrap/react-bootstrap.d.ts index e64f831de5..9dd6b9bbf1 100644 --- a/react-bootstrap/react-bootstrap.d.ts +++ b/react-bootstrap/react-bootstrap.d.ts @@ -190,6 +190,12 @@ declare module "react-bootstrap" { dialogComponent?: any; // TODO: Add more specific type enforceFocus?: boolean; keyboard?: boolean; + onEnter?: (node: HTMLElement) => any; + onEntered?: (node: HTMLElement) => any; + onEntering?: (node: HTMLElement) => any; + onExit?: (node: HTMLElement) => any; + onExited?: (node: HTMLElement) => any; + onExiting?: (node: HTMLElement) => any; show?: boolean; } interface ModalClass extends React.ClassicComponentClass { From 51ac3c4520c6daa5aeb84b516d97d8f6e82c6a82 Mon Sep 17 00:00:00 2001 From: Luke Venn Date: Sat, 23 Apr 2016 14:55:43 +0100 Subject: [PATCH 26/65] Added RegExp typing to 'path' argument descriptions (#9065) --- nock/nock.d.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/nock/nock.d.ts b/nock/nock.d.ts index 208aac9b31..3319456a5e 100644 --- a/nock/nock.d.ts +++ b/nock/nock.d.ts @@ -22,28 +22,45 @@ declare module "nock" { export interface Scope { get(path: string, data?: string): Scope; + get(path: RegExp, data?: string): Scope; post(path: string, data?: string): Scope; post(path: string, data?: Object): Scope; post(path: string, regex?: RegExp): Scope; + post(path: RegExp, data?: string): Scope; + post(path: RegExp, data?: Object): Scope; + post(path: RegExp, regex?: RegExp): Scope; patch(path: string, data?: string): Scope; patch(path: string, data?: Object): Scope; patch(path: string, regex?: RegExp): Scope; + patch(path: RegExp, data?: string): Scope; + patch(path: RegExp, data?: Object): Scope; + patch(path: RegExp, regex?: RegExp): Scope; put(path: string, data?: string): Scope; put(path: string, data?: Object): Scope; put(path: string, regex?: RegExp): Scope; + put(path: RegExp, data?: string): Scope; + put(path: RegExp, data?: Object): Scope; + put(path: RegExp, regex?: RegExp): Scope; head(path: string): Scope; + head(path: RegExp): Scope; delete(path: string, data?: string): Scope; delete(path: string, data?: Object): Scope; delete(path: string, regex?: RegExp): Scope; + delete(path: RegExp, data?: string): Scope; + delete(path: RegExp, data?: Object): Scope; + delete(path: RegExp, regex?: RegExp): Scope; merge(path: string, data?: string): Scope; merge(path: string, data?: Object): Scope; merge(path: string, regex?: RegExp): Scope; + merge(path: RegExp, data?: string): Scope; + merge(path: RegExp, data?: Object): Scope; + merge(path: RegExp, regex?: RegExp): Scope; query(params: any): Scope; query(acceptAnyParams: boolean): Scope; @@ -51,6 +68,9 @@ declare module "nock" { intercept(path: string, verb: string, body?: string, options?: any): Scope; intercept(path: string, verb: string, body?: Object, options?: any): Scope; intercept(path: string, verb: string, body?: RegExp, options?: any): Scope; + intercept(path: RegExp, verb: string, body?: string, options?: any): Scope; + intercept(path: RegExp, verb: string, body?: Object, options?: any): Scope; + intercept(path: RegExp, verb: string, body?: RegExp, options?: any): Scope; reply(responseCode: number, body?: string, headers?: Object): Scope; reply(responseCode: number, body?: Object, headers?: Object): Scope; From 8ee5d208609ba28d97b3fdd8d772e56a061a42d1 Mon Sep 17 00:00:00 2001 From: Joshua Date: Sat, 23 Apr 2016 16:32:25 +0200 Subject: [PATCH 27/65] Fix incorrect constraints typings. (#9068) --- p2/p2.d.ts | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/p2/p2.d.ts b/p2/p2.d.ts index a6f3cf256e..bdbac86b0e 100644 --- a/p2/p2.d.ts +++ b/p2/p2.d.ts @@ -118,7 +118,6 @@ declare namespace p2 { constructor(bodyA: Body, bodyB: Body, type: number, options?: { collideConnected?: boolean; - wakeUpBodies?: boolean; }); type: number; @@ -135,9 +134,7 @@ declare namespace p2 { export class DistanceConstraint extends Constraint { - constructor(bodyA: Body, bodyB: Body, type: number, options?: { - collideConnected?: boolean; - wakeUpBodies?: boolean; + constructor(bodyA: Body, bodyB: Body, options?: { distance?: number; localAnchorA?: number[]; localAnchorB?: number[]; @@ -161,9 +158,7 @@ declare namespace p2 { export class GearConstraint extends Constraint { - constructor(bodyA: Body, bodyB: Body, type: number, options?: { - collideConnected?: boolean; - wakeUpBodies?: boolean; + constructor(bodyA: Body, bodyB: Body, options?: { angle?: number; ratio?: number; maxTorque?: number; @@ -179,9 +174,7 @@ declare namespace p2 { export class LockConstraint extends Constraint { - constructor(bodyA: Body, bodyB: Body, type: number, options?: { - collideConnected?: boolean; - wakeUpBodies?: boolean; + constructor(bodyA: Body, bodyB: Body, options?: { localOffsetB?: number[]; localAngleB?: number; maxForce?: number; @@ -194,9 +187,7 @@ declare namespace p2 { export class PrismaticConstraint extends Constraint { - constructor(bodyA: Body, bodyB: Body, type: number, options?: { - collideConnected?: boolean; - wakeUpBodies?: boolean; + constructor(bodyA: Body, bodyB: Body, options?: { maxForce?: number; localAnchorA?: number[]; localAnchorB?: number[]; @@ -229,9 +220,7 @@ declare namespace p2 { export class RevoluteConstraint extends Constraint { - constructor(bodyA: Body, bodyB: Body, type: number, options?: { - collideConnected?: boolean; - wakeUpBodies?: boolean; + constructor(bodyA: Body, bodyB: Body, options?: { worldPivot?: number[]; localPivotA?: number[]; localPivotB?: number[]; From 458feddf12821dc5d1b368eb4c9ab80c1121d321 Mon Sep 17 00:00:00 2001 From: katashin Date: Sat, 23 Apr 2016 23:32:48 +0900 Subject: [PATCH 28/65] Update Vue v1.0.16 -> v1.0.21 (#9069) --- vue/vue-tests.ts | 12 +++++++++++- vue/vue.d.ts | 9 +++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/vue/vue-tests.ts b/vue/vue-tests.ts index 360625f05d..c8612ca870 100644 --- a/vue/vue-tests.ts +++ b/vue/vue-tests.ts @@ -8,7 +8,7 @@ namespace TestConfig { Vue.config.unsafeDelimiters = ['{!!', '!!}']; Vue.config.silent = true; Vue.config.async = false; - Vue.config.convertAllProperties = true; + Vue.config.devtools = true; } namespace TestGlobalAPI { @@ -67,6 +67,16 @@ namespace TestGlobalAPI { } } }); + Vue.component("component", { + props: { + a: [String, Number], + b: { + type: [Number, Function], + required: true + } + }, + init: function() {} + }); var transition = Vue.transition("transition"); Vue.transition("transition", transition); Vue.transition("transition", { diff --git a/vue/vue.d.ts b/vue/vue.d.ts index b655cf6d9b..faee50af8f 100644 --- a/vue/vue.d.ts +++ b/vue/vue.d.ts @@ -1,4 +1,4 @@ -// Type definitions for vuejs 1.0.16 +// Type definitions for vuejs 1.0.21 // Project: https://github.com/vuejs/vue // Definitions by: odangosan , kaorun343 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -11,7 +11,7 @@ interface Array { declare namespace vuejs { interface PropOption { - type?: { new (...args: any[]): any; }; + type?: { new (...args: any[]): any; } | { new (...args: any[]): any; }[]; required?: boolean; default?: any; twoWay?: boolean; @@ -68,13 +68,14 @@ declare namespace vuejs { interface ComponentOption { data?: { [key: string]: any } | Function; - props?: string[] | { [key: string]: (PropOption | { new (...args: any[]): any; }) }; + props?: string[] | { [key: string]: (PropOption | { new (...args: any[]): any; } | { new (...args: any[]): any; }[]) }; computed?: { [key: string]: (Function | ComputedOption) }; methods?: { [key: string]: Function }; watch?: { [key: string]: ((val: any, oldVal: any) => void) | string | WatchOption }; el?: string | HTMLElement | (() => HTMLElement); template?: string; replace?: boolean; + init?(): void; created?(): void; beforeCompile?(): void; compiled?(): void; @@ -143,7 +144,7 @@ declare namespace vuejs { unsafeDelimiters: [string, string]; silent: boolean; async: boolean; - convertAllProperties: boolean; + devtools: boolean; } interface VueUtil { From ed728ac598fb8ff02c8e5c386cffbc33c502934b Mon Sep 17 00:00:00 2001 From: Greg O'Connor Date: Sat, 23 Apr 2016 07:35:52 -0700 Subject: [PATCH 29/65] react-select: Allow placeholder to be an Element (#9061) --- react-select/react-select.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-select/react-select.d.ts b/react-select/react-select.d.ts index 05056d198e..5ad97ba2ff 100644 --- a/react-select/react-select.d.ts +++ b/react-select/react-select.d.ts @@ -173,7 +173,7 @@ declare namespace ReactSelect { * field placeholder, displayed when there's no value * @default "Select..." */ - placeholder?: string; + placeholder?: string | __React.ReactElement; /** * whether to enable searching feature or not * @default true; From 3abab28a3ea92c35a3018ad79a57f41cd8a67b0c Mon Sep 17 00:00:00 2001 From: TANAKA Koichi Date: Sat, 23 Apr 2016 23:36:34 +0900 Subject: [PATCH 30/65] sequelize: fix FindOptions (#9073) Fix FindOptions.attributes. Now allows a object having include and/or exclude properties. http://sequelize.readthedocs.org/en/latest/api/model/#findalloptions-promisearrayinstance --- sequelize/sequelize-tests.ts | 2 ++ sequelize/sequelize.d.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sequelize/sequelize-tests.ts b/sequelize/sequelize-tests.ts index 86be60d223..6e62606e19 100644 --- a/sequelize/sequelize-tests.ts +++ b/sequelize/sequelize-tests.ts @@ -882,6 +882,8 @@ User.findAll( { order : [['id', ';DELETE YOLO INJECTIONS']] } ); User.findAll( { include : [User], order : [[User, 'id', ';DELETE YOLO INJECTIONS']] } ); User.findAll( { include : [User], order : [['id', 'ASC NULLS LAST'], [User, 'id', 'DESC NULLS FIRST']] } ); User.findAll( { include : [{ model : User, where : { title : 'DoDat' }, include : [{ model : User }] }] } ); +User.findAll( { attributes: ['username', 'data']}); +User.findAll( { attributes: {include: ['username', 'data']} }); User.findById( 'a string' ); diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index 9af29c0e97..81c7f4a165 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -3121,7 +3121,7 @@ declare module "sequelize" { * `Sequelize.literal`, `Sequelize.fn` and so on), and the second is the name you want the attribute to * have in the returned instance */ - attributes? : Array; + attributes? : Array | { include?: Array, exclude?: Array }; /** * If true, only non-deleted records will be returned. If false, both deleted and non-deleted records will From 1fa3e10e0175d352b149ccbca794c9438d702b4e Mon Sep 17 00:00:00 2001 From: hellopao Date: Sat, 23 Apr 2016 22:39:14 +0800 Subject: [PATCH 31/65] update cluster module for node.d.ts (#9074) --- node/node-tests.ts | 13 +++++++++++++ node/node.d.ts | 6 +++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/node/node-tests.ts b/node/node-tests.ts index 0cc0b5de6c..64f7a5bb29 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -15,6 +15,7 @@ import * as querystring from "querystring"; import * as path from "path"; import * as readline from "readline"; import * as childProcess from "child_process"; +import * as cluster from "cluster"; import * as os from "os"; import * as vm from "vm"; // Specifically test buffer module regression. @@ -643,6 +644,18 @@ namespace readline_tests { childProcess.exec("echo test"); childProcess.spawnSync("echo test"); +////////////////////////////////////////////////////////////////////// +/// cluster tests: https://nodejs.org/api/cluster.html /// +////////////////////////////////////////////////////////////////////// + +cluster.fork(); +Object.keys(cluster.workers).forEach(key => { + const worker = cluster.workers[key]; + if (worker.isDead()) { + console.log('worker %d is dead', worker.process.pid); + } +}); + //////////////////////////////////////////////////// /// os tests : https://nodejs.org/api/os.html //////////////////////////////////////////////////// diff --git a/node/node.d.ts b/node/node.d.ts index 1b2da31c94..6f115759ff 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -679,6 +679,8 @@ declare module "cluster" { kill(signal?: string): void; destroy(signal?: string): void; disconnect(): void; + isConnected(): boolean; + isDead(): boolean; } export var settings: ClusterSettings; @@ -688,7 +690,9 @@ declare module "cluster" { export function fork(env?: any): Worker; export function disconnect(callback?: Function): void; export var worker: Worker; - export var workers: Worker[]; + export var workers: { + [index: string]: Worker + }; // Event emitter export function addListener(event: string, listener: Function): void; From 32f2a3b467d9ec6efb23b9db4a4501e24c661da1 Mon Sep 17 00:00:00 2001 From: Stephen Lautier Date: Sat, 23 Apr 2016 16:52:08 +0200 Subject: [PATCH 32/65] feat(es6): added support for es6 modules (#9071) --- ng-dialog/ng-dialog.d.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ng-dialog/ng-dialog.d.ts b/ng-dialog/ng-dialog.d.ts index 63510520ad..42d7821d4a 100644 --- a/ng-dialog/ng-dialog.d.ts +++ b/ng-dialog/ng-dialog.d.ts @@ -5,6 +5,18 @@ /// +declare module "ng-dialog" { + export type IDialogService = angular.dialog.IDialogService; + export type IDialogOpenResult = angular.dialog.IDialogOpenResult; + export type IDialogClosePromise = angular.dialog.IDialogClosePromise; + export type IDialogProvider = angular.dialog.IDialogProvider; + export type IDialogScope = angular.dialog.IDialogScope; + export type IDialogConfirmScope = angular.dialog.IDialogConfirmScope; + export type IDialogOptions = angular.dialog.IDialogOptions; + export type IDialogOpenOptions = angular.dialog.IDialogOpenOptions; + export type IDialogOpenConfirmOptions = angular.dialog.IDialogOpenConfirmOptions; +} + declare namespace angular.dialog { interface IDialogService { From 24ea8d373a92addab4bdb0b294b107188e9dc4b8 Mon Sep 17 00:00:00 2001 From: Gregor Date: Sat, 23 Apr 2016 16:53:25 +0200 Subject: [PATCH 33/65] Update hellojs.d.ts (#8304) This update will also give you the ability to use import/require imports in your projects like this: `import * as hello from 'hellojs';` or `import hello = require('hellojs');` Otherwise, TS will always say module 'hellojs' is undefined (if included as `import 'hellojs`) --- hellojs/hellojs.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hellojs/hellojs.d.ts b/hellojs/hellojs.d.ts index 6da9f9ca0b..686d5c1adf 100644 --- a/hellojs/hellojs.d.ts +++ b/hellojs/hellojs.d.ts @@ -80,3 +80,8 @@ interface HelloJSServiceDef { } declare var hello: HelloJSStatic; + +// Support AMD require +declare module 'hellojs' { + export = hello; +} From 7084dd9c282165e4496d2fe2f0554f8afa77772e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20H=C3=A4mmerle?= Date: Sat, 23 Apr 2016 18:01:46 +0300 Subject: [PATCH 34/65] allow other than string for state (#9067) also objects are allowed (as in the official Hapi.js Cookie Tutorial: http://hapijs.com/tutorials/cookies) --- hapi/hapi.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index 65cc044178..9962dd6c62 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -304,7 +304,7 @@ declare module "hapi" { response(result: any): Response; /** Sets a cookie on the response */ - state(name: string, value: string, options?: any): void; + state(name: string, value: any, options?: any): void; /** Clears a cookie on the response */ unstate(name: string, options?: any): void; From 250c3afd484aa4e7756bf4b64008655fc222fe14 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Sun, 24 Apr 2016 00:32:31 +0930 Subject: [PATCH 35/65] added material-design-lite definition and tests (#9080) --- .../material-design-lite-tests.ts | 38 ++++++ .../material-design-lite.d.ts | 128 ++++++++++++++++++ 2 files changed, 166 insertions(+) create mode 100644 material-design-lite/material-design-lite-tests.ts create mode 100644 material-design-lite/material-design-lite.d.ts diff --git a/material-design-lite/material-design-lite-tests.ts b/material-design-lite/material-design-lite-tests.ts new file mode 100644 index 0000000000..afbf5faf15 --- /dev/null +++ b/material-design-lite/material-design-lite-tests.ts @@ -0,0 +1,38 @@ +// Test file for Google Maps JavaScript API Definition file +/// + +componentHandler.upgradeDom(); +componentHandler.upgradeDom('MaterialButton'); +componentHandler.upgradeDom('MaterialButton', 'mdl-button'); + +componentHandler.upgradeElement(document.createElement('div')); +componentHandler.upgradeElement(document.getElementById('id')); +componentHandler.upgradeElement(document.getElementsByTagName('button')[0], 'MaterialButton'); + +componentHandler.upgradeElements(document.getElementsByTagName('div')); +componentHandler.upgradeElements([document.createElement('div')]); +componentHandler.upgradeElements(document.querySelectorAll('div.mdl-button')); + +componentHandler.upgradeAllRegistered(); + +componentHandler.registerUpgradedCallback('MaterialButton', function(element : HTMLElement) {}); + +componentHandler.register({ + constructor: function(element: HTMLElement) {}, + classAsString: 'MaterialCheese', + cssClass: 'mdl-cheese' +}); +componentHandler.register({ + constructor: function(element: HTMLElement) {}, + classAsString: 'MaterialFoo', + cssClass: 'mdl-foo', + widget: true +}); +componentHandler.register({ + constructor: function(element: HTMLElement) {}, + classAsString: 'MaterialFoo', + cssClass: 'mdl-foo', + widget: 'FooBar' +}); + +componentHandler.downgradeElements(document.querySelectorAll('div')); diff --git a/material-design-lite/material-design-lite.d.ts b/material-design-lite/material-design-lite.d.ts new file mode 100644 index 0000000000..11b93ea792 --- /dev/null +++ b/material-design-lite/material-design-lite.d.ts @@ -0,0 +1,128 @@ +// Type definitions for material-design-lite v1.1.3 +// Project: https://getmdl.io +// Definitions by: Brad Zacher +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module MaterialDesignLite { + interface ComponentHandler { + /** + * Searches existing DOM for elements of our component type and upgrades them + * if they have not already been upgraded. + */ + upgradeDom() : void; + /** + * Searches existing DOM for elements of our component type and upgrades them + * if they have not already been upgraded. + * + * @param {string} jsClass the programatic name of the element class we + * need to create a new instance of. + */ + upgradeDom(jsClass : string) : void; + /** + * Searches existing DOM for elements of our component type and upgrades them + * if they have not already been upgraded. + * + * @param {string} jsClass the programatic name of the element class we + * need to create a new instance of. + * @param {string} cssClass the name of the CSS class elements of this + * type will have. + */ + upgradeDom(jsClass : string, cssClass : string) : void; + + /** + * Upgrades a specific element rather than all in the DOM. + * + * @param {!Element} element The element we wish to upgrade. + */ + upgradeElement(element : HTMLElement) : void; + /** + * Upgrades a specific element rather than all in the DOM. + * + * @param {!Element} element The element we wish to upgrade. + * @param {string} jsClass Optional name of the class we want to upgrade + * the element to. + */ + upgradeElement(element : HTMLElement, jsClass : string) : void; + + /** + * Upgrades a specific list of elements rather than all in the DOM. + * + * @param {!Element} elements + * The elements we wish to upgrade. + */ + upgradeElements(elements : HTMLElement) : void; + /** + * Upgrades a specific list of elements rather than all in the DOM. + * + * @param {!Array} elements + * The elements we wish to upgrade. + */ + upgradeElements(elements : Array) : void; + /** + * Upgrades a specific list of elements rather than all in the DOM. + * + * @param {!NodeList} elements + * The elements we wish to upgrade. + */ + upgradeElements(elements : NodeList) : void; + /** + * Upgrades a specific list of elements rather than all in the DOM. + * + * @param {!HTMLCollection} elements + * The elements we wish to upgrade. + */ + upgradeElements(elements : HTMLCollection) : void; + + /** + * Upgrades all registered components found in the current DOM. This is + * automatically called on window load. + */ + upgradeAllRegistered() : void; + + /** + * Allows user to be alerted to any upgrades that are performed for a given + * component type + * + * @param {string} jsClass The class name of the MDL component we wish + * to hook into for any upgrades performed. + * @param {function(!HTMLElement)} callback The function to call upon an + * upgrade. This function should expect 1 parameter - the HTMLElement which + * got upgraded. + */ + registerUpgradedCallback(jsClass : string, callback : (element : HTMLElement) => any) : void; + + /** + * Registers a class for future use and attempts to upgrade existing DOM. + * + * @param {componentHandler.ComponentConfigPublic} config the registration configuration + */ + register(config : ComponentConfigPublic) : void; + + /** + * Downgrade either a given node, an array of nodes, or a NodeList. + * + * @param {!Node} nodes The list of nodes. + */ + downgradeElements(nodes : Node) : void; + /** + * Downgrade either a given node, an array of nodes, or a NodeList. + * + * @param {!Array} nodes The list of nodes. + */ + downgradeElements(nodes : Array) : void; + /** + * Downgrade either a given node, an array of nodes, or a NodeList. + * + * @param {!NodeList} nodes The list of nodes. + */ + downgradeElements(nodes : NodeList) : void; + } + interface ComponentConfigPublic { + constructor(element : HTMLElement) : void; + classAsString : string; + cssClass : string; + widget? : string | boolean; + } +} + +declare var componentHandler : MaterialDesignLite.ComponentHandler; \ No newline at end of file From 2d448c0a3152e8871521848c5c2c61ab4e2a2cc9 Mon Sep 17 00:00:00 2001 From: Markus Wagner Date: Sat, 23 Apr 2016 17:04:01 +0200 Subject: [PATCH 36/65] Update log4javascript.d.ts (#9081) constructor for LoggingEvent added --- log4javascript/log4javascript.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/log4javascript/log4javascript.d.ts b/log4javascript/log4javascript.d.ts index 1307053fad..460e17c91f 100644 --- a/log4javascript/log4javascript.d.ts +++ b/log4javascript/log4javascript.d.ts @@ -274,6 +274,8 @@ declare namespace log4javascript { messages: any[]; exception: Error; + constructor(logger: Logger, timeStamp: Date, level: Level, messages: string[], exception?: Error); + getThrowableStrRep: () => string; getCombinedMessages: () => string; toString: () => string; From 58e16ecbc393c3611359e90a3432f52a3a4bfeda Mon Sep 17 00:00:00 2001 From: James Trinklein Date: Mon, 25 Apr 2016 07:10:54 -0700 Subject: [PATCH 37/65] Update restify types add route spec (#9082) * restify: fix compile errors in test file did not compile without error when compiling with: `tsc --noImplicitAny restify/restify-tests.ts` * restify: add RouteSpec interface --- restify/restify-tests.ts | 34 ++++++++++++++++++++-------------- restify/restify.d.ts | 9 ++++++++- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/restify/restify-tests.ts b/restify/restify-tests.ts index ca3c5000ef..c6905878b4 100644 --- a/restify/restify-tests.ts +++ b/restify/restify-tests.ts @@ -4,7 +4,7 @@ import restify = require("restify"); var server = restify.createServer({ formatters: { - 'application/foo': function formatFoo(req, res, body) { + 'application/foo': function formatFoo(req: restify.Request, res: restify.Response, body: any) { if (body instanceof Error) return body.stack; @@ -37,7 +37,7 @@ server.use((req, res, next)=>{}); server.use([(req, res, next)=>{}]); server.use((req, res, next)=>{}, (req, res, next)=>{}); -function send(req, res, next) { +function send(req: restify.Request, res: restify.Response, next: restify.Next) { req.header('key', 'val'); req.header('key') === 'val'; @@ -77,7 +77,7 @@ function send(req, res, next) { res.code === 50; res.contentLength === 50; - res.charSet === 'test'; + res.charSet('test'); res.contentType === 'test'; res.headers; res.id === 'test'; @@ -249,7 +249,15 @@ server.on('after', restify.auditLogger({ log: ()=>{} })); -restify.defaultResponseHeaders = function(data) { +server.on('after', (req: restify.Request, res: restify.Response, route: restify.Route, err: any) => { + route.spec.method === 'GET'; + route.spec.name === 'routeName'; + route.spec.path === '/some/path'; + route.spec.versions === ['v1']; + restify.auditLogger({ log: ()=>{} })(req, res, route, err); +}); + +restify.defaultResponseHeaders = function(data: any) { this.header('Server', 'helloworld'); }; @@ -276,18 +284,16 @@ client = restify.createStringClient({ version: "" }); -client.get("test", send); -client.head('test', send); -client.post('path', {}, send); -client.put('path', {}, send); -client.del('path', send); +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.del('path', function(err: any, req: restify.Request, res: restify.Response) { }); -client.post('/foo', { hello: 'world' }, function(err, req, res, obj) { +client.post('/foo', { hello: 'world' }, function(err: any, req: restify.Request, res: restify.Response, obj: any) { console.log('%d -> %j', res.statusCode, res.headers); console.log('%j', obj); }); -client.get('/foo/bar', function(err, req, res, data) { +client.get('/foo/bar', function(err: any, req: restify.Request, res: restify.Response, data: string) { console.log('%s', data); }); @@ -295,13 +301,13 @@ var client2 = restify.createClient({ url: 'http://127.0.0.1' }); -client2.get('/str/mcavage', function(err, req) { +client2.get('/str/mcavage', function(err: any, req: any) { - req.on('result', function(err, res) { + req.on('result', function(err: any, res: any) { res.body = ''; res.setEncoding('utf8'); - res.on('data', function(chunk) { + res.on('data', function(chunk: string) { res.body += chunk; }); diff --git a/restify/restify.d.ts b/restify/restify.d.ts index ec6fd26b6e..f68ea0b2cc 100644 --- a/restify/restify.d.ts +++ b/restify/restify.d.ts @@ -73,11 +73,18 @@ declare module "restify" { id: string; } + interface RouteSpec { + method: string; + name: string; + path: string; + versions: string[]; + } + interface Route { name: string; method: string; path: RoutePathRegex; - spec: Object; + spec: RouteSpec; types: string[]; versions: string[]; } From ed7feb8223518d5af92381813b1fd79a934aa683 Mon Sep 17 00:00:00 2001 From: pafflique Date: Mon, 25 Apr 2016 17:11:05 +0300 Subject: [PATCH 38/65] jest.mock should accept optional factory (#9079) https://facebook.github.io/jest/docs/api.html#jest-mock-modulename-factory --- jest/jest.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jest/jest.d.ts b/jest/jest.d.ts index 033dd23faa..451b9abc88 100644 --- a/jest/jest.d.ts +++ b/jest/jest.d.ts @@ -29,7 +29,7 @@ declare namespace jest { function fn(implementation?: Function): Mock; function dontMock(moduleName: string): void; function genMockFromModule(moduleName: string): Mock; - function mock(moduleName: string): void; + function mock(moduleName: string, factory?: Function): void; function runAllTicks(): void; function runAllTimers(): void; function runOnlyPendingTimers(): void; From 2989fcf3d39f30bc9a8f6c25b59c47969aad48af Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Mon, 25 Apr 2016 16:23:46 +0200 Subject: [PATCH 39/65] Update to Electron 0.37.7 (#9086) * Update to Electron 0.37.7 * Add Electron specific process API --- github-electron/github-electron-main-tests.ts | 29 +++++- .../github-electron-renderer-tests.ts | 10 ++ github-electron/github-electron.d.ts | 92 +++++++++++++++++-- 3 files changed, 122 insertions(+), 9 deletions(-) diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index 1366a82022..27d6599596 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -65,7 +65,7 @@ app.on('ready', () => { mainWindow.webContents.openDevTools(); mainWindow.webContents.toggleDevTools(); - mainWindow.webContents.openDevTools({detach: true}); + mainWindow.webContents.openDevTools({mode: 'detach'}); mainWindow.webContents.closeDevTools(); mainWindow.webContents.addWorkSpace('/path/to/workspace'); mainWindow.webContents.removeWorkSpace('/path/to/workspace'); @@ -337,6 +337,9 @@ win.on('closed', () => { win.loadURL('https://github.com'); win.show(); +var toolbarRect = document.getElementById('toolbar').getBoundingClientRect(); +win.setSheetOffset(toolbarRect.height); + // content-tracing // https://github.com/atom/electron/blob/master/docs/api/content-tracing.md @@ -517,12 +520,20 @@ var template = [ { label: 'Reload', accelerator: 'Command+R', - click: () => { BrowserWindow.getFocusedWindow().webContents.reloadIgnoringCache(); } + click: (item, focusedWindow) => { + if (focusedWindow) { + focusedWindow.webContents.reloadIgnoringCache(); + } + } }, { label: 'Toggle DevTools', accelerator: 'Alt+Command+I', - click: () => { BrowserWindow.getFocusedWindow().webContents.toggleDevTools(); } + click: (item, focusedWindow) => { + if (focusedWindow) { + focusedWindow.webContents.toggleDevTools(); + } + } } ] }, @@ -703,6 +714,18 @@ var image = clipboard.readImage(); var appIcon3 = new Tray(image); var appIcon4 = new Tray('/Users/somebody/images/icon.png'); +// process +// https://github.com/electron/electron/blob/master/docs/api/process.md + +console.log(process.type); +console.log(process.resourcesPath); +console.log(process.mas); +console.log(process.windowsStore); +process.noAsar = true; +process.crash(); +process.hang(); +process.setFdLimit(8192); + // screen // https://github.com/atom/electron/blob/master/docs/api/screen.md diff --git a/github-electron/github-electron-renderer-tests.ts b/github-electron/github-electron-renderer-tests.ts index 37faae9dbb..42d034c5c7 100644 --- a/github-electron/github-electron-renderer-tests.ts +++ b/github-electron/github-electron-renderer-tests.ts @@ -171,6 +171,16 @@ var image = clipboard.readImage(); var appIcon3 = new Tray(image); var appIcon4 = new Tray('/Users/somebody/images/icon.png'); +// https://github.com/electron/electron/blob/master/docs/api/process.md + +// preload.js +var _setImmediate = setImmediate; +var _clearImmediate = clearImmediate; +process.once('loaded', function() { + global.setImmediate = _setImmediate; + global.clearImmediate = _clearImmediate; +}); + // screen // https://github.com/atom/electron/blob/master/docs/api/screen.md diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index ec53909d50..3d4bd89835 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Electron v0.37.6 +// Type definitions for Electron v0.37.7 // Project: http://electron.atom.io/ // Definitions by: jedmao , rhysd , Milan Burda // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -297,6 +297,14 @@ declare namespace Electron { * Note: This is only implemented on OS X. */ isDarkMode(): boolean; + /** + * Imports the certificate in pkcs12 format into the platform certificate store. + * @param callback Called with the result of import operation, a value of 0 indicates success + * while any other value indicates failure according to chromium net_error_list. + * + * Note: This API is only available on Linux. + */ + importCertificate(options: ImportCertificateOptions, callback: (result: number) => void): void; commandLine: CommandLine; /** * Note: This API is only available on Mac. @@ -306,6 +314,17 @@ declare namespace Electron { type AppPathName = 'home'|'appData'|'userData'|'temp'|'exe'|'module'|'desktop'|'documents'|'downloads'|'music'|'pictures'|'videos'; + interface ImportCertificateOptions { + /** + * Path for the pkcs12 file. + */ + certificate: string; + /** + * Passphrase for the certificate. + */ + password: string; + } + interface CommandLine { /** * Append a switch [with optional value] to Chromium's command line. @@ -814,6 +833,11 @@ declare namespace Electron { * @returns The title of the native window. */ getTitle(): string; + /** + * Changes the attachment point for sheets on Mac OS X. + * Note: This API is available only on OS X. + */ + setSheetOffset(offset: number): void; /** * Starts or stops flashing the window to attract user's attention. */ @@ -2419,7 +2443,7 @@ declare namespace Electron { /** * The screen module retrieves information about screen size, displays, cursor position, etc. - * You should not use this module until the ready event of the app module is emitted. + * You can not use this module until the ready event of the app module is emitted. */ interface Screen extends NodeJS.EventEmitter { /** @@ -2547,7 +2571,7 @@ declare namespace Electron { webRequest: WebRequest; } - type Permission = 'media' | 'geolocation' | 'notifications' | 'midiSysex' | 'pointerLock' | 'fullscreen'; + type Permission = 'media' | 'geolocation' | 'notifications' | 'midiSysex' | 'pointerLock' | 'fullscreen' | 'openExternal'; interface ClearStorageDataOptions { /** @@ -3253,6 +3277,10 @@ declare namespace Electron { * @returns Whether web page is still loading resources. */ isLoading(): boolean; + /** + * @returns Whether the main frame (and not just iframes or frames within it) is still loading. + */ + isLoadingMainFrame(): boolean; /** * @returns Whether web page is waiting for a first-response for the main * resource of the page. @@ -3420,9 +3448,9 @@ declare namespace Electron { */ openDevTools(options?: { /** - * Opens devtools in a new window. + * Opens the devtools with specified dock state. Defaults to last used dock state. */ - detach?: boolean; + mode?: 'right' | 'bottom' | 'undocked' | 'detach' }): void; /** * Closes the developer tools. @@ -4234,7 +4262,7 @@ declare namespace Electron { * Emitted when a page's theme color changes. This is usually due to encountering a meta tag: * */ - addEventListener(type: 'did-change-theme-color', listener: (event: WebViewElement.Event) => void, useCapture?: boolean): void; + addEventListener(type: 'did-change-theme-color', listener: (event: WebViewElement.DidChangeThemeColorEvent) => void, useCapture?: boolean): void; /** * Emitted when DevTools is opened. */ @@ -4330,6 +4358,10 @@ declare namespace Electron { name: string; version: string; } + + interface DidChangeThemeColorEvent extends Event { + themeColor: string; + } } /** @@ -4424,6 +4456,54 @@ interface File { path: string; } +// https://github.com/electron/electron/blob/master/docs/api/process.md + +declare namespace NodeJS { + interface Process { + /** + * Process's type + */ + type: 'browser' | 'renderer'; + /** + * Path to JavaScript source code. + */ + resourcesPath: string; + /** + * For Mac App Store build, this value is true, for other builds it is undefined. + */ + mas?: boolean; + /** + * If the app is running as a Windows Store app (appx), this value is true, for other builds it is undefined. + */ + windowsStore?: boolean; + /** + * Emitted when Electron has loaded its internal initialization script + * and is beginning to load the web page or the main script. + */ + on(event: 'loaded', listener: Function): this; + on(event: string, listener: Function): this; + /** + * Setting this to true can disable the support for asar archives in Node's built-in modules. + */ + noAsar?: boolean; + /** + * Causes the main thread of the current process crash; + */ + crash(): void; + /** + * Causes the main thread of the current process hang. + */ + hang(): void; + /** + * Sets the file descriptor soft limit to maxDescriptors or the OS hard limit, + * whichever is lower for the current process. + * + * Note: This API is only available on Mac and Linux. + */ + setFdLimit(maxDescriptors: number): void; + } +} + declare module 'electron' { var electron: Electron.ElectronMainAndRenderer; export = electron; From 129f08fb205936f67997c98cbd16fed92e3c38a1 Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Tue, 26 Apr 2016 00:34:26 +1000 Subject: [PATCH 41/65] `i18next.t("foo", {returnObjects: true})` returns an Object (#9077) * `t("foo", {returnObjects: true})` returns an Object * `t("foo", {returnObjects: true})` returns an Object * () will return Object you will have to cast it to any to access properties --- i18next/i18next.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18next/i18next.d.ts b/i18next/i18next.d.ts index d8627c4462..9f976fd751 100644 --- a/i18next/i18next.d.ts +++ b/i18next/i18next.d.ts @@ -100,7 +100,7 @@ declare namespace I18next { getFixedT(lng?:string, ns?:string|string[]):TranslationFunction; - t(key:string, options?:TranslationOptions):string; + t(key:string, options?:TranslationOptions):string|any|Array; exists():boolean; From f9c44651705f574f6d4258fe5e1c335462bdcc19 Mon Sep 17 00:00:00 2001 From: Pavel Martynov Date: Mon, 25 Apr 2016 07:34:59 -0700 Subject: [PATCH 42/65] angular-protractor.d.ts - fix for waitForAngular (#9088) Even citing to heredoc: * @return {!webdriver.promise.Promise} A promise that will resolve to the * scripts return value. */ and this is not Promise. This is Promise. --- angular-protractor/angular-protractor.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-protractor/angular-protractor.d.ts b/angular-protractor/angular-protractor.d.ts index fa2928c136..d33eeddace 100644 --- a/angular-protractor/angular-protractor.d.ts +++ b/angular-protractor/angular-protractor.d.ts @@ -1683,7 +1683,7 @@ declare namespace protractor { * @return {!webdriver.promise.Promise} A promise that will resolve to the * scripts return value. */ - waitForAngular(): webdriver.promise.Promise; + waitForAngular(): webdriver.promise.Promise; /** * Add a module to load before Angular whenever Protractor.get is called. From 3e3e5ac859992208dbe30f0abdbb2d86ccb454b3 Mon Sep 17 00:00:00 2001 From: basvis Date: Mon, 25 Apr 2016 16:44:02 +0200 Subject: [PATCH 43/65] Added isReady and onReady definitions to ITranslateService (#9037) --- angular-translate/angular-translate-tests.ts | 6 +++++- angular-translate/angular-translate.d.ts | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/angular-translate/angular-translate-tests.ts b/angular-translate/angular-translate-tests.ts index 8ef1ab2e39..4aac8b4b34 100644 --- a/angular-translate/angular-translate-tests.ts +++ b/angular-translate/angular-translate-tests.ts @@ -35,7 +35,11 @@ interface Scope extends ng.IScope { app.controller('Ctrl', ($scope: Scope, $translate: angular.translate.ITranslateService) => { $scope['changeLanguage'] = function (key: any) { - $translate.use(key); + $translate.onReady().then(() => { + if($translate.isReady()) { + $translate.use(key); + } + }); }; }).run(($filter: ng.IFilterService) => { var x: string; diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts index 9d9eeb98a1..c4eca39a95 100644 --- a/angular-translate/angular-translate.d.ts +++ b/angular-translate/angular-translate.d.ts @@ -66,6 +66,8 @@ declare namespace angular.translate { useFallbackLanguage(langKey?: string): void; versionInfo(): string; loaderCache(): any; + isReady(): boolean; + onReady(): angular.IPromise; } interface ITranslateProvider extends angular.IServiceProvider { From b97c0d5a222094e965a484606ed03a7e5e844c46 Mon Sep 17 00:00:00 2001 From: Dave Templin Date: Mon, 25 Apr 2016 07:44:19 -0700 Subject: [PATCH 44/65] mongodb.d.ts fixes to enable Promise and async-await (#9064) * mongodb.d.ts fixes to enable Promise and async-await * Update mongodb.d.ts --- mongodb/mongodb.d.ts | 161 +++++++++++++++++++++++++++++++------------ 1 file changed, 116 insertions(+), 45 deletions(-) diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index 6c9f8efe7f..a08251b8ba 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -164,8 +164,8 @@ declare module "mongodb" { // http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#addUser addUser(username: string, password: string, callback: MongoCallback): void; - addUser(username: string, password: string, options?: { w?: number | string, wtimeout?: number, j?: boolean, customData?: Object, roles?: Object[] }): Promise; - addUser(username: string, password: string, options: { w?: number | string, wtimeout?: number, j?: boolean, customData?: Object, roles?: Object[] }, callback: MongoCallback): void; + addUser(username: string, password: string, options?: DbAddUserOptions): Promise; + addUser(username: string, password: string, options: DbAddUserOptions, callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#admin admin(): Admin; // http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#authenticate @@ -184,7 +184,7 @@ declare module "mongodb" { collections(): Promise; collections(callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#command - command(command: Object, callback?: MongoCallback): void; + command(command: Object, callback: MongoCallback): void; command(command: Object, options?: { readPreference: ReadPreference | string }): Promise; command(command: Object, options: { readPreference: ReadPreference | string }, callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#createCollection @@ -199,8 +199,8 @@ declare module "mongodb" { db(dbName: string): Db; db(dbName: string, options: { noListener?: boolean, returnNonCachedInstance?: boolean }): Db; //http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#dropCollection - dropCollection(name: string): Promise; - dropCollection(name: string, callback: MongoCallback): void; + dropCollection(name: string): Promise; + dropCollection(name: string, callback: MongoCallback): void; // http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#dropDatabase dropDatabase(): Promise; dropDatabase(callback: MongoCallback): void; @@ -219,7 +219,7 @@ declare module "mongodb" { indexInformation(name: string, options?: { full?: boolean, readPreference?: ReadPreference | string }): Promise; indexInformation(name: string, options: { full?: boolean, readPreference?: ReadPreference | string }, callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#listCollections - listCollections(filter: Object, options?: { batchSize?: number, readPreference?: ReadPreference | string }): CommandCursor; + listCollections(filter: { name?: string }, options?: { batchSize?: number, readPreference?: ReadPreference | string }): CommandCursor; //http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#logout logout(callback: MongoCallback): void; logout(options?: { dbName?: string }): Promise; @@ -231,7 +231,7 @@ declare module "mongodb" { removeUser(username: string, callback: MongoCallback): void; removeUser(username: string, options?: { w?: number | string, wtimeout?: number, j?: boolean }): Promise; removeUser(username: string, options: { w?: number | string, wtimeout?: number, j?: boolean }, callback: MongoCallback): void; - //http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#renameCollection + // http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#renameCollection renameCollection(fromCollection: string, toCollection: string, callback: MongoCallback): void; renameCollection(fromCollection: string, toCollection: string, options?: { dropTarget?: boolean }): Promise; renameCollection(fromCollection: string, toCollection: string, options: { dropTarget?: boolean }, callback: MongoCallback): void; @@ -241,6 +241,8 @@ declare module "mongodb" { stats(options: { scale?: number }, callback: MongoCallback): void; } + + // Deprecated http://mongodb.github.io/node-mongodb-native/2.1/api/Server.html export class Server extends EventEmitter { constructor(host: string, port: number, options?: ServerOptions); @@ -254,13 +256,22 @@ declare module "mongodb" { connections(): Array; } - + // Deprecated http://mongodb.github.io/node-mongodb-native/2.1/api/ReplSet.html export class Mongos extends EventEmitter { constructor(servers: Array, options?: MongosOptions); connections(): Array; } + + // http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#addUser + export interface DbAddUserOptions { + w?: string | number; + wtimeout?: number; + j?: boolean; + customData?: Object; + roles?: Object[]; + } //http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#createCollection export interface CollectionCreateOptions { @@ -333,42 +344,42 @@ declare module "mongodb" { authenticate(username: string, password: string, callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#buildInfo buildInfo(): Promise; - buildInfo(callback: MongoCallback): void + buildInfo(callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#command command(command: Object, callback: MongoCallback): void; command(command: Object, options?: { readPreference?: ReadPreference | string, maxTimeMS?: number }): Promise; command(command: Object, options: { readPreference?: ReadPreference | string, maxTimeMS?: number }, callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#listDatabases listDatabases(): Promise; - listDatabases(callback: MongoCallback): void + listDatabases(callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#logout logout(): Promise; - logout(callback: MongoCallback): void + logout(callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#ping ping(): Promise; - ping(callback: MongoCallback): void + ping(callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#profilingInfo profilingInfo(): Promise; - profilingInfo(callback: MongoCallback): void + profilingInfo(callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#profilingLevel profilingLevel(): Promise; - profilingLevel(callback: MongoCallback): void + profilingLevel(callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#removeUser removeUser(username: string, callback: MongoCallback): void; removeUser(username: string, options?: FSyncOptions): Promise; removeUser(username: string, options: FSyncOptions, callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#replSetGetStatus replSetGetStatus(): Promise; - replSetGetStatus(callback: MongoCallback): void + replSetGetStatus(callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#serverInfo serverInfo(): Promise; - serverInfo(callback: MongoCallback): void + serverInfo(callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#serverStatus serverStatus(): Promise; - serverStatus(callback: MongoCallback): void + serverStatus(callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#setProfilingLevel setProfilingLevel(level: string): Promise; - setProfilingLevel(level: string, callback: MongoCallback): void + setProfilingLevel(level: string, callback: MongoCallback): void; // http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#validateCollection validateCollection(collectionNme: string, callback: MongoCallback): void; validateCollection(collectionNme: string, options?: Object): Promise; @@ -564,12 +575,12 @@ declare module "mongodb" { // Get current index hint for collection. hint: any; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#aggregate - aggregate(pipeline: Object[], callback: MongoCallback): void | AggregationCursor; - aggregate(pipeline: Object[], options: CollectionAggrigationOptions, callback: MongoCallback): void | AggregationCursor; + aggregate(pipeline: Object[], callback: MongoCallback): AggregationCursor; + aggregate(pipeline: Object[], options?: CollectionAggregationOptions, callback?: MongoCallback): AggregationCursor; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#bulkWrite - bulkWrite(operations: Object[], callback: MongoCallback): void - bulkWrite(operations: Object[], options?: CollectionBluckWriteOptions): Promise - bulkWrite(operations: Object[], options: CollectionBluckWriteOptions, callback: MongoCallback): void + bulkWrite(operations: Object[], callback: MongoCallback): void; + bulkWrite(operations: Object[], options?: CollectionBluckWriteOptions): Promise; + bulkWrite(operations: Object[], options: CollectionBluckWriteOptions, callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#count count(query: Object, callback: MongoCallback): void; count(query: Object, options?: MongoCountPreferences): Promise; @@ -590,9 +601,9 @@ declare module "mongodb" { deleteOne(filter: Object, options?: { w?: number | string, wtimmeout?: number, j?: boolean, bypassDocumentValidation?: boolean }): Promise; deleteOne(filter: Object, options: { w?: number | string, wtimmeout?: number, j?: boolean, bypassDocumentValidation?: boolean }, callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#distinct - distinct(key: string, query: Object, callback: MongoCallback): void + distinct(key: string, query: Object, callback: MongoCallback): void; distinct(key: string, query: Object, options?: { readPreference?: ReadPreference | string }): Promise; - distinct(key: string, query: Object, options: { readPreference?: ReadPreference | string }, callback: MongoCallback): void + distinct(key: string, query: Object, options: { readPreference?: ReadPreference | string }, callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#drop drop(): Promise; drop(callback: MongoCallback): void; @@ -604,7 +615,16 @@ declare module "mongodb" { dropIndexes(): Promise; dropIndexes(callback?: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#find - find(query: Object): Cursor; + find(query?: Object): Cursor; + /** @deprecated */ + find(query: Object, fields?: Object, skip?: number, limit?: number, timeout?: number): Cursor; + //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOne + /** @deprecated use find().limit(1).next(function(err, doc){}) */ + findOne(filter: Object, callback: MongoCallback): void; + /** @deprecated use find().limit(1).next(function(err, doc){}) */ + findOne(filter: Object, options?: FindOneOptions): Promise; + /** @deprecated use find().limit(1).next(function(err, doc){}) */ + findOne(filter: Object, options: FindOneOptions, callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndDelete findOneAndDelete(filter: Object, callback: MongoCallback): void; findOneAndDelete(filter: Object, options?: { projection?: Object, sort?: Object, maxTimeMS?: number }): Promise; @@ -640,17 +660,24 @@ declare module "mongodb" { indexInformation(options?: { full: boolean }): Promise; indexInformation(options: { full: boolean }, callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#initializeOrderedBulkOp - initializeOrderedBulkOp(options: CollectionOptions): OrderedBulkOperation; + initializeOrderedBulkOp(options?: CollectionOptions): OrderedBulkOperation; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#initializeUnorderedBulkOp - initializeUnorderedBulkOp(options: CollectionOptions): UnorderedBulkOperation; - //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#insertMany - insertMany(docs: Object[], callback: MongoCallback): void - insertMany(docs: Object[], options?: CollectionInsertManyOptions): Promise; - insertMany(docs: Object[], options: CollectionInsertManyOptions, callback: MongoCallback): void + initializeUnorderedBulkOp(options?: CollectionOptions): UnorderedBulkOperation; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#insertOne - insertOne(docs: Object, callback: MongoCallback): void + /** @deprecated Use insertOne, insertMany or bulkWrite */ + insert(docs: Object, callback: MongoCallback): void; + /** @deprecated Use insertOne, insertMany or bulkWrite */ + insert(docs: Object, options?: CollectionInsertOneOptions): Promise; + /** @deprecated Use insertOne, insertMany or bulkWrite */ + insert(docs: Object, options: CollectionInsertOneOptions, callback: MongoCallback): void; + //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#insertMany + insertMany(docs: Object[], callback: MongoCallback): void; + insertMany(docs: Object[], options?: CollectionInsertManyOptions): Promise; + insertMany(docs: Object[], options: CollectionInsertManyOptions, callback: MongoCallback): void; + //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#insertOne + insertOne(docs: Object, callback: MongoCallback): void; insertOne(docs: Object, options?: CollectionInsertOneOptions): Promise; - insertOne(docs: Object, options: CollectionInsertOneOptions, callback: MongoCallback): void + insertOne(docs: Object, options: CollectionInsertOneOptions, callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#isCapped isCapped(): Promise; isCapped(callback: MongoCallback): void; @@ -678,10 +705,22 @@ declare module "mongodb" { replaceOne(filter: Object, doc: Object, callback: MongoCallback): void; replaceOne(filter: Object, doc: Object, options?: ReplaceOneOptions): Promise; replaceOne(filter: Object, doc: Object, options: ReplaceOneOptions, callback: MongoCallback): void; + //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#save + /** @deprecated Use insertOne, insertMany, updateOne or updateMany */ + save(doc: Object, callback: MongoCallback): void; + save(doc: Object, options?: CollectionOptions): Promise; + save(doc: Object, options: CollectionOptions, callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#stats stats(callback: MongoCallback): void; stats(options?: { scale: number }): Promise; stats(options: { scale: number }, callback: MongoCallback): void; + // http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#update + /** @deprecated use updateOne, updateMany or bulkWrite */ + update(filter: Object, update: Object, callback: MongoCallback): void; + /** @deprecated use updateOne, updateMany or bulkWrite */ + update(filter: Object, update: Object, options?: ReplaceOneOptions & { multi?: boolean }): Promise; + /** @deprecated use updateOne, updateMany or bulkWrite */ + update(filter: Object, update: Object, options: ReplaceOneOptions & { multi?: boolean }, callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#updateMany updateMany(filter: Object, update: Object, callback: MongoCallback): void; updateMany(filter: Object, update: Object, options?: { upsert?: boolean; w?: any; wtimeout?: number; j?: boolean; }): Promise; @@ -693,6 +732,7 @@ declare module "mongodb" { } // Documentation: http://docs.mongodb.org/manual/reference/command/collStats/ + //TODO complete this export interface CollStats { // Namespace. ns: string; @@ -724,10 +764,11 @@ declare module "mongodb" { maxSize: boolean; wiredTiger: any; indexDetails: any; + ok: number; } //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#aggregate - export interface CollectionAggrigationOptions { + export interface CollectionAggregationOptions { readPreference?: ReadPreference | string; // Return the query as cursor, on 2.6 > it returns as a real cursor // on pre 2.6 it returns as an emulated cursor. @@ -875,7 +916,7 @@ declare module "mongodb" { length: number; //http://mongodb.github.io/node-mongodb-native/2.1/api/OrderedBulkOperation.html#execute execute(callback: MongoCallback): void; - execute(options: FSyncOptions): Promise; + execute(options?: FSyncOptions): Promise; execute(options: FSyncOptions, callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/OrderedBulkOperation.html#find find(selector: Object): FindOperatorsOrdered; @@ -885,7 +926,7 @@ declare module "mongodb" { //http://mongodb.github.io/node-mongodb-native/2.1/api/BulkWriteResult.html export interface BulkWriteResult { - ok: boolean; + ok: number; nInserted: number; nUpdated: number; nUpserted: number; @@ -936,7 +977,7 @@ declare module "mongodb" { export interface UnorderedBulkOperation { //http://mongodb.github.io/node-mongodb-native/2.1/api/UnorderedBulkOperation.html#execute execute(callback: MongoCallback): void; - execute(options: FSyncOptions): Promise; + execute(options?: FSyncOptions): Promise; execute(options: FSyncOptions, callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/UnorderedBulkOperation.html#find find(selector: Object): FindOperatorsUnordered; @@ -955,6 +996,30 @@ declare module "mongodb" { upsert(): FindOperatorsUnordered; } + //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOne + export interface FindOneOptions { + limit?: number, + sort?: Array | Object, + fields?: Object, + skip?: number, + hint?: Object, + explain?: boolean, + snapshot?: boolean, + timeout?: boolean, + tailable?: boolean, + batchSize?: number, + returnKey?: boolean, + maxScan?: number, + min?: number, + max?: number, + showDiskLoc?: boolean, + comment?: string, + raw?: boolean, + readPreference?: ReadPreference | string, + partial?: boolean, + maxTimeMs?: number + } + //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#~insertWriteOpResult export interface InsertWriteOpResult { insertedCount: number; @@ -1031,7 +1096,13 @@ declare module "mongodb" { bypassDocumentValidation?: boolean } - + //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#~WriteOpResult + export interface WriteOpResult { + ops: Array; + connection: any; + result: any; + } + //http://mongodb.github.io/node-mongodb-native/2.1/api/external-Readable.html export interface Readable { pause(): void; @@ -1177,7 +1248,7 @@ declare module "mongodb" { close(): Promise; close(callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#each - each(callback: MongoCallback): void + each(callback: MongoCallback): void; // http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#explain explain(): Promise; explain(callback: MongoCallback): void; @@ -1219,8 +1290,8 @@ declare module "mongodb" { // http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#sort sort(document: Object): AggregationCursor; // http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#toArray - toArray(): Promise; - toArray(callback: MongoCallback): void; + toArray(): Promise; + toArray(callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#unpipe unpipe(destination?: Writable): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#unshift @@ -1241,7 +1312,7 @@ declare module "mongodb" { close(): Promise; close(callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#each - each(callback: MongoCallback): void + each(callback: MongoCallback): void; // http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#isClosed isClosed(): boolean; // http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#maxTimeMS @@ -1264,8 +1335,8 @@ declare module "mongodb" { // http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#setReadPreference setReadPreference(readPreference: string | ReadPreference): CommandCursor; // http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#toArray - toArray(): Promise; - toArray(callback: MongoCallback): void; + toArray(): Promise; + toArray(callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#unpipe unpipe(destination?: Writable): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#unshift From d4c9dc3197a82bd731db8d2dd969af1534c0dc6b Mon Sep 17 00:00:00 2001 From: Klaus Reimer Date: Mon, 25 Apr 2016 16:47:15 +0200 Subject: [PATCH 45/65] Add type definitions for wrap-ansi (https://www.npmjs.com/package/wrap-ansi) (#9090) --- wrap-ansi/wrap-ansi-tests.ts | 8 ++++++++ wrap-ansi/wrap-ansi.d.ts | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 wrap-ansi/wrap-ansi-tests.ts create mode 100644 wrap-ansi/wrap-ansi.d.ts diff --git a/wrap-ansi/wrap-ansi-tests.ts b/wrap-ansi/wrap-ansi-tests.ts new file mode 100644 index 0000000000..8fb08dfd8b --- /dev/null +++ b/wrap-ansi/wrap-ansi-tests.ts @@ -0,0 +1,8 @@ +/// + +import wrapAnsi = require("wrap-ansi"); + +wrapAnsi("input", 80) === "output"; +wrapAnsi("input", 80, {}) === "output"; +wrapAnsi("input", 80, { hard: true }) === "output"; +wrapAnsi("input", 80, { hard: false }) === "output"; diff --git a/wrap-ansi/wrap-ansi.d.ts b/wrap-ansi/wrap-ansi.d.ts new file mode 100644 index 0000000000..79a63abc78 --- /dev/null +++ b/wrap-ansi/wrap-ansi.d.ts @@ -0,0 +1,20 @@ +// Type definitions for wrap-ansi v2.0.0 +// Project: https://www.npmjs.com/package/wrap-ansi +// Definitions by: Klaus Reimer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "wrap-ansi" { + /** + * Wrap words to the specified column width. + * + * @param input String with ANSI escape codes. Like one styled by chalk. + * @param columns Number of columns to wrap the text to. + * @param options By default the wrap is soft, meaning long words may extend past the column width. Setting + * this to true will make it hard wrap at the column width. + */ + function wrapAnsi(input: string, columns: number, options?: { hard?: boolean }): string; + + namespace wrapAnsi {} + + export = wrapAnsi; +} From 66a568104ade0a2359e47f139f387c9fa2cb0870 Mon Sep 17 00:00:00 2001 From: Voislav Date: Mon, 25 Apr 2016 16:48:14 +0200 Subject: [PATCH 46/65] update declarations to latest 2.3.6 version. keep 2.3.1 versions files (#9039) * update declarations to latest 2.3.6 version. keep 2.3.1 versions files * rename 2.3.1 tests file to use propper naming convention --- .../angular-permission-2.3.1-tests.ts | 92 ++++++++++ .../angular-permission-2.3.1.d.ts | 165 ++++++++++++++++++ .../angular-permission-tests.ts | 6 +- angular-permission/angular-permission.d.ts | 20 ++- 4 files changed, 275 insertions(+), 8 deletions(-) create mode 100644 angular-permission/angular-permission-2.3.1-tests.ts create mode 100644 angular-permission/angular-permission-2.3.1.d.ts diff --git a/angular-permission/angular-permission-2.3.1-tests.ts b/angular-permission/angular-permission-2.3.1-tests.ts new file mode 100644 index 0000000000..3753ba9d51 --- /dev/null +++ b/angular-permission/angular-permission-2.3.1-tests.ts @@ -0,0 +1,92 @@ +/// + +import permission = angular.permission; + +angular + .module('fooModule', ['permission', 'user']) + .run(function (PermissionStore: permission.PermissionStore, User: any) { + // Define anonymous permission + PermissionStore + .definePermission('anonymous', function (stateParams) { + // If the returned value is *truthy* then the user has the permission, otherwise they don't + if (!User) { + return true; // Is anonymous + } + return false; + }); + }); + + interface BackendUserService { + checkSession(): angular.IPromise; + getAccessLevel(): angular.IPromise<{accessLevel: string}>; + hasPermissionDefinition(permission: string) : angular.IPromise; + } + + angular.module('barModule', ['permission', 'user']) + .run(function (PermissionStore: permission.PermissionStore, User: BackendUserService, $q: angular.IQService) { + PermissionStore + // Define user permission calling back-end + .definePermission('user', function (stateParams) { + // This time we will return a promise + // If the promise *resolves* then the user has the permission, if it *rejects* (you guessed it) + + // Let's assume this returns a promise that resolves or rejects if session is active + return User.checkSession(); + }); + + PermissionStore + // A different example for admin + .definePermission('admin', function (stateParams) { + var deferred = $q.defer(); + + User.getAccessLevel() + .then(function (data) { + if (data.accessLevel === 'admin') { + deferred.resolve(); + } else { + deferred.reject(); + } + }) + .catch(function () { + // Error with request + deferred.reject(); + }); + + return deferred.promise; + }); + + let arrayOfPermissionNames = ['p1', 'p2']; + PermissionStore.defineManyPermissions(arrayOfPermissionNames, function (stateParams: angular.ui.IStateParamsService, permissionName: string) { + return User.hasPermissionDefinition(permissionName); + }); + + PermissionStore.clearStore(); + + PermissionStore.removePermissionDefinition('user'); + + let permissions: Array = PermissionStore.getStore(); + + + }); + +angular + .module('fooModule', ['permission', 'user']) + .run(function (RoleStore: permission.RoleStore, User: any) { + RoleStore + // Permission array validated role + // Library will internally validate if 'user' and 'editor' permissions are valid when checking if role is valid + .defineRole('admin', ['user', 'editor']); + + RoleStore + // Server side validated role + .defineRole('accountant', [], function (stateParams) { + // Let's assume that we are making a request to server here and return response as promise + return User.hasRole('accountant'); + }); + + RoleStore.clearStore(); + + RoleStore.removeRoleDefinition('user'); + + let roles: Array = RoleStore.getStore(); + }); diff --git a/angular-permission/angular-permission-2.3.1.d.ts b/angular-permission/angular-permission-2.3.1.d.ts new file mode 100644 index 0000000000..afe32ce875 --- /dev/null +++ b/angular-permission/angular-permission-2.3.1.d.ts @@ -0,0 +1,165 @@ +// Type definitions for angular-permission 2.3.1 +// Project: https://github.com/Narzerus/angular-permission +// Definitions by: Voislav Mishevski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + +declare namespace angular.permission { + + export interface PermissionStore { + /** + * Allows to define permission on application configuration + * @method + * + * @param permissionName {String} Name of defined permission + * @param validationFunction {Function} Function used to validate if permission is valid + */ + definePermission( + name: string, + validationFunction: (stateParams?: angular.ui.IStateParamsService, permission?: string) => boolean | angular.IPromise + ): void; + + /** + * Allows to define set of permissionNames with shared validation function on application configuration + * @method + * @throws {TypeError} + * + * @param permissionNames {Array} Set of permission names + * @param validationFunction {Function} Function used to validate if permission is valid + */ + defineManyPermissions( + permissions: string[], + validationFunction: (stateParams?: angular.ui.IStateParamsService, permission?: string) => boolean | angular.IPromise + ): void; + + clearStore(): void; + + /** + * Deletes permission + * @method + * + * @param permissionName {String} Name of defined permission + */ + removePermissionDefinition(permission: string): void; + + /** + * Checks if permission exists + * @method + * + * @param permissionName {String} Name of defined permission + * @returns {Boolean} + */ + hasPermissionDefinition(permissionName: string): boolean; + + /** + * Returns all permissions + * @method + * + * @returns {Object} Permissions collection + */ + getStore(): Permission[]; + } + + export interface RoleStore { + /** + * Allows to define role + * @method + * + * @param roleName {String} Name of defined role + * @param permissions {Array} Set of permission names + * @param [validationFunction] {Function} Function used to validate if permissions in role are valid + */ + defineRole( + role: string, + permissions: Array, + validationFunction: RoleValidationFunction + ): void; + + /** + * Allows to define role + * @method + * + * @param roleName {String} Name of defined role + * @param permissions {Array} Set of permission names + */ + defineRole(role: string, permissions: Array): void; + + /** + * Checks if role is defined in store + * @method + * + * @param roleName {String} Name of role + * @returns {Boolean} + */ + hasRoleDefinition(role: string): boolean; + + /** + * Returns role definition object by it's name + * @method + * + * @returns {permission.Role} Role definition object + */ + getRoleDefinition(roleName: string): Role; + + /** + * Removes all role definitions + * @method + */ + clearStore(): void; + + /** + * Deletes role from store + * @method + * + * @param roleName {String} Name of defined permission + */ + removeRoleDefinition(roleName: string): void; + + /** + * Returns all role definitions + * @method + * + * @returns {Object} Defined roles collection + */ + getStore(): Role[]; + } + + export interface Role { + roleName: string; + permissionNames: string[]; + validationFunction?: RoleValidationFunction; + } + + export interface Permission { + permissionName: string; + validationFunction?: PermissionValidationFunction; + } + + interface RoleValidationFunction { + (stateParams?: angular.ui.IStateParamsService, permission?: string): boolean | angular.IPromise; + } + + interface PermissionValidationFunction { + (stateParams?: angular.ui.IStateParamsService, permission?: string): boolean | angular.IPromise; + } + + export interface IPermissionState extends angular.ui.IState { + data?: any | DataWithPermissions; + } + + export interface DataWithPermissions { + permissions?: { + only?: (() => void) | Array | angular.IPromise; + except?: (() => void) | Array | angular.IPromise; + redirectTo: string | (() => string) | (() => PermissionRedirectConfigation) | {[index: string]: PermissionRedirectConfigation} + }; + } + + export interface PermissionRedirectConfigation { + state: string; + params?: {}; + options?: angular.ui.IStateOptions; + } +} diff --git a/angular-permission/angular-permission-tests.ts b/angular-permission/angular-permission-tests.ts index 206850ad70..cc9cd7c367 100644 --- a/angular-permission/angular-permission-tests.ts +++ b/angular-permission/angular-permission-tests.ts @@ -36,7 +36,7 @@ angular PermissionStore // A different example for admin - .definePermission('admin', function (stateParams) { + .definePermission('admin', function (permission: string, stateParams: angular.permission.TransitionProperties) { var deferred = $q.defer(); User.getAccessLevel() @@ -56,7 +56,7 @@ angular }); let arrayOfPermissionNames = ['p1', 'p2']; - PermissionStore.defineManyPermissions(arrayOfPermissionNames, function (stateParams: angular.ui.IStateParamsService, permissionName: string) { + PermissionStore.defineManyPermissions(arrayOfPermissionNames, function (permissionName: string, stateParams: angular.permission.TransitionProperties) { return User.hasPermissionDefinition(permissionName); }); @@ -79,7 +79,7 @@ angular RoleStore // Server side validated role - .defineRole('accountant', [], function (stateParams) { + .defineRole('accountant', [], function (permission, stateParams) { // Let's assume that we are making a request to server here and return response as promise return User.hasRole('accountant'); }); diff --git a/angular-permission/angular-permission.d.ts b/angular-permission/angular-permission.d.ts index afe32ce875..fecbafb29b 100644 --- a/angular-permission/angular-permission.d.ts +++ b/angular-permission/angular-permission.d.ts @@ -1,4 +1,4 @@ -// Type definitions for angular-permission 2.3.1 +// Type definitions for angular-permission 2.3.6 // Project: https://github.com/Narzerus/angular-permission // Definitions by: Voislav Mishevski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -7,6 +7,16 @@ /// declare namespace angular.permission { + /** + * Used as optional parameter provided on definitions of permissions and roles + */ + export interface TransitionProperties { + fromState?: angular.ui.IState; + fromParams?: angular.ui.IStateParamsService; + toState?: angular.ui.IState; + toParams?: angular.ui.IStateParamsService; + options?: angular.ui.IStateOptions; + } export interface PermissionStore { /** @@ -18,7 +28,7 @@ declare namespace angular.permission { */ definePermission( name: string, - validationFunction: (stateParams?: angular.ui.IStateParamsService, permission?: string) => boolean | angular.IPromise + validationFunction: (permission?: string, transitionProperties?: TransitionProperties) => boolean | angular.IPromise ): void; /** @@ -31,7 +41,7 @@ declare namespace angular.permission { */ defineManyPermissions( permissions: string[], - validationFunction: (stateParams?: angular.ui.IStateParamsService, permission?: string) => boolean | angular.IPromise + validationFunction: (permission?: string, transitionProperties?: TransitionProperties) => boolean | angular.IPromise ): void; clearStore(): void; @@ -138,11 +148,11 @@ declare namespace angular.permission { } interface RoleValidationFunction { - (stateParams?: angular.ui.IStateParamsService, permission?: string): boolean | angular.IPromise; + (permission?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise; } interface PermissionValidationFunction { - (stateParams?: angular.ui.IStateParamsService, permission?: string): boolean | angular.IPromise; + (permission?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise; } export interface IPermissionState extends angular.ui.IState { From 1dc239e241cf7f3ceba0c83ded52c11f9d792b32 Mon Sep 17 00:00:00 2001 From: Gergely Sipos Date: Mon, 25 Apr 2016 16:48:47 +0200 Subject: [PATCH 47/65] Highland: fix for HighlandStatic generics (#9091) _(Promise) should return Highland.Stream and _(Promise --- highland/highland-tests.ts | 4 +++- highland/highland.d.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/highland/highland-tests.ts b/highland/highland-tests.ts index c7e213aa17..7a67670edd 100644 --- a/highland/highland-tests.ts +++ b/highland/highland-tests.ts @@ -137,7 +137,9 @@ fooStream = _(readable); fooStream = _(emitter); fooStream = _(fooStreamThen); -fooStream = _(fooArrThen); +fooStream = _(fooThen); + +fooArrStream = _(fooArrThen); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/highland/highland.d.ts b/highland/highland.d.ts index 8becaf2762..f3617ccd14 100644 --- a/highland/highland.d.ts +++ b/highland/highland.d.ts @@ -67,7 +67,7 @@ interface HighlandStatic { // moar (promise for everything?) (xs: Highland.Thenable>): Highland.Stream; - (xs: Highland.Thenable): Highland.Stream; + (xs: Highland.Thenable): Highland.Stream; /** * The end of stream marker. This is sent along the data channel of a Stream From 42e2274e9b5dc51598e2a7371c25a46bc31620b9 Mon Sep 17 00:00:00 2001 From: Howard Yeh Date: Mon, 25 Apr 2016 07:50:02 -0700 Subject: [PATCH 48/65] react-native specialized Component class (#9060) * react-native specialized Component class * react-native native component methods * react-native move global static outwards * react-native fix typedef bugs --- react-native/react-native-tests.tsx | 10 +- react-native/react-native.d.ts | 138 +++++++++++++++++++++++----- 2 files changed, 124 insertions(+), 24 deletions(-) diff --git a/react-native/react-native-tests.tsx b/react-native/react-native-tests.tsx index 8bed3c8be3..00f4be76d8 100644 --- a/react-native/react-native-tests.tsx +++ b/react-native/react-native-tests.tsx @@ -72,11 +72,19 @@ var styles = StyleSheet.create( class Welcome extends React.Component { + testNativeMethods() { + this.setNativeProps({}); + + const { rootView } = this.refs; + + rootView.measure((x, y, width, height) => { + }); + } render() { return ( - + Welcome to React Native diff --git a/react-native/react-native.d.ts b/react-native/react-native.d.ts index a6cab25ff0..824fad6f77 100644 --- a/react-native/react-native.d.ts +++ b/react-native/react-native.d.ts @@ -22,7 +22,7 @@ import React = __React; //react-native "extends" react -declare namespace __React { +declare module "react-native" { /** @@ -121,6 +121,109 @@ declare namespace __React { // @see lib.es6.d.ts export var Promise: PromiseConstructor; + module NativeMethodsMixin { + type MeasureOnSuccessCallback = ( + x: number, + y: number, + width: number, + height: number, + pageX: number, + pageY: number + ) => void + + type MeasureInWindowOnSuccessCallback = ( + x: number, + y: number, + width: number, + height: number + ) => void + + type MeasureLayoutOnSuccessCallback = ( + left: number, + top: number, + width: number, + height: number + ) => void + } + + /** + * @see https://github.com/facebook/react-native/blob/master/Libraries/ReactIOS/NativeMethodsMixin.js + */ + export class Component extends React.Component { + /** + * Determines the location on screen, width, and height of the given view and + * returns the values via an async callback. If successful, the callback will + * be called with the following arguments: + * + * - x + * - y + * - width + * - height + * - pageX + * - pageY + * + * Note that these measurements are not available until after the rendering + * has been completed in native. If you need the measurements as soon as + * possible, consider using the [`onLayout` + * prop](docs/view.html#onlayout) instead. + */ + measure(callback: NativeMethodsMixin.MeasureOnSuccessCallback): void; + + /** + * Determines the location of the given view in the window and returns the + * values via an async callback. If the React root view is embedded in + * another native view, this will give you the absolute coordinates. If + * successful, the callback will be called with the following + * arguments: + * + * - x + * - y + * - width + * - height + * + * Note that these measurements are not available until after the rendering + * has been completed in native. + */ + measureInWindow(callback: NativeMethodsMixin.MeasureInWindowOnSuccessCallback): void; + + /** + * Like [`measure()`](#measure), but measures the view relative an ancestor, + * specified as `relativeToNativeNode`. This means that the returned x, y + * are relative to the origin x, y of the ancestor view. + * + * As always, to obtain a native node handle for a component, you can use + * `React.findNodeHandle(component)`. + */ + measureLayout( + relativeToNativeNode: number, + onSuccess: NativeMethodsMixin.MeasureLayoutOnSuccessCallback, + onFail: () => void /* currently unused */ + ): void; + + /** + * This function sends props straight to native. They will not participate in + * future diff process - this means that if you do not include them in the + * next render, they will remain active (see [Direct + * Manipulation](docs/direct-manipulation.html)). + */ + setNativeProps(nativeProps: Object): void; + + /** + * Requests focus for the given input or view. The exact behavior triggered + * will depend on the platform and type of view. + */ + focus(): void; + + /** + * Removes focus from an input or view. This is the opposite of `focus()`. + */ + blur(): void; + + refs: { + [key: string]: Component + }; + } + //TODO: BGR: Replace with ComponentClass ? // node_modules/react-tools/src/classic/class/ReactClass.js export interface ReactClass { @@ -219,7 +322,6 @@ declare namespace __React { * //FIXME: need to find documentation on which compoenent is a native (i.e. non composite component) */ export interface NativeComponent { - setNativeProps: ( props: Object ) => void } /** @@ -2080,7 +2182,7 @@ declare namespace __React { } export interface Route { - component?: ComponentClass + component?: React.ComponentClass id?: string title?: string passProps?: Object; @@ -3489,19 +3591,6 @@ declare namespace __React { export function __spread( target: any, ...sources: any[] ): any; - - export interface GlobalStatic { - - /** - * Accepts a function as its only argument and calls that function before the next repaint. - * It is an essential building block for animations that underlies all of the JavaScript-based animation APIs. - * In general, you shouldn't need to call this yourself - the animation API's will manage frame updates for you. - * @see https://facebook.github.io/react-native/docs/animations.html#requestanimationframe - */ - requestAnimationFrame( fn: () => void ) : void; - - } - // // Add-Ons // @@ -3518,16 +3607,19 @@ declare namespace __React { export var TestModule: TestModuleStatic export type TestModule = TestModuleStatic } - - } -declare module "react-native" { - - import ReactNative = __React - export = ReactNative +declare interface ReactNativeGlobalStatic { + /** + * Accepts a function as its only argument and calls that function before the next repaint. + * It is an essential building block for animations that underlies all of the JavaScript-based animation APIs. + * In general, you shouldn't need to call this yourself - the animation API's will manage frame updates for you. + * @see https://facebook.github.io/react-native/docs/animations.html#requestanimationframe + */ + requestAnimationFrame( fn: () => void ) : void; } -declare var global: __React.GlobalStatic + +declare var global: ReactNativeGlobalStatic; declare function require( name: string ): any \ No newline at end of file From 55b227930cdb7a362b9022082e00954f57bd787d Mon Sep 17 00:00:00 2001 From: Andrew Date: Mon, 25 Apr 2016 18:54:06 +0400 Subject: [PATCH 49/65] Master (#9078) * Create dts for surveyjs surveyjs is origionally written on TypeScript * Fix The Travis CI build * Fix The Travis CI build * Fix The Travis CI build * Rename survey.d.ts to survey-knockout.d.ts --- survey-knockout/survey-knockout-tests.ts | 22 + survey-knockout/survey-knockout.d.ts | 1087 ++++++++++++++++++++++ 2 files changed, 1109 insertions(+) create mode 100644 survey-knockout/survey-knockout-tests.ts create mode 100644 survey-knockout/survey-knockout.d.ts diff --git a/survey-knockout/survey-knockout-tests.ts b/survey-knockout/survey-knockout-tests.ts new file mode 100644 index 0000000000..4d45d371c7 --- /dev/null +++ b/survey-knockout/survey-knockout-tests.ts @@ -0,0 +1,22 @@ +/// + +function createFromCodeTests() { + var survey = new Survey.SurveyModel(); + var page = survey.addNewPage("Page 1"); + page.addNewQuestion("text", "question1"); + page.addNewQuestion("comment", "question2"); + page = survey.addNewPage("Page 2"); + page.addNewQuestion("matrix", "question3"); + page.addNewQuestion("matrixdropdown", "question4"); + return survey; +} +function createFromJSONTests() { + var survey = new Survey.SurveyModel({ + pages: [{ + "name": "page1", + "questions": [{ "type": "text", "name": "textQuestion", "isRequired": "true" }, { "type": "checkbox", "name": "checkboxQuestion", "isRequired": "true", "choices": ["red", "white"] }] + }] + }); + survey.setValue("textQuestion", "newValue"); + return survey; +} diff --git a/survey-knockout/survey-knockout.d.ts b/survey-knockout/survey-knockout.d.ts new file mode 100644 index 0000000000..e5e26e23b8 --- /dev/null +++ b/survey-knockout/survey-knockout.d.ts @@ -0,0 +1,1087 @@ +// Type definitions for Survey JavaScript library v0.9.3 +// Project: http://surveyjs.org/ +// Definitions by: Andrew Telnov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module Survey { + interface HashTable { + [key: string]: T; + } + interface ISurvey { + getValue(name: string): any; + setValue(name: string, newValue: any): any; + getComment(name: string): string; + setComment(name: string, newValue: string): any; + pageVisibilityChanged(page: IPage, newValue: boolean): any; + questionVisibilityChanged(question: IQuestion, newValue: boolean): any; + questionAdded(question: IQuestion, index: number): any; + questionRemoved(question: IQuestion): any; + validateQuestion(name: string): SurveyError; + isDesignMode: boolean; + } + interface IQuestion { + name: string; + visible: boolean; + hasTitle: boolean; + setVisibleIndex(value: number): any; + onSurveyValueChanged(newValue: any): any; + } + interface IPage { + visible: boolean; + } + class ItemValue { + static Separator: string; + static setData(items: Array, values: Array): void; + static getData(items: Array): any; + private itemValue; + private itemText; + constructor(value: any, text?: string); + getType(): string; + value: any; + hasText: boolean; + text: string; + } + class Base { + getType(): string; + } + class SurveyError { + getText(): string; + } + class Event { + private callbacks; + isEmpty: boolean; + fire(sender: any, options: Options): void; + add(func: T): void; + remove(func: T): void; + } +} + +declare module Survey { + class dxSurveyService { + static serviceUrl: string; + constructor(); + loadSurvey(surveyId: string, onLoad: (success: boolean, result: string, response: any) => void): void; + sendResult(postId: string, result: JSON, onSendResult: (success: boolean, response: any) => void, clientId?: string, isPartialCompleted?: boolean): void; + getResult(resultId: string, name: string, onGetResult: (success: boolean, data: any, dataList: Array, response: any) => void): void; + isCompleted(resultId: string, clientId: string, onIsCompleted: (success: boolean, result: string, response: any) => void): void; + } +} + +declare module Survey { + var surveyLocalization: { + currentLocale: string; + locales: {}; + getString: (strName: string) => any; + getLocales: () => string[]; + }; + var surveyStrings: { + pagePrevText: string; + pageNextText: string; + completeText: string; + otherItemText: string; + progressText: string; + optionsCaption: string; + requiredError: string; + numericError: string; + textMinLength: string; + minSelectError: string; + maxSelectError: string; + numericMinMax: string; + numericMin: string; + numericMax: string; + invalidEmail: string; + }; +} + +/// +/// +declare module Survey { + class AnswerRequiredError extends SurveyError { + constructor(); + getText(): string; + } + class RequreNumericError extends SurveyError { + constructor(); + getText(): string; + } + class CustomError extends SurveyError { + private text; + constructor(text: string); + getText(): string; + } +} + +/// +declare module Survey { + class JsonObjectProperty { + name: string; + private typeValue; + private choicesValue; + private choicesfunc; + className: string; + classNamePart: string; + baseClassName: string; + defaultValue: any; + onGetValue: (obj: any) => any; + onSetValue: (obj: any, value: any, jsonConv: JsonObject) => any; + constructor(name: string); + type: string; + hasToUseGetValue: (obj: any) => any; + isDefaultValue(value: any): boolean; + getValue(obj: any): any; + hasToUseSetValue: (obj: any, value: any, jsonConv: JsonObject) => any; + setValue(obj: any, value: any, jsonConv: JsonObject): void; + getObjType(objType: string): string; + getClassName(className: string): string; + choices: Array; + setChoices(value: Array, valueFunc: () => Array): void; + } + class JsonMetadataClass { + name: string; + creator: () => any; + parentName: string; + static requiredSymbol: string; + static typeSymbol: string; + properties: Array; + requiredProperties: Array; + constructor(name: string, propertiesNames: Array, creator?: () => any, parentName?: string); + find(name: string): JsonObjectProperty; + private getPropertyName(propertyName); + } + class JsonMetadata { + private classes; + private childrenClasses; + private classProperties; + private classRequiredProperties; + addClass(name: string, propertiesNames: Array, creator?: () => any, parentName?: string): JsonMetadataClass; + overrideClassCreatore(name: string, creator: () => any): void; + setPropertyValues(name: string, propertyName: string, propertyClassName: string, defaultValue?: any, onGetValue?: (obj: any) => any, onSetValue?: (obj: any, value: any, jsonConv: JsonObject) => any): void; + setPropertyChoices(name: string, propertyName: string, choices: Array, choicesFunc?: () => Array): void; + setPropertyClassInfo(name: string, propertyName: string, baseClassName: string, classNamePart?: string): void; + getProperties(name: string): Array; + createClass(name: string): any; + getChildrenClasses(name: string, canBeCreated?: boolean): Array; + getRequiredProperties(name: string): Array; + private fillChildrenClasses(name, canBeCreated, result); + private findClass(name); + private findProperty(name, propertyName); + private fillProperties(name, list); + private addProperty(property, list, endIndex); + private fillRequiredProperties(name, list); + } + class JsonError { + type: string; + message: string; + description: string; + at: Number; + constructor(type: string, message: string); + getFullDescription(): string; + } + class JsonUnknownPropertyError extends JsonError { + propertyName: string; + className: string; + constructor(propertyName: string, className: string); + } + class JsonMissingTypeErrorBase extends JsonError { + baseClassName: string; + type: string; + message: string; + constructor(baseClassName: string, type: string, message: string); + } + class JsonMissingTypeError extends JsonMissingTypeErrorBase { + propertyName: string; + baseClassName: string; + constructor(propertyName: string, baseClassName: string); + } + class JsonIncorrectTypeError extends JsonMissingTypeErrorBase { + propertyName: string; + baseClassName: string; + constructor(propertyName: string, baseClassName: string); + } + class JsonRequiredPropertyError extends JsonError { + propertyName: string; + className: string; + constructor(propertyName: string, className: string); + } + class JsonObject { + private static typePropertyName; + private static positionPropertyName; + private static metaDataValue; + static metaData: JsonMetadata; + errors: JsonError[]; + toJsonObject(obj: any): any; + toObject(jsonObj: any, obj: any): void; + protected toJsonObjectCore(obj: any, property: JsonObjectProperty): any; + protected valueToJson(obj: any, result: any, property: JsonObjectProperty): void; + protected valueToObj(value: any, obj: any, key: any, property: JsonObjectProperty): void; + private isValueArray(value); + private createNewObj(value, property); + private checkNewObjectOnErrors(newObj, value, property, className); + private addNewError(error, jsonObj); + private valueToArray(value, obj, key, property); + private findProperty(properties, key); + } +} + +/// +/// +declare module Survey { + class QuestionBase extends Base implements IQuestion { + name: string; + protected data: ISurvey; + private visibleValue; + private visibleIndexValue; + width: string; + visibilityChangedCallback: () => void; + visibleIndexChangedCallback: () => void; + constructor(name: string); + visible: boolean; + visibleIndex: number; + hasErrors(): boolean; + hasTitle: boolean; + hasComment: boolean; + setData(newValue: ISurvey): void; + protected fireCallback(callback: () => void): void; + protected onSetData(): void; + protected onCreating(): void; + onSurveyValueChanged(newValue: any): void; + setVisibleIndex(value: number): void; + } +} + +/// +/// +declare module Survey { + class QuestionFactory { + static Instance: QuestionFactory; + static DefaultChoices: (string | { + value: number; + text: string; + })[]; + private creatorHash; + registerQuestion(questionType: string, questionCreator: (name: string) => QuestionBase): void; + getAllTypes(): Array; + createQuestion(questionType: string, name: string): QuestionBase; + } +} + +/// +/// +/// +declare module Survey { + class PageModel extends Base implements IPage { + name: string; + questions: Array; + data: ISurvey; + title: string; + visibleIndex: number; + private numValue; + private visibleValue; + constructor(name?: string); + num: number; + visible: boolean; + getType(): string; + isVisible: boolean; + addQuestion(question: QuestionBase, index?: number): void; + addNewQuestion(questionType: string, name: string): QuestionBase; + removeQuestion(question: QuestionBase): void; + hasErrors(): boolean; + addQuestionsToList(list: Array, visibleOnly?: boolean): void; + protected onNumChanged(value: number): void; + } +} + +/// +/// +/// +declare module Survey { + class ValidatorResult { + value: any; + error: SurveyError; + constructor(value: any, error?: SurveyError); + } + class SurveyValidator extends Base { + text: string; + constructor(); + protected getErrorText(name: string): string; + protected getDefaultErrorText(name: string): string; + validate(value: any, name?: string): ValidatorResult; + } + interface IValidatorOwner { + validators: Array; + value: any; + getValidatorTitle(): string; + } + class ValidatorRunner { + run(owner: IValidatorOwner): SurveyError; + } + class NumericValidator extends SurveyValidator { + minValue: number; + maxValue: number; + constructor(minValue?: number, maxValue?: number); + getType(): string; + validate(value: any, name?: string): ValidatorResult; + protected getDefaultErrorText(name: string): any; + private isNumber(value); + } + class TextValidator extends SurveyValidator { + minLength: number; + constructor(minLength?: number); + getType(): string; + validate(value: any, name?: string): ValidatorResult; + protected getDefaultErrorText(name: string): any; + } + class AnswerCountValidator extends SurveyValidator { + minCount: number; + maxCount: number; + constructor(minCount?: number, maxCount?: number); + getType(): string; + validate(value: any, name?: string): ValidatorResult; + protected getDefaultErrorText(name: string): string; + } + class RegexValidator extends SurveyValidator { + regex: string; + constructor(regex?: string); + getType(): string; + validate(value: any, name?: string): ValidatorResult; + } + class EmailValidator extends SurveyValidator { + private re; + constructor(); + getType(): string; + validate(value: any, name?: string): ValidatorResult; + protected getDefaultErrorText(name: string): any; + } +} + +/// +/// +/// +/// +/// +declare module Survey { + class Question extends QuestionBase implements IValidatorOwner { + name: string; + private titleValue; + private questionValue; + private isRequiredValue; + private hasCommentValue; + private hasOtherValue; + errors: Array; + validators: Array; + valueChangedCallback: () => void; + commentChangedCallback: () => void; + errorsChangedCallback: () => void; + constructor(name: string); + hasTitle: boolean; + title: string; + supportComment(): boolean; + supportOther(): boolean; + isRequired: boolean; + hasComment: boolean; + hasOther: boolean; + protected onSetData(): void; + value: any; + comment: string; + isEmpty(): boolean; + hasErrors(): boolean; + private checkForErrors(); + protected onCheckForErrors(errors: Array): void; + protected runValidators(): SurveyError; + private isValueChangedInSurvey; + protected setNewValue(newValue: any): void; + protected onValueChanged(): void; + private setNewComment(newValue); + onSurveyValueChanged(newValue: any): void; + getValidatorTitle(): string; + } +} + +/// +/// +declare module Survey { + class QuestionSelectBase extends Question { + otherItem: ItemValue; + choicesValues: Array; + otherErrorText: string; + choicesOrderValue: string; + constructor(name: string); + isOtherSelected: boolean; + choices: Array; + choicesOrder: string; + otherText: string; + visibleChoices: Array; + supportComment(): boolean; + supportOther(): boolean; + protected onCheckForErrors(errors: Array): void; + sortVisibleChoices(array: Array): Array; + sortArray(array: Array, mult: number): Array; + randomizeArray(array: Array): Array; + } + class QuestionCheckboxBase extends QuestionSelectBase { + name: string; + private colCountValue; + colCountChangedCallback: () => void; + constructor(name: string); + colCount: number; + } +} + +/// +/// +declare module Survey { + class QuestionCheckboxModel extends QuestionCheckboxBase { + name: string; + constructor(name: string); + isOtherSelected: boolean; + getType(): string; + } +} + +/// +/// +declare module Survey { + class QuestionCommentModel extends Question { + name: string; + rows: number; + cols: number; + constructor(name: string); + getType(): string; + isEmpty(): boolean; + } +} + +/// +/// +declare module Survey { + class QuestionDropdownModel extends QuestionSelectBase { + name: string; + private optionsCaptionValue; + constructor(name: string); + optionsCaption: string; + getType(): string; + } +} + +/// +/// +declare module Survey { + class QuestionHtmlModel extends QuestionBase { + name: string; + private htmlValue; + constructor(name: string); + getType(): string; + html: string; + } +} + +/// +/// +declare module Survey { + interface IMatrixData { + onMatrixRowChanged(row: MatrixRowModel): any; + } + class MatrixRowModel extends Base { + name: any; + text: string; + fullName: string; + private data; + protected rowValue: any; + constructor(name: any, text: string, fullName: string, data: IMatrixData, value: any); + value: any; + protected onValueChanged(): void; + } + class QuestionMatrixModel extends Question implements IMatrixData { + name: string; + private columnsValue; + private rowsValue; + private isRowChanging; + private generatedVisibleRows; + constructor(name: string); + getType(): string; + hasRows: boolean; + columns: Array; + rows: Array; + visibleRows: Array; + protected createMatrixRow(name: any, text: string, fullName: string, value: any): MatrixRowModel; + protected onValueChanged(): void; + onMatrixRowChanged(row: MatrixRowModel): void; + } +} + +/// +/// +declare module Survey { + interface IMatrixDropdownData { + onCellChanged(cell: MatrixDropdownCellModel): any; + columns: Array; + choices: Array; + optionsCaption: string; + } + class MatrixDropdownColumn extends Base { + name: string; + private choicesValue; + private titleValue; + optionsCaption: string; + constructor(name: string, title?: string); + getType(): string; + title: string; + choices: Array; + } + class MatrixDropdownCellModel { + column: MatrixDropdownColumn; + row: MatrixDropdownRowModel; + private data; + private cellValue; + constructor(column: MatrixDropdownColumn, row: MatrixDropdownRowModel, data: IMatrixDropdownData, value: any); + choices: Array; + optionsCaption: string; + value: any; + protected onValueChanged(): void; + } + class MatrixDropdownRowModel { + name: any; + text: string; + protected data: IMatrixDropdownData; + protected rowValue: any; + cells: Array; + constructor(name: any, text: string, data: IMatrixDropdownData, value: any); + value: any; + private buildCells(); + protected createCell(column: MatrixDropdownColumn, value: any): MatrixDropdownCellModel; + protected getCellValue(column: MatrixDropdownColumn): any; + } + class QuestionMatrixDropdownModel extends Question implements IMatrixDropdownData { + name: string; + private columnsValue; + private rowsValue; + private choicesValue; + private optionsCaptionValue; + private isRowChanging; + private generatedVisibleRows; + constructor(name: string); + getType(): string; + columns: Array; + rows: Array; + choices: Array; + optionsCaption: string; + addColumn(name: string, title?: string): MatrixDropdownColumn; + visibleRows: Array; + protected createMatrixRow(name: any, text: string, value: any): MatrixDropdownRowModel; + protected onValueChanged(): void; + onCellChanged(cell: MatrixDropdownCellModel): void; + } +} + +/// +/// +declare module Survey { + interface IMultipleTextData { + getMultipleTextValue(name: string): any; + setMultipleTextValue(name: string, value: any): any; + } + class MultipleTextItemModel extends Base implements IValidatorOwner { + name: any; + private data; + private titleValue; + validators: Array; + constructor(name?: any, title?: string); + getType(): string; + setData(data: IMultipleTextData): void; + title: string; + value: any; + onValueChanged(newValue: any): void; + getValidatorTitle(): string; + } + class QuestionMultipleTextModel extends Question implements IMultipleTextData { + name: string; + itemSize: number; + items: Array; + constructor(name: string); + getType(): string; + AddItem(name: string, title?: string): MultipleTextItemModel; + private isMultipleItemValueChanging; + protected onValueChanged(): void; + protected createTextItem(name: string, title: string): MultipleTextItemModel; + protected onItemValueChanged(): void; + protected runValidators(): SurveyError; + getMultipleTextValue(name: string): any; + setMultipleTextValue(name: string, value: any): void; + } +} + +/// +/// +declare module Survey { + class QuestionRadiogroupModel extends QuestionCheckboxBase { + name: string; + constructor(name: string); + getType(): string; + } +} + +/// +/// +declare module Survey { + class QuestionRatingModel extends Question { + name: string; + static defaultRateValues: ItemValue[]; + private rates; + mininumRateDescription: string; + maximumRateDescription: string; + rateValuesChangedCallback: () => void; + constructor(name: string); + rateValues: Array; + visibleRateValues: ItemValue[]; + getType(): string; + supportComment(): boolean; + supportOther(): boolean; + } +} + +/// +/// +declare module Survey { + class QuestionTextModel extends Question { + name: string; + size: number; + constructor(name: string); + getType(): string; + isEmpty(): boolean; + } +} + +/// +/// +declare module Survey { + class Trigger extends Base { + static operatorsValue: HashTable; + static operators: HashTable; + private opValue; + value: any; + constructor(); + operator: string; + check(value: any): void; + protected onSuccess(): void; + protected onFailure(): void; + } + interface ISurveyTriggerOwner { + getObjects(pages: string[], questions: string[]): any[]; + } + class SurveyTrigger extends Trigger { + name: string; + pages: string[]; + questions: string[]; + private owner; + constructor(); + setOwner(owner: ISurveyTriggerOwner): void; + protected onSuccess(): void; + protected onFailure(): void; + onTrigger(func: Function): void; + protected onItemSuccess(item: any): void; + protected onItemFailure(item: any): void; + } + class SurveyTriggerVisible extends SurveyTrigger { + constructor(); + getType(): string; + protected onItemSuccess(item: any): void; + protected onItemFailure(item: any): void; + } +} + +/// +/// +/// +/// +/// +declare module Survey { + class SurveyModel extends Base implements ISurvey, ISurveyTriggerOwner { + surveyId: string; + surveyPostId: string; + clientId: string; + sendResultOnPageNext: boolean; + commentPrefix: string; + title: string; + showNavigationButtons: boolean; + showTitle: boolean; + showPageTitles: boolean; + requiredText: string; + showProgressBar: string; + pages: Array; + triggers: Array; + private currentPageValue; + private valuesHash; + private pagePrevTextValue; + private pageNextTextValue; + private completeTextValue; + private showPageNumbersValue; + private showQuestionNumbersValue; + private localeValue; + onComplete: Event<(sender: SurveyModel) => any, any>; + onCurrentPageChanged: Event<(sender: SurveyModel, options: any) => any, any>; + onValueChanged: Event<(sender: SurveyModel, options: any) => any, any>; + onVisibleChanged: Event<(sender: SurveyModel, options: any) => any, any>; + onPageVisibleChanged: Event<(sender: SurveyModel, options: any) => any, any>; + onQuestionAdded: Event<(sender: SurveyModel, options: any) => any, any>; + onQuestionRemoved: Event<(sender: SurveyModel, options: any) => any, any>; + onValidateQuestion: Event<(sender: SurveyModel, options: any) => any, any>; + onSendResult: Event<(sender: SurveyModel, options: any) => any, any>; + onGetResult: Event<(sender: SurveyModel, options: any) => any, any>; + jsonErrors: Array; + mode: string; + constructor(jsonObj?: any, renderedElement?: any); + getType(): string; + locale: string; + pagePrevText: string; + pageNextText: string; + completeText: string; + showPageNumbers: boolean; + showQuestionNumbers: string; + data: any; + comments: any; + visiblePages: Array; + isEmpty: boolean; + PageCount: number; + visiblePageCount: number; + currentPage: PageModel; + protected currentPageChanged(newValue: PageModel, oldValue: PageModel): void; + isDesignMode: boolean; + nextPage(): boolean; + isCurrentPageHasErrors: boolean; + prevPage(): boolean; + completeLastPage(): boolean; + isFirstPage: boolean; + isLastPage: boolean; + progressText: string; + getPage(index: number): PageModel; + addPage(page: PageModel): void; + addNewPage(name: string): PageModel; + removePage(page: PageModel): void; + getQuestionByName(name: string): IQuestion; + getQuestionsByNames(names: string[]): IQuestion[]; + getPageByQuestion(question: IQuestion): PageModel; + getPageByName(name: string): PageModel; + getPagesByNames(names: string[]): PageModel[]; + getAllQuestions(visibleOnly?: boolean): Array; + protected createNewPage(name: string): PageModel; + private notifyQuestionOnValueChanged(name, newValue); + private notifyAllQuestionsOnValueChanged(); + private checkTriggers(name, newValue); + sendResult(postId?: string, clientId?: string, isPartialCompleted?: boolean): void; + getResult(resultId: string, name: string): void; + loadSurveyFromService(surveyId?: string, element?: any): void; + protected onLoadSurveyFromService(element: any): void; + private updateVisibleIndexes(); + private updatePageVisibleIndexes(showIndex); + private updateQuestionVisibleIndexes(questions, showIndex); + private setJsonObject(jsonObj); + protected onBeforeCreating(): void; + protected onCreating(): void; + getValue(name: string): any; + setValue(name: string, newValue: any): void; + getComment(name: string): string; + setComment(name: string, newValue: string): void; + questionVisibilityChanged(question: IQuestion, newValue: boolean): void; + pageVisibilityChanged(page: IPage, newValue: boolean): void; + questionAdded(question: IQuestion, index: number): void; + questionRemoved(question: IQuestion): void; + validateQuestion(name: string): SurveyError; + getObjects(pages: string[], questions: string[]): any[]; + } +} + +declare module Survey { + class SurveyWindowModel extends Base { + static surveyElementName: string; + surveyValue: SurveyModel; + windowElement: HTMLDivElement; + isShowingValue: boolean; + isExpandedValue: boolean; + titleValue: string; + templateValue: string; + constructor(jsonObj: any); + getType(): string; + survey: SurveyModel; + isShowing: boolean; + isExpanded: boolean; + title: string; + expand(): void; + collapse(): void; + protected createSurvey(jsonObj: any): SurveyModel; + protected expandcollapse(value: boolean): void; + } +} + +/// +declare module Survey { +} + +/// +declare module Survey { +} + +/// +declare module Survey { + class Page extends PageModel { + koNo: any; + constructor(name?: string); + protected onCreating(): void; + protected onNumChanged(value: number): void; + } +} + +/// +declare module Survey { + class QuestionImplementorBase { + question: QuestionBase; + koVisible: any; + koNo: any; + koErrors: any; + constructor(question: QuestionBase); + protected onVisibilityChanged(): void; + protected onVisibleIndexChanged(): void; + protected getNo(): string; + } +} + +/// +/// +declare module Survey { + class QuestionImplementor extends QuestionImplementorBase { + question: Question; + private isUpdating; + koValue: any; + koComment: any; + constructor(question: Question); + protected onValueChanged(): void; + protected onCommentChanged(): void; + protected onVisibilityChanged(): void; + protected onVisibleIndexChanged(): void; + protected onErrorsChanged(): void; + protected createkoValue(): any; + protected setkoValue(newValue: any): void; + protected updateValue(newValue: any): void; + protected updateComment(newValue: any): void; + protected getNo(): string; + } +} + +/// +declare module Survey { + class QuestionSelectBaseImplementor extends QuestionImplementor { + koOtherVisible: any; + constructor(question: Question); + protected isOtherSelected: boolean; + } + class QuestionCheckboxBaseImplementor extends QuestionSelectBaseImplementor { + koWidth: any; + constructor(question: Question); + protected onColCountChanged(): void; + protected colWidth: string; + private koAfterRender(el, con); + } +} + +/// +/// +declare module Survey { + class QuestionCheckbox extends QuestionCheckboxModel { + name: string; + constructor(name: string); + } +} + +/// +declare module Survey { + class QuestionComment extends QuestionCommentModel { + name: string; + constructor(name: string); + } +} + +/// +declare module Survey { + class QuestionDropdown extends QuestionDropdownModel { + name: string; + constructor(name: string); + } +} + +/// +/// +declare module Survey { + class QuestionHtml extends QuestionHtmlModel { + name: string; + constructor(name: string); + } +} + +/// +declare module Survey { + class MatrixRow extends MatrixRowModel { + name: any; + text: string; + fullName: string; + private isValueUpdating; + koValue: any; + constructor(name: any, text: string, fullName: string, data: IMatrixData, value: any); + protected onValueChanged(): void; + } + class QuestionMatrix extends QuestionMatrixModel { + name: string; + constructor(name: string); + protected createMatrixRow(name: any, text: string, fullName: string, value: any): MatrixRowModel; + } +} + +/// +declare module Survey { + class MatrixDropdownCell extends MatrixDropdownCellModel { + column: MatrixDropdownColumn; + row: MatrixDropdownRowModel; + private isValueUpdating; + koValue: any; + constructor(column: MatrixDropdownColumn, row: MatrixDropdownRowModel, data: IMatrixDropdownData, value: any); + protected onValueChanged(): void; + } + class MatrixDropdownRow extends MatrixDropdownRowModel { + name: any; + text: string; + constructor(name: any, text: string, data: IMatrixDropdownData, value: any); + protected createCell(column: MatrixDropdownColumn, value: any): MatrixDropdownCellModel; + } + class QuestionMatrixDropdown extends QuestionMatrixDropdownModel { + name: string; + constructor(name: string); + protected createMatrixRow(name: any, text: string, value: any): MatrixDropdownRowModel; + } +} + +/// +declare module Survey { + class MultipleTextItem extends MultipleTextItemModel { + name: any; + private isKOValueUpdating; + koValue: any; + constructor(name?: any, title?: string); + onValueChanged(newValue: any): void; + } + class QuestionMultipleText extends QuestionMultipleTextModel { + name: string; + constructor(name: string); + protected createTextItem(name: string, title: string): MultipleTextItemModel; + } +} + +/// +declare module Survey { + class QuestionRadiogroup extends QuestionRadiogroupModel { + name: string; + constructor(name: string); + } +} + +/// +declare module Survey { + class QuestionRating extends QuestionRatingModel { + name: string; + constructor(name: string); + } +} + +/// +declare module Survey { + class QuestionText extends QuestionTextModel { + name: string; + constructor(name: string); + } +} + +/// +declare module Survey { + class SurveyBase extends SurveyModel { + private renderedElement; + onRendered: Event<(sender: SurveyModel) => any, any>; + koCurrentPage: any; + koIsFirstPage: any; + koIsLastPage: any; + dummyObservable: any; + koProgress: any; + koProgressText: any; + constructor(jsonObj?: any, renderedElement?: any); + render(element?: any): void; + protected createNewPage(name: string): Page; + protected getTemplate(): string; + protected onBeforeCreating(): void; + protected currentPageChanged(newValue: PageModel, oldValue: PageModel): void; + protected onLoadSurveyFromService(element: any): void; + private applyBinding(); + private updateKoCurrentPage(); + private getProgress(); + } +} + +/// +/// +declare module Survey { + class SurveyWindowBase extends SurveyWindowModel { + koExpanded: any; + doExpand: any; + constructor(jsonObj: any); + protected createSurvey(jsonObj: any): SurveyModel; + protected expandcollapse(value: boolean): void; + protected template: string; + show(): void; + protected getDefaultTemplate(): string; + hide(): void; + private changeExpanded(); + private onComplete(); + } +} + +declare module Survey { + class SurveyTemplateTextBase { + constructor(); + replaceText(replaceText: string, id: string, questionType?: string): void; + protected getId(id: string, questionType: string): string; + protected text: string; + } +} + +declare module template.ko { + var html: string; +} + +/// +/// +declare module Survey { + class Survey extends SurveyBase { + constructor(jsonObj?: any, renderedElement?: any); + protected getTemplate(): string; + } +} + +/// +/// +declare module Survey { + class SurveyWindow extends SurveyWindowBase { + koExpanded: any; + doExpand: any; + constructor(jsonObj: any); + protected createSurvey(jsonObj: any): SurveyModel; + protected getDefaultTemplate(): string; + } +} + +declare module template.window.ko { + var html: string; +} + +/// +/// +declare module Survey { + class SurveyTemplateText extends SurveyTemplateTextBase { + protected text: string; + } +} + From 6d1c71e4802e9e33c739a7aff7fccf5597eae3f3 Mon Sep 17 00:00:00 2001 From: Randall Koutnik Date: Mon, 25 Apr 2016 08:33:22 -0700 Subject: [PATCH 50/65] Add definition for hidden function in colors (#9097) This is the secret style referenced at the end of colors' readme. --- colors/colors.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/colors/colors.d.ts b/colors/colors.d.ts index cc6b307c03..07c4c19e06 100644 --- a/colors/colors.d.ts +++ b/colors/colors.d.ts @@ -41,6 +41,7 @@ declare module "colors" { america: Color; trap: Color; random: Color; + zalgo: Color; } namespace e { From 6adcd02b062c7ad6302a1b69baa56d6194718795 Mon Sep 17 00:00:00 2001 From: Jakob Gillich Date: Mon, 25 Apr 2016 17:36:30 +0200 Subject: [PATCH 51/65] pouch: add callback-less constructor (#8868) --- pouchDB/pouch.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pouchDB/pouch.d.ts b/pouchDB/pouch.d.ts index d3097a4099..0360e02b65 100644 --- a/pouchDB/pouch.d.ts +++ b/pouchDB/pouch.d.ts @@ -207,11 +207,13 @@ interface PouchApi { interface PouchOptions { name?: string; adapter?: string; + skip_setup?: boolean; } interface PouchDB extends PouchApi { new (name: string, opts: PouchOptions, callback: (err: PouchError, res: PouchDB) => void): PouchDB; new (name: string, callback: (err: PouchError, res: PouchDB) => void): PouchDB; + new (name: string, opts: PouchOptions): PouchDB; new (name: string): PouchDB; destroy(name: string, callback: (err: PouchError) => void): void; } From 1f17720f56a341e2a290ee2182054b7317222a22 Mon Sep 17 00:00:00 2001 From: Derrick Liu Date: Mon, 25 Apr 2016 07:40:19 -0800 Subject: [PATCH 52/65] react-select: use export default to match library (#9100) * Update react-select to export Select by default * Update react-select tests to match --- react-select/react-select-tests.tsx | 2 +- react-select/react-select.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/react-select/react-select-tests.tsx b/react-select/react-select-tests.tsx index b5258d85ca..8e573e1444 100644 --- a/react-select/react-select-tests.tsx +++ b/react-select/react-select-tests.tsx @@ -5,7 +5,7 @@ import * as React from "react"; import * as ReactDOM from "react-dom"; -import * as Select from "react-select"; +import Select from "react-select"; class SelectTest extends React.Component, {}> { diff --git a/react-select/react-select.d.ts b/react-select/react-select.d.ts index 5ad97ba2ff..72cc5d43e8 100644 --- a/react-select/react-select.d.ts +++ b/react-select/react-select.d.ts @@ -302,5 +302,5 @@ declare namespace ReactSelect { declare module "react-select" { const select: ReactSelect.ReactSelectClass; - export = select; + export default select; } From 869bd9c489a21cc6ed7fe56978b2cfced295c4a7 Mon Sep 17 00:00:00 2001 From: Robin Joseph Date: Mon, 25 Apr 2016 08:41:51 -0700 Subject: [PATCH 53/65] Update bookshelf.d.ts (#9101) --- bookshelf/bookshelf-tests.ts | 3 +++ bookshelf/bookshelf.d.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bookshelf/bookshelf-tests.ts b/bookshelf/bookshelf-tests.ts index 42faf0909e..92758e143a 100644 --- a/bookshelf/bookshelf-tests.ts +++ b/bookshelf/bookshelf-tests.ts @@ -15,6 +15,9 @@ var knex = Knex({ var bookshelf = Bookshelf(knex); +bookshelf.plugin('registry'); +bookshelf.plugin(['virtuals']); + class User extends bookshelf.Model { get tableName() { return 'users'; } messages() : Bookshelf.Collection { diff --git a/bookshelf/bookshelf.d.ts b/bookshelf/bookshelf.d.ts index 74f5e83d4a..cf70220840 100644 --- a/bookshelf/bookshelf.d.ts +++ b/bookshelf/bookshelf.d.ts @@ -18,7 +18,7 @@ declare module 'bookshelf' { Model : typeof Bookshelf.Model; Collection : typeof Bookshelf.Collection; - plugin(name: string) : Bookshelf; + plugin(name: string | string[] | Function, options?: any) : Bookshelf; transaction(callback : (transaction : knex.Transaction) => T) : Promise; } From 925fedb376b733608663d213aa908407a4bfd6b6 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Tue, 26 Apr 2016 01:15:01 +0930 Subject: [PATCH 54/65] adding react-mdl (#9102) * added material-design-lite definition and tests * adding react-mdl * fixed es6 compilation by chanigng import i don't know why git is saying that every line changed... * fixed es6 compilation --- react-mdl/react-mdl-tests.tsx | 1044 +++++++++++++++++++++++++++++++++ react-mdl/react-mdl.d.ts | 606 +++++++++++++++++++ 2 files changed, 1650 insertions(+) create mode 100644 react-mdl/react-mdl-tests.tsx create mode 100644 react-mdl/react-mdl.d.ts diff --git a/react-mdl/react-mdl-tests.tsx b/react-mdl/react-mdl-tests.tsx new file mode 100644 index 0000000000..1e7fd19b0c --- /dev/null +++ b/react-mdl/react-mdl-tests.tsx @@ -0,0 +1,1044 @@ +// Test file for react-mdl Definition file +/// + +import * as React from 'react'; +import {Badge, + FABButton, Button, IconButton, + Card, CardActions, CardTitle, CardText, CardMenu, CardMedia, + Checkbox, + DataTable, TableHeader, Table, + Dialog, DialogTitle, DialogContent, DialogActions, + Grid, Cell, + Icon, IconToggle, + Layout, Header, Navigation, Drawer, Content, HeaderRow, HeaderTabs, Footer, FooterDropDownSection, FooterLinkList, FooterSection, + List, ListItem, ListItemContent, ListItemAction, + Menu, MenuItem, + ProgressBar, + RadioGroup, Radio, + Slider, + Snackbar, + Spinner, + Switch, + Tabs, Tab, + Textfield, + Tooltip} from 'react-mdl'; + +// all tests are from the examples provided here: https://tleunen.github.io/react-mdl/ + +// Badge tests +React.createClass({ + render: function() { + return ( +
+ {/* Number badge on icon */} + + + + + {/* Icon badge on icon */} + + + + + {/* Number badge on text */} + Inbox + + {/* Icon badge without background on text */} + Mood +
+ ); + } +}); + +// Button tests +React.createClass({ + render: function() { + return ( +
+ {/* Colored FAB button */} + + + + + {/* Colored FAB button with ripple */} + + + + + {/* FAB button */} + + + + + {/* FAB button with ripple */} + + + + + {/* Disabled FAB button */} + + + + + {/* Mini FAB button */} + + + + + {/* Colored Mini FAB button */} + + + + + {/* Raised button */} + + + {/* Raised button with ripple */} + + + {/* Disabled Raised button */} + + + {/* Colored Raised button */} + + + {/* Accent-colored button without ripple */} + + + {/* Accent-colored button with ripple */} + + + {/* Flat button */} + + + {/* Flat button with ripple */} + + + {/* Disabled flat button */} + + + {/* Primary colored flat button */} + + + {/* Accent-colored flat button */} + + + {/* Icon button */} + + + {/* Colored Icon button */} + +
+ ); + } +}) + +// Card tests +React.createClass({ + render: function() { + return ( +
+ + Welcome + + Lorem ipsum dolor sit amet, consectetur adipiscing elit. + Mauris sagittis pellentesque lacus eleifend lacinia... + + + + + + + + + + + Update + + Lorem ipsum dolor sit amet, consectetur adipiscing elit. + Aenan convallis. + + + + + + + + + + + Image.jpg + + + + + + +

+ Featured event:
+ May 24, 2016
+ 7-11pm +

+
+ + +
+ +
+
+
+ ); + } +}); + +// Checkbox tests +React.createClass({ + render: function() { + return ( +
+ + + +
+ ); + } +}); + +// DataTable tests +React.createClass({ + render: function() { + return ( +
+ + Material + Quantity + `\$${price.toFixed(2)}`} tooltip="Price pet unit">Price + + + + Material + Quantity + `\$${price.toFixed(2)}`} tooltip="Price pet unit">Price + + + + (isAsc ? a : b).match(/\((.*)\)/)[1].localeCompare((isAsc ? b : a).match(/\((.*)\)/)[1])} + tooltip="The amazing material name" + > + Material + + + Quantity + + `\$${price.toFixed(2)}`} + tooltip="Price pet unit" + > + Price + +
+
+ ); + } +}); + +// Dialog tests +React.createClass({ + render: function() { + return ( +
+
+ + + Allow data collection? + +

Allowing us to collect data will let us get you the information you want faster.

+
+ + + + +
+
+ +
+ + + Allow this site to collect usage data to improve your experience? + +

Allowing us to collect data will let us get you the information you want faster.

+
+ + + + +
+
+ +
+ + + Allow data collection? + +

Allowing us to collect data will let us get you the information you want faster.

+
+ + + + +
+
+
+ ); + } +}); + +// Grid tests +React.createClass({ + render: function() { + return ( +
+
+ + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + + 4 + 4 + 4 + + + 6 + 4 + 2 + + + 6 (8 tablet) + 4 (6 tablet) + 2 (4 phone) + +
+
+ ); + } +}); + +// IconToggle tests +React.createClass({ + render: function() { + return ( +
+ + + +
+ ); + } +}); + +// Layout tests +React.createClass({ + render: function() { + return ( +
+ {/* Uses a transparent header that draws on top of the layout's background */} +
+ +
+ + Link + Link + Link + Link + +
+ + + Link + Link + Link + Link + + + +
+
+ + {/* No header, and the drawer stays open on larger screens (fixed drawer). */} +
+ + + + Link + Link + Link + Link + + + + +
+ + {/* Always shows a header, even in smaller screens. */} +
+ +
Area / The Title}> + + Link + Link + Link + Link + +
+ + + Link + Link + Link + Link + + + +
+
+ + {/* The drawer is always open in large screens. The header is always shown, even in small screens. */} +
+ +
+ {}} + label="Search" + expandable + expandableIcon="search" + /> +
+ + + Link + Link + Link + Link + + + +
+
+ + {/* Uses a header that scrolls with the text, rather than staying locked at the top */} +
+ +
+ + Link + Link + Link + Link + +
+ + + Link + Link + Link + Link + + + +
+ + +
+ + {/* Uses a header that contracts as the page scrolls down. */} +
+ +
+ + {}} + label="Search" + expandable + expandableIcon="search" + /> + + + + Link + Link + Link + Link + + +
+ + + Link + Link + Link + Link + + + +
+ + +
+ + {/* Hide the top part of the header when scrolling down */} +
+ +
+ + {}} + label="Search" + expandable + expandableIcon="search" + /> + + + + Link + Link + Link + Link + + +
+ + + Link + Link + Link + Link + + + +
+ + +
+ +
+ +
+ + this.setState({ activeTab: tabId })}> + Tab1 + Tab2 + Tab3 + Tab4 + Tab5 + Tab6 + +
+ + +
Content for the tab: {this.state.activeTab}
+
+
+
+ + {/* Simple header with fixed tabs. */} +
+ +
+ + {}}> + Tab1 + Tab2 + Tab3 + +
+ + +
You can add logic to update the content of this container based on the "activeTab" receive in the `onChange` callback.
+
+
+
+ + + + +
+ ); + } +}); + +// List tests +React.createClass({ + render: function() { + return ( +
+ + Bryan Cranston + Aaron Paul + Bob Odenkirk + + + + + Bryan Cranston + + + Aaron Paul + + + Bob Odenkirk + + + + + + Bryan Cranston + + + + + + Aaron Paul + + + + + + Bob Odenkirk + + + + + + + + + Bryan Cranston + + + + + + Aaron Paul + + + + + + Bob Odenkirk + + + + + + + + + Bryan Cranston + + + + + + Aaron Paul + + + + + + Bob Odenkirk + + + + + + + + + Bryan Cranston + + + + + + Aaron Paul + + + + + + Bob Odenkirk + + + + + +
+ ); + } +}); + +// Menu tests +React.createClass({ + render: function() { + return ( +
+ {/* Lower left */} +
+ + + Some Action + Another Action + Disabled Action + Yet Another Action + +
+ + {/* Lower right */} +
+ + + Some Action + Another Action + Disabled Action + Yet Another Action + +
+ + {/* Top left */} +
+ + + Some Action + Another Action + Disabled Action + Yet Another Action + +
+ + {/* Top right */} +
+ + + Some Action + Another Action + Disabled Action + Yet Another Action + +
+
+ ); + } +}); + +// ProgressBar tests +React.createClass({ + render: function() { + return ( +
+ {/* Simple Progress Bar */} + + + {/* Progress Bar with Indeterminate Progress */} + + + {/* Progress Bar with Buffering */} + +
+ ); + } +}); + +// Radio tests +React.createClass({ + render: function() { + return ( +
+ + Ripple option + Other option + + + + Ripple option + Other option + +
+ ); + } +}); + +// Slider tests +React.createClass({ + render: function() { + return ( +
+ {/* Default slider */} + + + {/* Slider with initial value */} + +
+ ); + } +}); + +// Snackbar tests +React.createClass({ + render: function() { + return ( +
+
+ + Button color changed. +
+ +
+ + + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce varius luctus quam. Fusce quis blandit libero. Donec accumsan nunc lectus, vel blandit diam bibendum ac. Integer faucibus, lorem et convallis fermentum, diam dolor imperdiet mi, nec iaculis risus mauris id elit. Vivamus vel eros dapibus, molestie ante ut, vestibulum sem. + +
+
+ ); + } +}); + +// Spinner tests +React.createClass({ + render: function() { + return ( +
+ {/* Simple spinner */} + + + {/* Single color spinner */} + +
+ ); + } +}); + +// Switch tests +React.createClass({ + render: function() { + return ( +
+ Ripple switch + + Switch +
+ ); + } +}); + +// Tab tests +React.createClass({ + render: function() { + return ( +
+
+ this.setState({ activeTab: tabId })} ripple> + Starks + Lannisters + Targaryens + +
+
Content for the tab: {this.state.activeTab}
+
+
+
+ ); + } +}); + +// Textfield tests +React.createClass({ + render: function() { + return ( +
+ {/* Simple textfield */} + {}} + label="Text..." + style={{width: '200px'}} + /> + + {/* Numeric textfield */} + {}} + pattern="-?[0-9]*(\.[0-9]+)?" + error="Input is not a number!" + label="Number..." + style={{width: '200px'}} + /> + + {/* Textfield with floating label */} + {}} + label="Text..." + floatingLabel + style={{width: '200px'}} + /> + + {/* Numeric Textfield with floating label */} + {}} + pattern="-?[0-9]*(\.[0-9]+)?" + error="Input is not a number!" + label="Number..." + floatingLabel + /> +
+ ); + } +}); + +// Tooltip tests +React.createClass({ + render: function() { + return ( +
+ {/* Simple tooltip */} + + + + + {/* Large Tooltip */} + + + + + {/* Rich Tooltip */} + Upload file.zip}> + + + + {/* Multiline Tooltip */} + Share your content
via social media}> + +
+ + {/* Right Tooltip */} + + + + + {/* Left Tooltip */} + + + + + {/* Top Tooltip */} + + + + + {/* Bottom Tooltip */} + + + +
+ ); + } +}); diff --git a/react-mdl/react-mdl.d.ts b/react-mdl/react-mdl.d.ts new file mode 100644 index 0000000000..56d688c7f4 --- /dev/null +++ b/react-mdl/react-mdl.d.ts @@ -0,0 +1,606 @@ +// Type definitions for react-mdl 1.5.3 +// Project: https://github.com/tleunen/react-mdl +// Definitions by: Brad Zacher +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace __ReactMDL { + import React = __React; + + type __MDLClassProps = React.ClassAttributes; + type __MDLOtherProps = React.HTMLProps; + class __MDLComponent

extends React.Component {} + class __MDLBasicComponent extends __MDLComponent<__MDLOtherProps> {} + + interface ShadowedComponent { + shadow ?: number; + } + interface RippleComponent { + ripple ?: boolean; + } + interface CustomRenderedComponent { + component ?: string | JSX.Element | Function; + } + + + // HTMLAttributes (minus the 'data', 'icon', 'label', 'name', 'rows', 'size', 'title', 'value' attributes) + interface MDLHTMLAttributes { + // React-specific Attributes + defaultChecked?: boolean; + defaultValue?: string | string[]; + + // Standard HTML Attributes + accept?: string; + acceptCharset?: string; + accessKey?: string; + action?: string; + allowFullScreen?: boolean; + allowTransparency?: boolean; + alt?: string; + async?: boolean; + autoComplete?: string; + autoFocus?: boolean; + autoPlay?: boolean; + capture?: boolean; + cellPadding?: number | string; + cellSpacing?: number | string; + charSet?: string; + challenge?: string; + checked?: boolean; + classID?: string; + className?: string; + cols?: number; + colSpan?: number; + content?: string; + contentEditable?: boolean; + contextMenu?: string; + controls?: boolean; + coords?: string; + crossOrigin?: string; + dateTime?: string; + default?: boolean; + defer?: boolean; + dir?: string; + disabled?: boolean; + download?: any; + draggable?: boolean; + encType?: string; + form?: string; + formAction?: string; + formEncType?: string; + formMethod?: string; + formNoValidate?: boolean; + formTarget?: string; + frameBorder?: number | string; + headers?: string; + height?: number | string; + hidden?: boolean; + high?: number; + href?: string; + hrefLang?: string; + htmlFor?: string; + httpEquiv?: string; + id?: string; + inputMode?: string; + integrity?: string; + is?: string; + keyParams?: string; + keyType?: string; + kind?: string; + lang?: string; + list?: string; + loop?: boolean; + low?: number; + manifest?: string; + marginHeight?: number; + marginWidth?: number; + max?: number | string; + maxLength?: number; + media?: string; + mediaGroup?: string; + method?: string; + min?: number | string; + minLength?: number; + multiple?: boolean; + muted?: boolean; + nonce?: string; + noValidate?: boolean; + open?: boolean; + optimum?: number; + pattern?: string; + placeholder?: string; + poster?: string; + preload?: string; + radioGroup?: string; + readOnly?: boolean; + rel?: string; + required?: boolean; + reversed?: boolean; + role?: string; + rowSpan?: number; + sandbox?: string; + scope?: string; + scoped?: boolean; + scrolling?: string; + seamless?: boolean; + selected?: boolean; + shape?: string; + sizes?: string; + span?: number; + spellCheck?: boolean; + src?: string; + srcDoc?: string; + srcLang?: string; + srcSet?: string; + start?: number; + step?: number | string; + style?: React.CSSProperties; + summary?: string; + tabIndex?: number; + target?: string; + type?: string; + useMap?: string; + width?: number | string; + wmode?: string; + wrap?: string; + + // RDFa Attributes + about?: string; + datatype?: string; + inlist?: any; + prefix?: string; + property?: string; + resource?: string; + typeof?: string; + vocab?: string; + + // Non-standard Attributes + autoCapitalize?: string; + autoCorrect?: string; + autoSave?: string; + color?: string; + itemProp?: string; + itemScope?: boolean; + itemType?: string; + itemID?: string; + itemRef?: string; + results?: number; + security?: string; + unselectable?: boolean; + + // Allows aria- and data- Attributes + [key: string]: any; + } + // DOMAttributes (minus 'onClick', 'onChange') + interface MDLDOMAttributes { + // DOMAttributes (minus onClick) + children?: React.ReactNode; + dangerouslySetInnerHTML?: { + __html: string; + }; + + // Clipboard Events + onCopy?: React.ClipboardEventHandler; + onCut?: React.ClipboardEventHandler; + onPaste?: React.ClipboardEventHandler; + + // Composition Events + onCompositionEnd?: React.CompositionEventHandler; + onCompositionStart?: React.CompositionEventHandler; + onCompositionUpdate?: React.CompositionEventHandler; + + // Focus Events + onFocus?: React.FocusEventHandler; + onBlur?: React.FocusEventHandler; + + // Form Events + onInput?: React.FormEventHandler; + onSubmit?: React.FormEventHandler; + + // Image Events + onLoad?: React.ReactEventHandler; + onError?: React.ReactEventHandler; // also a Media Event + + // Keyboard Events + onKeyDown?: React.KeyboardEventHandler; + onKeyPress?: React.KeyboardEventHandler; + onKeyUp?: React.KeyboardEventHandler; + + // Media Events + onAbort?: React.ReactEventHandler; + onCanPlay?: React.ReactEventHandler; + onCanPlayThrough?: React.ReactEventHandler; + onDurationChange?: React.ReactEventHandler; + onEmptied?: React.ReactEventHandler; + onEncrypted?: React.ReactEventHandler; + onEnded?: React.ReactEventHandler; + onLoadedData?: React.ReactEventHandler; + onLoadedMetadata?: React.ReactEventHandler; + onLoadStart?: React.ReactEventHandler; + onPause?: React.ReactEventHandler; + onPlay?: React.ReactEventHandler; + onPlaying?: React.ReactEventHandler; + onProgress?: React.ReactEventHandler; + onRateChange?: React.ReactEventHandler; + onSeeked?: React.ReactEventHandler; + onSeeking?: React.ReactEventHandler; + onStalled?: React.ReactEventHandler; + onSuspend?: React.ReactEventHandler; + onTimeUpdate?: React.ReactEventHandler; + onVolumeChange?: React.ReactEventHandler; + onWaiting?: React.ReactEventHandler; + + // MouseEvents + onContextMenu?: React.MouseEventHandler; + onDoubleClick?: React.MouseEventHandler; + onDrag?: React.DragEventHandler; + onDragEnd?: React.DragEventHandler; + onDragEnter?: React.DragEventHandler; + onDragExit?: React.DragEventHandler; + onDragLeave?: React.DragEventHandler; + onDragOver?: React.DragEventHandler; + onDragStart?: React.DragEventHandler; + onDrop?: React.DragEventHandler; + onMouseDown?: React.MouseEventHandler; + onMouseEnter?: React.MouseEventHandler; + onMouseLeave?: React.MouseEventHandler; + onMouseMove?: React.MouseEventHandler; + onMouseOut?: React.MouseEventHandler; + onMouseOver?: React.MouseEventHandler; + onMouseUp?: React.MouseEventHandler; + + // Selection Events + onSelect?: React.ReactEventHandler; + + // Touch Events + onTouchCancel?: React.TouchEventHandler; + onTouchEnd?: React.TouchEventHandler; + onTouchMove?: React.TouchEventHandler; + onTouchStart?: React.TouchEventHandler; + + // UI Events + onScroll?: React.UIEventHandler; + + // Wheel Events + onWheel?: React.WheelEventHandler; + } + + + + interface BadgeProps extends __MDLClassProps { + text: string | number; + className ?: string; + noBackground ?: boolean; + overlap ?: boolean; + } + class Badge extends __MDLComponent {} + + + interface ButtonProps extends __MDLOtherProps, RippleComponent, CustomRenderedComponent { + accent ?: boolean; + colored ?: boolean; + primary ?: boolean; + } + interface StandardButtonProps extends ButtonProps { + raised ?: boolean; + } + interface FABButtonProps extends ButtonProps { + mini ?: boolean; + } + interface IconButtonProps extends ButtonProps { + name ?: string; + raised ?: boolean; + } + class Button extends __MDLComponent {} + class FABButton extends __MDLComponent {} + class IconButton extends __MDLComponent {} + + + interface CardProps extends __MDLOtherProps, ShadowedComponent {} + interface CardActionProps extends __MDLOtherProps { + border ?: boolean; + } + interface CardTitleProps extends __MDLOtherProps { + expand ?: boolean; + } + class Card extends __MDLComponent {} + class CardActions extends __MDLComponent {} + class CardTitle extends __MDLComponent {} + class CardText extends __MDLBasicComponent {} + class CardMenu extends __MDLBasicComponent {} + class CardMedia extends __MDLBasicComponent {} + + + interface CheckboxProps extends __MDLOtherProps, RippleComponent { + checked ?: boolean; + disabled ?: boolean; + label ?: string; + } + class Checkbox extends __MDLComponent {} + + interface UndecoratedTableProps extends __MDLClassProps, MDLHTMLAttributes, React.DOMAttributes, ShadowedComponent { + rows: Array; + rowKeyColumn ?: string; + + name ?: string; + title ?: string; + } + interface TableProps extends UndecoratedTableProps { + sortable ?: boolean; + selectable ?: boolean; + onSelectionChanged ?: (row : any) => any; + } + interface TableHeaderProps extends __MDLClassProps, MDLHTMLAttributes, MDLDOMAttributes { + name : string; + title ?: string; + cellFormatter ?: (value : any, row : any, index : number) => React.ReactNode; + numeric ?: boolean; + nosort ?: boolean; + onClick ?: (e : React.MouseEvent, name : string) => any; + sortFn ?: (a : any, b : any, isAsc : boolean) => number; + tooltip ?: React.ReactNode; + } + class Table extends __MDLComponent {} + class TableHeader extends __MDLComponent {} + class UndecoratedTable extends __MDLComponent {} + class DataTable extends Table {} + + + interface DialogProps extends __MDLOtherProps { + open ?: boolean; + } + interface DialogActionsProps extends __MDLOtherProps { + fullWidth ?: boolean; + } + interface DialogTitleProps extends __MDLOtherProps, CustomRenderedComponent {} + class Dialog extends __MDLComponent {} + class DialogActions extends __MDLComponent {} + class DialogTitle extends __MDLComponent {} + class DialogContent extends __MDLBasicComponent {} + + + interface GridProps extends __MDLOtherProps, CustomRenderedComponent, ShadowedComponent { + noSpacing ?: boolean; + } + interface CellProps extends __MDLOtherProps, CustomRenderedComponent, ShadowedComponent { + col : number; + align ?: string; + phone ?: number; + tablet ?: number; + hideDesktop ?: boolean; + hidePhone ?: boolean; + hideTablet ?: boolean; + } + class Grid extends __MDLComponent {} + class Cell extends __MDLComponent {} + + + interface IconProps extends __MDLOtherProps { + name : string; + } + class Icon extends __MDLComponent {} + + + interface IconToggleProps extends __MDLOtherProps, RippleComponent { + name : string; + checked ?: boolean; + disabled ?: boolean; + } + class IconToggle extends __MDLComponent {} + + + interface ContentProps extends __MDLOtherProps, CustomRenderedComponent {} + interface DrawerProps extends __MDLOtherProps { + title ?: string; + } + interface HeaderProps extends __MDLOtherProps { + title ?: string; + scroll ?: boolean; + seamed ?: boolean; + transparent ?: boolean; + waterfall ?: boolean; + hideTop ?: boolean; + } + interface HeaderRowProps extends __MDLOtherProps { + title ?: string; + } + interface HeaderTabsProps extends __MDLOtherProps, RippleComponent { + activeTab ?: number; + onChange ?: React.FormEventHandler; + } + interface LayoutProps extends __MDLOtherProps { + fixedDrawer ?: boolean; + fixedHeader ?: boolean; + fixedTabse ?: boolean; + } + interface NavigationProps extends __MDLOtherProps {} + class Content extends __MDLComponent {} + class Drawer extends __MDLComponent {} + class Header extends __MDLComponent {} + class HeaderRow extends __MDLComponent {} + class HeaderTabs extends __MDLComponent {} + class Layout extends __MDLComponent {} + class Navigation extends __MDLComponent {} + class Spacer extends __MDLBasicComponent {} + + interface FooterProps extends MDLHTMLAttributes, React.DOMAttributes { + size ?: string; + + title ?: string; + } + interface FooterDropDownSectionProps extends MDLHTMLAttributes, React.DOMAttributes { + size ?: string; + title : React.ReactNode; + } + interface FooterLinkListProps extends MDLHTMLAttributes, React.DOMAttributes { + size ?: string; + + title ?: string; + } + interface FooterSectionProps extends MDLHTMLAttributes, React.DOMAttributes { + size ?: string; + type ?: string; + logo ?: React.ReactNode; + + title ?: string; + } + class Footer extends __MDLComponent {} + class FooterDropDownSection extends __MDLComponent {} + class FooterLinkList extends __MDLComponent {} + class FooterSection extends __MDLComponent {} + + interface ListItemProps extends __MDLOtherProps { + twoLine ?: boolean; + threeLine ?: boolean; + } + interface ListItemActionProps extends __MDLOtherProps { + info ?: string; + } + interface ListItemContentProps extends MDLHTMLAttributes, React.DOMAttributes { + avatar ?: string | JSX.Element; + icon ?: string | JSX.Element; + subtitle ?: React.ReactNode; + useBodyClass ?: boolean; + } + class List extends __MDLBasicComponent {} + class ListItem extends __MDLComponent {} + class ListItemAction extends __MDLComponent {} + class ListItemContent extends __MDLComponent {} + + + interface MenuProps extends __MDLOtherProps, RippleComponent { + target : string; + align ?: string; + valign ?: string; + } + class Menu extends __MDLComponent {} + class MenuItem extends __MDLBasicComponent {} + + + interface ProgressBarProps extends __MDLOtherProps { + buffer ?: number; + indeterminate ?: boolean; + progress ?: number; + } + class ProgressBar extends __MDLComponent {} + + + interface RadioProps extends MDLHTMLAttributes, React.DOMAttributes, RippleComponent { + value : string | number; + checked ?: boolean; + disabled ?: boolean; + name ?: string; + onChange ?: React.FormEventHandler; + label ?: string; + } + interface RadioGroupProps extends MDLHTMLAttributes, React.DOMAttributes { + name : string; + value : string | number; + childContainer ?: string; + container ?: string; + onChange ?: React.FormEventHandler; + label ?: string; + } + class Radio extends __MDLComponent {} + class RadioGroup extends __MDLComponent {} + + + interface SliderProps extends MDLHTMLAttributes, React.DOMAttributes { + max : number; + min : number; + onChange ?: React.FormEventHandler; + value ?: number; + } + class Slider extends __MDLComponent {} + + + interface SnackbarProps extends __MDLOtherProps { + active : boolean; + onTimeout : () => any; + action ?: string; + onActionClick ?: React.MouseEventHandler; + timeout ?: number; + } + class Snackbar extends __MDLComponent {} + + + interface SpinnerProps extends __MDLOtherProps { + singleColor ?: boolean; + } + class Spinner extends __MDLComponent {} + + + interface SwitchProps extends __MDLOtherProps, RippleComponent { + checked ?: boolean; + disabled ?: boolean; + onChange ?: React.FormEventHandler; + } + class Switch extends __MDLComponent {} + + + interface TabProps extends __MDLOtherProps, CustomRenderedComponent { + active ?: boolean; + cssPrefix ?: string; + onTabClick ?: (tabId : number) => any; + tabId ?: number; + } + interface TabBarProps extends MDLHTMLAttributes, MDLDOMAttributes { + cssPrefix : string; + activeTab ?: number; + onChange ?: (tabId : number) => any; + + name ?: string; + title ?: string; + onClick ?: React.MouseEventHandler; + } + interface TabsProps extends MDLHTMLAttributes, MDLDOMAttributes { + activeTab ?: number; + onChange ?: (tabId : number) => any; + tabBarProps ?: TabBarProps; + + name ?: string; + title ?: string; + onClick ?: React.MouseEventHandler; + } + class Tab extends __MDLComponent {} + class TabBar extends __MDLComponent {} + class Tabs extends __MDLComponent {} + + + interface TextfieldProps extends MDLHTMLAttributes, React.DOMAttributes { + label : string; + disabled ?: boolean; + error ?: React.ReactNode; + expandable ?: boolean; + expandableIcon ?: string; + floatingLabel ?: boolean; + id ?: string; + inputClassName ?: string; + maxRows ?: number; + onChange ?: React.FormEventHandler; + pattern ?: string; + required ?: boolean; + rows ?: number; + value ?: string | number; + + name ?: string; + title ?: string; + } + class Textfield extends __MDLComponent {} + + + interface TooltipProps extends MDLHTMLAttributes, React.DOMAttributes { + label : React.ReactNode; + large ?: boolean; + position ?: string; + + name ?: string; + title ?: string; + } + class Tooltip extends __MDLComponent {} +} + +declare module 'react-mdl' { + export = __ReactMDL; +} \ No newline at end of file From c2c611de3da3dadcaf911490d32f58653c541e67 Mon Sep 17 00:00:00 2001 From: mmmichl Date: Mon, 25 Apr 2016 17:45:14 +0200 Subject: [PATCH 55/65] Make JWT token payloads optional (#9093) This is suggested by the spec https://jwt.io/introduction/#payload --- angular-jwt/angular-jwt-tests.ts | 4 ++-- angular-jwt/angular-jwt.d.ts | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/angular-jwt/angular-jwt-tests.ts b/angular-jwt/angular-jwt-tests.ts index 7f66f26114..3a6b7d6bf1 100644 --- a/angular-jwt/angular-jwt-tests.ts +++ b/angular-jwt/angular-jwt-tests.ts @@ -3,14 +3,14 @@ var app = angular.module("angular-jwt-tests", ["angular-jwt"]); -var $jwtHelper: angular.jwt.IJwtHelper; +var $jwtHelper: ng.jwt.IJwtHelper; var expToken = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3NhbXBsZXMuYXV0aDAuY29tLyIsInN1YiI6ImZhY2Vib29rfDEwMTU0Mjg3MDI3NTEwMzAyIiwiYXVkIjoiQlVJSlNXOXg2MHNJSEJ3OEtkOUVtQ2JqOGVESUZ4REMiLCJleHAiOjE0MTIyMzQ3MzAsImlhdCI6MTQxMjE5ODczMH0.7M5sAV50fF1-_h9qVbdSgqAnXVF7mz3I6RjS6JiH0H8'; var tokenPayload = $jwtHelper.decodeToken(expToken); var date = $jwtHelper.getTokenExpirationDate(expToken); var bool = $jwtHelper.isTokenExpired(expToken); -var $jwtInterceptor: angular.jwt.IJwtInterceptor; +var $jwtInterceptor: ng.jwt.IJwtInterceptor; $jwtInterceptor.tokenGetter = () => { return expToken; diff --git a/angular-jwt/angular-jwt.d.ts b/angular-jwt/angular-jwt.d.ts index d8c719e2ef..eb02cf24df 100644 --- a/angular-jwt/angular-jwt.d.ts +++ b/angular-jwt/angular-jwt.d.ts @@ -8,14 +8,14 @@ declare namespace angular.jwt { interface JwtToken { - iss: string; - sub: string; - aud: string; - exp: number; - nbf: number; - iat: number; - jti: string; - unique_name: string; + iss?: string; + sub?: string; + aud?: string; + exp?: number; + nbf?: number; + iat?: number; + jti?: string; + unique_name?: string; } interface IJwtHelper { From d0fb1d757135f5a0236467b3cf87f52b0b87ad01 Mon Sep 17 00:00:00 2001 From: georgeedwards Date: Mon, 25 Apr 2016 16:45:46 +0100 Subject: [PATCH 56/65] Made module name comply with the Azure docs (#9104) --- azure-mobile-services-client/AzureMobileServicesClient.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-mobile-services-client/AzureMobileServicesClient.d.ts b/azure-mobile-services-client/AzureMobileServicesClient.d.ts index f93ca868c7..b9749002c9 100644 --- a/azure-mobile-services-client/AzureMobileServicesClient.d.ts +++ b/azure-mobile-services-client/AzureMobileServicesClient.d.ts @@ -100,7 +100,7 @@ declare namespace Microsoft.WindowsAzure { } } -declare module "WindowsAzure" { +declare module "azure-mobile-apps-client" { export = WindowsAzure; } From 5b7257019ae959533341a715b339d2562bbf9b85 Mon Sep 17 00:00:00 2001 From: Alex Staroselsky Date: Mon, 25 Apr 2016 10:50:16 -0500 Subject: [PATCH 57/65] Exposed angular.mock.module.sharedInjector method for jasmine and mocha testing to take advantage of jasmine's beforeAll() and mocha's before() methods. (#9106) --- angularjs/angular-mocks-tests.ts | 1 + angularjs/angular-mocks.d.ts | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/angularjs/angular-mocks-tests.ts b/angularjs/angular-mocks-tests.ts index 294bcf8982..8790e68cf3 100644 --- a/angularjs/angular-mocks-tests.ts +++ b/angularjs/angular-mocks-tests.ts @@ -36,6 +36,7 @@ mock.module( function () { return 2; } ); mock.module({ module1: function () { return 1; } }); +mock.module.sharedInjector(); date = mock.TzDate(-7, '2013-1-1T15:00:00Z'); date = mock.TzDate(-8, 12345678); diff --git a/angularjs/angular-mocks.d.ts b/angularjs/angular-mocks.d.ts index c97471e5bf..9031cc56d1 100644 --- a/angularjs/angular-mocks.d.ts +++ b/angularjs/angular-mocks.d.ts @@ -47,7 +47,10 @@ declare namespace angular { inject: IInjectStatic // see https://docs.angularjs.org/api/ngMock/function/angular.mock.module - module(...modules: any[]): any; + module: { + (...modules: any[]): any; + sharedInjector(): void; + } // see https://docs.angularjs.org/api/ngMock/type/angular.mock.TzDate TzDate(offset: number, timestamp: number): Date; From 9b795ab947fd030e65e611326a41e0169709e43a Mon Sep 17 00:00:00 2001 From: Flavien R Date: Mon, 25 Apr 2016 17:51:20 +0200 Subject: [PATCH 58/65] Pikaday: added showDaysInNextAndPreviousMonths property. (#8849) * added missing property to Pikaday. * cleanup. * test --- pikaday/pikaday-tests.ts | 11 +++++++++++ pikaday/pikaday.d.ts | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/pikaday/pikaday-tests.ts b/pikaday/pikaday-tests.ts index f98d4afcee..48cd8d3226 100644 --- a/pikaday/pikaday-tests.ts +++ b/pikaday/pikaday-tests.ts @@ -71,3 +71,14 @@ new Pikaday({field: $('#datepicker')[0]}); yearRange: [2000, 2020] }); })(); + +(() => { + new Pikaday( + { + field: document.getElementById('datepicker'), + firstDay: 1, + minDate: new Date('2000-01-01'), + maxDate: new Date('2020-12-31'), + showDaysInNextAndPreviousMonths: true + }); +})(); diff --git a/pikaday/pikaday.d.ts b/pikaday/pikaday.d.ts index 0025561f54..3e4f80df9a 100644 --- a/pikaday/pikaday.d.ts +++ b/pikaday/pikaday.d.ts @@ -241,6 +241,11 @@ declare namespace Pikaday { * Render the month after the year in the title. Default: false. */ showMonthAfterYear?: boolean; + + /** + * Render days of the calendar grid that fall in the next or previous months to the current month instead of rendering an empty table cell. Default: false. + */ + showDaysInNextAndPreviousMonths?: boolean; /** * Number of visible calendars. From 7ae49d7dac88d557c33ab6621b8168f882c6ed5d Mon Sep 17 00:00:00 2001 From: Luca Cavallaro Date: Mon, 25 Apr 2016 17:51:34 +0200 Subject: [PATCH 59/65] Update vexflow.d.ts (#9095) * Update vexflow.d.ts Backends renderer enum starts with 1, according to http://www.vexflow.com/docs/renderer.html * Update vexflow.d.ts fix all enums * Update vexflow.d.ts fix StaveConnector 'type' enum. "SINGLE_LEFT and SINGLE are the same value for compatibility with older versions of vexflow" --- vexflow/vexflow.d.ts | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/vexflow/vexflow.d.ts b/vexflow/vexflow.d.ts index 8fec777460..a651c850d4 100644 --- a/vexflow/vexflow.d.ts +++ b/vexflow/vexflow.d.ts @@ -167,8 +167,8 @@ declare namespace Vex { } namespace Annotation { - const enum Justify {LEFT, CENTER, RIGHT, CENTER_STEM} - const enum VerticalJustify {TOP, CENTER, BOTTOM, CENTER_STEM} + const enum Justify {LEFT = 1, CENTER, RIGHT, CENTER_STEM} + const enum VerticalJustify {TOP = 1, CENTER, BOTTOM, CENTER_STEM} const CATEGORY : string; } @@ -194,7 +194,7 @@ declare namespace Vex { } namespace Barline { - const enum type {SINGLE, DOUBLE, END, REPEAT_BEGIN, REPEAT_END, REPEAT_BOTH, NONE} + const enum type {SINGLE = 1, DOUBLE, END, REPEAT_BEGIN, REPEAT_END, REPEAT_BOTH, NONE} } class Barline extends StaveModifier { @@ -365,7 +365,7 @@ declare namespace Vex { } namespace Curve { - const enum Position {NEAR_HEAD, NEAR_TOP} + const enum Position {NEAR_HEAD = 1, NEAR_TOP} } class Dot extends Modifier { @@ -553,7 +553,7 @@ declare namespace Vex { } namespace Modifier { - const enum Position {LEFT, RIGHT, ABOVE, BELOW} + const enum Position {LEFT = 1, RIGHT, ABOVE, BELOW} const CATEGORY : string } @@ -717,7 +717,7 @@ declare namespace Vex { } namespace PedalMarking { - const enum Styles {TEXT, BRACKET, MIXED} + const enum Styles {TEXT = 1, BRACKET, MIXED} const GLYPHS : {[name : string] : {code : string, x_shift : number, y_shift : number}}; } @@ -774,8 +774,8 @@ declare namespace Vex { } namespace Renderer { - const enum Backends {CANVAS, RAPHAEL, SVG, VML} - const enum LineEndType {NONE, UP, DOWN} + const enum Backends {CANVAS = 1, RAPHAEL, SVG, VML} + const enum LineEndType {NONE = 1, UP, DOWN} } class Repetition extends StaveModifier { @@ -790,7 +790,7 @@ declare namespace Vex { } namespace Repetition { - const enum type { NONE, CODA_LEFT, CODA_RIGHT, SEGNO_LEFT, SEGNO_RIGHT, DC, DC_AL_CODA, DC_AL_FINE, DS, DS_AL_CODA, DS_AL_FINE, FINE } + const enum type { NONE = 1, CODA_LEFT, CODA_RIGHT, SEGNO_LEFT, SEGNO_RIGHT, DC, DC_AL_CODA, DC_AL_FINE, DS, DS_AL_CODA, DS_AL_FINE, FINE } } class Stave { @@ -859,7 +859,7 @@ declare namespace Vex { } namespace StaveConnector { - const enum type { SINGLE_RIGHT, SINGLE_LEFT, SINGLE, DOUBLE, BRACE, BRACKET, BOLD_DOUBLE_LEFT, BOLD_DOUBLE_RIGHT, THIN_DOUBLE } + const enum type { SINGLE_RIGHT = 0, SINGLE_LEFT = 1, SINGLE = 1, DOUBLE = 2, BRACE = 3, BRACKET = 4, BOLD_DOUBLE_LEFT = 5, BOLD_DOUBLE_RIGHT = 6, THIN_DOUBLE = 7 } } class StaveHairpin { @@ -874,7 +874,7 @@ declare namespace Vex { } namespace StaveHairpin { - const enum type { CRESC, DECRESC } + const enum type { CRESC = 1, DECRESC } } class StaveLine { @@ -892,8 +892,8 @@ declare namespace Vex { } namespace StaveLine { - const enum TextVerticalPosition { TOP, BOTTOM } - const enum TextJustification { LEFT, CENTER, RIGHT } + const enum TextVerticalPosition { TOP = 1, BOTTOM } + const enum TextJustification { LEFT = 1, CENTER, RIGHT } } class StaveModifier { @@ -1105,7 +1105,7 @@ declare namespace Vex { } namespace Stroke { - const enum Type {BRUSH_DOWN, BRUSH_UP, ROLL_DOWN, ROLL_UP, RASQUEDO_DOWN, RASQUEDO_UP} + const enum Type {BRUSH_DOWN = 1, BRUSH_UP, ROLL_DOWN, ROLL_UP, RASQUEDO_DOWN, RASQUEDO_UP} const CATEGORY : string; } @@ -1212,7 +1212,7 @@ declare namespace Vex { } namespace TextBracket { - const enum Positions {TOP, BOTTOM} + const enum Positions {TOP = 1, BOTTOM = -1} } class TextDynamics extends Note { @@ -1232,7 +1232,7 @@ declare namespace Vex { } namespace TextNote { - const enum Justification {LEFT, CENTER, RIGHT} + const enum Justification {LEFT = 1, CENTER, RIGHT} const GLYPHS : {[name : string] : {code : string, point : number, x_shift : number, y_shift : number}} } @@ -1390,7 +1390,7 @@ declare namespace Vex { } namespace Voice { - const enum Mode {STRICT, SOFT, FULL} + const enum Mode {STRICT = 1, SOFT, FULL} } class VoiceGroup { @@ -1407,7 +1407,7 @@ declare namespace Vex { } namespace Volta { - const enum type {NONE, BEGIN, MID, END, BEGIN_END} + const enum type {NONE = 1, BEGIN, MID, END, BEGIN_END} } } } From bde199ae38af4220608c9afe4959275ec5230fe4 Mon Sep 17 00:00:00 2001 From: Vaggelis Mparmpas Date: Mon, 25 Apr 2016 17:58:29 +0200 Subject: [PATCH 60/65] Removed: ISourceArg, IDestinationArg, linkChannels (#9107) Changed: wiretaps to wireTaps --- postal/postal.d.ts | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/postal/postal.d.ts b/postal/postal.d.ts index d476c3710a..62caad6c1d 100644 --- a/postal/postal.d.ts +++ b/postal/postal.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Postal v1.0.6 +// Type definitions for Postal v1.0.8 // Project: https://github.com/postaljs/postal.js // Definitions by: Lokesh Peta , Paul Jolly // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -61,19 +61,9 @@ interface IChannelDefinition { channel: string; } -interface ISourceArg { - topic: string; - channel?: string; -} - -interface IDestinationArg { - topic: string | ((topic: string) => string); - channel?: string; -} - interface IPostal { subscriptions: {}; - wiretaps: ICallback[]; + wireTaps: ICallback[]; addWireTap(callback: ICallback): () => void; @@ -83,8 +73,6 @@ interface IPostal { getSubscribersFor(options: {channel?: string, topic?: string, context?: any}): ISubscriptionDefinition[]; getSubscribersFor(predicateFn: (sub: ISubscriptionDefinition) => boolean): ISubscriptionDefinition[]; - linkChannels(source: ISourceArg | ISourceArg[], destination: IDestinationArg | IDestinationArg[]): void; - publish(envelope: IEnvelope): void; reset(): void; From 735fe1063ed8b32595296d41295847c2ecd75357 Mon Sep 17 00:00:00 2001 From: Piotr Laszczkowski Date: Mon, 25 Apr 2016 18:00:02 +0200 Subject: [PATCH 61/65] Update definitions for Handsontable (#8970) * Add type definitions for Handsontable * Update definitions for Handsontable --- handsontable/handsontable-tests.ts | 14 ++++++++++++++ handsontable/handsontable.d.ts | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/handsontable/handsontable-tests.ts b/handsontable/handsontable-tests.ts index 88cbe587af..25ec4dee0f 100644 --- a/handsontable/handsontable-tests.ts +++ b/handsontable/handsontable-tests.ts @@ -14,14 +14,17 @@ function test_HandsontableInit() { autoRowSize: true, autoWrapCol: true, autoWrapRow: true, + bindRowsWithHeaders: 'foo', cell: [], cells: function() {}, checkedTemplate: true, className: [], colHeaders: true, + collapsibleColumns: true, columnHeaderHeight: 123, columns: [], columnSorting: {}, + columnSummary: {}, colWidths: 123, commentedCellClassName: 'foo', comments: [], @@ -41,15 +44,24 @@ function test_HandsontableInit() { debug: true, defaultDate: 'foo', disableVisualSelection: true, + dropdownMenu: [], editor: true, enterBeginsEditing: true, enterMoves: {}, fillHandle: true, + filter: true, + filteringCaseSensitive: true, + filters: false, fixedColumnsLeft: 123, + fixedRowsBottom: 123, fixedRowsTop: 123, format: 'foo', fragmentSelection: true, + ganttChart: {}, + headerTooltips: true, height: 123, + hiddenColumns: true, + hiddenRows: {}, invalidCellClassName: 'foo', label: {}, language: 'foo', @@ -66,6 +78,7 @@ function test_HandsontableInit() { minSpareCols: 123, minSpareRows: 123, multiSelect: true, + nestedHeaders: [], noWordWrapClassName: 'foo', observeChanges: true, observeDOMVisibility: true, @@ -85,6 +98,7 @@ function test_HandsontableInit() { search: true, selectOptions: [], skipColumnOnPaste: true, + sortByRelevance: true, sortFunction: function() {}, sortIndicator: true, source: [], diff --git a/handsontable/handsontable.d.ts b/handsontable/handsontable.d.ts index 1af41e0125..9c7f87aaa3 100644 --- a/handsontable/handsontable.d.ts +++ b/handsontable/handsontable.d.ts @@ -16,14 +16,17 @@ declare namespace ht { autoRowSize?: Object|boolean; autoWrapCol?: boolean; autoWrapRow?: boolean; + bindRowsWithHeaders?: boolean|string; cell?: any[]; cells?: Function; checkedTemplate?: boolean|string; className?: string|any[]; colHeaders?: boolean|any[]|Function; + collapsibleColumns?: boolean|any[]; columnHeaderHeight?: number|any[]; columns?: any[]; columnSorting?: boolean|Object; + columnSummary?: Object; colWidths?: any[]|Function|number|string; commentedCellClassName?: string; comments?: boolean|any[]; @@ -43,15 +46,24 @@ declare namespace ht { debug?: boolean; defaultDate?: string; disableVisualSelection?: boolean|string|any[]; + dropdownMenu?: boolean|Object|any[]; editor?: string|Function|boolean; enterBeginsEditing?: boolean; enterMoves?: Object|Function; fillHandle?: boolean|string|Object; + filter?: boolean; + filteringCaseSensitive?: boolean; + filters?: boolean; fixedColumnsLeft?: number; + fixedRowsBottom?: number; fixedRowsTop?: number; format?: string; fragmentSelection?: boolean|string; + ganttChart?: Object; + headerTooltips?: boolean|Object; height?: number|Function; + hiddenColumns?: boolean|Object; + hiddenRows?: boolean|Object; invalidCellClassName?: string; label?: Object; language?: string; @@ -68,6 +80,7 @@ declare namespace ht { minSpareCols?: number; minSpareRows?: number; multiSelect?: boolean; + nestedHeaders?: any[]; noWordWrapClassName?: string; observeChanges?: boolean; observeDOMVisibility?: boolean; @@ -87,6 +100,7 @@ declare namespace ht { search?: boolean; selectOptions?: any[]; skipColumnOnPaste?: boolean; + sortByRelevance?: boolean; sortFunction?: Function; sortIndicator?: boolean; source?: any[]|Function; From 91d28b86d71068abe2e8cb223fcc8151e3683b31 Mon Sep 17 00:00:00 2001 From: Steve Date: Mon, 25 Apr 2016 18:02:56 +0200 Subject: [PATCH 62/65] fixed-data-table: Added missing 'extends React.Props' to ColumnGroupProps (#9092) --- fixed-data-table/fixed-data-table.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fixed-data-table/fixed-data-table.d.ts b/fixed-data-table/fixed-data-table.d.ts index e4bc79ff51..dcc188e5ba 100644 --- a/fixed-data-table/fixed-data-table.d.ts +++ b/fixed-data-table/fixed-data-table.d.ts @@ -398,7 +398,7 @@ declare namespace FixedDataTable { /** * Component that defines the attributes of a table column group. */ - export interface ColumnGroupProps { + export interface ColumnGroupProps extends __React.Props { /** * The horizontal alignment of the table cell content. * 'left', 'center', 'right' From 310c247694d7f31bd2e3198f71c55221f7c3a3c7 Mon Sep 17 00:00:00 2001 From: Howard Yeh Date: Mon, 25 Apr 2016 09:03:05 -0700 Subject: [PATCH 63/65] React native animated (#9057) * Type Animated.Value * react-native Animated.spring * react-native AnimatedValueXY type * react-native Animated.parallel * react-native Animated.event * react-native Animated components * react-native tweak Animated types * react-native add Animated.timing * react-native rewrite animation config as interface * react-native remove semi-colons * react-native refine the type AnimatedValue * react-native refine the type AnimatedValue * react-native animated no implicit any * react-native animated API tests * react-native more Animated API type coverage * react-native add Animated.Base as alias of commone base type * react-native fix typedef bug --- react-native/react-native-animated-tests.tsx | 95 ++++++ react-native/react-native.d.ts | 298 +++++++++++++++++++ 2 files changed, 393 insertions(+) create mode 100644 react-native/react-native-animated-tests.tsx diff --git a/react-native/react-native-animated-tests.tsx b/react-native/react-native-animated-tests.tsx new file mode 100644 index 0000000000..6fafd9f32f --- /dev/null +++ b/react-native/react-native-animated-tests.tsx @@ -0,0 +1,95 @@ +/// + +import * as React from 'react-native' + +import { + Animated, + View, +} from 'react-native'; + +function TestAnimatedAPI() { + // Value + const v1 = new Animated.Value(0); + const v2 = new Animated.Value(0); + + v1.setValue(0.1); + + v1.addListener(e => { + let n: number = e.value; + }); + + const v200 = v1.interpolate({ + inputRange: [0, 1], + outputRange: [0, 200], + }); + + // ValueXY + const position = new Animated.ValueXY({ x: 0, y: 0 }); + + // Animation functions + const spring1 = Animated.spring(v1, { + toValue: 0.5, + tension: 10, + }); + + const springXY = Animated.spring(position, { + toValue: { + x: 1, + y: 2, + } + }); + + spring1.start(); + spring1.stop(); + + Animated.parallel([ + Animated.spring(v1, { toValue: 1 }), + Animated.spring(v2, { toValue: 1 }), + ], { + stopTogether: true, + }); + + Animated.decay(v1, { + velocity: 2, + }); + + Animated.timing(v1, { + toValue: 1, + duration: 100, + delay: 100, + easing: v => v, + }); + + Animated.add(v1, v2); + Animated.multiply(v1, v2); + Animated.modulo(v1, 2); + + Animated.delay(100); + + Animated.sequence([ + spring1, + springXY, + ]); + + Animated.stagger(100, [ + spring1, + springXY, + ]); + + return ( + + + + + + + + ); +} \ No newline at end of file diff --git a/react-native/react-native.d.ts b/react-native/react-native.d.ts index 824fad6f77..8b2ab35f82 100644 --- a/react-native/react-native.d.ts +++ b/react-native/react-native.d.ts @@ -3453,6 +3453,304 @@ declare module "react-native" { vibrate(): void } + export module Animated { + // Most (all?) functions where AnimatedValue is used any subclass of Animated can be used as well. + type AnimatedValue = Animated; + type AnimatedValueXY = ValueXY; + + type Base = Animated; + + class Animated { + // Internal class, no public API. + } + + class AnimatedWithChildren extends Animated { + // Internal class, no public API. + } + + class AnimatedInterpolation extends AnimatedWithChildren { + interpolate(config: InterpolationConfigType): AnimatedInterpolation; + } + + type ExtrapolateType = 'extend' | 'identity' | 'clamp'; + + type InterpolationConfigType = { + inputRange: number[]; + outputRange: (number[] | string[]); + easing?: ((input: number) => number); + extrapolate?: ExtrapolateType; + extrapolateLeft?: ExtrapolateType; + extrapolateRight?: ExtrapolateType; + }; + + type ValueListenerCallback = (state: {value: number}) => void; + + /** + * Standard value for driving animations. One `Animated.Value` can drive + * multiple properties in a synchronized fashion, but can only be driven by one + * mechanism at a time. Using a new mechanism (e.g. starting a new animation, + * or calling `setValue`) will stop any previous ones. + */ + export class Value extends AnimatedWithChildren { + constructor(value: number); + + setValue(value: number): void; + + /** + * Sets an offset that is applied on top of whatever value is set, whether via + * `setValue`, an animation, or `Animated.event`. Useful for compensating + * things like the start of a pan gesture. + */ + setOffset(offset: number): void; + + /** + * Merges the offset value into the base value and resets the offset to zero. + * The final output of the value is unchanged. + */ + flattenOffset(): void; + + /** + * Adds an asynchronous listener to the value so you can observe updates from + * animations. This is useful because there is no way to + * synchronously read the value because it might be driven natively. + */ + addListener(callback: ValueListenerCallback): string; + + removeListener(id: string): void; + + removeAllListeners(): void; + + /** + * Stops any running animation or tracking. `callback` is invoked with the + * final value after stopping the animation, which is useful for updating + * state to match the animation position with layout. + */ + stopAnimation(callback?: (value: number) => void): void; + + /** + * Interpolates the value before updating the property, e.g. mapping 0-1 to + * 0-10. + */ + interpolate(config: InterpolationConfigType): AnimatedInterpolation; + } + + type ValueXYListenerCallback = (value: {x: number; y: number}) => void; + + /** + * 2D Value for driving 2D animations, such as pan gestures. Almost identical + * API to normal `Animated.Value`, but multiplexed. Contains two regular + * `Animated.Value`s under the hood. + */ + export class ValueXY extends AnimatedWithChildren { + x: AnimatedValue; + y: AnimatedValue; + + constructor(valueIn?: {x: number | AnimatedValue; y: number | AnimatedValue}); + + setValue(value: {x: number; y: number}): void; + + setOffset(offset: {x: number; y: number}): void; + + flattenOffset(): void + + stopAnimation(callback?: () => number): void; + + addListener(callback: ValueXYListenerCallback): string; + + removeListener(id: string): void; + + /** + * Converts `{x, y}` into `{left, top}` for use in style, e.g. + * + *```javascript + * style={this.state.anim.getLayout()} + *``` + */ + getLayout(): { left: AnimatedValue, top: AnimatedValue }; + + /** + * Converts `{x, y}` into a useable translation transform, e.g. + * + *```javascript + * style={{ + * transform: this.state.anim.getTranslateTransform() + * }} + *``` + */ + getTranslateTransform(): {[key: string]: AnimatedValue}[]; + + } + + type EndResult = {finished: boolean}; + type EndCallback = (result: EndResult) => void; + + interface CompositeAnimation { + start: (callback?: EndCallback) => void; + stop: () => void; + } + + interface AnimationConfig { + isInteraction?: boolean; + useNativeDriver?: boolean; + } + + /** + * Animates a value from an initial velocity to zero based on a decay + * coefficient. + */ + export function decay( + value: AnimatedValue | AnimatedValueXY, + config: DecayAnimationConfig + ): CompositeAnimation; + + interface DecayAnimationConfig extends AnimationConfig { + velocity: number | {x: number, y: number}; + deceleration?: number; + } + + /** + * Animates a value along a timed easing curve. The `Easing` module has tons + * of pre-defined curves, or you can use your own function. + */ + export var timing: ( + value: AnimatedValue | AnimatedValueXY, + config: TimingAnimationConfig + ) => CompositeAnimation; + + interface TimingAnimationConfig extends AnimationConfig { + toValue: number | AnimatedValue | {x: number, y: number} | AnimatedValueXY; + easing?: (value: number) => number; + duration?: number; + delay?: number; + } + + interface SpringAnimationConfig extends AnimationConfig { + toValue: number | AnimatedValue | {x: number, y: number} | AnimatedValueXY; + overshootClamping?: boolean; + restDisplacementThreshold?: number; + restSpeedThreshold?: number; + velocity?: number | {x: number, y: number}; + bounciness?: number; + speed?: number; + tension?: number; + friction?: number; + } + + /** + * Creates a new Animated value composed from two Animated values added + * together. + */ + export function add( + a: Animated, + b: Animated + ): AnimatedAddition; + + class AnimatedAddition extends AnimatedInterpolation {} + + /** + * Creates a new Animated value composed from two Animated values multiplied + * together. + */ + export function multiply( + a: Animated, + b: Animated + ): AnimatedMultiplication; + + class AnimatedMultiplication extends AnimatedInterpolation {} + + /** + * Creates a new Animated value that is the (non-negative) modulo of the + * provided Animated value + */ + export function modulo( + a: Animated, + modulus: number + ): AnimatedModulo; + + class AnimatedModulo extends AnimatedInterpolation {} + + /** + * Starts an animation after the given delay. + */ + export function delay(time: number): CompositeAnimation; + + /** + * Starts an array of animations in order, waiting for each to complete + * before starting the next. If the current running animation is stopped, no + * following animations will be started. + */ + export function sequence( + animations: Array + ): CompositeAnimation; + + /** + * Array of animations may run in parallel (overlap), but are started in + * sequence with successive delays. Nice for doing trailing effects. + */ + + export function stagger( + time: number, + animations: Array + ): CompositeAnimation + + /** + * Spring animation based on Rebound and Origami. Tracks velocity state to + * create fluid motions as the `toValue` updates, and can be chained together. + */ + export var spring: ( + value: AnimatedValue | AnimatedValueXY, + config: SpringAnimationConfig + ) => CompositeAnimation; + + type ParallelConfig = { + stopTogether?: boolean; // If one is stopped, stop all. default: true + } + + /** + * Starts an array of animations all at the same time. By default, if one + * of the animations is stopped, they will all be stopped. You can override + * this with the `stopTogether` flag. + */ + var parallel: ( + animations: Array, + config?: ParallelConfig + ) => CompositeAnimation; + + type Mapping = {[key: string]: Mapping} | AnimatedValue; + interface EventConfig { + listener?: Function + } + + /** + * Takes an array of mappings and extracts values from each arg accordingly, + * then calls `setValue` on the mapped outputs. e.g. + * + *```javascript + * onScroll={Animated.event( + * [{nativeEvent: {contentOffset: {x: this._scrollX}}}] + * {listener}, // Optional async listener + * ) + * ... + * onPanResponderMove: Animated.event([ + * null, // raw event arg ignored + * {dx: this._panX}, // gestureState arg + * ]), + *``` + */ + var event: ( + argMapping: Mapping[], + config?: EventConfig + ) => (...args: any[]) => void; + + /** + * Animated variants of the basic native views. Accepts Animated.Value for + * props and style. + */ + export var View: any; + export var Image: any; + export var Text: any; + } + ////////////////////////////////////////////////////////////////////////// // // R E - E X P O R T S From 768a3952704566c0665550700bcb131eee7b91a1 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 26 Apr 2016 19:11:47 -0500 Subject: [PATCH 64/65] When only a single column is returned, it is of type Column, not SortColumn (#8659) --- slickgrid/SlickGrid.d.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/slickgrid/SlickGrid.d.ts b/slickgrid/SlickGrid.d.ts index 9dbdd0e75c..96f91eaaf1 100644 --- a/slickgrid/SlickGrid.d.ts +++ b/slickgrid/SlickGrid.d.ts @@ -1395,9 +1395,13 @@ declare namespace Slick { export interface OnSortEventArgs extends GridEventArgs { multiColumnSort: boolean; - sortCol?: SortColumn; - sortCols?: SortColumn[]; + + // Single column returned + sortCol?: Column; sortAsc: boolean; + + // Multiple columns returned + sortCols?: SortColumn[]; } export interface OnScrollEventArgs extends GridEventArgs { From 08ed4e9f1869e37e29514d862e0158b40e550232 Mon Sep 17 00:00:00 2001 From: Nicholas Lydon Date: Wed, 27 Apr 2016 04:56:38 +0100 Subject: [PATCH 65/65] React TestUtils SyntheticEventData extends browser Event (#9000) * SyntheticEventData extends browser Event From https://facebook.github.io/react/docs/events.html Your event handlers will be passed instances of SyntheticEvent, a cross-browser wrapper around the browser's native event. It has the same interface as the browser's native event, including stopPropagation() and preventDefault(), except the events work identically across all browsers. * make react synthetic event properties optional --- react/react-addons-test-utils.d.ts | 20 +++++++++++++++++--- react/react-global-tests.ts | 3 ++- react/react-tests.ts | 2 +- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/react/react-addons-test-utils.d.ts b/react/react-addons-test-utils.d.ts index 8bf50366e9..9807300ff4 100644 --- a/react/react-addons-test-utils.d.ts +++ b/react/react-addons-test-utils.d.ts @@ -6,7 +6,22 @@ /// declare namespace __React { - interface SyntheticEventData { + interface OptionalEventProperties { + bubbles?: boolean; + cancelable?: boolean; + currentTarget?: EventTarget; + defaultPrevented?: boolean; + eventPhase?: number; + isTrusted?: boolean; + nativeEvent?: Event; + preventDefault?(): void; + stopPropagation?(): void; + target?: EventTarget; + timeStamp?: Date; + type?: string; + } + + interface SyntheticEventData extends OptionalEventProperties { altKey?: boolean; button?: number; buttons?: number; @@ -41,8 +56,7 @@ declare namespace __React { } interface EventSimulator { - (element: Element, eventData?: SyntheticEventData): void; - (component: Component, eventData?: SyntheticEventData): void; + (element: Element | Component, eventData?: SyntheticEventData): void; } interface MockedComponentClass { diff --git a/react/react-global-tests.ts b/react/react-global-tests.ts index 3aaf4b2c1f..1ed7f8484e 100644 --- a/react/react-global-tests.ts +++ b/react/react-global-tests.ts @@ -418,9 +418,10 @@ React.createClass({ // TestUtils addon // -------------------------------------------------------------------------- var node: Element; + React.addons.TestUtils.Simulate.click(node); React.addons.TestUtils.Simulate.change(node); -React.addons.TestUtils.Simulate.keyDown(node, { key: "Enter" }); +React.addons.TestUtils.Simulate.keyDown(node, { key: "Enter", cancelable: false }); var renderer: React.ShallowRenderer = React.addons.TestUtils.createRenderer(); diff --git a/react/react-tests.ts b/react/react-tests.ts index dc0a409dcf..5976fb23bd 100644 --- a/react/react-tests.ts +++ b/react/react-tests.ts @@ -553,7 +553,7 @@ var node: Element = TestUtils.renderIntoDocument(React.DOM.div()); TestUtils.Simulate.click(node); TestUtils.Simulate.change(node); -TestUtils.Simulate.keyDown(node, { key: "Enter" }); +TestUtils.Simulate.keyDown(node, { key: "Enter", cancelable: false }); var renderer: React.ShallowRenderer = TestUtils.createRenderer();