From bd3f46b25e232e9fc126f17e15819b5135898a23 Mon Sep 17 00:00:00 2001 From: Thor Sedeke Date: Sun, 29 Apr 2018 18:04:49 +0200 Subject: [PATCH 001/189] Add definition for koa-response-time --- types/koa-response-time/index.d.ts | 11 +++++++++ .../koa-response-time-tests.ts | 4 ++++ types/koa-response-time/tsconfig.json | 23 +++++++++++++++++++ types/koa-response-time/tslint.json | 1 + 4 files changed, 39 insertions(+) create mode 100644 types/koa-response-time/index.d.ts create mode 100644 types/koa-response-time/koa-response-time-tests.ts create mode 100644 types/koa-response-time/tsconfig.json create mode 100644 types/koa-response-time/tslint.json diff --git a/types/koa-response-time/index.d.ts b/types/koa-response-time/index.d.ts new file mode 100644 index 0000000000..6daf0c8566 --- /dev/null +++ b/types/koa-response-time/index.d.ts @@ -0,0 +1,11 @@ +// Type definitions for koa-response-time 2.0 +// Project: https://github.com/koajs/response-time#readme +// Definitions by: Thor Sedeke +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as koa from 'koa'; + +declare function koa_response_time(): koa.Middleware; + +export = koa_response_time; diff --git a/types/koa-response-time/koa-response-time-tests.ts b/types/koa-response-time/koa-response-time-tests.ts new file mode 100644 index 0000000000..6b35c60f9a --- /dev/null +++ b/types/koa-response-time/koa-response-time-tests.ts @@ -0,0 +1,4 @@ +import koaResponseTime = require('koa-response-time'); +import Koa = require('koa'); + +new Koa().use(koaResponseTime()); diff --git a/types/koa-response-time/tsconfig.json b/types/koa-response-time/tsconfig.json new file mode 100644 index 0000000000..cd6c50be36 --- /dev/null +++ b/types/koa-response-time/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "koa-response-time-tests.ts" + ] +} diff --git a/types/koa-response-time/tslint.json b/types/koa-response-time/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/koa-response-time/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 29270f0837c7d81cd698ff721a9f2a020c74d454 Mon Sep 17 00:00:00 2001 From: Thor Sedeke Date: Sun, 29 Apr 2018 20:02:18 +0200 Subject: [PATCH 002/189] Update to module definition --- types/koa-response-time/index.d.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/types/koa-response-time/index.d.ts b/types/koa-response-time/index.d.ts index 6daf0c8566..8d55bb9188 100644 --- a/types/koa-response-time/index.d.ts +++ b/types/koa-response-time/index.d.ts @@ -4,8 +4,10 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -import * as koa from 'koa'; +declare module 'koa-response-time' { -declare function koa_response_time(): koa.Middleware; + function koa_response_time(): any; + namespace koa_response_time { } -export = koa_response_time; + export = koa_response_time; +} From 848df4943f737a474b6c5d8821a50a6d6c6c7b06 Mon Sep 17 00:00:00 2001 From: Thor Sedeke Date: Sun, 29 Apr 2018 20:06:16 +0200 Subject: [PATCH 003/189] Update to 4 spaces --- types/koa-response-time/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/koa-response-time/index.d.ts b/types/koa-response-time/index.d.ts index 8d55bb9188..a8ae9b0378 100644 --- a/types/koa-response-time/index.d.ts +++ b/types/koa-response-time/index.d.ts @@ -6,8 +6,8 @@ declare module 'koa-response-time' { - function koa_response_time(): any; - namespace koa_response_time { } + function koa_response_time(): any; + namespace koa_response_time { } - export = koa_response_time; + export = koa_response_time; } From 4d560d85373686f47752d87466478666b31df38b Mon Sep 17 00:00:00 2001 From: Thor Sedeke Date: Sun, 29 Apr 2018 22:26:25 +0200 Subject: [PATCH 004/189] Remove module declaration --- types/koa-response-time/index.d.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/types/koa-response-time/index.d.ts b/types/koa-response-time/index.d.ts index a8ae9b0378..6c9f2131fc 100644 --- a/types/koa-response-time/index.d.ts +++ b/types/koa-response-time/index.d.ts @@ -4,10 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -declare module 'koa-response-time' { +declare function koa_response_time(): any; +declare namespace koa_response_time { } - function koa_response_time(): any; - namespace koa_response_time { } - - export = koa_response_time; -} +export = koa_response_time; From a84e447cb1c2a3e37150680ce2442af16e26751f Mon Sep 17 00:00:00 2001 From: Arne Schubert Date: Wed, 2 May 2018 18:39:00 +0200 Subject: [PATCH 005/189] Add type definition for "request-as-curl" (#25472) * Add type definitions for request-as-curl * Fix TypeScript version in comment * Add correct project URL --- types/request-as-curl/index.d.ts | 15 ++++++++++++ .../request-as-curl/request-as-curl-tests.ts | 14 +++++++++++ types/request-as-curl/tsconfig.json | 23 +++++++++++++++++++ types/request-as-curl/tslint.json | 1 + 4 files changed, 53 insertions(+) create mode 100644 types/request-as-curl/index.d.ts create mode 100644 types/request-as-curl/request-as-curl-tests.ts create mode 100644 types/request-as-curl/tsconfig.json create mode 100644 types/request-as-curl/tslint.json diff --git a/types/request-as-curl/index.d.ts b/types/request-as-curl/index.d.ts new file mode 100644 index 0000000000..e24266c53d --- /dev/null +++ b/types/request-as-curl/index.d.ts @@ -0,0 +1,15 @@ +// Type definitions for request-as-curl 0.1 +// Project: https://github.com/azproduction/node-request-as-curl +// Definitions by: Arne Schubert +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { CoreOptions, Request, RequestAPI, RequiredUriUrl } from "request"; + +export = request_as_curl; + +declare function request_as_curl(request: RequestAPI, body?: any): string; + +declare namespace request_as_curl { + function serialize(request: RequestAPI): string; +} diff --git a/types/request-as-curl/request-as-curl-tests.ts b/types/request-as-curl/request-as-curl-tests.ts new file mode 100644 index 0000000000..2865ce3886 --- /dev/null +++ b/types/request-as-curl/request-as-curl-tests.ts @@ -0,0 +1,14 @@ +import requestAsCurl = require("request-as-curl"); + +import { CoreOptions, Request, RequestAPI, RequiredUriUrl } from "request"; + +let stringValue: string; +const req: RequestAPI = {} as any; + +// with optional data +stringValue = requestAsCurl(req, {test: "data"}); + +// without optional data +stringValue = requestAsCurl(req); + +stringValue = requestAsCurl.serialize(req); diff --git a/types/request-as-curl/tsconfig.json b/types/request-as-curl/tsconfig.json new file mode 100644 index 0000000000..9deda4ea8e --- /dev/null +++ b/types/request-as-curl/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "request-as-curl-tests.ts" + ] +} diff --git a/types/request-as-curl/tslint.json b/types/request-as-curl/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/request-as-curl/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From e05a329534215872e7490511bab6faa0586fdbec Mon Sep 17 00:00:00 2001 From: "Carry.Wu" Date: Thu, 3 May 2018 23:01:04 +0800 Subject: [PATCH 006/189] Added type definitions for behavior3 (#25469) * add behavior3 types * fix test issues * type behavior3 remove jsdoc params. --- types/behavior3/behavior3-tests.ts | 73 +++ types/behavior3/index.d.ts | 908 +++++++++++++++++++++++++++++ types/behavior3/tsconfig.json | 23 + types/behavior3/tslint.json | 1 + 4 files changed, 1005 insertions(+) create mode 100644 types/behavior3/behavior3-tests.ts create mode 100644 types/behavior3/index.d.ts create mode 100644 types/behavior3/tsconfig.json create mode 100644 types/behavior3/tslint.json diff --git a/types/behavior3/behavior3-tests.ts b/types/behavior3/behavior3-tests.ts new file mode 100644 index 0000000000..b612209a09 --- /dev/null +++ b/types/behavior3/behavior3-tests.ts @@ -0,0 +1,73 @@ +import '../behavior3'; + +// Test decode +const blackboard = new b3.Blackboard(); +const behaviorTree = new b3.BehaviorTree(); +behaviorTree.load({ + version: "0.3.0", + scope: "tree", + id: "6bc03cd0-38ef-4a3e-8e08-54c412491525", + title: "A behavior tree", + description: "", + root: "607d29f5-9dbc-4cc4-8ebb-e57c4908d87b", + properties: {}, + nodes: { + "607d29f5-9dbc-4cc4-8ebb-e57c4908d87b": { + id: "607d29f5-9dbc-4cc4-8ebb-e57c4908d87b", + name: "Sequence", + title: "Sequence", + description: "", + properties: {}, + display: { + x: -216, + y: -36 + }, + children: [ + "09f04185-205b-40c0-8494-ffd53ffd0820", + "df7366f8-999a-4971-872c-cef57607f99f" + ] + }, + "df7366f8-999a-4971-872c-cef57607f99f": { + id: "df7366f8-999a-4971-872c-cef57607f99f", + name: "Runner", + title: "Runner", + description: "", + properties: {}, + display: { + x: -12, + y: -36 + } + }, + "e498e1a5-5295-43c3-8716-20dd6d3407f2": { + id: "e498e1a5-5295-43c3-8716-20dd6d3407f2", + name: "Succeeder", + title: "Succeeder", + description: "", + properties: {}, + display: { + x: 192, + y: -96 + } + }, + "09f04185-205b-40c0-8494-ffd53ffd0820": { + id: "09f04185-205b-40c0-8494-ffd53ffd0820", + name: "Inverter", + title: "Inverter", + description: "", + properties: {}, + display: { + x: -36, + y: -108 + }, + child: "e498e1a5-5295-43c3-8716-20dd6d3407f2" + } + }, + display: { + camera_x: 640, + camera_y: 324, + camera_z: 1, + x: -324, + y: -36 + } + }); +behaviorTree.tick(null, blackboard); diff --git a/types/behavior3/index.d.ts b/types/behavior3/index.d.ts new file mode 100644 index 0000000000..7cb3ad9deb --- /dev/null +++ b/types/behavior3/index.d.ts @@ -0,0 +1,908 @@ +// Type definitions for behavior3 0.2 +// Project: https://github.com/behavior3/behavior3js +// Definitions by: carry.wu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Behavior3JS + * =========== + * + * * * * + * + * **Behavior3JS** is a Behavior Tree library written in JavaScript. It + * provides structures and algorithms that assist you in the task of creating + * intelligent agents for your game or application. Check it out some features + * of Behavior3JS: + * + * - Based on the work of (Marzinotto et al., 2014), in which they propose a + * **formal**, **consistent** and **general** definition of Behavior Trees; + * - **Optimized to control multiple agents**: you can use a single behavior + * tree instance to handle hundreds of agents; + * - It was **designed to load and save trees in a JSON format**, in order to + * use, edit and test it in multiple environments, tools and languages; + * - A **cool visual editor** which you can access online; + * - Several **composite, decorator and action nodes** available within the + * library. You still can define your own nodes, including composites and + * decorators; + * - **Completely free**, the core module and the visual editor are all + * published under the MIT License, which means that you can use them for + * your open source and commercial projects; + * - **Lightweight**! + * + * Visit http://behavior3.com to know more! + * + * + * ## Core Classes and Functions + * + * This library include the following core structures... + * + * + * **Public:** + * + * - **BehaviorTree**: the structure that represents a Behavior Tree; + * - **Blackboard**: represents a "memory" in an agent and is required to to + * run a `BehaviorTree`; + * - **Composite**: base class for all composite nodes; + * - **Decorator**: base class for all decorator nodes; + * - **Action**: base class for all action nodes; + * - **Condition**: base class for all condition nodes; + * + * + * **Internal:** + * + * - **Tick**: used as container and tracking object through the tree during + * the tick signal; + * - **BaseNode**: the base class that provide all common node features; + * + * *Some classes are used internally on Behavior3JS, but you may need to access + * its functionalities eventually, specially the `Tick` object.* + * + * + * **Nodes:** + * + * - **Composite Nodes**: Sequence, Priority, MemSequence, MemPriority. + * - **Decorators**: Inverter, Limiter, MaxTime, Repeater, + * RepeaterUntilFailure, RepeaterUntilSuccess. + * - **Actions**: Succeeder, Failer, Error, Runner, Wait. + * + * ## The list of all constants in B3. + * + * NAME | VALUE + * ------------------- | ---------------------- + * VERSION | depends on the version + * | + * **Node State** | + * SUCCESS | 1 + * FAILURE | 2 + * RUNNING | 3 + * ERROR | 4 + * | + * **Node categories** | + * COMPOSITE | 'composite' + * DECORATOR | 'decorator' + * ACTION | 'action' + * CONDITION | 'condition' + * + */ +declare namespace b3 { + /** + * This function is used to create unique IDs for trees and nodes. + * + * (consult http://www.ietf.org/rfc/rfc4122.txt). + * + */ + function createUUID(): string; + + /** + * The BaseNode class is used as super class to all nodes in BehaviorJS. It + * comprises all common variables and methods that a node must have to + * execute. + * + * **IMPORTANT:** Do not inherit from this class, use `Composite`, + * `Decorator`, `Action` or `Condition`, instead. + * + * The attributes are specially designed to serialization of the node in a + * JSON format. In special, the `parameters` attribute can be set into the + * visual editor (thus, in the JSON file), and it will be used as parameter + * on the node initialization at `BehaviorTree.load`. + * + * BaseNode also provide 5 callback methods, which the node implementations + * can override. They are `enter`, `open`, `tick`, `close` and `exit`. See + * their documentation to know more. These callbacks are called inside the + * `_execute` method, which is called in the tree traversal. + * + */ + class BaseNode { + /** + * Initialization method. + */ + constructor({category, name, title, description, properties}?: {category?: string, name?: string, title?: string, description?: string, properties?: any}); + + /** + * This is the main method to propagate the tick signal to this node. This + * method calls all callbacks: `enter`, `open`, `tick`, `close`, and + * `exit`. It only opens a node if it is not already open. In the same + * way, this method only close a node if the node returned a status + * different of `RUNNING`. + * + */ + _execute(tick: Tick): number; + + /** + * Wrapper for enter method. + */ + _enter(tick: Tick): void; + + /** + * Wrapper for open method. + */ + _open(tick: Tick): void; + + /** + * Wrapper for tick method. + */ + _tick(tick: Tick): number; + + /** + * Wrapper for close method. + */ + _close(tick: Tick): void; + + /** + * Wrapper for exit method. + */ + _exit(tick: Tick): void; + + /** + * Enter method, override this to use. It is called every time a node is + * asked to execute, before the tick itself. + */ + enter(tick: Tick): void; + + /** + * Open method, override this to use. It is called only before the tick + * callback and only if the not isn't closed. + * + * Note: a node will be closed if it returned `RUNNING` in the tick. + * + */ + open(tick: Tick): void; + + /** + * Tick method, override this to use. This method must contain the real + * execution of node (perform a task, call children, etc.). It is called + * every time a node is asked to execute. + * + */ + tick(tick: Tick): void; + + /** + * Close method, override this to use. This method is called after the tick + * callback, and only if the tick return a state different from + * `RUNNING`. + * + */ + close(tick: Tick): void; + + /** + * Exit method, override this to use. Called every time in the end of the + * execution. + * + */ + exit(tick: Tick): void; + } + + /** + * Action is the base class for all action nodes. Thus, if you want to create + * new custom action nodes, you need to inherit from this class. For example, + * take a look at the Runner action: + * + * class Runner extends b3.Action { + * constructor(){ + * super({name: 'Runner'}); + * } + * tick(tick) { + * return b3.RUNNING; + * } + * }; + * + */ + class Action extends BaseNode { + /** + * Creates an instance of Action. + */ + constructor({name, title, properties}?: {name?: string, title?: string, properties?: any}); + } + + /** + * The BehaviorTree class, as the name implies, represents the Behavior Tree + * structure. + * + * There are two ways to construct a Behavior Tree: by manually setting the + * root node, or by loading it from a data structure (which can be loaded + * from a JSON). Both methods are shown in the examples below and better + * explained in the user guide. + * + * The tick method must be called periodically, in order to send the tick + * signal to all nodes in the tree, starting from the root. The method + * `BehaviorTree.tick` receives a target object and a blackboard as + * parameters. The target object can be anything: a game agent, a system, a + * DOM object, etc. This target is not used by any piece of Behavior3JS, + * i.e., the target object will only be used by custom nodes. + * + * The blackboard is obligatory and must be an instance of `Blackboard`. This + * requirement is necessary due to the fact that neither `BehaviorTree` or + * any node will store the execution variables in its own object (e.g., the + * BT does not store the target, information about opened nodes or number of + * times the tree was called). But because of this, you only need a single + * tree instance to control multiple (maybe hundreds) objects. + * + * Manual construction of a Behavior Tree + * -------------------------------------- + * + * var tree = new b3.BehaviorTree(); + * + * tree.root = new b3.Sequence({children:[ + * new b3.Priority({children:[ + * new MyCustomNode(), + * new MyCustomNode() + * ]}), + * ... + * ]}); + * + * + * Loading a Behavior Tree from data structure + * ------------------------------------------- + * + * var tree = new b3.BehaviorTree(); + * + * tree.load({ + * 'title' : 'Behavior Tree title' + * 'description' : 'My description' + * 'root' : 'node-id-1' + * 'nodes' : { + * 'node-id-1' : { + * 'name' : 'Priority', // this is the node type + * 'title' : 'Root Node', + * 'description' : 'Description', + * 'children' : ['node-id-2', 'node-id-3'], + * }, + * ... + * } + * }) + * + */ + class BehaviorTree { + /** + * Initialization method. + */ + constructor(); + + /** + * This method loads a Behavior Tree from a data structure, populating this + * object with the provided data. Notice that, the data structure must + * follow the format specified by Behavior3JS. Consult the guide to know + * more about this format. + * + * You probably want to use custom nodes in your BTs, thus, you need to + * provide the `names` object, in which this method can find the nodes by + * `names[NODE_NAME]`. This variable can be a namespace or a dictionary, + * as long as this method can find the node by its name, for example: + * + * //json + * ... + * 'node1': { + * 'name': MyCustomNode, + * 'title': ... + * } + * ... + * + * //code + * var bt = new b3.BehaviorTree(); + * bt.load(data, {'MyCustomNode':MyCustomNode}) + * + * + */ + load(data: any, names?: any): void; + + /** + * This method dump the current BT into a data structure. + * + * Note: This method does not record the current node parameters. Thus, + * it may not be compatible with load for now. + * + */ + dump(): any; + + /** + * Propagates the tick signal through the tree, starting from the root. + * + * This method receives a target object of any type (Object, Array, + * DOMElement, whatever) and a `Blackboard` instance. The target object has + * no use at all for all Behavior3JS components, but surely is important + * for custom nodes. The blackboard instance is used by the tree and nodes + * to store execution variables (e.g., last node running) and is obligatory + * to be a `Blackboard` instance (or an object with the same interface). + * + * Internally, this method creates a Tick object, which will store the + * target and the blackboard objects. + * + * Note: BehaviorTree stores a list of open nodes from last tick, if these + * nodes weren't called after the current tick, this method will close them + * automatically. + * + */ + tick(target: any, blackboard: Blackboard): string; + } + + /** + * The Blackboard is the memory structure required by `BehaviorTree` and its + * nodes. It only have 2 public methods: `set` and `get`. These methods works + * in 3 different contexts: global, per tree, and per node per tree. + * + * Suppose you have two different trees controlling a single object with a + * single blackboard, then: + * + * - In the global context, all nodes will access the stored information. + * - In per tree context, only nodes sharing the same tree share the stored + * information. + * - In per node per tree context, the information stored in the blackboard + * can only be accessed by the same node that wrote the data. + * + * The context is selected indirectly by the parameters provided to these + * methods, for example: + * + * // getting/setting variable in global context + * blackboard.set('testKey', 'value'); + * var value = blackboard.get('testKey'); + * + * // getting/setting variable in per tree context + * blackboard.set('testKey', 'value', tree.id); + * var value = blackboard.get('testKey', tree.id); + * + * // getting/setting variable in per node per tree context + * blackboard.set('testKey', 'value', tree.id, node.id); + * var value = blackboard.get('testKey', tree.id, node.id); + * + * Note: Internally, the blackboard store these memories in different + * objects, being the global on `_baseMemory`, the per tree on `_treeMemory` + * and the per node per tree dynamically create inside the per tree memory + * (it is accessed via `_treeMemory[id].nodeMemory`). Avoid to use these + * variables manually, use `get` and `set` instead. + * + */ + class Blackboard { + /** + * Initialization method. + */ + constructor(); + + /** + * Internal method to retrieve the tree context memory. If the memory does + * not exist, this method creates it. + * + */ + _getTreeMemory(treeScope: string): any; + + /** + * Internal method to retrieve the node context memory, given the tree + * memory. If the memory does not exist, this method creates is. + * + */ + _getNodeMemory(treeMemory: string, nodeScope: string): any; + + /** + * Internal method to retrieve the context memory. If treeScope and + * nodeScope are provided, this method returns the per node per tree + * memory. If only the treeScope is provided, it returns the per tree + * memory. If no parameter is provided, it returns the global memory. + * Notice that, if only nodeScope is provided, this method will still + * return the global memory. + * + */ + _getMemory(treeScope: string, nodeScope: string): any; + + /** + * Stores a value in the blackboard. If treeScope and nodeScope are + * provided, this method will save the value into the per node per tree + * memory. If only the treeScope is provided, it will save the value into + * the per tree memory. If no parameter is provided, this method will save + * the value into the global memory. Notice that, if only nodeScope is + * provided (but treeScope not), this method will still save the value into + * the global memory. + * + */ + set(key: string, value: string, treeScope: string, nodeScope: string): void; + + /** + * Retrieves a value in the blackboard. If treeScope and nodeScope are + * provided, this method will retrieve the value from the per node per tree + * memory. If only the treeScope is provided, it will retrieve the value + * from the per tree memory. If no parameter is provided, this method will + * retrieve from the global memory. If only nodeScope is provided (but + * treeScope not), this method will still try to retrieve from the global + * memory. + * + */ + get(key: string, treeScope: string, nodeScope: string): any; + } + + /** + * Composite is the base class for all composite nodes. Thus, if you want to + * create new custom composite nodes, you need to inherit from this class. + * + * When creating composite nodes, you will need to propagate the tick signal + * to the children nodes manually. To do that, override the `tick` method and + * call the `_execute` method on all nodes. For instance, take a look at how + * the Sequence node inherit this class and how it call its children: + * + * // Inherit from Composite, using the util function Class. + * class Sequence extends Composite { + * + * constructor(){ + * // Remember to set the name of the node. + * super({name: 'Sequence'}); + * } + * + * // Override the tick function + * tick(tick) { + * + * // Iterates over the children + * for (var i=0; i Date: Thu, 3 May 2018 11:28:04 -0400 Subject: [PATCH 007/189] Added intercom-client (#25510) * added feather-icons * added strictfunctiontypes * added intercom-client * splitting pull requests by package --- types/intercom-client/index.d.ts | 13 +++++++++++++ types/intercom-client/intercom-client-tests.ts | 3 +++ types/intercom-client/tsconfig.json | 16 ++++++++++++++++ types/intercom-client/tslint.json | 1 + 4 files changed, 33 insertions(+) create mode 100644 types/intercom-client/index.d.ts create mode 100644 types/intercom-client/intercom-client-tests.ts create mode 100644 types/intercom-client/tsconfig.json create mode 100644 types/intercom-client/tslint.json diff --git a/types/intercom-client/index.d.ts b/types/intercom-client/index.d.ts new file mode 100644 index 0000000000..b68dc87e71 --- /dev/null +++ b/types/intercom-client/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for intercom-client 2.9 +// Project: https://github.com/intercom/intercom-node +// Definitions by: Jinesh Shah +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface IdentityVerificationOptions { + secretKey: string; + identifier: string; +} + +export const IdentityVerification: { + userHash(opts: IdentityVerificationOptions): string; +}; diff --git a/types/intercom-client/intercom-client-tests.ts b/types/intercom-client/intercom-client-tests.ts new file mode 100644 index 0000000000..e74dab4f53 --- /dev/null +++ b/types/intercom-client/intercom-client-tests.ts @@ -0,0 +1,3 @@ +import * as intercom from "intercom-client"; + +intercom.IdentityVerification.userHash({ secretKey: "", identifier: "" }); // $ExpectType string diff --git a/types/intercom-client/tsconfig.json b/types/intercom-client/tsconfig.json new file mode 100644 index 0000000000..a74d113775 --- /dev/null +++ b/types/intercom-client/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": ["index.d.ts", "intercom-client-tests.ts"] +} diff --git a/types/intercom-client/tslint.json b/types/intercom-client/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/intercom-client/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 73a7a2d99ff63502d7fb426133a340fadc945538 Mon Sep 17 00:00:00 2001 From: Jinesh Shah Date: Thu, 3 May 2018 11:28:43 -0400 Subject: [PATCH 008/189] Added feather-icons (#25509) * added feather-icons * added strictfunctiontypes * added intercom-client --- types/feather-icons/feather-icons-tests.ts | 7 +++++++ types/feather-icons/index.d.ts | 22 ++++++++++++++++++++++ types/feather-icons/tsconfig.json | 16 ++++++++++++++++ types/feather-icons/tslint.json | 1 + 4 files changed, 46 insertions(+) create mode 100644 types/feather-icons/feather-icons-tests.ts create mode 100644 types/feather-icons/index.d.ts create mode 100644 types/feather-icons/tsconfig.json create mode 100644 types/feather-icons/tslint.json diff --git a/types/feather-icons/feather-icons-tests.ts b/types/feather-icons/feather-icons-tests.ts new file mode 100644 index 0000000000..fc71f25798 --- /dev/null +++ b/types/feather-icons/feather-icons-tests.ts @@ -0,0 +1,7 @@ +import * as feather from "feather-icons"; + +feather.replace(); // $ExpectType void +feather.icons[""].toSvg(); // $ExpectType string +feather.icons[""].name; // $ExpectType string +feather.icons[""].contents; // $ExpectType string +feather.icons[""].tags; // $ExpectType string[] diff --git a/types/feather-icons/index.d.ts b/types/feather-icons/index.d.ts new file mode 100644 index 0000000000..34acfb80aa --- /dev/null +++ b/types/feather-icons/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for feather-icons 4.7 +// Project: https://github.com/feathericons/feather#readme +// Definitions by: Jinesh Shah +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export as namespace feather; + +export interface FeatherAttributes { + [key: string]: string | number; +} + +export function replace(options?: FeatherAttributes): void; + +export const icons: { + [key: string]: { + name: string; + contents: string; + tags: string[]; + attrs: FeatherAttributes; + toSvg: (options?: FeatherAttributes) => string; + }; +}; diff --git a/types/feather-icons/tsconfig.json b/types/feather-icons/tsconfig.json new file mode 100644 index 0000000000..ab8237b4de --- /dev/null +++ b/types/feather-icons/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": ["index.d.ts", "feather-icons-tests.ts"] +} diff --git a/types/feather-icons/tslint.json b/types/feather-icons/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/feather-icons/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From ee09f446b0b61f27a9e774048f87347a0a1c15d8 Mon Sep 17 00:00:00 2001 From: James Bromwell <943160+thw0rted@users.noreply.github.com> Date: Thu, 3 May 2018 17:29:14 +0200 Subject: [PATCH 009/189] ws: add address method to Server (#25503) --- types/ws/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/ws/index.d.ts b/types/ws/index.d.ts index 7848bf3992..f9bda66eba 100644 --- a/types/ws/index.d.ts +++ b/types/ws/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ws 4.0 +// Type definitions for ws 5.1 // Project: https://github.com/websockets/ws // Definitions by: Paul Loyd // Matt Silverlock @@ -176,6 +176,7 @@ declare namespace WebSocket { constructor(options?: ServerOptions, callback?: () => void); + address(): { port: number; family: string; address: string; }; close(cb?: (err?: Error) => void): void; handleUpgrade(request: http.IncomingMessage, socket: net.Socket, upgradeHead: Buffer, callback: (client: WebSocket) => void): void; From 884979debd85d0bad3cb3b999c0574bf46e49fb5 Mon Sep 17 00:00:00 2001 From: Kyle Roach Date: Thu, 3 May 2018 11:50:27 -0400 Subject: [PATCH 010/189] [react-native] ScrollView - make scrollToLocation method (#25505) --- types/react-native/index.d.ts | 20 ++++++++--------- types/react-native/test/index.tsx | 37 ++++++++++++++++++++----------- 2 files changed, 34 insertions(+), 23 deletions(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 3b51e1012f..3da848137d 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -3784,14 +3784,6 @@ export interface SectionListData extends SectionBase { [key: string]: any; } -export interface SectionListScrollParams { - animated?: boolean; - itemIndex: number; - sectionIndex: number; - viewOffset?: number; - viewPosition?: number; -} - export interface SectionListProps extends ScrollViewProps { /** * Rendered in between adjacent Items within each section. @@ -3900,7 +3892,17 @@ export interface SectionListProps extends ScrollViewProps { * Only enabled by default on iOS because that is the platform standard there. */ stickySectionHeadersEnabled?: boolean; +} +export interface SectionListScrollParams { + animated?: boolean; + itemIndex: number; + sectionIndex: number; + viewOffset?: number; + viewPosition?: number; +} + +export interface SectionListStatic extends React.ComponentClass> { /** * Scrolls to the item at the specified sectionIndex and itemIndex (within the section) * positioned in the viewable area such that viewPosition 0 places it at the top @@ -3909,8 +3911,6 @@ export interface SectionListProps extends ScrollViewProps { scrollToLocation?(params: SectionListScrollParams): void; } -export interface SectionListStatic extends React.ComponentClass> {} - /** * @see https://facebook.github.io/react-native/docs/virtualizedlist.html#props */ diff --git a/types/react-native/test/index.tsx b/types/react-native/test/index.tsx index a4564d6614..0bd0309963 100644 --- a/types/react-native/test/index.tsx +++ b/types/react-native/test/index.tsx @@ -259,6 +259,12 @@ export class FlatListTest extends React.Component, {}> { } export class SectionListTest extends React.Component, {}> { + myList: SectionList + + scrollMe = () => { + this.myList.scrollToLocation({itemIndex: 0, sectionIndex: 1}); + } + render() { const sections = [ { @@ -277,19 +283,24 @@ export class SectionListTest extends React.Component, { ]; return ( - ( - - {section.title} - - )} - renderItem={(info: { item: string }) => ( - - {info.item} - - )} - /> + +