Merge remote-tracking branch 'upstream/master'

This commit is contained in:
stabilo
2018-10-20 16:00:09 +10:00
551 changed files with 44876 additions and 34658 deletions
+4 -3
View File
@@ -533,9 +533,10 @@ AFRAME.registerComponent('audioanalyser-waveform', {
rings.forEach(function transformRing(ring: THREE.Line, index: number) {
var normLevel;
normLevel = levels[RINGCOUNT - index - 1] + 0.01; // Avoid scaling by 0.
(ring.material as THREE.LineBasicMaterial).color.setHSL(colors[index], 1, normLevel);
ring.material.linewidth = normLevel * 3;
ring.material.opacity = normLevel;
const lineMaterial = ring.material as THREE.LineBasicMaterial;
lineMaterial.color.setHSL(colors[index], 1, normLevel);
lineMaterial.linewidth = normLevel * 3;
lineMaterial.opacity = normLevel;
ring.scale.z = normLevel;
});
},
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/epoberezkin/ajv-errors
// Definitions by: Afshawn Lotfi <https://github.com/afshawnlotfi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import { Ajv } from "ajv";
+84 -59
View File
@@ -1,85 +1,110 @@
// Tests for Amplitude SDK TypeScript definitions
module Amplitude.Tests {
function all() {
amplitude.init('YOUR_API_KEY_HERE', null, {
// optional configuration options
var client: amplitude.AmplitudeClient = new amplitude.AmplitudeClient();
var identify: amplitude.Identify = new amplitude.Identify();
var revenue: amplitude.Revenue = new amplitude.Revenue();
client = amplitude.getInstance();
client = amplitude.getInstance('some name');
amplitude.__VERSION__ === '1.2.3';
amplitude.options.logLevel = 'WARN';
amplitude.init('API_KEY', 'USER_ID', {
saveEvents: true,
includeUtm: true,
includeReferrer: true,
batchEvents: true,
eventUploadThreshold: 50
});
amplitude.init('YOUR_API_KEY_HERE', 'USER_ID_HERE', null, () => {});
}, function () { });
amplitude.init('API_KEY', 'USER_ID', { includeReferrer: true, includeUtm: true });
amplitude.init('API_KEY', 'USER_ID');
amplitude.init('API_KEY');
amplitude.logEvent('EVENT_IDENTIFIER_HERE');
amplitude.setUserId('USER_ID_HERE');
amplitude.init('YOUR_API_KEY_HERE', 'USER_ID_HERE');
amplitude.setUserId(null); // not string 'null'
amplitude.setVersionName('VERSION_NAME_HERE');
amplitude.regenerateDeviceId();
amplitude.setDeviceId('CUSTOM_DEVICE_ID');
amplitude.logEvent('EVENT_IDENTIFIER_HERE', {
'color': 'blue',
'age': 20,
'key': 'value'
});
amplitude.logEvent('Clicked Homepage Button', { 'finished_flow': false, 'clicks': 15 });
amplitude.logEvent('EVENT_IDENTIFIER_HERE', { 'color': 'blue', 'age': 20, 'key': 'value' });
amplitude.logEvent("EVENT_IDENTIFIER_HERE", null, (httpCode, response) => { });
amplitude.logEventWithGroups('initialize_game', { 'key': 'value' }, { 'sport': 'soccer' });
amplitude.setDeviceId('45f0954f-eb79-4463-ac8a-233a6f45a8f0');
amplitude.setDomain('.amplitude.com');
amplitude.setGroup('orgId', '15');
amplitude.setGroup('orgId', ['15', '16']);
amplitude.setUserId('joe@gmail.com');
amplitude.setUserProperties({ 'gender': 'female', 'sign_up_complete': true })
amplitude.setVersionName('1.12.3');
amplitude.isNewSession();
amplitude.getSessionId() === 123;
let identify = new amplitude.Identify().set('gender', 'female').set('age', 20);
amplitude.identify(identify);
amplitude.logRevenue(3.99, 1, 'product_1234');
amplitude.logRevenueV2(revenue);
identify = new amplitude.Identify().setOnce('sign_up_date', '08/24/2015');
amplitude.identify(identify);
identify = new amplitude.Identify().setOnce('sign_up_date', '09/14/2015');
amplitude.identify(identify);
client.init('API_KEY', 'USER_ID', {
saveEvents: true,
includeUtm: true,
includeReferrer: true,
batchEvents: true,
eventUploadThreshold: 50
}, function () { });
client.init('API_KEY', 'USER_ID', { includeReferrer: true, includeUtm: true });
client.init('API_KEY', 'USER_ID');
client.init('API_KEY');
identify = new amplitude.Identify().unset('gender').unset('age');
amplitude.identify(identify);
client.logEvent('Clicked Homepage Button', { 'finished_flow': false, 'clicks': 15 });
client.logEvent('EVENT_IDENTIFIER_HERE', { 'color': 'blue', 'age': 20, 'key': 'value' });
client.logEvent("EVENT_IDENTIFIER_HERE", null, (httpCode, response) => { });
client.logEventWithGroups('initialize_game', { 'key': 'value' }, { 'sport': 'soccer' });
client.logEventWithTimestamp('EVENT_IDENTIFIER_HERE', { 'key': 'value' }, 1505430378000, (httpCode, response) => { });
client.setDeviceId('45f0954f-eb79-4463-ac8a-233a6f45a8f0');
client.setDomain('.amplitude.com');
client.setUserId('joe@gmail.com');
client.setOptOut(true);
client.setGroup('type', 'name');
client.setGroup('type', ['name', 'name2']);
client.setUserProperties({ 'gender': 'female', 'sign_up_complete': true });
client.setGlobalUserProperties({ 'gender': 'female', 'sign_up_complete': true });
client.setVersionName('1.12.3');
client.setSessionId(1505430378000);
client.options.logLevel = 'WARN';
client.getSessionId() === 123;
client.isNewSession() === true;
client.regenerateDeviceId();
client.clearUserProperties();
client.identify(identify);
client.logRevenue(3.99, 1, 'product_1234');
client.logRevenueV2(revenue);
identify = new amplitude.Identify().set('colors', ['rose', 'gold']).add('karma', 1).setOnce('sign_up_date', '2016-03-31');
identify = new amplitude.Identify().add('karma', 1).add('friends', 1);
amplitude.identify(identify);
identify = new amplitude.Identify().append('ab-tests', 'new-user-test').append('some_list', [1, 2, 3, 4, 'values']);
amplitude.identify(identify);
identify = new amplitude.Identify().prepend('ab-tests', 'new-user-test').prepend('some_list', [1, 2, 3, 4, 'values']);
amplitude.identify(identify);
identify = new amplitude.Identify()
.set('karma', 10)
.add('karma', 1)
.unset('karma');
amplitude.identify(identify);
identify = new amplitude.Identify().set('karma', 10).add('karma', 1).unset('karma');
identify = new amplitude.Identify().append('ab-tests', 'new-user-tests');
identify.append('some_list', [1, 2, 3, 4, 'values']);
identify = new amplitude.Identify().prepend('ab-tests', 'new-user-tests');
identify.prepend('some_list', [1, 2, 3, 4, 'values']);
identify = new amplitude.Identify().set('user_type', 'beta');
identify.set('name', { 'first': 'John', 'last': 'Doe' });
identify = new amplitude.Identify().setOnce('sign_up_date', '2016-04-01');
identify = new amplitude.Identify().unset('user_type').unset('age');
identify = new amplitude.Identify()
.set('colors', ['rose', 'gold'])
.append('ab-tests', 'campaign_a')
.append('existing_list', [4, 5]);
amplitude.identify(identify);
amplitude.setUserProperties({
gender: 'female',
age: 20
});
amplitude.clearUserProperties();
amplitude.setOptOut(true);
amplitude.setOptOut(false);
amplitude.setGroup('orgId', '15');
amplitude.setGroup('sport', ['soccer', 'tennis']);
// TODO: Implement those.
/*
var revenue = new amplitude.Revenue().setProductId('com.company.productId').setPrice(3.99).setQuantity(3);
amplitude.logRevenueV2(revenue);
amplitude.logEventWithGroups('initialize_game', { 'key': 'value' }, { 'sport': 'soccer' });
*/
revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99);
revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99).setEventProperties({ 'city': 'San Francisco' });
revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99).setQuantity(5);
revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99).setRevenueType('purchase');
}
}
+97 -12
View File
@@ -1,61 +1,146 @@
// Type definitions for Amplitude SDK 2.12.1
// Type definitions for Amplitude SDK 4.4.0
// Project: https://github.com/amplitude/Amplitude-Javascript
// Definitions by: Arvydas Sidorenko <https://github.com/Asido>
// Definitions: https://github.com/Asido/DefinitelyTyped
// Dan Manastireanu <https://github.com/danmana>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module amplitude {
type Callback = (responseCode: number, responseBody: string, details?: { reason: string; }) => void;
type LogReturn = number | void;
interface Config {
apiEndpoint?: string;
batchEvents?: boolean;
cookieExpiration?: number;
cookieName?: string;
userId?: string;
deviceId?: string;
deviceIdFromUrlParam?: boolean;
domain?: string;
eventUploadPeriodMillis?: number;
eventUploadThreshold?: number;
forceHttps?: boolean;
includeGclid?: boolean;
includeReferrer?: boolean;
includeUtm?: boolean;
language?: string;
logLevel?: 'DISABLE' | 'ERROR' | 'WARN' | 'INFO';
optOut?: boolean;
platform?: string;
saveEvents?: boolean;
savedMaxCount?: number;
saveParamsReferrerOncePerSession?: boolean;
sessionTimeout?: number;
trackingOptions?: {
city?: boolean;
country?: boolean;
device_model?: boolean;
dma?: boolean;
ip_address?: boolean;
language?: boolean;
os_name?: boolean;
os_version?: boolean;
platform?: boolean;
region?: boolean;
version_name?: boolean;
},
unsentKey?: string;
unsentIdentifyKey?: string;
uploadBatchSize?: number;
}
export class Identify {
set(key: string, value: any): Identify;
setOnce(key: string, value: any): Identify;
add(key: string, value: number): Identify;
add(key: string, value: number | string): Identify;
append(key: string, value: any): Identify;
prepend(key: string, value: any): Identify;
unset(key: string): Identify;
}
export function init(apiKey: string): void;
export function init(apiKey: string, userId: string): void;
export function init(apiKey: string, userId: string, options: Config): void;
export function init(apiKey: string, userId: string, options: Config, callback: () => void): void;
export class Revenue {
setProductId(productId: string): Revenue;
setQuantity(quantity: number): Revenue;
setPrice(price: number): Revenue;
setRevenueType(revenueType: string): Revenue;
setEventProperties(eventProperties: any): Revenue;
}
export class AmplitudeClient {
constructor(instanceName?: string);
options: Config;
init(apiKey: string, userId?: string, config?: Config, callback?: (client: AmplitudeClient) => void): void;
setVersionName(versionName: string): void;
isNewSession(): boolean;
setSessionId(sessionId: number): void;
getSessionId(): number;
setDomain(domain: string): void;
setUserId(userId: string): void;
setDeviceId(id: string): void;
regenerateDeviceId(): void;
identify(identify_obj: Identify, opt_callback?: Callback): void;
setUserProperties(properties: any): void;
setGlobalUserProperties(properties: any): void;
clearUserProperties(): void;
setOptOut(enable: boolean): void;
setGroup(groupType: string, groupName: string | string[]): void;
logEvent(event: string, data?: any, callback?: Callback): LogReturn;
logEventWithGroups(event: string, data?: any, groups?: any, callback?: Callback): LogReturn;
logRevenueV2(revenue_obj: Revenue): LogReturn;
logRevenue(pric: number, quantity: number, product: string): LogReturn;
logEventWithTimestamp(event: string, data?: any, timestamp?: number, callback?: Callback): LogReturn;
}
// Proxy methods that get executed on the default AmplitudeClient instance (not all client methods are proxied)
export function init(apiKey: string, userId?: string, options?: Config, callback?: (client: AmplitudeClient) => void): void;
export function setVersionName(version: string): void;
export function isNewSession(): boolean;
export function getSessionId(): number;
export function setDomain(domain: string): void;
export function setUserId(userId: string): void;
export function setDeviceId(id: string): void;
export function regenerateDeviceId(): void;
export function identify(identify: Identify): void;
export function identify(identify: Identify, callback?: Callback): void;
export function setUserProperties(properties: Object): void;
export function setUserProperties(properties: any): void;
export function setGlobalUserProperties(properties: any): void;
export function clearUserProperties(): void;
export function setOptOut(optOut: boolean): void;
export function setGroup(groupType: string, groupName: string | string[]): void;
export function logEvent(event: string): void;
export function logEvent(event: string, data: Object): void;
export function logEvent(event: string, data: Object, callback: (httpCode: number, response: any) => void): void;
export function logEvent(event: string, data?: any, callback?: Callback): LogReturn;
export function logEventWithGroups(event: string, data?: any, groups?: any, callback?: Callback): LogReturn;
export function logRevenueV2(revenue_obj: Revenue): LogReturn;
export function logRevenue(pric: number, quantity: number, product: string): LogReturn;
export function logEventWithTimestamp(event: string, data?: any, timestamp?: number, callback?: Callback): LogReturn;
export function getInstance(instanceName?: string): AmplitudeClient;
export const __VERSION__: string;
export var options: Config;
}
+1
View File
@@ -2,6 +2,7 @@
"extends": "dtslint/dt.json",
"rules": {
// All are TODOs
"no-any-union": false,
"no-empty-interface": false,
"prefer-const": false
}
+2 -1
View File
@@ -2,7 +2,8 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
+2 -1
View File
@@ -6,7 +6,8 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
+1 -1
View File
@@ -3,7 +3,7 @@
// Definitions by: bryn austin bellomy <https://github.com/brynbellomy>
// plylrnsdy <https://github.com/plylrnsdy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
import { EscapeCode } from './escape-code';
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/apollographql/apollo-codegen
// Definitions by: Bradley Ayers <https://github.com/bradleyayers>, Maria Carrasco <https://github.com/kostspielig>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.6
import { Options } from 'graphql/utilities/schemaPrinter';
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/jaydenseric/apollo-upload-client#readme
// Definitions by: Edward Sammut Alessi <https://github.com/Slessi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// TypeScript Version: 2.6
import { ApolloLink } from "apollo-link";
import { HttpOptions } from "apollo-link-http-common";
+3 -1
View File
@@ -2,7 +2,9 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6", "dom"
"es6",
"dom",
"esnext.asynciterable"
],
"noImplicitAny": true,
"noImplicitThis": true,
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/arangodb/arangodb
// Definitions by: Alan Plum <https://github.com/pluma>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.6
/// <reference types="node" />
+1 -1
View File
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"lib": ["es6", "esnext.asynciterable"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
+50
View File
@@ -0,0 +1,50 @@
// Type definitions for astring 1.3
// Project: https://github.com/davidbonnet/astring
// Definitions by: Nikolaj Kappler <https://github.com/nkappler>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as ESTree from 'estree';
import 'node';
import { Stream } from 'stream';
export interface Options {
/** string to use for indentation (defaults to " ") */
indent?: string;
/** string to use for line endings (defaults to "\n") */
lineEnd?: string;
/** indent level to start from (defaults to 0) */
startingIndentLevel?: number;
/** generate comments if true (defaults to false) */
comments?: boolean;
/** custom code generator (defaults to astring.baseGenerator) */
generator?: object;
/** source map generator (defaults to null), see https://github.com/mozilla/source-map#sourcemapgenerator */
sourceMap?: any;
}
/** Returns a string representing the rendered code of the provided AST `node`. However, if an `output` stream is provided in the options, it writes to that stream and returns it. */
export function generate(node: ESTree.Node, options?: Options): string;
/** Returns a string representing the rendered code of the provided AST `node`. However, if an `output` stream is provided in the options, it writes to that stream and returns it. */
export function generate(node: ESTree.Node, options: Options & {
/** output stream to write the rendered code to (defaults to null) */
output: Stream;
}): Stream;
/**
* A code generator consists of a mapping of node names and functions that take two arguments: `node` and `state`.
* The `node` points to the node from which to generate the code and the `state` exposes the `write` method that takes generated code strings.
*/
export type Generator = { [key in ESTree.Node["type"]]: (node: Extract<ESTree.Node, { type: key }>, state: { write(s: string): void }) => void };
/** Base generator that can be used to extend Astring. See https://github.com/davidbonnet/astring#extending */
export const baseGenerator: Generator;
declare global {
interface astring {
generate: typeof generate;
/** Base generator that can be used to extend Astring. See https://github.com/davidbonnet/astring#extending */
baseGenerator: Generator;
}
const astring: astring;
}
@@ -0,0 +1,5 @@
// global scope function
astring.generate(null);
// global scope function
astring.baseGenerator.Program(null, { write(s: string) { return; } });
+32
View File
@@ -0,0 +1,32 @@
import { baseGenerator, generate } from "astring";
import { FunctionExpression, MemberExpression, Program } from "estree";
import { Stream } from "stream";
const ast: Program = null;
const functionE: FunctionExpression = null;
const memberE: MemberExpression = null;
// should accept different nodes
generate(ast);
generate(functionE);
generate(memberE);
// options without output option should generate string
const string: string = generate(ast, {
comments: true,
generator: baseGenerator,
indent: "\t",
lineEnd: "\n",
startingIndentLevel: 42,
sourceMap: null
});
// options with output option should return Stream
const stream: Stream = generate(ast, {
output: new Stream()
});
// Generator should map node types to functions whose first parameter is same node type
baseGenerator.Program(ast, { write(s: string) { return; } });
baseGenerator.FunctionExpression(functionE, { write(s: string) { return; } });
baseGenerator.MemberExpression(memberE, { write(s: string) { return; } });
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"test/astring.test.ts",
"test/astring-global.test.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+77 -77
View File
@@ -2,34 +2,34 @@
// Project: https://github.com/caolan/async
// Definitions by: Boris Yankov <https://github.com/borisyankov>, Arseniy Maximov <https://github.com/kern0>, Joe Herman <https://github.com/Penryn>, Angus Fenying <https://github.com/fenying>, Pascal Martin <https://github.com/pascalmartin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
// TypeScript Version: 2.3
export as namespace async;
export interface Dictionary<T> { [key: string]: T; }
export type IterableCollection<T> = T[] | IterableIterator<T> | Dictionary<T>
export interface ErrorCallback<T> { (err?: T): void; }
export interface AsyncBooleanResultCallback<E> { (err?: E, truthValue?: boolean): void; }
export interface AsyncResultCallback<T, E> { (err?: E, result?: T): void; }
export interface AsyncResultArrayCallback<T, E> { (err?: E, results?: Array<T | undefined>): void; }
export interface AsyncResultObjectCallback<T, E> { (err: E | undefined, results: Dictionary<T | undefined>): void; }
export interface ErrorCallback<E = Error> { (err?: E | null): void; }
export interface AsyncBooleanResultCallback<E = Error> { (err?: E | null, truthValue?: boolean): void; }
export interface AsyncResultCallback<T, E = Error> { (err?: E | null, result?: T): void; }
export interface AsyncResultArrayCallback<T, E = Error> { (err?: E | null, results?: Array<T | undefined>): void; }
export interface AsyncResultObjectCallback<T, E = Error> { (err: E | undefined, results: Dictionary<T | undefined>): void; }
export interface AsyncFunction<T, E> { (callback: (err?: E, result?: T) => void): void; }
export interface AsyncFunctionEx<T, E> { (callback: (err?: E, ...results: T[]) => void): void; }
export interface AsyncIterator<T, E> { (item: T, callback: ErrorCallback<E>): void; }
export interface AsyncForEachOfIterator<T, E> { (item: T, key: number|string, callback: ErrorCallback<E>): void; }
export interface AsyncResultIterator<T, R, E> { (item: T, callback: AsyncResultCallback<R, E>): void; }
export interface AsyncMemoIterator<T, R, E> { (memo: R | undefined, item: T, callback: AsyncResultCallback<R, E>): void; }
export interface AsyncBooleanIterator<T, E> { (item: T, callback: AsyncBooleanResultCallback<E>): void; }
export interface AsyncFunction<T, E = Error> { (callback: (err?: E | null, result?: T) => void): void; }
export interface AsyncFunctionEx<T, E = Error> { (callback: (err?: E | null, ...results: T[]) => void): void; }
export interface AsyncIterator<T, E = Error> { (item: T, callback: ErrorCallback<E>): void; }
export interface AsyncForEachOfIterator<T, E = Error> { (item: T, key: number|string, callback: ErrorCallback<E>): void; }
export interface AsyncResultIterator<T, R, E = Error> { (item: T, callback: AsyncResultCallback<R, E>): void; }
export interface AsyncMemoIterator<T, R, E = Error> { (memo: R | undefined, item: T, callback: AsyncResultCallback<R, E>): void; }
export interface AsyncBooleanIterator<T, E = Error> { (item: T, callback: AsyncBooleanResultCallback<E>): void; }
export interface AsyncWorker<T, E> { (task: T, callback: ErrorCallback<E>): void; }
export interface AsyncVoidFunction<E> { (callback: ErrorCallback<E>): void; }
export interface AsyncWorker<T, E = Error> { (task: T, callback: ErrorCallback<E>): void; }
export interface AsyncVoidFunction<E = Error> { (callback: ErrorCallback<E>): void; }
export type AsyncAutoTasks<R extends Dictionary<any>, E> = { [K in keyof R]: AsyncAutoTask<R[K], R, E> }
export type AsyncAutoTask<R1, R extends Dictionary<any>, E> = AsyncAutoTaskFunctionWithoutDependencies<R1, E> | (keyof R | AsyncAutoTaskFunction<R1, R, E>)[];
export interface AsyncAutoTaskFunctionWithoutDependencies<R1, E> { (cb: AsyncResultCallback<R1, E> | ErrorCallback<E>): void; }
export interface AsyncAutoTaskFunction<R1, R extends Dictionary<any>, E> { (results: R, cb: AsyncResultCallback<R1, E> | ErrorCallback<E>): void; }
export interface AsyncAutoTaskFunctionWithoutDependencies<R1, E = Error> { (cb: AsyncResultCallback<R1, E> | ErrorCallback<E>): void; }
export interface AsyncAutoTaskFunction<R1, R extends Dictionary<any>, E = Error> { (results: R, cb: AsyncResultCallback<R1, E> | ErrorCallback<E>): void; }
export interface AsyncQueue<T> {
length(): number;
@@ -37,9 +37,8 @@ export interface AsyncQueue<T> {
running(): number;
idle(): boolean;
concurrency: number;
push<E>(task: T | T[], callback?: ErrorCallback<E>): void;
push<R,E>(task: T, callback?: AsyncResultCallback<R, E>): void;
unshift<E>(task: T | T[], callback?: ErrorCallback<E>): void;
push<R,E = Error>(task: T | T[], callback?: AsyncResultCallback<R, E>): void;
unshift<E = Error>(task: T | T[], callback?: ErrorCallback<E>): void;
saturated: () => any;
empty: () => any;
drain: () => any;
@@ -61,7 +60,7 @@ export interface AsyncPriorityQueue<T> {
concurrency: number;
started: boolean;
paused: boolean;
push<R,E>(task: T | T[], priority: number, callback?: AsyncResultArrayCallback<R, E>): void;
push<R,E = Error>(task: T | T[], priority: number, callback?: AsyncResultArrayCallback<R, E>): void;
saturated: () => any;
empty: () => any;
drain: () => any;
@@ -94,112 +93,113 @@ export interface AsyncCargo {
}
// Collections
export function each<T, E>(arr: IterableCollection<T>, iterator: AsyncIterator<T, E>, callback?: ErrorCallback<E>): void;
export function each<T, E = Error>(arr: IterableCollection<T>, iterator: AsyncIterator<T, E>, callback?: ErrorCallback<E>): void;
export const eachSeries: typeof each;
export function eachLimit<T, E>(arr: IterableCollection<T>, limit: number, iterator: AsyncIterator<T, E>, callback?: ErrorCallback<E>): void;
export function eachLimit<T, E = Error>(arr: IterableCollection<T>, limit: number, iterator: AsyncIterator<T, E>, callback?: ErrorCallback<E>): void;
export const forEach: typeof each;
export const forEachSeries: typeof each;
export const forEachLimit: typeof eachLimit;
export function forEachOf<T, E>(obj: IterableCollection<T>, iterator: AsyncForEachOfIterator<T, E>, callback?: ErrorCallback<E>): void;
export function forEachOf<T, E = Error>(obj: IterableCollection<T>, iterator: AsyncForEachOfIterator<T, E>, callback?: ErrorCallback<E>): void;
export const forEachOfSeries: typeof forEachOf;
export function forEachOfLimit<T, E>(obj: IterableCollection<T>, limit: number, iterator: AsyncForEachOfIterator<T, E>, callback?: ErrorCallback<E>): void;
export function forEachOfLimit<T, E = Error>(obj: IterableCollection<T>, limit: number, iterator: AsyncForEachOfIterator<T, E>, callback?: ErrorCallback<E>): void;
export const eachOf: typeof forEachOf;
export const eachOfSeries: typeof forEachOf;
export const eachOfLimit: typeof forEachOfLimit;
export function map<T, R, E>(arr: T[] | IterableIterator<T>, iterator: AsyncResultIterator<T, R, E>, callback?: AsyncResultArrayCallback<R, E>): void;
export function map<T, R, E>(arr: Dictionary<T>, iterator: AsyncResultIterator<T, R, E>, callback?: AsyncResultArrayCallback<R, E>): void;
export function map<T, R, E = Error>(arr: T[] | IterableIterator<T>, iterator: AsyncResultIterator<T, R, E>, callback?: AsyncResultArrayCallback<R, E>): void;
export function map<T, R, E = Error>(arr: Dictionary<T>, iterator: AsyncResultIterator<T, R, E>, callback?: AsyncResultArrayCallback<R, E>): void;
export const mapSeries: typeof map;
export function mapLimit<T, R, E>(arr: IterableCollection<T>, limit: number, iterator: AsyncResultIterator<T, R, E>, callback?: AsyncResultArrayCallback<R, E>): void;
export function mapValuesLimit<T, R, E>(obj: Dictionary<T>, limit: number, iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void, callback: AsyncResultObjectCallback<R, E>): void;
export function mapValues<T, R, E>(obj: Dictionary<T>, iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void, callback: AsyncResultObjectCallback<R, E>): void;
export function mapLimit<T, R, E = Error>(arr: IterableCollection<T>, limit: number, iterator: AsyncResultIterator<T, R, E>, callback?: AsyncResultArrayCallback<R, E>): void;
export function mapValuesLimit<T, R, E = Error>(obj: Dictionary<T>, limit: number, iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void, callback: AsyncResultObjectCallback<R, E>): void;
export function mapValues<T, R, E = Error>(obj: Dictionary<T>, iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void, callback: AsyncResultObjectCallback<R, E>): void;
export const mapValuesSeries: typeof mapValues;
export function filter<T, E>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultArrayCallback<T, E>): void;
export function filter<T, E = Error>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultArrayCallback<T, E>): void;
export const filterSeries: typeof filter;
export function filterLimit<T, E>(arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultArrayCallback<T, E>): void;
export function filterLimit<T, E = Error>(arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultArrayCallback<T, E>): void;
export const select: typeof filter;
export const selectSeries: typeof filter;
export const selectLimit: typeof filterLimit;
export const reject: typeof filter;
export const rejectSeries: typeof filter;
export const rejectLimit: typeof filterLimit;
export function reduce<T, R, E>(arr: T[] | IterableIterator<T>, memo: R, iterator: AsyncMemoIterator<T, R, E>, callback?: AsyncResultCallback<R, E>): void;
export function reduce<T, R, E = Error>(arr: T[] | IterableIterator<T>, memo: R, iterator: AsyncMemoIterator<T, R, E>, callback?: AsyncResultCallback<R, E>): void;
export const inject: typeof reduce;
export const foldl: typeof reduce;
export const reduceRight: typeof reduce;
export const foldr: typeof reduce;
export function detect<T, E>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultCallback<T, E>): void;
export function detect<T, E = Error>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultCallback<T, E>): void;
export const detectSeries: typeof detect;
export function detectLimit<T, E>(arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultCallback<T, E>): void;
export function detectLimit<T, E = Error>(arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultCallback<T, E>): void;
export const find: typeof detect;
export const findSeries: typeof detect;
export const findLimit: typeof detectLimit;
export function sortBy<T, V, E>(arr: T[] | IterableIterator<T>, iterator: AsyncResultIterator<T, V, E>, callback?: AsyncResultArrayCallback<T, E>): void;
export function some<T, E>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
export function sortBy<T, V, E = Error>(arr: T[] | IterableIterator<T>, iterator: AsyncResultIterator<T, V, E>, callback?: AsyncResultArrayCallback<T, E>): void;
export function some<T, E = Error>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
export const someSeries: typeof some;
export function someLimit<T, E>(arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
export function someLimit<T, E = Error>(arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
export const any: typeof some;
export const anySeries: typeof someSeries;
export const anyLimit: typeof someLimit;
export function every<T, E>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
export function every<T, E = Error>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
export const everySeries: typeof every;
export function everyLimit<T, E>(arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
export function everyLimit<T, E = Error>(arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
export const all: typeof every;
export const allSeries: typeof every;
export const allLimit: typeof everyLimit;
export function concat<T, R, E>(arr: IterableCollection<T>, iterator: AsyncResultIterator<T, R[], E>, callback?: AsyncResultArrayCallback<R, E>): void;
export function concatLimit<T, R, E>(arr: IterableCollection<T>, limit: number, iterator: AsyncResultIterator<T, R[], E>, callback?: AsyncResultArrayCallback<R, E>): void;
export function concat<T, R, E = Error>(arr: IterableCollection<T>, iterator: AsyncResultIterator<T, R[], E>, callback?: AsyncResultArrayCallback<R, E>): void;
export function concatLimit<T, R, E = Error>(arr: IterableCollection<T>, limit: number, iterator: AsyncResultIterator<T, R[], E>, callback?: AsyncResultArrayCallback<R, E>): void;
export const concatSeries: typeof concat;
// Control Flow
export function series<T, E>(tasks: AsyncFunction<T, E>[], callback?: AsyncResultArrayCallback<T, E>): void;
export function series<T, E>(tasks: Dictionary<AsyncFunction<T, E>>, callback?: AsyncResultObjectCallback<T, E>): void;
export function parallel<T, E>(tasks: Array<AsyncFunction<T, E>>, callback?: AsyncResultArrayCallback<T, E>): void;
export function parallel<T, E>(tasks: Dictionary<AsyncFunction<T, E>>, callback?: AsyncResultObjectCallback<T, E>): void;
export function parallelLimit<T, E>(tasks: Array<AsyncFunction<T, E>>, limit: number, callback?: AsyncResultArrayCallback<T, E>): void;
export function parallelLimit<T, E>(tasks: Dictionary<AsyncFunction<T, E>>, limit: number, callback?: AsyncResultObjectCallback<T, E>): void;
export function whilst<E>(test: () => boolean, fn: AsyncVoidFunction<E>, callback: ErrorCallback<E>): void;
export function doWhilst<T, E>(fn: AsyncFunctionEx<T, E>, test: (...results: T[]) => boolean, callback: ErrorCallback<E>): void;
export function until<E>(test: () => boolean, fn: AsyncVoidFunction<E>, callback: ErrorCallback<E>): void;
export function doUntil<T, E>(fn: AsyncFunctionEx<T, E>, test: (...results: T[]) => boolean, callback: ErrorCallback<E>): void;
export function during<E>(test: (testCallback : AsyncBooleanResultCallback<E>) => void, fn: AsyncVoidFunction<E>, callback: ErrorCallback<E>): void;
export function doDuring<E>(fn: AsyncVoidFunction<E>, test: (testCallback: AsyncBooleanResultCallback<E>) => void, callback: ErrorCallback<E>): void;
export function forever<E>(next: (next : ErrorCallback<E>) => void, errBack: ErrorCallback<E>) : void;
export function waterfall<T, E>(tasks: Function[], callback?: AsyncResultCallback<T, E | Error>): void;
export function series<T, E = Error>(tasks: AsyncFunction<T, E>[], callback?: AsyncResultArrayCallback<T, E>): void;
export function series<T, E = Error>(tasks: Dictionary<AsyncFunction<T, E>>, callback?: AsyncResultObjectCallback<T, E>): void;
export function parallel<T, E = Error>(tasks: Array<AsyncFunction<T, E>>, callback?: AsyncResultArrayCallback<T, E>): void;
export function parallel<T, E = Error>(tasks: Dictionary<AsyncFunction<T, E>>, callback?: AsyncResultObjectCallback<T, E>): void;
export function parallelLimit<T, E = Error>(tasks: Array<AsyncFunction<T, E>>, limit: number, callback?: AsyncResultArrayCallback<T, E>): void;
export function parallelLimit<T, E = Error>(tasks: Dictionary<AsyncFunction<T, E>>, limit: number, callback?: AsyncResultObjectCallback<T, E>): void;
export function whilst<E = Error>(test: () => boolean, fn: AsyncVoidFunction<E>, callback: ErrorCallback<E>): void;
export function doWhilst<T, E = Error>(fn: AsyncFunctionEx<T, E>, test: (...results: T[]) => boolean, callback: ErrorCallback<E>): void;
export function until<E = Error>(test: () => boolean, fn: AsyncVoidFunction<E>, callback: ErrorCallback<E>): void;
export function doUntil<T, E = Error>(fn: AsyncFunctionEx<T, E>, test: (...results: T[]) => boolean, callback: ErrorCallback<E>): void;
export function during<E = Error>(test: (testCallback : AsyncBooleanResultCallback<E>) => void, fn: AsyncVoidFunction<E>, callback: ErrorCallback<E>): void;
export function doDuring<E = Error>(fn: AsyncVoidFunction<E>, test: (testCallback: AsyncBooleanResultCallback<E>) => void, callback: ErrorCallback<E>): void;
export function forever<E = Error>(next: (next : ErrorCallback<E>) => void, errBack: ErrorCallback<E>) : void;
export function waterfall<T, E = Error>(tasks: Function[], callback?: AsyncResultCallback<T, E>): void;
export function compose(...fns: Function[]): Function;
export function seq(...fns: Function[]): Function;
export function applyEach(fns: Function[], ...argsAndCallback: any[]): void; // applyEach(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional.
export function applyEachSeries(fns: Function[], ...argsAndCallback: any[]): void; // applyEachSeries(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional.
export function queue<T, E>(worker: AsyncWorker<T, E>, concurrency?: number): AsyncQueue<T>;
export function queue<T, R, E>(worker: AsyncResultIterator<T, R, E>, concurrency?: number): AsyncQueue<T>;
export function priorityQueue<T, E>(worker: AsyncWorker<T, E>, concurrency: number): AsyncPriorityQueue<T>;
export function cargo<E>(worker : (tasks: any[], callback : ErrorCallback<E>) => void, payload? : number) : AsyncCargo;
export function auto<R extends Dictionary<any>, E>(tasks: AsyncAutoTasks<R, E>, concurrency?: number, callback?: AsyncResultCallback<R, E>): void;
export function autoInject<E>(tasks: any, callback?: AsyncResultCallback<any, E>): void;
export function retry<T, E>(opts: number, task: (callback : AsyncResultCallback<T, E>, results: any) => void, callback: AsyncResultCallback<any, E | Error>): void;
export function retry<T, E>(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback<T, E>, results : any) => void, callback: AsyncResultCallback<any, E | Error>): void;
export function retryable<T, E>(opts: number | {times: number, interval: number}, task: AsyncFunction<T, E>): AsyncFunction<T, E | Error>;
export function apply<E>(fn: Function, ...args: any[]): AsyncFunction<any,E | Error>;
export function queue<T, E = Error>(worker: AsyncWorker<T, E>, concurrency?: number): AsyncQueue<T>;
export function queue<T, R, E = Error>(worker: AsyncResultIterator<T, R, E>, concurrency?: number): AsyncQueue<T>;
export function priorityQueue<T, E = Error>(worker: AsyncWorker<T, E>, concurrency: number): AsyncPriorityQueue<T>;
export function cargo<E = Error>(worker : (tasks: any[], callback : ErrorCallback<E>) => void, payload? : number) : AsyncCargo;
export function auto<R extends Dictionary<any>, E = Error>(tasks: AsyncAutoTasks<R, E>, concurrency?: number, callback?: AsyncResultCallback<R, E>): void;
export function auto<R extends Dictionary<any>, E = Error>(tasks: AsyncAutoTasks<R, E>, callback?: AsyncResultCallback<R, E>): void;
export function autoInject<E = Error>(tasks: any, callback?: AsyncResultCallback<any, E>): void;
export function retry<T, E = Error>(opts: number, task: (callback : AsyncResultCallback<T, E>, results: any) => void, callback: AsyncResultCallback<any, E>): void;
export function retry<T, E = Error>(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback<T, E>, results : any) => void, callback: AsyncResultCallback<any, E>): void;
export function retryable<T, E = Error>(opts: number | {times: number, interval: number}, task: AsyncFunction<T, E>): AsyncFunction<T, E>;
export function apply<E = Error>(fn: Function, ...args: any[]): AsyncFunction<any,E>;
export function nextTick(callback: Function, ...args: any[]): void;
export const setImmediate: typeof nextTick;
export function reflect<T, E>(fn: AsyncFunction<T, E>) : (callback: (err: null, result: {error?: E, value?: T}) => void) => void;
export function reflectAll<T, E>(tasks: AsyncFunction<T, E>[]): ((callback: (err: null, result: {error?: E, value?: T}) => void) => void)[];
export function reflect<T, E = Error>(fn: AsyncFunction<T, E>) : (callback: (err: null, result: {error?: E, value?: T}) => void) => void;
export function reflectAll<T, E = Error>(tasks: AsyncFunction<T, E>[]): ((callback: (err: null, result: {error?: E, value?: T}) => void) => void)[];
export function timeout<T, E>(fn: AsyncFunction<T, E>, milliseconds: number, info?: any): AsyncFunction<T, E | Error>;
export function timeout<T, R, E>(fn: AsyncResultIterator<T, R, E>, milliseconds: number, info?: any): AsyncResultIterator<T, R, E | Error>;
export function timeout<T, E = Error>(fn: AsyncFunction<T, E>, milliseconds: number, info?: any): AsyncFunction<T, E>;
export function timeout<T, R, E = Error>(fn: AsyncResultIterator<T, R, E>, milliseconds: number, info?: any): AsyncResultIterator<T, R, E>;
export function times<T, E> (n: number, iterator: AsyncResultIterator<number, T, E>, callback: AsyncResultArrayCallback<T, E>): void;
export function timesSeries<T, E>(n: number, iterator: AsyncResultIterator<number, T, E>, callback: AsyncResultArrayCallback<T, E>): void;
export function timesLimit<T, E>(n: number, limit: number, iterator: AsyncResultIterator<number, T, E>, callback: AsyncResultArrayCallback<T, E>): void;
export function timesSeries<T, E = Error>(n: number, iterator: AsyncResultIterator<number, T, E>, callback: AsyncResultArrayCallback<T, E>): void;
export function timesLimit<T, E = Error>(n: number, limit: number, iterator: AsyncResultIterator<number, T, E>, callback: AsyncResultArrayCallback<T, E>): void;
export function transform<T, R, E>(arr: T[], iteratee: (acc: R[], item: T, key: number, callback: (error?: E) => void) => void, callback?: AsyncResultArrayCallback<T, E>): void;
export function transform<T, R, E>(arr: T[], acc: R[], iteratee: (acc: R[], item: T, key: number, callback: (error?: E) => void) => void, callback?: AsyncResultArrayCallback<T, E>): void;
export function transform<T, R, E = Error>(arr: T[], iteratee: (acc: R[], item: T, key: number, callback: (error?: E) => void) => void, callback?: AsyncResultArrayCallback<T, E>): void;
export function transform<T, R, E = Error>(arr: T[], acc: R[], iteratee: (acc: R[], item: T, key: number, callback: (error?: E) => void) => void, callback?: AsyncResultArrayCallback<T, E>): void;
export function transform<T, R, E>(arr: {[key: string] : T}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void, callback?: AsyncResultObjectCallback<T, E>): void;
export function transform<T, R, E>(arr: {[key: string] : T}, acc: {[key: string] : R}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void, callback?: AsyncResultObjectCallback<T, E>): void;
export function transform<T, R, E = Error>(arr: {[key: string] : T}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void, callback?: AsyncResultObjectCallback<T, E>): void;
export function transform<T, R, E = Error>(arr: {[key: string] : T}, acc: {[key: string] : R}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void, callback?: AsyncResultObjectCallback<T, E>): void;
export function race<T, E>(tasks: (AsyncFunction<T, E>)[], callback: AsyncResultCallback<T, E | Error>) : void;
export function race<T, E = Error>(tasks: (AsyncFunction<T, E>)[], callback: AsyncResultCallback<T, E>) : void;
// Utils
export function memoize(fn: Function, hasher?: Function): Function;
+79 -46
View File
@@ -114,7 +114,7 @@ async.series([
],
function (err, results) { });
async.series<string,Error>([
async.series<string>([
function (callback) {
callback(undefined, 'one');
},
@@ -138,7 +138,7 @@ async.series({
},
function (err, results) { });
async.series<number,Error>({
async.series<number>({
one: function (callback) {
setTimeout(function () {
callback(undefined, 1);
@@ -178,7 +178,7 @@ async.parallel([
],
function (err, results) { });
async.parallel<string,Error>([
async.parallel<string>([
function (callback) {
setTimeout(function () {
callback(undefined, 'one');
@@ -207,7 +207,7 @@ async.parallel({
},
function (err, results) { });
async.parallel<number,Error>({
async.parallel<number>({
one: function (callback) {
setTimeout(function () {
callback(undefined, 1);
@@ -273,7 +273,7 @@ async.waterfall([
], function (err, result) { });
var q = async.queue<any,Error>(function (task: any, callback: (err?:Error,msg?:string) => void) {
var q = async.queue<any>(function (task: any, callback: (err?:Error,msg?:string) => void) {
console.log('hello ' + task.name);
callback(undefined,'a message.');
}, 2);
@@ -293,7 +293,7 @@ q.push([{ name: 'baz' }, { name: 'bay' }, { name: 'bax' }], function (err) {
console.log('finished processing bar');
});
q.push<string,Error>({name: 'foo'}, function (err,msg) {
q.push<string>({name: 'foo'}, function (err, msg) {
console.log('foo finished with a message "'+ msg! + '"');
});
@@ -330,7 +330,7 @@ q.resume();
q.kill();
// tests for strongly typed tasks
var q2 = async.queue<string,Error>(function (task: string, callback: () => void) {
var q2 = async.queue<string>(function (task: string, callback: () => void) {
console.log('Task: ' + task);
callback();
}, 1);
@@ -356,7 +356,7 @@ q2.unshift(['task3', 'task4', 'task5'], function (error) {
});
var aq = async.queue<number, number, Error>(function (level: number, callback: (error?: Error, newLevel?: number) => void) {
var aq = async.queue<number, number>(function (level: number, callback: (error?: Error, newLevel?: number) => void) {
console.log('hello ' + level);
callback(undefined, level+1);
});
@@ -387,14 +387,47 @@ cargo.push({ name: 'baz' }, function (err: Error) {
var filename = '';
async.auto({
get_data: function (callback: any) { },
make_folder: function (callback: any) { },
get_data: function (callback: AsyncResultCallback<any>) { },
make_folder: function (callback: AsyncResultCallback<any>) { },
//arrays with different types are not accepted by TypeScript.
write_file: ['get_data', 'make_folder', <any>function (callback: any) {
write_file: ['get_data', 'make_folder', <any>function (callback: AsyncResultCallback<any>) {
callback(null, filename);
}],
//arrays with different types are not accepted by TypeScript.
email_link: ['write_file', <any>function (callback: any, results: any) { }]
email_link: ['write_file', <any>function (callback: AsyncResultCallback<any>, results: any) { }]
});
async.auto({
get_data: function (callback: AsyncResultCallback<any>) { },
make_folder: function (callback: AsyncResultCallback<any>) { },
//arrays with different types are not accepted by TypeScript.
write_file: ['get_data', 'make_folder', <any>function (callback: AsyncResultCallback<any>) {
callback(null, filename);
}],
//arrays with different types are not accepted by TypeScript.
email_link: ['write_file', <any>function (callback: AsyncResultCallback<any>, results: any) { }]
}, function (err, results) {
console.log('finished auto');
});
interface A {
get_data: any;
make_folder: any;
write_file: any;
email_link: any;
}
async.auto<A>({
get_data: function (callback: AsyncResultCallback<any>) { },
make_folder: function (callback: AsyncResultCallback<any>) { },
//arrays with different types are not accepted by TypeScript.
write_file: ['get_data', 'make_folder', <any>function (callback: AsyncResultCallback<any>) {
callback(null, filename);
}],
//arrays with different types are not accepted by TypeScript.
email_link: ['write_file', <any>function (callback: AsyncResultCallback<any>, results: any) { }]
}, 1, function (err, results) {
console.log('finished auto');
});
async.retry(3, function (callback, results) { }, function (err, result) { });
@@ -459,10 +492,10 @@ async.dir(function (name: string, callback: any) {
// each
async.each<number,Error>({
async.each<number>({
"a": 1,
"b": 2
}, function(val: number, next: ErrorCallback<Error>): void {
}, function(val: number, next: ErrorCallback): void {
setTimeout(function(): void {
@@ -478,10 +511,10 @@ async.each<number,Error>({
});
async.eachSeries<number, Error>({
async.eachSeries<number>({
"a": 1,
"b": 2
}, function(val: number, next: ErrorCallback<Error>): void {
}, function(val: number, next: ErrorCallback): void {
setTimeout(function(): void {
@@ -497,14 +530,14 @@ async.eachSeries<number, Error>({
});
async.eachLimit<number, Error>({
async.eachLimit<number>({
"a": 1,
"b": 2,
"c": 3,
"d": 4,
"e": 5,
"f": 6
}, 2, function(val: number, next: ErrorCallback<Error>): void {
}, 2, function(val: number, next: ErrorCallback): void {
setTimeout(function(): void {
@@ -522,10 +555,10 @@ async.eachLimit<number, Error>({
// forEachOf/eachOf
async.eachOf<number, Error>({
async.eachOf<number>({
"a": 1,
"b": 2
}, function(val: number, key: string, next: ErrorCallback<Error>): void {
}, function(val: number, key: string, next: ErrorCallback): void {
setTimeout(function(): void {
@@ -541,10 +574,10 @@ async.eachOf<number, Error>({
});
async.forEachOfSeries<number, Error>({
async.forEachOfSeries<number>({
"a": 1,
"b": 2
}, function(val: number, key: string, next: ErrorCallback<Error>): void {
}, function(val: number, key: string, next: ErrorCallback): void {
setTimeout(function(): void {
@@ -560,14 +593,14 @@ async.forEachOfSeries<number, Error>({
});
async.forEachOfLimit<number, Error>({
async.forEachOfLimit<number>({
"a": 1,
"b": 2,
"c": 3,
"d": 4,
"e": 5,
"f": 6
}, 2, function(val: number, key: string, next: ErrorCallback<Error>): void {
}, 2, function(val: number, key: string, next: ErrorCallback): void {
setTimeout(function(): void {
@@ -585,11 +618,11 @@ async.forEachOfLimit<number, Error>({
// map
async.map<number, string, Error>({
async.map<number, string>({
"a": 1,
"b": 2,
"c": 3
}, function(val: number, next: AsyncResultCallback<string, Error>): void {
}, function(val: number, next: AsyncResultCallback<string>): void {
setTimeout(function(): void {
@@ -605,11 +638,11 @@ async.map<number, string, Error>({
});
async.mapSeries<number, string, Error>({
async.mapSeries<number, string>({
"a": 1,
"b": 2,
"c": 3
}, function(val: number, next: AsyncResultCallback<string, Error>): void {
}, function(val: number, next: AsyncResultCallback<string>): void {
setTimeout(function(): void {
@@ -625,14 +658,14 @@ async.mapSeries<number, string, Error>({
});
async.mapLimit<number, string, Error>({
async.mapLimit<number, string>({
"a": 1,
"b": 2,
"c": 3,
"d": 4,
"e": 5,
"f": 6
}, 2, function(val: number, next: AsyncResultCallback<string, Error>): void {
}, 2, function(val: number, next: AsyncResultCallback<string>): void {
setTimeout(function(): void {
@@ -650,11 +683,11 @@ async.mapLimit<number, string, Error>({
// mapValues
async.mapValues<number, string, Error>({
async.mapValues<number, string>({
"a": 1,
"b": 2,
"c": 3
}, function(val: number, key: string, next: AsyncResultCallback<string, Error>): void {
}, function(val: number, key: string, next: AsyncResultCallback<string>): void {
setTimeout(function(): void {
@@ -670,11 +703,11 @@ async.mapValues<number, string, Error>({
});
async.mapValuesSeries<number, string, Error>({
async.mapValuesSeries<number, string>({
"a": 1,
"b": 2,
"c": 3
}, function(val: number, key: string, next: AsyncResultCallback<string, Error>): void {
}, function(val: number, key: string, next: AsyncResultCallback<string>): void {
setTimeout(function(): void {
@@ -692,11 +725,11 @@ async.mapValuesSeries<number, string, Error>({
// filter/select/reject
async.filter<number, Error>({
async.filter<number>({
"a": 1,
"b": 2,
"c": 3
}, function(val: number, next: AsyncBooleanResultCallback<Error>): void {
}, function(val: number, next: AsyncBooleanResultCallback): void {
setTimeout(function(): void {
@@ -712,11 +745,11 @@ async.filter<number, Error>({
});
async.reject<number, Error>({
async.reject<number>({
"a": 1,
"b": 2,
"c": 3
}, function(val: number, next: AsyncBooleanResultCallback<Error>): void {
}, function(val: number, next: AsyncBooleanResultCallback): void {
setTimeout(function(): void {
@@ -734,11 +767,11 @@ async.reject<number, Error>({
// concat
async.concat<string, string, Error>({
async.concat<string, string>({
"a": "1",
"b": "2",
"c": "3"
}, function(item: string, next: AsyncResultCallback<string[], Error>): void {
}, function(item: string, next: AsyncResultCallback<string[]>): void {
console.log(`async.concat: ${item}`);
@@ -752,11 +785,11 @@ async.concat<string, string, Error>({
// detect/find
async.detect<number, Error>({
async.detect<number>({
"a": 1,
"b": 2,
"c": 3
}, function(item: number, next: AsyncBooleanResultCallback<Error>): void {
}, function(item: number, next: AsyncBooleanResultCallback): void {
console.log(`async.detect/find: ${item}`);
@@ -777,11 +810,11 @@ async.detect<number, Error>({
// every/all
async.every<number,Error>({
async.every<number>({
"a": 1,
"b": 2,
"c": 3
}, function(item: number, next: AsyncBooleanResultCallback<Error>): void {
}, function(item: number, next: AsyncBooleanResultCallback): void {
console.log(`async.every/all: ${item}`);
@@ -795,11 +828,11 @@ async.every<number,Error>({
// some/any
async.some<number, Error>({
async.some<number>({
"a": 1,
"b": 2,
"c": 3
}, function(item: number, next: AsyncBooleanResultCallback<Error>): void {
}, function(item: number, next: AsyncBooleanResultCallback): void {
console.log(`async.some/any: ${item}`);
+1 -1
View File
@@ -3,7 +3,7 @@ declare class Session {
readonly token: string;
readonly createdAt: Date;
readonly expiresAt: Date;
constructor(token: string, createdAt: Date, expiresAt: Date);
toCrowd(): SessionObj;
static fromCrowd(obj: SessionObj): Session;
+1 -1
View File
@@ -3,7 +3,7 @@ export interface Settings {
readonly application: {
readonly name: string;
readonly password: string;
}
};
readonly nesting?: boolean;
readonly sessionTimeout?: number;
readonly debug?: boolean;
+4 -1
View File
@@ -4,6 +4,9 @@
"await-promise": [true, "CancellablePromise"],
"indent": [true, "spaces", 4],
"max-line-length": [true, 100],
"no-any": true
"no-any": true,
// TODOs
"no-declare-current-package": false
}
}
+6
View File
@@ -0,0 +1,6 @@
import * as auth from 'auth-header';
const basic: string = auth.format('Basic');
const basic2: string = auth.format({scheme: 'Basic'});
const parsed: {scheme: string, token: null | string | string[]} = auth.parse('');
+27
View File
@@ -0,0 +1,27 @@
// Type definitions for auth-header 1.0
// Project: https://github.com/izaakschroeder/auth-header
// Definitions by: ForbesLindesay <https://github.com/ForbesLindesay>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
type Params =
| Array<[string, string | ReadonlyArray<string>]>
| {[key: string]: string | ReadonlyArray<string>};
export {Params};
export interface TokenOptions {
scheme: string;
token?: string;
params?: Params;
}
export interface Token {
scheme: string;
params: {[key: string]: string | string[]};
token: null | string | string[];
}
export function format(token: TokenOptions): string;
export function format(scheme: string, token?: string, params?: Params): string;
export function parse(header: string): Token;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"auth-header-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+1
View File
@@ -98,6 +98,7 @@ interface Auth0LockAuthOptions {
params?: Auth0LockAuthParamsOptions;
redirect?: boolean;
redirectUrl?: string;
responseMode?: string;
responseType?: string;
sso?: boolean;
audience?: string;
+2 -1
View File
@@ -2,7 +2,8 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/sandrinodimattia/axios-token-interceptor#readme
// Definitions by: Mike Dodge <https://github.com/innovation-team>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { AxiosRequestConfig } from 'axios';
+9 -2
View File
@@ -2,14 +2,21 @@
"extends": "dtslint/dt.json",
"rules": {
// All are TODOs
"eofline": false,
"adjacent-overload-signatures": false,
"array-type": false,
"ban-types": false,
"comment-format": false,
"dt-header": false,
"eofline": false,
"max-line-length": false,
"member-access": false,
"no-consecutive-blank-lines": false,
"no-empty-interface": false,
"no-namespace": false,
"no-unnecessary-class": false,
"no-useless-files": false,
"no-var": false,
"semicolon": false
"semicolon": false,
"space-before-function-paren": false
}
}
-1
View File
@@ -1,5 +1,4 @@
import Boom = require('boom');
import * as Hapi from 'hapi';
// 4xx and data type
+2 -1
View File
@@ -2,7 +2,8 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
@@ -0,0 +1,46 @@
import Plugin = require('broccoli-plugin');
declare function copySync(src: string, dest: string): void;
declare function setTimeout(callback: () => void, duration: number): void;
class SlowItDown extends Plugin {
constructor(private readonly waitInMS: number) {
super([], {
annotation: `${waitInMS} ms`,
needsCache: false
});
}
async build() {
await new Promise(resolve => setTimeout(resolve, this.waitInMS));
}
}
class FileCopier extends Plugin {
constructor(inputNodes: Plugin.BroccoliNode[]) {
super(inputNodes, {
name: 'CopyFiles',
persistentOutput: true
});
}
build() {
for (const input of this.inputPaths) {
copySync(input, this.outputPath);
}
}
getCallbackObject() {
return this;
}
}
new FileCopier([
new SlowItDown(5000),
'src',
'assets'
]);
new Plugin(); // $ExpectError
new Plugin([{}]); // $ExpectError
new Plugin([], { foo: 'bar' }); // $ExpectError
+78
View File
@@ -0,0 +1,78 @@
// Type definitions for broccoli-plugin 1.3
// Project: https://github.com/broccolijs/broccoli-plugin
// Definitions by: Dan Freeman <https://github.com/dfreeman>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
export = BroccoliPlugin;
declare namespace BroccoliPlugin {
type BroccoliNode = BroccoliPlugin | string;
interface BroccoliPluginOptions {
/**
* The name of this plugin. Defaults to `this.constructor.name`.
*/
name?: string;
/**
* A descriptive annotation. Useful for debugging, to tell multiple
* instances of the same plugin apart.
*/
annotation?: string;
/**
* If `true`, the output directory is not automatically emptied between
* builds. Defaults to `false`.
*/
persistentOutput?: boolean;
/**
* If `true`, a cache directory is created automatically and the path is
* set at `cachePath`. If `false`, a cache directory is not created and
* `this.cachePath` is `undefined`. Defaults to `true`.
*/
needsCache?: boolean;
}
}
declare class BroccoliPlugin {
constructor(inputNodes: BroccoliPlugin.BroccoliNode[], options?: BroccoliPlugin.BroccoliPluginOptions);
/**
* An array of paths on disk corresponding to each node in `inputNodes`.
* Your plugin will read files from these paths.
*/
readonly inputPaths: ReadonlyArray<string>;
/**
* The path on disk corresponding to this plugin instance (this node).
* Your plugin will write files to this path. This directory is emptied by
* Broccoli before each build, unless the `persistentOutput` options is
* `true`.
*/
readonly outputPath: string;
/**
* The path on disk to an auxiliary cache directory. Use this to store
* files that you want preserved between builds. This directory will
* only be deleted when Broccoli exits. If a cache directory is not
* needed, set `needsCache` to false when calling `broccoli-plugin`
* constructor.
*/
readonly cachePath?: string;
/**
* Override this method in your subclass. It will be called on each
* (re-)build. All paths stay the same between builds.
* To perform asynchronous work, return a promise.
*/
build(): void | Promise<any>;
/**
* Advanced usage only.
* Return the object on which Broccoli will call `obj.build()`. Called
* once after instantiation. By default, returns `this`.
*/
getCallbackObject(): { build(): void | Promise<any> };
}
+23
View File
@@ -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",
"broccoli-plugin-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/gluwer/bunyan-winston-adapter
// Definitions by: Steve Hipwell <https://github.com/stevehipwell>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
// TypeScript Version: 2.2
import * as bunyan from "bunyan";
import { Logger } from "winston";
+1 -1
View File
@@ -1,6 +1,6 @@
// Type definitions for chai-fs 2.0
// Project: https://github.com/chaijs/chai-fs
// Definitions by: Dimitar Danailov <https://github.com/Nemo157>
// Definitions by: Dimitar Danailov <https://github.com/dimitardanailov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
+2 -1
View File
@@ -2,7 +2,8 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
+3 -1
View File
@@ -19,7 +19,7 @@ const chart: Chart = new Chart(new CanvasRenderingContext2D(), {
backgroundColor: "#000000",
borderWidth: 1,
label: "test",
data: [1]
data: [1, null, 3]
}
]
},
@@ -36,6 +36,7 @@ const chart: Chart = new Chart(new CanvasRenderingContext2D(), {
tooltips: {
filter: data => Number(data.yLabel) > 0,
intersect: true,
mode: 'index',
itemSort: (a, b) => Math.random() - 0.5,
position: "average",
caretPadding: 2,
@@ -125,6 +126,7 @@ const chartConfig: Chart.ChartConfiguration = {
backgroundColor: '#37738353',
borderColor: '#37738353',
borderWidth: 3,
borderCapStyle: 'round',
fill: true
}]
},
+16 -10
View File
@@ -10,7 +10,6 @@
// Guillaume Rodriguez <https://github.com/guillaume-ro-fr>
// Simon Archer <https://github.com/archy-bold>
// Ken Elkabany <https://github.com/braincore>
// Slavik Nychkalo <https://github.com/gebeto>
// Francesco Benedetto <https://github.com/frabnt>
// Alexandros Dorodoulis <https://github.com/alexdor>
// Manuel Heidrich <https://github.com/mahnuh>
@@ -174,6 +173,8 @@ declare namespace Chart {
type PositionType = 'left' | 'right' | 'top' | 'bottom';
type InteractionMode = 'point' | 'nearest' | 'single' | 'label' | 'index' | 'x-axis' | 'dataset' | 'x' | 'y';
interface ChartArea {
top: number;
right: number;
@@ -185,10 +186,10 @@ declare namespace Chart {
text?: string;
fillStyle?: string;
hidden?: boolean;
lineCap?: string;
lineCap?: 'butt' | 'round' | 'square';
lineDash?: number[];
lineDashOffset?: number;
lineJoin?: string;
lineJoin?: 'bevel' | 'round' | 'miter';
lineWidth?: number;
strokeStyle?: string;
pointStyle?: PointStyle;
@@ -331,7 +332,7 @@ declare namespace Chart {
interface ChartTooltipOptions {
enabled?: boolean;
custom?(a: any): void;
mode?: string;
mode?: InteractionMode;
intersect?: boolean;
backgroundColor?: ChartColor;
titleFontFamily?: string;
@@ -373,7 +374,7 @@ declare namespace Chart {
type ChartTooltipPositioner = (elements: any[], eventPosition: Point) => Point;
interface ChartHoverOptions {
mode?: string;
mode?: InteractionMode;
animationDuration?: number;
intersect?: boolean;
onHover?(this: Chart, event: MouseEvent, activeElements: Array<{}>): any;
@@ -479,7 +480,12 @@ declare namespace Chart {
fontStyle?: string;
}
interface TickOptions {
interface TickOptions extends NestedTickOptions {
minor?: NestedTickOptions | false;
major?: NestedTickOptions | false;
}
interface NestedTickOptions {
autoSkip?: boolean;
autoSkipPadding?: number;
backdropColor?: ChartColor;
@@ -541,12 +547,12 @@ declare namespace Chart {
backgroundColor?: ChartColor | ChartColor[];
borderWidth?: number | number[];
borderColor?: ChartColor | ChartColor[];
borderCapStyle?: string;
borderCapStyle?: 'butt' | 'round' | 'square';
borderDash?: number[];
borderDashOffset?: number;
borderJoinStyle?: string;
borderJoinStyle?: 'bevel' | 'round' | 'miter';
borderSkipped?: PositionType;
data?: number[] | ChartPoint[];
data?: Array<number | null | undefined> | ChartPoint[];
fill?: boolean | number | string;
hoverBackgroundColor?: string | string[];
hoverBorderColor?: string | string[];
@@ -566,7 +572,7 @@ declare namespace Chart {
pointStyle?: PointStyle | HTMLImageElement | HTMLCanvasElement | Array<PointStyle | HTMLImageElement | HTMLCanvasElement>;
xAxisID?: string;
yAxisID?: string;
type?: string;
type?: ChartType | string;
hidden?: boolean;
hideInLegendAndTooltip?: boolean;
showLine?: boolean;
+1
View File
@@ -197,6 +197,7 @@ new Chartist.Bar('.ct-chart', {
}, {
// Default mobile configuration
stackBars: true,
stackMode: 'accumulate',
axisX: {
labelInterpolationFnc: (value: string) => {
return value.split(/\s+/).map((word: string) => {
+1
View File
@@ -283,6 +283,7 @@ declare namespace Chartist {
* If set to true this property will cause the series bars to be stacked and form a total for each series point. This will also influence the y-axis and the overall bounds of the chart. In stacked mode the seriesBarDistance property will have no effect.
*/
stackBars?: boolean;
stackMode?: 'overlap' | 'accumulate';
horizontalBars?: boolean;
distributeSeries?: boolean;
+4 -4
View File
@@ -1,5 +1,5 @@
export interface Map {
[key: string]: any
[key: string]: any;
}
export interface CursorParams {
page?: number;
@@ -15,9 +15,9 @@ export interface Cursor {
total_pages?: number;
}
export interface Entries<T> extends Cursor {
entries: T[]
entries: T[];
}
interface Summary {
export interface Summary {
current: number;
previous: number;
['percentage-change']: number;
@@ -25,4 +25,4 @@ interface Summary {
export interface EntriesSummary<T> {
entries: T[];
summary: Summary;
}
}
+51
View File
@@ -0,0 +1,51 @@
// Type definitions for CodeMirror
// Project: https://github.com/marijnh/CodeMirror
// Definitions by: Nikolaj Kappler <https://github.com/nkappler>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// See docs https://codemirror.net/doc/manual.html#addon_panel
import * as CodeMirror from "codemirror";
declare module "codemirror" {
interface Panel {
/**Removes the panel from the editor */
clear(): void;
/**Notifies panel that height of DOM node has changed */
changed(height?: number): void;
}
interface ShowPanelOptions {
/**Controls the position of the newly added panel. The following values are recognized:
* `top` (default): Adds the panel at the very top.
* `after-top`: Adds the panel at the bottom of the top panels.
* `bottom`: Adds the panel at the very bottom.
* `before-bottom`: Adds the panel at the top of the bottom panels.
*/
position?: "top" | "after-top" | "bottom" | "before-bottom";
/**The new panel will be added before the given panel. */
before?: Panel;
/**The new panel will be added after the given panel. */
after?: Panel;
/**The new panel will replace the given panel. */
replace?: Panel;
/**Whether to scroll the editor to keep the text's vertical position stable, when adding a panel above it. Defaults to false. */
stable?: boolean;
}
interface Editor {
/**
* Places a DOM node above or below an editor and shrinks the editor to make room for the node.
* When using the `after`, `before` or `replace` options, if the panel doesn't exists or has been removed, the value of the `position` option will be used as a fallback.
* @param node the DOM node
* @param options optional options object
*/
addPanel(node: HTMLElement, options?: ShowPanelOptions): Panel;
}
}
declare module "codemirror/addon/display/panel" {
export = CodeMirror;
}
+12 -10
View File
@@ -260,16 +260,7 @@ declare namespace CodeMirror {
line should be either an integer or a line handle, and node should be a DOM node, which will be displayed below the given line.
options, when given, should be an object that configures the behavior of the widget.
Note that the widget node will become a descendant of nodes with CodeMirror-specific CSS classes, and those classes might in some cases affect it. */
addLineWidget(line: any, node: HTMLElement, options?: {
/** Whether the widget should cover the gutter. */
coverGutter?: boolean;
/** Whether the widget should stay fixed in the face of horizontal scrolling. */
noHScroll?: boolean;
/** Causes the widget to be placed above instead of below the text of the line. */
above?: boolean;
/** When true, will cause the widget to be rendered even if the line it is associated with is hidden. */
showIfHidden?: boolean;
}): CodeMirror.LineWidget;
addLineWidget(line: any, node: HTMLElement, options?: CodeMirror.LineWidgetOptions): CodeMirror.LineWidget;
/** Programatically set the size of the editor (overriding the applicable CSS rules).
@@ -728,6 +719,17 @@ declare namespace CodeMirror {
changed(): void;
}
interface LineWidgetOptions {
/** Whether the widget should cover the gutter. */
coverGutter?: boolean;
/** Whether the widget should stay fixed in the face of horizontal scrolling. */
noHScroll?: boolean;
/** Causes the widget to be placed above instead of below the text of the line. */
above?: boolean;
/** When true, will cause the widget to be rendered even if the line it is associated with is hidden. */
showIfHidden?: boolean;
}
interface EditorChange {
/** Position (in the pre-change coordinate system) where the change started. */
from: CodeMirror.Position;
+17
View File
@@ -0,0 +1,17 @@
var cm: CodeMirror.Editor = CodeMirror(document.body);
var panel1 = cm.addPanel(document.body);
var panel2: CodeMirror.Panel = cm.addPanel(document.body, {
position: "top",
after: panel1,
before: panel1,
replace: panel1,
stable: true
});
panel2.changed();
panel2.changed(100);
panel2.clear();
+2
View File
@@ -20,11 +20,13 @@
"files": [
"index.d.ts",
"codemirror-matchbrackets.d.ts",
"codemirror-panel.d.ts",
"codemirror-runmode.d.ts",
"codemirror-showhint.d.ts",
"searchcursor.d.ts",
"test/index.ts",
"test/matchbrackets.ts",
"test/panel.ts",
"test/runmode.ts",
"test/searchcursor.ts",
"test/showhint.ts"
@@ -0,0 +1,10 @@
import Critters from 'critters-webpack-plugin';
new Critters({
compress: true,
external: true,
inlineFonts: false,
preloadFonts: true,
keyframes: 'critical',
noscriptFallback: true,
});
+65
View File
@@ -0,0 +1,65 @@
// Type definitions for critters-webpack-plugin 1.3
// Project: https://github.com/GoogleChromeLabs/critters
// Definitions by: Juan José González Giraldo <https://github.com/JuanJoseGonGi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { Plugin } from 'webpack';
export default Critters;
declare class Critters extends Plugin {
constructor(options?: Critters.CrittersOptions);
}
declare namespace Critters {
interface CrittersOptions {
/**
* Inline styles from external stylesheets.
* @default true
*/
external?: boolean;
/**
* The mechanism to use for lazy-loading stylesheets. [JS] indicates that a strategy requires JavaScript (falls back to <noscript>).
* - default: Move stylesheet links to the end of the document and insert preload meta tags in their place.
* - "body": Move all external stylesheet links to the end of the document.
* - "media": Load stylesheets asynchronously by adding media="not x" and removing once loaded. [JS]
* - "swap": Convert stylesheet links to preloads that swap to rel="stylesheet" once loaded. [JS]
* - "js": Inject an asynchronous CSS loader similar to LoadCSS and use it to load stylesheets. [JS]
* - "js-lazy": Like "js", but the stylesheet is disabled until fully loaded.
*/
preload?: 'body' | 'media' | 'swap' | 'js' | 'js-lazy';
/**
* Add <noscript> fallback to JS-based strategies
*/
noscriptFallback?: boolean;
/**
* Inline critical font-face rules.
* @default false
*/
inlineFonts?: boolean;
/**
* Preloads critical fonts.
* @default true
*/
preloadFonts?: boolean;
/**
* Shorthand for setting inlineFonts+preloadFonts - Values:
* - true to inline critical font-face rules and preload the fonts.
* - false to don"t inline any font-face rules and don"t preload fonts.
*/
fonts?: boolean;
/**
* Controls which keyframes rules are inlined. - Values:
* - "critical": Inline keyframes rules used by the critical CSS.
* - "all" Inline all keyframes rules.
* - "none" Remove all keyframes rules
* @default "critical"
*/
keyframes?: 'critical' | 'all' | 'none';
/**
* Compress resulting critical CSS.
* @default true
*/
compress?: boolean;
}
}
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": ["index.d.ts", "critters-webpack-plugin-tests.ts"]
}
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+6 -2
View File
@@ -596,6 +596,7 @@ numbersArray = d3Array.pairs(readonlyMergedArray, (a, b) => {
// getting a permutation of array elements
mergedArray = d3Array.permute(mergedArray, [1, 0, 2, 5, 3, 4, 6]);
mergedArray = d3Array.permute(readonlyMergedArray, [1, 0, 2, 5, 3, 4, 6]);
mergedArray = d3Array.permute(readonlyMergedArray, nums);
// Getting an ordered array with object properties
@@ -606,7 +607,10 @@ const testObject = {
more: [10, 30, 40]
};
const x: Array<number | string | Date | number[]> = d3Array.permute(testObject, ['name', 'val', 'when', 'more']);
const p1: Array<number | string | Date | number[]> = d3Array.permute(testObject, ['name', 'val', 'when', 'more']);
const p2: Array<Date | number[]> = d3Array.permute(testObject, ['when', 'more']);
// $ExpectError
const p3 = d3Array.permute(testObject, ['when', 'unknown']);
// range() ---------------------------------------------------------------------
@@ -913,7 +917,7 @@ mixedObject = binMixedObject_DateOrUndefined[0];
dateOrUndefined = binMixedObject_DateOrUndefined.x0;
dateOrUndefined = binMixedObject_DateOrUndefined.x1;
// Histogram Tresholds =========================================================
// Histogram Thresholds ========================================================
numbersArray = [-1, 0, 1, 1, 3, 20, 234];
typedArray = new Uint8Array(numbersArray);
+16 -7
View File
@@ -228,19 +228,23 @@ export function pairs<T>(array: ArrayLike<T>): Array<[T, T]>;
* Returns the empty array if the input array has fewer than two elements.
*
* @param array Array of input elements
* @param reducer A reducer function taking as input to adjecent elements of the input array and returning a reduced value.
* @param reducer A reducer function taking as input to adjacent elements of the input array and returning a reduced value.
*/
export function pairs<T, U>(array: ArrayLike<T>, reducer: (a: T, b: T) => U): U[];
/**
* Given the specified array, return an array corresponding to the list of indices in 'keys'.
* Returns a permutation of the specified array using the specified array of indexes.
* The returned array contains the corresponding element in array for each index in indexes, in order.
* For example, `permute(["a", "b", "c"], [1, 2, 0]) // ["b", "c", "a"]`
*/
export function permute<T>(array: { [key: number]: T }, keys: ArrayLike<number>): T[];
/**
* Given the specified object, return an array corresponding to the list of property names in 'keys'.
* Extract the values from an object into an array with a stable order. For example:
* `var object = {yield: 27, year: 1931, site: "University Farm"};`
* `d3.permute(object, ["site", "yield"]); // ["University Farm", 27]`
*/
export function permute<T>(object: { [key: string]: T }, keys: ArrayLike<string>): T[];
export function permute<T, K extends keyof T>(object: T, keys: ArrayLike<K>): Array<T[K]>;
/**
* Generates a 0-based numeric sequence. The output range does not include 'stop'.
@@ -347,6 +351,11 @@ export type ThresholdNumberArrayGenerator<Value extends number | undefined> =
export type ThresholdDateArrayGenerator<Value extends Date | undefined> =
(values: ArrayLike<Value>, min: Date, max: Date) => Value[];
/**
* @deprecated Use ThresholdNumberArrayGenerator or ThresholdDateArrayGenerator.
*/
export type ThresholdArrayGenerator = ThresholdNumberArrayGenerator<number>;
/**
* @deprecated Use `HistogramGeneratorNumber<Datum, Value>` for `number` values and `HistogramGeneratorDate<Datum, Value> for `Date` values.
*/
@@ -403,7 +412,7 @@ export interface HistogramGeneratorDate<Datum, Value extends Date | undefined> e
* and the last bin.x1 is always equal to the maximum domain value.
*
* @param thresholds A function which accepts as arguments the array of materialized values, and
* optionally the domain minimum and maximum. The function calcutates and returns the array of values to be used as
* optionally the domain minimum and maximum. The function calculates and returns the array of values to be used as
* thresholds in determining the bins.
*/
thresholds(thresholds: ThresholdDateArrayGenerator<Value>): this;
@@ -434,7 +443,7 @@ export interface HistogramGeneratorNumber<Datum, Value extends number | undefine
* and the last bin.x1 is always equal to the maximum domain value.
*
* @param count A function which accepts as arguments the array of materialized values, and
* optionally the domain minimum and maximum. The function calcutates and returns the suggested
* optionally the domain minimum and maximum. The function calculates and returns the suggested
* number of bins.
*/
thresholds(count: ThresholdCountGenerator<Value>): this;
@@ -456,7 +465,7 @@ export interface HistogramGeneratorNumber<Datum, Value extends number | undefine
* and the last bin.x1 is always equal to the maximum domain value.
*
* @param thresholds A function which accepts as arguments the array of materialized values, and
* optionally the domain minimum and maximum. The function calcutates and returns the array of values to be used as
* optionally the domain minimum and maximum. The function calculates and returns the array of values to be used as
* thresholds in determining the bins.
*/
thresholds(thresholds: ThresholdNumberArrayGenerator<Value>): this;
+16
View File
@@ -0,0 +1,16 @@
import { select, BaseType } from 'd3-selection';
import * as d3Graphviz from 'd3-graphviz';
let graphviz: d3Graphviz.Graphviz<BaseType, any, BaseType, any>;
// Can get a graphviz render using extension method on d3-select
graphviz = select('test').graphviz();
// Can use graphviz method as selector
graphviz = d3Graphviz.graphviz('test');
// Can get the options
const options: d3Graphviz.GraphvizOptions = d3Graphviz.graphviz('').options();
// Can set the options
graphviz = graphviz.options(options);
+455
View File
@@ -0,0 +1,455 @@
// Type definitions for d3-graphviz 2.6
// Project: https://github.com/magjac/d3-graphviz
// Definitions by: Dom Parfitt <https://github.com/DomParfitt>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { ZoomBehavior } from 'd3-zoom';
import { Selection, BaseType, ValueFn } from 'd3-selection';
import { Transition } from 'd3-transition';
/**
* Define methods which act as extensions to d3-selection
*/
declare module 'd3-selection' {
interface Selection<GElement extends BaseType, Datum, PElement extends BaseType, PDatum> {
/**
* Returns a new graphviz renderer instance on the first element in the given selection. If a graphviz renderer instance already exists
* on that element, instead returns the existing graphviz renderer instance.
* @param options either a GraphvizOptions object representing the options of the graphviz renderer or a boolean representing the
* useWorker option.
*/
graphviz(options?: GraphvizOptions | boolean): Graphviz<GElement, Datum, BaseType, PDatum>;
/**
* For each selected element, selects the first descendant element that matches the specified selector string in the same ways as
* d3-selection.select, but does not propagate any associated data from the current element to the corresponding selected element.
*/
selectWithoutDataPropagation(): Selection<GElement, Datum, PElement, PDatum>;
}
}
/**
* Creates a new graphviz renderer instance on the first element matching the given selector string. If the selector is not a string,
* instead creates a new graphviz renderer instance on the specified node. If a graphviz renderer instance already exists on that
* element, instead returns the existing graphviz renderer instance.
* @param selector either a string representing a selector for a given node or an instance of a node
* @param options the options to be applied to the graphviz renderer
*/
export function graphviz(selector: string | BaseType, options?: GraphvizOptions | boolean): Graphviz<BaseType, any, BaseType, any>;
/**
* Interface representing the Graphviz Renderer. Methods generally return the instance of the
* object they were called on (i.e this) in order to allow for easy method chaining.
*/
export interface Graphviz<GElement extends BaseType, Datum, PElement extends BaseType, PDatum> {
// Options
/**
* Gets the currently set options object on the renderer
*/
options(): GraphvizOptions;
/**
* Sets the options provided. Does not overwrite existing options that are not
* provided in the options parameter.
* @param options the options to set on the renderer
*/
options(options: GraphvizOptions): this;
// Rendering
/**
* Renders an SVG graph from the specified src string and appends it to the selection the grapviz
* renderer instance was generated on.
* @param src a string representing a valid string in the DOT language
* @param callback
*/
renderDot(src: string, callback?: () => void): this;
/**
* Starts computation of the layout of a graph from the specified dotSrc string and saves the data for
* rendering the SVG with {@link render} at a later stage.
* @param src a string representing a valid string in the DOT language
* @param callback
*/
dot(src: string, callback?: () => void): this;
/**
* Starts rendering of an SVG graph from data saved by {@link dot} and appends it to the selection
* the grapviz renderer instance was generated on.
* @param callback
*/
render(callback?: () => void): this;
/**
* Sets the Graphviz layout engine name to the specified engine string.
* @param engine a string taking one of the following values:
* - circo
* - dot
* - fdp
* - neato
* - osage
* - patchwork
* - twopi
*/
engine(engine: Engine): this;
/**
* Sets the callback that is called if the layout computation encounters
* an error. If no callback is passed then it removes the existing callback.
* @param callback the call back function triggered by an error
*/
onerror(callback?: (errorMessage: any) => void): this;
// Images
/**
* Add an image reference. Must be called before {@link renderDot} ir {@link dot}
* are called.
* @param path the path of the image, may be a filename, relative or absolute path or a URL
* @param width the width of the image, if a string is used then it may specify units. Allowed
* units are: in, px, pc, pt, cm, or mm. If no units are given or dimensions are
* given as numbers, points (pt) are used.
* @param height the height of the image, which follows the same unit rules as width.
*/
addImage(path: string, width: number | string, height: number | string): this;
// Creating Transitions
/**
* Applies the specified transition name to subsequent SVG rendering. Accepts the same arguments
* as {@link d3-select.transition} or a function, but returns the graph renderer instance, not the
* transition. If name is a function, it is taken to be a transition factory. A transition factory
* is a function that returns a transition.
* @param name either a function returning a transition, a transition object or a string naming a
* transition
*/
transition(name?: () => Transition<GElement, Datum, PElement, PDatum> | string | Transition<GElement, Datum, PElement, PDatum>): this;
/**
* Returns the active transition on the generated graph's top level svg with the specified name,
* if any. Returns null if there is no such active transition on the top level svg node.
* @param name the name of the transition
*/
active(name?: string): Transition<GElement, Datum, PElement, PDatum> | null;
// Controlling SVG and Graph Size
/**
* Sets the SVG width attribute.
* @param width the width in pixels
*/
width(width: number): this;
/**
* Sets the SVG height attribute
* @param height the height in pixels
*/
height(height: number): this;
/**
* Sets whether the graph's viewbox is affected by the size of its parent SVG's size
* @param fit true, if the graph should scale to fit its parent, false if it should
* remain at its original size
*/
fit(fit: boolean): this;
/**
* Sets the value the graph should scale by in relation to its parent SVG. Scaling
* only occurs if fit is set to true
* @param scale the scale value with 1.0 being 100%, 0.5 being 50% etc.
*/
scale(scale: number): this;
// Control Flow
/**
* Adds or removes a listener to the graphviz renderer instance for the specified event typenames.
* @param typenames
* @param callback
*/
on(typenames: TypeNames, callback?: () => void): this;
/**
* Sets whether events are logged or not.
* @param enable true if events should be logged, false if not
*/
logEvents(enable: boolean): this;
// Controlling Fade
/**
* Sets whether fade in and out of nodes is enabled.
* @param enable true to enable fade in and out, false to disable
*/
fade(enable: boolean): this;
// Controlling Animated Growth of Entering Edges
/**
* Sets whether animated growth of entering edges is enabled.
* @param enable true to animate entering edges, false to disable
*/
growEnteringEdges(enable: boolean): this;
// Controlling Path Tweening
/**
* Enables or disables path tweening
* @param enable true if path tweening should be enabled, false if it should be disabled
*/
tweenPaths(enable: boolean): this;
/**
* Sets the precision of path tweening. If precision is a number, sets the precision used
* during path tweening to precision points. The precision is the length of each path
* segment during tweening. If instead precision is a string containing '%', sets the
* relative precision.
* @param precision the precision as either a number of a string containing a percentage
*/
tweenPrecision(precision: number | string): this;
// Controlling Shape Tweening
/**
* Enables or disables shape tweening during transitions. Implicitly sets path tweening
* as enabled due to SVGs handling for them.
* @param enable true if shape tweening should be enabled, false if it should be disabled
*/
tweenShapes(enable: boolean): this;
/**
* Enables or disables conversion of polygons with an equal number of sides during shape
* tweening.
* @param enable true if conversion should be enabled, false if it should be disabled.
*/
convertEqualSidedPolygons(enable: boolean): this;
// Controlling Panning & Zooming
/**
* Enables or disables zooming and panning.
* @param enable true if zooming should be enabled, false if it should be disabled.
*/
zoom(enable: boolean): this;
/**
* Returns the zoom behaviour of a graph. If the zoom is disable or the graph has not
* yet been rendered then returns null.
*/
zoomBehavior(): ZoomBehavior<Element, Datum> | null;
/**
* Returns the selection to which zoom behaviour has been applied. If zoom is disabled
* or the graph has not yet been rendered then returns null.
*/
zoomSelection(): Element | null;
/**
* Sets the scale extend for zooming where the first number is the minimum allowed zoom
* and the second is the maximum.
* @param extent a tuple containing the minimum and maximum allowed zoom
*/
zoomScaleExtent(extent?: [number, number]): this;
/**
* Sets the translate extent which restricts panning.
* @param extent a tuple of the form ((x0, y0), (x1, y1)) where (x0, y0) is the top-left
* corner of the "world" and (x1, y1) is the bottom-right corner
*/
zoomTranslateExtent(extent?: [[number, number], [number, number]]): this;
/**
* Resets any transformations made by panning and zooming.
* @param transition an optional transition to apply during reset.
*/
resetZoom(transition?: string | Transition<GElement, Datum, PElement, PDatum>): this;
// Maintaining Object Constancy
/**
* Sets the key mode to the the provided mode string. Must be set before passing in
* any DOT strings.
* @param keyMode
*/
keyMode(keyMode: KeyMode): this;
// Customizing Graph Attributes
/**
*
* @param callback
*/
attributer(callback?: ValueFn<GElement, Datum, void>): this;
// Accessing Extracted Data
/**
* Returns the data extracted by {@link dot} or null if none exists.
*/
data(): Datum;
// Modifying an Existing Graph and Animating the Changes
// Edges
/**
* Draws a straight edge from (x1, y1) to (x2, y2) using coordinates relative to top level G container element of the graph.
* @param x1 the starting x co-ordinate
* @param y1 the starting y co-ordinate
* @param x2 the ending x co-ordinate
* @param y2 the ending y co-ordinate
* @param attributes object containing DOT attributes
* @param options object containing the options used when drawing the edge
*/
drawEdge(x1: number, y1: number, x2: number, y2: number, attributes?: DotAttributes, options?: EdgeOptions): this;
/**
* Updates properties and attributes of the edge currently drawn with {@link drawEdge},
* using the same arguments. This method cannot be used after the edge has been inserted
* into the graph data with {@link insertDrawnEdge.}
* @param x1 the starting x co-ordinate
* @param y1 the starting y co-ordinate
* @param x2 the ending x co-ordinate
* @param y2 the ending y co-ordinate
* @param attributes object containing DOT attributes
* @param options object containing the options used when drawing the edge
*/
updateDrawnEdge(x1: number, y1: number, x2: number, y2: number, attributes?: DotAttributes, options?: EdgeOptions): this;
/**
* Updates the end point of the edge currently drawn with {@link drawEdge},
* accepting the same options argument. This method cannot be used after the
* edge has been inserted into the graph data with {@link insertDrawnEdge}.
* @param x2 the ending x co-ordinate
* @param y2 the ending y co-ordinate
* @param options object containing the options used when drawing the edge
*/
moveDrawnEdgeEndPoint(x2: number, y2: number, options?: EdgeOptions): this;
/**
* Inserts the edge into the graph data, making it available for an animated
* transition into a subsequent new layout.
* @param name the name of the edge.
*/
insertDrawnEdge(name: string): this;
/**
* Removes the edge currently drawn with {@link drawEdge}. This method cannot
* be used after the edge has been inserted into the graph data with
* {@link insertDrawnEdge}.
*/
removeDrawnEdge(): this;
/**
* Returns a {@link Selection} containing the edge currently being drawn. The selection is empty
* if no edge has been drawn or the lastest drawn edge has been inserted into the graph data with
* {@link insertDrawnNode}.
*/
drawnEdgeSelection(): Selection<GElement, Datum, PElement, PDatum>;
// Nodes
/**
* Draws a node with the upper left corner of its bounding box at (x, y), using
* coordinates relative to the top level G container element of the graph.
* @param x x co-ordinate of the top-left bounding box of the node
* @param y y co-ordinate of the top-left bounding box of the node
* @param nodeId the ID of the node
* @param attributes object containing DOT attributes
* @param options object containing the options used when drawing the node, currently unused
*/
drawNode(x: number, y: number, nodeId: string, attributes?: DotAttributes, options?: any): this;
/**
* Updates properties and attributes of the node currently drawn with {@link drawNode},
* using the same arguments. This method cannot be used after the node has been inserted
* into the graph data with {@link insertDrawnNode}.
* @param x x co-ordinate of the top-left bounding box of the node
* @param y y co-ordinate of the top-left bounding box of the node
* @param nodeId the ID of the node
* @param attributes object containing DOT attributes
* @param options object containing the options used when drawing the node, currently unused
*/
updateDrawnNode(x: number, y: number, nodeId: string, attributes?: DotAttributes, options?: any): this;
/**
* Updates the position of the upper left corner of the node currently drawn
* with {@link drawNode}, accepting the same options argument. This method
* cannot be used after the node has been inserted into the graph data with
* {@link insertDrawnNode}.
* @param x new x co-ordinate of the top-left bounding box of the node
* @param y new y co-ordinate of the top-left bounding box of the node
* @param options object containing the options used when drawing the node, currently unused
*/
moveDrawnNode(x: number, y: number, options?: any): this;
/**
* Inserts the node into the graph data, making it available for an animated
* transition into a subsequent new layout.
* @param nodeId the ID of the node
*/
insertDrawnNode(nodeId: string): this;
/**
* Removes the node currently drawn with {@link drawNode}. This method cannot
* be used after the node has been inserted into the graph data with {@link insertDrawnNode}.
*/
removeDrawnNode(): this;
/**
* Returns a {@link Selection} containing the node currently being drawn. The selection is empty
* if no node has been drawn or the lastest drawn node has been inserted into the graph data with
* {@link insertDrawnNode}.
*/
drawnNodeSelection(): Selection<GElement, Datum, PElement, PDatum>;
// Large Graphs
/**
* Sets the total memory available to Viz.js to size bytes, which should be a power of 2.
* @param size the size in bytes of memory allocated to Viz.js
*/
totalMemory(size: number): this;
}
/**
* Enum defining the valid strings that can be passed in as an engine
*/
export type Engine = 'circo' | 'dot' | 'fdp' | 'neato' | 'osage' | 'patchwork' | 'twopi';
/**
* Enum defining the valid strings that can be passed as TypeNames
*/
export type TypeNames = 'initEnd' | 'start' | 'layoutStart' | 'layoutEnd' | 'dataExtractEnd' |
'dataProcessPass1End' | 'dataProcessPass2End' | 'dataProcessEnd' |
'renderStart' | 'renderEnd' | 'transitionStart' | 'transitionEnd' |
'resotreEnd' | 'end' | string; // string included to allow for optional addition of a name, e.g. initEnd.foo
/**
* Enum defining the valid strings that can be passed as KeyModes
*/
export type KeyMode = 'title' | 'id' | 'tag-index' | 'index';
/**
* Interface defining the options present on the Graphviz Renderer.
* Most map directly to methods that can be used to set their values.
*/
export interface GraphvizOptions {
useWorker?: boolean;
engine?: Engine;
totalMemory?: number;
keyMode?: KeyMode;
fade?: boolean;
tweenPaths?: boolean;
tweenShapes?: boolean;
convertEqualSidedPolygons?: boolean;
tweenPrecision?: number | string;
growEnteringEdges?: boolean;
zoom?: boolean;
zoomScaleExtent?: [number, number];
zoomTranslateExtent?: [[number, number], [number, number]];
width?: number;
height?: number;
scale?: number;
fit?: boolean;
}
/**
* Interface defining the attributes available per the DOT language
*/
export interface DotAttributes {
style?: any;
URL?: any;
tooltip?: any;
}
/**
* Interface defining the options available for rendering edges
*/
export interface EdgeOptions {
shortening: number;
}
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-graphviz-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+8 -1
View File
@@ -1,6 +1,9 @@
// Type definitions for D3JS d3 standard bundle 5.0
// Project: https://github.com/d3/d3
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>
// Alex Ford <https://github.com/gustavderdrache>
// Boris Yankov <https://github.com/borisyankov>
// denisname <https://github.com/denisname>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -11,7 +14,11 @@
export as namespace d3;
/**
* Version number in format _Major.Minor.BugFix_, like 5.0.0.
*/
export const version: string;
export * from 'd3-array';
export * from 'd3-axis';
export * from 'd3-brush';
+1 -1
View File
@@ -7,7 +7,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
+8 -1
View File
@@ -1,6 +1,9 @@
// Type definitions for D3JS d3 standard bundle 4.13
// Project: https://github.com/d3/d3
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>
// Alex Ford <https://github.com/gustavderdrache>
// Boris Yankov <https://github.com/borisyankov>
// denisname <https://github.com/denisname>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -8,7 +11,11 @@
export as namespace d3;
/**
* Version number in format _Major.Minor.BugFix_, like 4.13.0.
*/
export const version: string;
export * from 'd3-array';
export * from 'd3-axis';
export * from 'd3-brush';
+1 -1
View File
@@ -7,7 +7,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../../",
"typeRoots": [
+2
View File
@@ -2,6 +2,8 @@
// Project: https://github.com/rochdev/datadog-tracer-js#readme
// Definitions by: Dinesh Saravanan Kumaraswamy <https://github.com/dineshsaravanan>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
import * as opentracing from "opentracing";
import { EventEmitter } from "events";
+2 -1
View File
@@ -2,7 +2,8 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
+1 -1
View File
@@ -22,7 +22,7 @@ interface SpanContextLike {
trace?: {
started: number[],
finished: number[]
}
};
}
export = DatadogSpanContext;
+5
View File
@@ -13,3 +13,8 @@ const imm1: number = (debounce((x: number) => x * 2, 100, true))(2);
const clearable = debounce(doThings);
clearable.clear();
// Intentionally asserts that the member variable has all the same benefits as the direct export.
// Eventually, if debounce stop supporting the CommonJS-only module calling (`require("debounce")(...)`),
// we can remove this and change the top import&require to `import { debounce } from "debounce";`.
const assertsSame: typeof debounce = debounce.debounce;
+9 -3
View File
@@ -1,7 +1,13 @@
// Type definitions for debounce 1.0
// Type definitions for debounce 3.0
// Project: https://github.com/component/debounce
// Definitions by: Denis Sokolov <https://github.com/denis-sokolov>
// Josh Goldberg <https://github.com/joshuakgoldberg>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function debounce<A extends Function>(f: A, interval?: number, immediate?: boolean): A & { clear(): void; };
export = debounce;
declare namespace _debounce {
const debounce: typeof _debounce;
}
declare function _debounce<A extends Function>(f: A, interval?: number, immediate?: boolean): A & { clear(): void; };
export = _debounce;
+3
View File
@@ -21,6 +21,9 @@ describe('Test', () => {
await element(by.id('scrollView')).swipe('down', 'fast');
await element(by.type('UIPickerView')).setColumnToValue(1, "6");
await expect(element(by.id('element').withAncestor(by.id('parent_element')))).toNotExist();
await expect(element(by.id('element').withDescendant(by.id('child_element')))).toNotExist();
await waitFor(element(by.id('element'))).toBeVisible().withTimeout(2000);
await device.pressBack();
await waitFor(element(by.text('Text5'))).toBeVisible().whileElement(by.id('ScrollView630')).scroll(50, 'down');
+24 -16
View File
@@ -1,6 +1,6 @@
// Type definitions for detox 7.3
// Type definitions for detox 9.0
// Project: https://github.com/wix/detox
// Definitions by: Tareq El-Masri <https://github.com/TareqElMasri>
// Definitions by: Tareq El-Masri <https://github.com/TareqElMasri>, Steve Chun <https://github.com/stevechun>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare const detox: Detox.Detox;
@@ -22,7 +22,7 @@ declare namespace Detox {
* await detox.init(config);
* });
*/
init(config: any, options: DetoxInitOptions): Promise<void>;
init(config: any, options?: DetoxInitOptions): Promise<void>;
/**
* Artifacts currently include only logs from the app process before each task
* @param args
@@ -157,18 +157,6 @@ declare namespace Detox {
interface Element {
(by: Matchers): DetoxAny;
/**
* Select by parent element
* @param parent
* @example await element(by.id('Grandson883').withAncestor(by.id('Son883')));
*/
withAncestor(parent: Element): DetoxAny;
/**
* Select by child element
* @param parent
* @example await element(by.id('Son883').withDescendant(by.id('Grandson883')));
*/
withDescendant(child: Element): DetoxAny;
/**
* Choose from multiple elements matching the same matcher using index
* @param index
@@ -177,6 +165,8 @@ declare namespace Detox {
atIndex(index: number): DetoxAny;
}
interface Matchers {
(by: Matchers): Matchers;
/**
* by.id will match an id that is given to the view via testID prop.
* @param id
@@ -209,6 +199,24 @@ declare namespace Detox {
* @example await element(by.traits(['button']));
*/
traits(traits: string[]): Matchers;
/**
* Find an element by a matcher with a parent matcher
* @param parentBy
* @example await element(by.id('Grandson883').withAncestor(by.id('Son883')));
*/
withAncestor(parentBy: Matchers): Matchers;
/**
* Find an element by a matcher with a child matcher
* @param childBy
* @example await element(by.id('Son883').withDescendant(by.id('Grandson883')));
*/
withDescendant(childBy: Matchers): Matchers;
/**
* Find an element by multiple matchers
* @param by
* @example await element(by.text('Product').and(by.id('product_name'));
*/
and(by: Matchers): Matchers;
}
interface Expect<R> {
(element: Element): Expect<any>;
@@ -275,7 +283,7 @@ declare namespace Detox {
withTimeout(millis: number): Promise<void>;
/**
* Performs the action repeatedly on the element until an expectation is met
* @param element
* @param by
* @example await waitFor(element(by.text('Text5'))).toBeVisible().whileElement(by.id('ScrollView630')).scroll(50, 'down');
*/
whileElement(by: Matchers): DetoxAny;
-1
View File
@@ -2,7 +2,6 @@
// Project: https://github.com/rolodato/dotenv-safe
// Definitions by: Stan Goldmann <https://github.com/krenor>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import env = require("dotenv")
+1 -1
View File
@@ -2,7 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5"
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
+1 -1
View File
@@ -6,7 +6,7 @@
*
* Copyright 2018, Dynamsoft Corporation
* Author: Dynamsoft Support Team
* Version: 13.4
* Version: 14.2
*/
declare enum EnumDWT_ConvertMode {
+4 -4
View File
@@ -1,4 +1,4 @@
// Type definitions for dwt 13.4
// Type definitions for dwt 14.2
// Project: http://www.dynamsoft.com/Products/WebTWAIN_Overview.aspx
// Definitions by: Xiao Ling <https://github.com/yushulx>
// Josh Hall <https://github.com/jbh>
@@ -14,7 +14,7 @@
*
* Copyright 2018, Dynamsoft Corporation
* Author: Dynamsoft Support Team
* Version: 13.4
* Version: 14.2
*/
/**
@@ -2889,12 +2889,12 @@ interface WebTwain {
* @return {number}
*/
GetImageYResolution(sImageIndex: number): number;
/**
* Return the runtime license info.
* @method WebTwain#GetLicenseInfo
*/
GetLicenseInfo(): { Domain: string, Detail: LicenseDetailItem[] };
GetLicenseInfo(optionalAsyncSuccessFunc?: (result: any) => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
/**
* Returns the index of the selected image.
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/eggjs/egg-mock
// Definitions by: Eward Song <https://github.com/sheperdwind>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
import { Application, Context } from 'egg';
+2 -1
View File
@@ -2,7 +2,8 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
+9 -1
View File
@@ -1 +1,9 @@
{ "extends": "dtslint/dt.json" }
{
"extends": "dtslint/dt.json",
"rules": {
// All are TODOs
"ban-types": false,
"interface-name": false,
"strict-export-declare-modifiers": false
}
}
@@ -338,6 +338,21 @@ client.indices.updateAliases({
// ...
});
client.reindex({
body: {
source: {
index: "twitter"
},
dest: {
index: "new_twitter"
}
}
})
.then(response => {
const { took, timed_out } = response;
// ...
});
// Errors
function testErrors() {
throw new elasticsearch.errors.AuthenticationException();
+20 -33
View File
@@ -281,26 +281,13 @@ export interface DeleteDocumentByQueryParams extends GenericParams {
scrollSize?: number;
waitForCompletion?: boolean;
requestsPerSecond?: number;
slices?: number;
index?: string;
type?: string;
}
export interface DeleteDocumentByQueryResponse {
took: number;
timed_out: boolean;
deleted: number;
batches: number;
version_conflicts: number;
noops: number;
retries: {
bulk: number;
search: number;
};
throttled_millis: number;
requests_per_second: number;
throttled_until_millis: number;
total: number;
failures: any[];
export interface DeleteDocumentByQueryResponse extends ReindexResponse {
// DeleteDocumentByQueryResponse, UpdateDocumentByQueryResponse and ReindexResponse are identical
}
export interface DeleteScriptParams extends GenericParams {
@@ -531,6 +518,7 @@ export interface ReindexParams extends GenericParams {
waitForActiveShards?: string;
waitForCompletion?: boolean;
requestsPerSecond?: number;
slices?: number;
body: {
conflicts?: string;
source: {
@@ -559,20 +547,6 @@ export interface ReindexParams extends GenericParams {
};
}
export interface ReindexResponse {
took: number;
updated: number;
created: number;
batches: number;
version_conflicts: number;
retries: {
bulk: number;
search: number;
};
throttled_millis: number;
failures: any[];
}
export interface ReindexRethrottleParams extends GenericParams {
requestsPerSecond: number;
taskId: string;
@@ -784,13 +758,28 @@ export interface UpdateDocumentByQueryParams extends GenericParams {
scrollSize?: number;
waitForCompletion?: boolean;
requestsPerSecond?: number;
slices?: number;
index: NameList;
type: NameList;
}
export interface UpdateDocumentByQueryResponse {
export interface UpdateDocumentByQueryResponse extends ReindexResponse {
// DeleteDocumentByQueryResponse, UpdateDocumentByQueryResponse and ReindexResponse are identical
}
export interface ReindexResponse extends ReindexResponseBase {
took: number;
timed_out: boolean;
failures: any[];
slices?: ReindexOrByQueryResponseSlice[];
}
export interface ReindexOrByQueryResponseSlice extends ReindexResponseBase {
slice_id: number;
}
export interface ReindexResponseBase {
total: number;
updated: number;
deleted: number;
batches: number;
@@ -803,8 +792,6 @@ export interface UpdateDocumentByQueryResponse {
throttled_millis: number;
requests_per_second: number;
throttled_until_millis: number;
total: number;
failures: any[];
}
export interface Cat {
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/blainesch/electron-notifications
// Definitions by: Daniel Pereira <https://github.com/djpereira>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
// TypeScript Version: 2.2
import * as Electron from 'electron';
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/hankbao/electron-notify
// Definitions by: Daniel Pereira <https://github.com/djpereira>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
// TypeScript Version: 2.2
/// <reference types="electron" />
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/paulcbetts/electron-spellchecker
// Definitions by: Daniel Perez Alvarez <https://github.com/unindented>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types="electron"/>
+2 -1
View File
@@ -2,7 +2,8 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/mawie81/electron-window-state
// Definitions by: rhysd <https://github.com/rhysd>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
// TypeScript Version: 2.2
/// <reference types="electron" />
+1 -1
View File
@@ -1,6 +1,6 @@
{
"private": true,
"dependencies": {
"electron": "^1.7.5"
"electron": "*"
}
}
+19 -6
View File
@@ -14,18 +14,31 @@
"../"
],
"paths": {
"@ember/debug": ["ember__debug"],
"@ember/debug/*": ["ember__debug/*"],
"@ember/service": ["ember__service"],
"@ember/application": ["ember__application"],
"@ember/application/*": ["ember__application/*"],
"@ember/array": ["ember__array"],
"@ember/array/*": ["ember__array/*"],
"@ember/component": ["ember__component"],
"@ember/component/*": ["ember__component/*"],
"@ember/controller": ["ember__controller"],
"@ember/debug": ["ember__debug"],
"@ember/debug/*": ["ember__debug/*"],
"@ember/controller": ["ember__controller"],
"@ember/engine": ["ember__engine"],
"@ember/engine/*": ["ember__engine/*"],
"@ember/error": ["ember__error"],
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"],
"@ember/polyfills": ["ember__polyfills"],
"@ember/routing": ["ember__routing"],
"@ember/routing/*": ["ember__routing/*"],
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"]
"@ember/runloop": ["ember__runloop"],
"@ember/runloop/*": ["ember__runloop/*"],
"@ember/service": ["ember__service"],
"@ember/string": ["ember__string"],
"@ember/test": ["ember__test"],
"@ember/test/*": ["ember__test/*"],
"@ember/utils": ["ember__utils"],
"@ember/utils/*": ["ember__utils/*"]
},
"types": [],
"noEmit": true,
+24 -2
View File
@@ -14,9 +14,31 @@
"../"
],
"paths": {
"@ember/service": ["ember__service"],
"@ember/application": ["ember__application"],
"@ember/application/*": ["ember__application/*"],
"@ember/array": ["ember__array"],
"@ember/array/*": ["ember__array/*"],
"@ember/component": ["ember__component"],
"@ember/component/*": ["ember__component/*"],
"@ember/controller": ["ember__controller"],
"@ember/debug": ["ember__debug"],
"@ember/debug/*": ["ember__debug/*"],
"@ember/engine": ["ember__engine"],
"@ember/engine/*": ["ember__engine/*"],
"@ember/error": ["ember__error"],
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"]
"@ember/object/*": ["ember__object/*"],
"@ember/polyfills": ["ember__polyfills"],
"@ember/routing": ["ember__routing"],
"@ember/routing/*": ["ember__routing/*"],
"@ember/runloop": ["ember__runloop"],
"@ember/runloop/*": ["ember__runloop/*"],
"@ember/service": ["ember__service"],
"@ember/string": ["ember__string"],
"@ember/test": ["ember__test"],
"@ember/test/*": ["ember__test/*"],
"@ember/utils": ["ember__utils"],
"@ember/utils/*": ["ember__utils/*"]
},
"types": [],
"noEmit": true,
+1 -1
View File
@@ -248,6 +248,6 @@ describe('rendering test', function() {
// render the component
await this.render(hbs`{{ x-foo value=value}}`);
chai.expect(this.element.querySelector('div>.value').textContent.trim()).to.equal('cat', 'The component shows the correct value');
chai.expect(this.element.querySelector('div>.value')!.textContent!.trim()).to.equal('cat', 'The component shows the correct value');
});
});
+24 -4
View File
@@ -2,7 +2,8 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
@@ -13,12 +14,31 @@
"../"
],
"paths": {
"@ember/engine": ["ember__engine"],
"@ember/engine/*": ["ember__engine/*"],
"@ember/application": ["ember__application"],
"@ember/application/*": ["ember__application/*"],
"@ember/array": ["ember__array"],
"@ember/array/*": ["ember__array/*"],
"@ember/component": ["ember__component"],
"@ember/component/*": ["ember__component/*"],
"@ember/controller": ["ember__controller"],
"@ember/debug": ["ember__debug"],
"@ember/debug/*": ["ember__debug/*"],
"@ember/engine": ["ember__engine"],
"@ember/engine/*": ["ember__engine/*"],
"@ember/error": ["ember__error"],
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"]
"@ember/object/*": ["ember__object/*"],
"@ember/polyfills": ["ember__polyfills"],
"@ember/routing": ["ember__routing"],
"@ember/routing/*": ["ember__routing/*"],
"@ember/runloop": ["ember__runloop"],
"@ember/runloop/*": ["ember__runloop/*"],
"@ember/service": ["ember__service"],
"@ember/string": ["ember__string"],
"@ember/test": ["ember__test"],
"@ember/test/*": ["ember__test/*"],
"@ember/utils": ["ember__utils"],
"@ember/utils/*": ["ember__utils/*"]
},
"types": [],
"noEmit": true,
+23 -2
View File
@@ -14,10 +14,31 @@
"../"
],
"paths": {
"@ember/application": ["ember__application"],
"@ember/application/*": ["ember__application/*"],
"@ember/array": ["ember__array"],
"@ember/array/*": ["ember__array/*"],
"@ember/component": ["ember__component"],
"@ember/component/*": ["ember__component/*"],
"@ember/controller": ["ember__controller"],
"@ember/debug": ["ember__debug"],
"@ember/debug/*": ["ember__debug/*"],
"@ember/engine": ["ember__engine"],
"@ember/engine/*": ["ember__engine/*"],
"@ember/error": ["ember__error"],
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"],
"@ember/component": ["ember__component"],
"@ember/component/*": ["ember__component/*"]
"@ember/polyfills": ["ember__polyfills"],
"@ember/routing": ["ember__routing"],
"@ember/routing/*": ["ember__routing/*"],
"@ember/runloop": ["ember__runloop"],
"@ember/runloop/*": ["ember__runloop/*"],
"@ember/service": ["ember__service"],
"@ember/string": ["ember__string"],
"@ember/test": ["ember__test"],
"@ember/test/*": ["ember__test/*"],
"@ember/utils": ["ember__utils"],
"@ember/utils/*": ["ember__utils/*"]
},
"types": [],
"noEmit": true,
+21 -4
View File
@@ -14,14 +14,31 @@
"../"
],
"paths": {
"@ember/engine": ["ember__engine"],
"@ember/engine/*": ["ember__engine/*"],
"@ember/application": ["ember__application"],
"@ember/application/*": ["ember__application/*"],
"@ember/array": ["ember__array"],
"@ember/array/*": ["ember__array/*"],
"@ember/component": ["ember__component"],
"@ember/component/*": ["ember__component/*"],
"@ember/controller": ["ember__controller"],
"@ember/debug": ["ember__debug"],
"@ember/debug/*": ["ember__debug/*"],
"@ember/engine": ["ember__engine"],
"@ember/engine/*": ["ember__engine/*"],
"@ember/error": ["ember__error"],
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"],
"@ember/polyfills": ["ember__polyfills"],
"@ember/routing": ["ember__routing"],
"@ember/routing/*": ["ember__routing/*"],
"@ember/runloop": ["ember__runloop"],
"@ember/runloop/*": ["ember__runloop/*"],
"@ember/service": ["ember__service"],
"@ember/string": ["ember__string"],
"@ember/test": ["ember__test"],
"@ember/test/*": ["ember__test/*"],
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"]
"@ember/utils": ["ember__utils"],
"@ember/utils/*": ["ember__utils/*"]
},
"types": [],
"noEmit": true,
+24 -4
View File
@@ -2,7 +2,8 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
@@ -13,12 +14,31 @@
"../"
],
"paths": {
"@ember/engine": ["ember__engine"],
"@ember/engine/*": ["ember__engine/*"],
"@ember/application": ["ember__application"],
"@ember/application/*": ["ember__application/*"],
"@ember/array": ["ember__array"],
"@ember/array/*": ["ember__array/*"],
"@ember/component": ["ember__component"],
"@ember/component/*": ["ember__component/*"],
"@ember/controller": ["ember__controller"],
"@ember/debug": ["ember__debug"],
"@ember/debug/*": ["ember__debug/*"],
"@ember/engine": ["ember__engine"],
"@ember/engine/*": ["ember__engine/*"],
"@ember/error": ["ember__error"],
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"]
"@ember/object/*": ["ember__object/*"],
"@ember/polyfills": ["ember__polyfills"],
"@ember/routing": ["ember__routing"],
"@ember/routing/*": ["ember__routing/*"],
"@ember/runloop": ["ember__runloop"],
"@ember/runloop/*": ["ember__runloop/*"],
"@ember/service": ["ember__service"],
"@ember/string": ["ember__string"],
"@ember/test": ["ember__test"],
"@ember/test/*": ["ember__test/*"],
"@ember/utils": ["ember__utils"],
"@ember/utils/*": ["ember__utils/*"]
},
"types": [],
"noEmit": true,
+1 -1
View File
@@ -3,7 +3,7 @@
// Definitions by: Dan Freeman <https://github.com/dfreeman>
// Mike North <https://github.com/mike-north>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
// TypeScript Version: 2.8
import Ember from 'ember';
+3 -2
View File
@@ -2,12 +2,13 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictFunctionTypes": false,
"baseUrl": "../../",
"typeRoots": [
"../../"
+22 -3
View File
@@ -14,12 +14,31 @@
"../"
],
"paths": {
"@ember/engine": ["ember__engine"],
"@ember/engine/*": ["ember__engine/*"],
"@ember/application": ["ember__application"],
"@ember/application/*": ["ember__application/*"],
"@ember/array": ["ember__array"],
"@ember/array/*": ["ember__array/*"],
"@ember/component": ["ember__component"],
"@ember/component/*": ["ember__component/*"],
"@ember/controller": ["ember__controller"],
"@ember/debug": ["ember__debug"],
"@ember/debug/*": ["ember__debug/*"],
"@ember/engine": ["ember__engine"],
"@ember/engine/*": ["ember__engine/*"],
"@ember/error": ["ember__error"],
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"]
"@ember/object/*": ["ember__object/*"],
"@ember/polyfills": ["ember__polyfills"],
"@ember/routing": ["ember__routing"],
"@ember/routing/*": ["ember__routing/*"],
"@ember/runloop": ["ember__runloop"],
"@ember/runloop/*": ["ember__runloop/*"],
"@ember/service": ["ember__service"],
"@ember/string": ["ember__string"],
"@ember/test": ["ember__test"],
"@ember/test/*": ["ember__test/*"],
"@ember/utils": ["ember__utils"],
"@ember/utils/*": ["ember__utils/*"]
},
"types": [],
"noEmit": true,
+20 -20
View File
@@ -15,31 +15,31 @@
"../"
],
"paths": {
"@ember/string": ["ember__string"],
"@ember/application": ["ember__application"],
"@ember/application/*": ["ember__application/*"],
"@ember/array": ["ember__array"],
"@ember/array/*": ["ember__array/*"],
"@ember/component": ["ember__component"],
"@ember/component/*": ["ember__component/*"],
"@ember/controller": ["ember__controller"],
"@ember/debug": ["ember__debug"],
"@ember/debug/*": ["ember__debug/*"],
"@ember/engine": ["ember__engine"],
"@ember/engine/*": ["ember__engine/*"],
"@ember/error": ["ember__error"],
"@ember/service": ["ember__service"],
"@ember/utils": ["ember__utils"],
"@ember/utils/*": ["ember__utils/*"],
"@ember/array": ["ember__array"],
"@ember/array/*": ["ember__array/*"],
"@ember/debug": ["ember__debug"],
"@ember/debug/*": ["ember__debug/*"],
"@ember/runloop": ["ember__runloop"],
"@ember/runloop/*": ["ember__runloop/*"],
"@ember/routing": ["ember__routing"],
"@ember/routing/*": ["ember__routing/*"],
"@ember/test": ["ember__test"],
"@ember/test/*": ["ember__test/*"],
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"],
"@ember/component": ["ember__component"],
"@ember/component/*": ["ember__component/*"],
"@ember/application": ["ember__application"],
"@ember/application/*": ["ember__application/*"],
"@ember/controller": ["ember__controller"],
"@ember/polyfills": ["ember__polyfills"]
"@ember/polyfills": ["ember__polyfills"],
"@ember/routing": ["ember__routing"],
"@ember/routing/*": ["ember__routing/*"],
"@ember/runloop": ["ember__runloop"],
"@ember/runloop/*": ["ember__runloop/*"],
"@ember/service": ["ember__service"],
"@ember/string": ["ember__string"],
"@ember/test": ["ember__test"],
"@ember/test/*": ["ember__test/*"],
"@ember/utils": ["ember__utils"],
"@ember/utils/*": ["ember__utils/*"]
},
"types": [],
"noEmit": true,
+3 -1
View File
@@ -21,8 +21,10 @@
"@ember/engine/*": ["ember__engine/*"],
"@ember/routing": ["ember__routing"],
"@ember/routing/*": ["ember__routing/*"],
"@ember/service": ["ember__service"],
"@ember/application": ["ember__application"],
"@ember/application/*": ["ember__application/*"]
"@ember/application/*": ["ember__application/*"],
"@ember/controller": ["ember__controller"]
},
"types": [],
"noEmit": true,
+135 -123
View File
@@ -1,8 +1,8 @@
import Ember from 'ember';
import { assertType } from './lib/assert';
import CoreObject from '@ember/object/core';
/** Newable tests */
const co1 = new Ember.CoreObject();
const co1 = new CoreObject();
// TODO: Enable in TS 3.0 see: https://github.com/typed-ember/ember-cli-typescript/issues/291
// co1.concatenatedProperties; // $ExpectType string[]
@@ -12,7 +12,7 @@ co1.destroy(); // $ExpectType CoreObject
co1.toString(); // $ExpectType string
/** .create tests */
const co2 = Ember.CoreObject.create();
const co2 = CoreObject.create();
// TODO: Enable in TS 3.0 see: https://github.com/typed-ember/ember-cli-typescript/issues/291
// co2.concatenatedProperties; // $ExpectType string[]
co2.isDestroyed; // $ExpectType boolean
@@ -21,13 +21,13 @@ co2.destroy(); // $ExpectType CoreObject
co2.toString(); // $ExpectType string
/** .create tests w/ initial instance data passed in */
const co3 = Ember.CoreObject.create({ foo: '123', bar: 456 });
const co3 = CoreObject.create({ foo: '123', bar: 456 });
co3.foo; // $ExpectType string
co3.bar; // $ExpectType number
/** .extend with a zero-argument .create() */
const co4 = Ember.CoreObject.extend({
const co4 = CoreObject.extend({
foo: '123',
bar: 456,
baz(): [string, number] {
@@ -40,8 +40,8 @@ co4.bar; // $ExpectType number
co4.baz; // $ExpectType () => [string, number]
/** .extend with inconsistent arguments passed into .create() */
const class05 = Ember.CoreObject.extend({
foo: '123' as (string | boolean),
const class05 = CoreObject.extend({
foo: '123' as string | boolean,
bar: 456,
baz() {
return [this.foo, this.bar];
@@ -54,33 +54,36 @@ assertType<string>(c05b.foo); // $ExpectError
assertType<boolean>(c05c.foo); // $ExpectError
/** two .extend arguments with a zero-argument .create() */
const co6 = Ember.CoreObject.extend({
foo: '123',
bar: 456,
baz() {
return [this.foo, this.bar];
const co6 = CoreObject.extend(
{
foo: '123',
bar: 456,
baz() {
return [this.foo, this.bar];
},
func1() {
// this includes stuff from CoreObject
this.init; // $ExpectType () => void
// this includes stuff from this extend-arg
this.foo; // $ExpectType string
// this does not include stuff from later extend args
this.bee; // $ExpectError
}
},
func1() {
// this includes stuff from CoreObject
this.init; // $ExpectType () => void
// this includes stuff from this extend-arg
this.foo; // $ExpectType string
// this does not include stuff from later extend args
this.bee; // $ExpectError
{
foo: 99,
bee: 'honey',
func2() {
// this includes stuff from CoreObject
this.init; // $ExpectType () => void
// this includes stuff from this extend-arg
// TODO: switch to "$ExpectType number" in TS 3.0 see: https://github.com/typed-ember/ember-cli-typescript/issues/291
this.foo; // $ExpectType string & number
// this includes stuff from earlier extend-args
this.bar; // $ExpectType number
}
}
}, {
foo: 99,
bee: 'honey',
func2() {
// this includes stuff from CoreObject
this.init; // $ExpectType () => void
// this includes stuff from this extend-arg
// TODO: switch to "$ExpectType number" in TS 3.0 see: https://github.com/typed-ember/ember-cli-typescript/issues/291
this.foo; // $ExpectType string & number
// this includes stuff from earlier extend-args
this.bar; // $ExpectType number
}
}).create();
).create();
// TODO: enable in TS 3.0 see: https://github.com/typed-ember/ember-cli-typescript/issues/291
// assertType<string>(co6.foo); // $ExpectError
@@ -88,45 +91,49 @@ assertType<number>(co6.bar); // $ExpectType number
assertType<() => Array<string | number>>(co6.baz); // $ExpectType () => (string | number)[]
/** three .extend arguments with a zero-argument .create() */
const co7 = Ember.CoreObject.extend({
foo: '123',
bar: 456,
baz() {
return [this.foo, this.bar];
const co7 = CoreObject.extend(
{
foo: '123',
bar: 456,
baz() {
return [this.foo, this.bar];
},
func1() {
// this includes stuff from CoreObject
this.init; // $ExpectType () => void
// this includes stuff from this extend-arg
this.foo; // $ExpectType string
// this does not include stuff from later extend args
this.bee; // $ExpectError
}
},
func1() {
// this includes stuff from CoreObject
this.init; // $ExpectType () => void
// this includes stuff from this extend-arg
this.foo; // $ExpectType string
// this does not include stuff from later extend args
this.bee; // $ExpectError
{
foo: 99,
bee: 'honey',
func2() {
// this includes stuff from CoreObject
this.init; // $ExpectType () => void
// this includes stuff from this extend-arg
// TODO: switch to "$ExpectType number" in TS 3.0 see: https://github.com/typed-ember/ember-cli-typescript/issues/291
this.foo; // $ExpectType string & number
// this includes stuff from earlier extend-args
this.bar; // $ExpectType number
}
},
{
foo: '99',
money: 'in the banana stand',
func3() {
// this includes stuff from CoreObject
this.init; // $ExpectType () => void
// this includes stuff from this extend-arg
this.money; // $ExpectType string
// this includes stuff from earlier extend-args
this.bee; // $ExpectType string
this.bar; // $ExpectType number
}
}
}, {
foo: 99,
bee: 'honey',
func2() {
// this includes stuff from CoreObject
this.init; // $ExpectType () => void
// this includes stuff from this extend-arg
// TODO: switch to "$ExpectType number" in TS 3.0 see: https://github.com/typed-ember/ember-cli-typescript/issues/291
this.foo; // $ExpectType string & number
// this includes stuff from earlier extend-args
this.bar; // $ExpectType number
}
}, {
foo: '99',
money: 'in the banana stand',
func3() {
// this includes stuff from CoreObject
this.init; // $ExpectType () => void
// this includes stuff from this extend-arg
this.money; // $ExpectType string
// this includes stuff from earlier extend-args
this.bee; // $ExpectType string
this.bar; // $ExpectType number
}
}).create();
).create();
// TODO: enable in TS 3.0 see: https://github.com/typed-ember/ember-cli-typescript/issues/291
// assertType<number>(co7.foo); // $ExpectError
assertType<number>(co7.bar); // $ExpectType number
@@ -134,62 +141,67 @@ assertType<string>(co7.money); // $ExpectType string
assertType<() => Array<string | number>>(co7.baz); // $ExpectType () => (string | number)[]
/** four .extend arguments with a zero-argument .create() */
const co8 = Ember.CoreObject.extend({
foo: '123',
bar: 456,
baz() {
return [this.foo, this.bar];
const co8 = CoreObject.extend(
{
foo: '123',
bar: 456,
baz() {
return [this.foo, this.bar];
},
func1() {
// this includes stuff from CoreObject
this.init; // $ExpectType () => void
// this includes stuff from this extend-arg
this.foo; // $ExpectType string
// this does not include stuff from later extend args
this.bee; // $ExpectError
}
},
func1() {
// this includes stuff from CoreObject
this.init; // $ExpectType () => void
// this includes stuff from this extend-arg
this.foo; // $ExpectType string
// this does not include stuff from later extend args
this.bee; // $ExpectError
{
foo: 99,
bee: 'honey',
func2() {
// this includes stuff from CoreObject
this.init; // $ExpectType () => void
// this includes stuff from this extend-arg
// TODO: switch to "$ExpectType number" in TS 3.0 see: https://github.com/typed-ember/ember-cli-typescript/issues/291
this.foo; // $ExpectType string & number
// this includes stuff from earlier extend-args
this.bar; // $ExpectType number
// this does not include stuff from later extend args
this.money; // $ExpectError
}
},
{
foo: '99',
money: 'in the banana stand',
func3() {
// this includes stuff from CoreObject
this.init; // $ExpectType () => void
// this includes stuff from this extend-arg
this.money; // $ExpectType string
// this includes stuff from earlier extend-args
this.bee; // $ExpectType string
this.bar; // $ExpectType number
// this does not include stuff from later extend args
this.neighborhood; // $ExpectError
}
},
{
foo: '99',
neighborhood: 'sudden valley',
func4() {
// this includes stuff from CoreObject
this.init; // $ExpectType () => void
// this includes stuff from this extend-arg
this.neighborhood; // $ExpectType string
// this includes stuff from earlier extend-args
this.bee; // $ExpectType string
this.bar; // $ExpectType number
this.money; // $ExpectType string
}
}
}, {
foo: 99,
bee: 'honey',
func2() {
// this includes stuff from CoreObject
this.init; // $ExpectType () => void
// this includes stuff from this extend-arg
// TODO: switch to "$ExpectType number" in TS 3.0 see: https://github.com/typed-ember/ember-cli-typescript/issues/291
this.foo; // $ExpectType string & number
// this includes stuff from earlier extend-args
this.bar; // $ExpectType number
// this does not include stuff from later extend args
this.money; // $ExpectError
}
}, {
foo: '99',
money: 'in the banana stand',
func3() {
// this includes stuff from CoreObject
this.init; // $ExpectType () => void
// this includes stuff from this extend-arg
this.money; // $ExpectType string
// this includes stuff from earlier extend-args
this.bee; // $ExpectType string
this.bar; // $ExpectType number
// this does not include stuff from later extend args
this.neighborhood; // $ExpectError
}
}, {
foo: '99',
neighborhood: 'sudden valley',
func4() {
// this includes stuff from CoreObject
this.init; // $ExpectType () => void
// this includes stuff from this extend-arg
this.neighborhood; // $ExpectType string
// this includes stuff from earlier extend-args
this.bee; // $ExpectType string
this.bar; // $ExpectType number
this.money; // $ExpectType string
}
}).create();
).create();
// TODO: enable in TS 3.0 see: https://github.com/typed-ember/ember-cli-typescript/issues/291
// assertType<number>(co8.foo); // $ExpectError
@@ -1,5 +1,4 @@
import { assertType } from './lib/assert';
import Ember from 'ember';
import { PersonWithNumberName, Person } from './create';
Person.create({ firstName: 99 }); // $ExpectError
+20 -3
View File
@@ -17,14 +17,31 @@
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"paths": {
"@ember/application": ["ember__application"],
"@ember/application/*": ["ember__application/*"],
"@ember/array": ["ember__array"],
"@ember/array/*": ["ember__array/*"],
"@ember/component": ["ember__component"],
"@ember/component/*": ["ember__component/*"],
"@ember/controller": ["ember__controller"],
"@ember/debug": ["ember__debug"],
"@ember/debug/*": ["ember__debug/*"],
"@ember/engine": ["ember__engine"],
"@ember/engine/*": ["ember__engine/*"],
"@ember/error": ["ember__error"],
"@ember/application": ["ember__application"],
"@ember/application/*": ["ember__application/*"],
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"],
"@ember/test-helpers": ["ember__test-helpers"]
"@ember/polyfills": ["ember__polyfills"],
"@ember/routing": ["ember__routing"],
"@ember/routing/*": ["ember__routing/*"],
"@ember/runloop": ["ember__runloop"],
"@ember/runloop/*": ["ember__runloop/*"],
"@ember/service": ["ember__service"],
"@ember/string": ["ember__string"],
"@ember/test": ["ember__test"],
"@ember/test/*": ["ember__test/*"],
"@ember/utils": ["ember__utils"],
"@ember/utils/*": ["ember__utils/*"]
}
},
"files": [

Some files were not shown because too many files have changed in this diff Show More