modified test to pass no angle bracket type assertion

This commit is contained in:
Armin Nasufovic
2018-12-11 20:35:18 -08:00
221 changed files with 7315 additions and 1703 deletions
+1 -1
View File
@@ -22,6 +22,6 @@
},
"devDependencies": {
"dtslint": "github:Microsoft/dtslint#production",
"types-publisher": "Microsoft/types-publisher#production"
"types-publisher": "github:Microsoft/types-publisher#production"
}
}
+10 -1
View File
@@ -136,7 +136,16 @@ export interface ChannelWrapper extends EventEmitter {
* Setup functions should, ideally, not throw errors, but if they do then the ChannelWrapper will emit an 'error' event.
* @param func
*/
addSetup(func: SetupFunc): Promise<void>;
addSetup(func: SetupFunc): Promise<void>;
/**
* Remove a setup function added with `addSetup`. If there is currently a
* connection, `teardown(channel, [cb])` will be run immediately, and the
* returned Promise will not resolve until it completes.
* @param func
* @param [tearDown]
*/
removeSetup(func: SetupFunc, tearDown?: SetupFunc): Promise<void>;
/**
* @see amqplib
+2 -1
View File
@@ -74,6 +74,7 @@
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
"whitespace": false,
"no-angle-bracket-type-assertion": false
}
}
+2 -1
View File
@@ -74,6 +74,7 @@
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
"whitespace": false,
"no-angle-bracket-type-assertion": false
}
}
+2 -1
View File
@@ -74,6 +74,7 @@
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
"whitespace": false,
"no-angle-bracket-type-assertion": false
}
}
+2 -1
View File
@@ -74,6 +74,7 @@
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
"whitespace": false,
"no-angle-bracket-type-assertion": false
}
}
+10 -200
View File
@@ -94,8 +94,6 @@ function JQuery() {
}
function bind() {
interface I1 { kind: 'I1'; }
// $ExpectType JQuery<HTMLElement>
$('p').bind('myEvent', 'myData', function(event) {
// TODO: $ExpectType HTMLElement
@@ -104,14 +102,6 @@ function JQuery() {
event;
});
// $ExpectType JQuery<HTMLElement>
$('p').bind('myEvent', 'myData', function(this: I1, event) {
// $ExpectType I1
this;
// TODO: $ExpectType Event<HTMLElement, string>
event;
});
// $ExpectType JQuery<HTMLElement>
$('p').bind('myEvent', function(event) {
// TODO: $ExpectType HTMLElement
@@ -120,14 +110,6 @@ function JQuery() {
event;
});
// $ExpectType JQuery<HTMLElement>
$('p').bind('myEvent', function(this: I1, event) {
// $ExpectType I1
this;
// TODO: $ExpectType Event<HTMLElement, null>
event;
});
// $ExpectType JQuery<HTMLElement>
$('p').bind('myEvent', false);
@@ -139,12 +121,6 @@ function JQuery() {
this;
// TODO: $ExpectType Event<HTMLElement, null>
event;
},
myEvent3(this: I1, event) {
// $ExpectType I1
this;
// TODO: $ExpectType Event<HTMLElement, null>
event;
}
});
@@ -164,27 +140,15 @@ function JQuery() {
}
function off() {
function defaultContext_defaultData(this: HTMLElement, event: JQueryEventObject) { }
function defaultData(this: HTMLElement, event: JQueryEventObject) { }
function defaultContext_customData(this: HTMLElement, event: JQueryEventObject) { }
function customContext_defaultData(this: I1, event: JQueryEventObject) { }
function customContext_customData(this: I1, event: JQueryEventObject) { }
interface I1 { kind: 'I1'; }
function customData(this: HTMLElement, event: JQueryEventObject) { }
// $ExpectType JQuery<HTMLElement>
$('table').off('myEvent', 'td', defaultContext_defaultData);
$('table').off('myEvent', 'td', defaultData);
// $ExpectType JQuery<HTMLElement>
$('table').off('myEvent', 'td', defaultContext_customData);
// $ExpectType JQuery<HTMLElement>
$('table').off('myEvent', 'td', customContext_defaultData);
// $ExpectType JQuery<HTMLElement>
$('table').off('myEvent', 'td', customContext_customData);
$('table').off('myEvent', 'td', customData);
// $ExpectType JQuery<HTMLElement>
$('table').off('myEvent', 'td', false);
@@ -193,16 +157,10 @@ function JQuery() {
$('table').off('myEvent', 'td');
// $ExpectType JQuery<HTMLElement>
$('table').off('myEvent', defaultContext_defaultData);
$('table').off('myEvent', defaultData);
// $ExpectType JQuery<HTMLElement>
$('table').off('myEvent', defaultContext_customData);
// $ExpectType JQuery<HTMLElement>
$('table').off('myEvent', customContext_defaultData);
// $ExpectType JQuery<HTMLElement>
$('table').off('myEvent', customContext_customData);
$('table').off('myEvent', customData);
// $ExpectType JQuery<HTMLElement>
$('table').off('myEvent', false);
@@ -213,19 +171,15 @@ function JQuery() {
// $ExpectType JQuery<HTMLElement>
$('table').off({
myEvent1: false,
defaultContext_defaultData,
defaultContext_customData,
customContext_defaultData,
customContext_customData
defaultData,
customData
}, 'td');
// $ExpectType JQuery<HTMLElement>
$('table').off({
myEvent1: false,
defaultContext_defaultData,
defaultContext_customData,
customContext_defaultData,
customContext_customData
defaultData,
customData
});
// $ExpectType JQuery<HTMLElement>
@@ -236,8 +190,6 @@ function JQuery() {
}
function on() {
interface I1 { kind: 'I1'; }
// $ExpectType JQuery<HTMLElement>
$('table').on('myEvent', 'td', 'myData', function(event) {
// TODO: $ExpectType HTMLElement
@@ -246,14 +198,6 @@ function JQuery() {
event;
});
// $ExpectType JQuery<HTMLElement>
$('table').on('myEvent', 'td', 'myData', function(this: I1, event) {
// $ExpectType I1
this;
// TODO: $ExpectType Event<HTMLElement, string>
event;
});
// $ExpectType JQuery<HTMLElement>
$('table').on('myEvent', null, 'myData', function(event) {
// TODO: $ExpectType HTMLElement
@@ -262,14 +206,6 @@ function JQuery() {
event;
});
// $ExpectType JQuery<HTMLElement>
$('table').on('myEvent', null, 'myData', function(this: I1, event) {
// $ExpectType I1
this;
// TODO: $ExpectType Event<HTMLElement, string>
event;
});
// $ExpectType JQuery<HTMLElement>
$('table').on('myEvent', 'td', function(event) {
// TODO: $ExpectType HTMLElement
@@ -278,14 +214,6 @@ function JQuery() {
event;
});
// $ExpectType JQuery<HTMLElement>
$('table').on('myEvent', 'td', function(this: I1, event) {
// $ExpectType I1
this;
// TODO: $ExpectType Event<HTMLElement, null>
event;
});
// $ExpectType JQuery<HTMLElement>
$('table').on('myEvent', 'td', false);
@@ -297,14 +225,6 @@ function JQuery() {
event;
});
// $ExpectType JQuery<HTMLElement>
$('table').on('myEvent', 3, function(this: I1, event) {
// $ExpectType I1
this;
// TODO: $ExpectType Event<HTMLElement, number>
event;
});
// $ExpectType JQuery<HTMLElement>
$('table').on('myEvent', function(event) {
// TODO: $ExpectType HTMLElement
@@ -313,14 +233,6 @@ function JQuery() {
event;
});
// $ExpectType JQuery<HTMLElement>
$('table').on('myEvent', function(this: I1, event) {
// $ExpectType I1
this;
// TODO: $ExpectType Event<HTMLElement, null>
event;
});
// $ExpectType JQuery<HTMLElement>
$('table').on('myEvent', false);
@@ -332,12 +244,6 @@ function JQuery() {
this;
// TODO: $ExpectType Event<HTMLElement, string>
event;
},
myEvent3(this: I1, event) {
// $ExpectType I1
this;
// TODO: $ExpectType Event<HTMLElement, string>
event;
}
}, 'td', 'myData');
@@ -349,12 +255,6 @@ function JQuery() {
this;
// TODO: $ExpectType Event<HTMLElement, string>
event;
},
myEvent3(this: I1, event) {
// $ExpectType I1
this;
// TODO: $ExpectType Event<HTMLElement, string>
event;
}
}, null, 'myData');
@@ -366,12 +266,6 @@ function JQuery() {
this;
// TODO: $ExpectType Event<HTMLElement, null>
event;
},
myEvent3(this: I1, event) {
// $ExpectType I1
this;
// TODO: $ExpectType Event<HTMLElement, null>
event;
}
}, 'td');
@@ -383,12 +277,6 @@ function JQuery() {
this;
// TODO: $ExpectType Event<HTMLElement, number>
event;
},
myEvent3(this: I1, event) {
// $ExpectType I1
this;
// TODO: $ExpectType Event<HTMLElement, number>
event;
}
}, 3);
@@ -400,19 +288,11 @@ function JQuery() {
this;
// TODO: $ExpectType Event<HTMLElement, null>
event;
},
myEvent3(this: I1, event) {
// $ExpectType I1
this;
// TODO: $ExpectType Event<HTMLElement, null>
event;
}
});
}
function one() {
interface I1 { kind: 'I1'; }
// $ExpectType JQuery<HTMLElement>
$('table').one('myEvent', 'td', 'myData', function(event) {
// TODO: $ExpectType HTMLElement
@@ -421,14 +301,6 @@ function JQuery() {
event;
});
// $ExpectType JQuery<HTMLElement>
$('table').one('myEvent', 'td', 'myData', function(this: I1, event) {
// $ExpectType I1
this;
// TODO: $ExpectType Event<HTMLElement, string>
event;
});
// $ExpectType JQuery<HTMLElement>
$('table').one('myEvent', null, 'myData', function(event) {
// TODO: $ExpectType HTMLElement
@@ -437,14 +309,6 @@ function JQuery() {
event;
});
// $ExpectType JQuery<HTMLElement>
$('table').one('myEvent', null, 'myData', function(this: I1, event) {
// $ExpectType I1
this;
// TODO: $ExpectType Event<HTMLElement, string>
event;
});
// $ExpectType JQuery<HTMLElement>
$('table').one('myEvent', 'td', function(event) {
// TODO: $ExpectType HTMLElement
@@ -453,14 +317,6 @@ function JQuery() {
event;
});
// $ExpectType JQuery<HTMLElement>
$('table').one('myEvent', 'td', function(this: I1, event) {
// $ExpectType I1
this;
// TODO: $ExpectType Event<HTMLElement, null>
event;
});
// $ExpectType JQuery<HTMLElement>
$('table').one('myEvent', 'td', false);
@@ -472,14 +328,6 @@ function JQuery() {
event;
});
// $ExpectType JQuery<HTMLElement>
$('table').one('myEvent', 3, function(this: I1, event) {
// $ExpectType I1
this;
// TODO: $ExpectType Event<HTMLElement, number>
event;
});
// $ExpectType JQuery<HTMLElement>
$('table').one('myEvent', function(event) {
// TODO: $ExpectType HTMLElement
@@ -488,14 +336,6 @@ function JQuery() {
event;
});
// $ExpectType JQuery<HTMLElement>
$('table').one('myEvent', function(this: I1, event) {
// $ExpectType I1
this;
// TODO: $ExpectType Event<HTMLElement, null>
event;
});
// $ExpectType JQuery<HTMLElement>
$('table').one('myEvent', false);
@@ -507,12 +347,6 @@ function JQuery() {
this;
// TODO: $ExpectType Event<HTMLElement, string>
event;
},
myEvent3(this: I1, event) {
// $ExpectType I1
this;
// TODO: $ExpectType Event<HTMLElement, string>
event;
}
}, 'td', 'myData');
@@ -524,12 +358,6 @@ function JQuery() {
this;
// TODO: $ExpectType Event<HTMLElement, string>
event;
},
myEvent3(this: I1, event) {
// $ExpectType I1
this;
// TODO: $ExpectType Event<HTMLElement, string>
event;
}
}, null, 'myData');
@@ -541,12 +369,6 @@ function JQuery() {
this;
// TODO: $ExpectType Event<HTMLElement, null>
event;
},
myEvent3(this: I1, event) {
// $ExpectType I1
this;
// TODO: $ExpectType Event<HTMLElement, null>
event;
}
}, 'td');
@@ -558,12 +380,6 @@ function JQuery() {
this;
// TODO: $ExpectType Event<HTMLElement, number>
event;
},
myEvent3(this: I1, event) {
// $ExpectType I1
this;
// TODO: $ExpectType Event<HTMLElement, number>
event;
}
}, 3);
@@ -575,12 +391,6 @@ function JQuery() {
this;
// TODO: $ExpectType Event<HTMLElement, null>
event;
},
myEvent3(this: I1, event) {
// $ExpectType I1
this;
// TODO: $ExpectType Event<HTMLElement, null>
event;
}
});
}
+2 -1
View File
@@ -74,6 +74,7 @@
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
"whitespace": false,
"no-angle-bracket-type-assertion": false
}
}
+1
View File
@@ -5,6 +5,7 @@ assert(true, "it's working");
assert.ok(true, "inner functions work as well");
assert.throws(() => {});
assert.throws(() => {}, /Regex test/);
assert.throws(() => {}, () => {}, "works wonderfully");
assert['fail'](true, true, "works like a charm");
+3 -2
View File
@@ -1,6 +1,7 @@
// Type definitions for commonjs-assert 1.4
// Project: https://github.com/browserify/commonjs-assert
// Definitions by: Nico Gallinal <https://github.com/nicoabie>
// Linus Unnebäck <https://github.com/LinusU>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function assert(value: any, message?: string): void;
@@ -23,10 +24,10 @@ declare namespace assert {
function notStrictEqual(actual: any, expected: any, message?: string): void;
function throws(block: () => void, message?: string): void;
function throws(block: () => void, error: () => void | ((err: any) => boolean) | RegExp, message?: string): void;
function throws(block: () => void, error: (() => void) | ((err: any) => boolean) | RegExp, message?: string): void;
function doesNotThrow(block: () => void, message?: string): void;
function doesNotThrow(block: () => void, error: () => void | ((err: any) => boolean) | RegExp, message?: string): void;
function doesNotThrow(block: () => void, error: (() => void) | ((err: any) => boolean) | RegExp, message?: string): void;
function ifError(value: any): void;
+1 -1
View File
@@ -92,7 +92,7 @@ declare namespace Backbone {
}
interface EventsHash {
[selector: string]: string | {(eventObject: JQueryEventObject): void};
[selector: string]: string | {(eventObject: JQuery.TriggeredEvent): void};
}
export const Events: Events;
@@ -42,7 +42,7 @@ $(() => {
$('#ex7').slider();
$('#ex7-enabled').click(function(this: HTMLInputElement) {
$<HTMLInputElement>('#ex7-enabled').click(function() {
if (this.checked) {
// With JQuery
$('#ex7').slider('enable');
+4 -1
View File
@@ -1,3 +1,6 @@
{
"extends": "dtslint/dt.json"
"extends": "dtslint/dt.json",
"rules": {
"no-angle-bracket-type-assertion": false
}
}
+7 -2
View File
@@ -322,7 +322,7 @@ export interface TooltipOption {
// Events
// --------------------------------------------------------------------------------------
export interface CarouselEventHandler<TElement> extends JQuery.Event<TElement, undefined> {
export interface CarouselEventHandler<TElement> extends JQuery.TriggeredEvent<TElement, undefined> {
/**
* The direction in which the carousel is sliding.
*/
@@ -339,6 +339,10 @@ export interface CarouselEventHandler<TElement> extends JQuery.Event<TElement, u
to: number;
}
export interface TapEventHandler<TElement> extends JQuery.TriggeredEvent<TElement, undefined> {
relatedTarget: HTMLElement;
}
export type AlertEvent = "close.bs.alert" | "closed.bs.alert";
export type CarouselEvent = "slide.bs.carousel" | "slid.bs.carousel";
export type CollapseEvent = "show.bs.collapse" | "shown.bs.collapse" | "hide.bs.collapse" | "hidden.bs.collapse";
@@ -383,9 +387,10 @@ declare global {
tooltip(options?: TooltipOption): this;
on(events: CarouselEvent, handler: JQuery.EventHandlerBase<TElement, CarouselEventHandler<TElement>>): this;
on(events: TapEvent, handler: JQuery.EventHandlerBase<TElement, TapEventHandler<TElement>>): this;
on(events:
AlertEvent | CollapseEvent | DropdownEvent | ModalEvent |
PopoverEvent | ScrollspyEvent | TapEvent | TooltipEvent,
PopoverEvent | ScrollspyEvent | TooltipEvent,
handler: JQuery.EventHandler<TElement>): this;
}
}
+48
View File
@@ -0,0 +1,48 @@
import {
agents, features, feature, Agent, Feature, PackedFeature, StatsByAgentID, SupportStatusByVersion, SupportStatus
} from "caniuse-lite";
const chrome: Agent | undefined = agents.chrome;
if (chrome !== undefined) {
const browser: string = chrome.browser;
const prefix: string = chrome.prefix;
const prefixExceptions: any = chrome.prefix_exceptions;
const usageGlobal: { [version: string]: number | undefined } = chrome.usage_global;
const releaseDate: { [version: string]: number | undefined } = chrome.release_date;
const versions: Array<string | null> = chrome.versions;
consume(browser, prefix, prefixExceptions, usageGlobal, releaseDate, versions);
}
const unpackedFeatures = Object.keys(features).map((id: string) => {
const packed: PackedFeature = features[id];
const unpacked: Feature = feature(packed);
const status: string = unpacked.status;
const title: string = unpacked.title;
const stats: StatsByAgentID = unpacked.stats;
Object.keys(stats).forEach((agentID: string) => {
const byVersion: SupportStatusByVersion = stats[agentID];
Object.keys(byVersion).forEach(version => {
const supportStatus: SupportStatus = byVersion[version];
consume(supportStatus);
});
const supportStatusByVersion: SupportStatusByVersion = stats[agentID];
const agent: Agent = agents[agentID]!;
return {
feature: unpacked,
agent,
versions: Object.keys(supportStatusByVersion).map(version => {
return {
version,
releaseDate: agent.release_date[version],
[`feature_${id}`]: supportStatusByVersion[version]
};
})
};
});
});
function consume(...anything: any[]): void {
// ...
}
+159
View File
@@ -0,0 +1,159 @@
// Type definitions for caniuse-lite 1.0
// Project: https://github.com/ben-eb/caniuse-lite#readme
// Definitions by: Michael Utech <https://github.com/mutech>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/**
* Information about user agents (browsers, platforms) indexed by their ID.
*/
export const agents: AgentsByID;
/**
* Features index by their ID. The feature ID is a human readable identifier. The
* associated value is a packed version of information about the feature that
* can be unpacked using the function `feature(packed)`
*/
export const features: { [featureID: string]: PackedFeature; };
/**
* @param packedFeature a packed feature obtained from `features[key]` for some valid key.
* @return the unpacked information as `Feature`.
*/
export function feature(packedFeature: PackedFeature): Feature;
/**
* @param packedRegion a packed version of regional usage data by agent OD.
* @return the unpacked usage data indexed by agent ID and then version.
*/
export function region(packedRegion: PackedRegion): { [agentID: string]: UsageByVersion };
/**
* Agents indexed by their ID. .
*/
export type AgentsByID = Readonly<{ [id: string]: Readonly<Agent> | undefined }>;
/**
* Feature support status by version indexed by agent ID.
*/
export type StatsByAgentID = Readonly<{ [agentID: string]: SupportStatusByVersion }>;
/**
* Feature support status indexed by an agent's versions.
*/
export type SupportStatusByVersion = Readonly<{ [version: string]: SupportStatus }>;
/**
* Usage (percentage/market share) indexed by an agent's versions.
*/
export type UsageByVersion = Readonly<{ [version: string]: number | undefined }>;
/**
* The standardization status of a feature:
* * ls - WHATWG living standard
* * rec - W3C recommendation
* * pr - W3C proposed recommendation
* * cr - W3C candidate recommendation
* * wd - W3C working draft
* * other - Non-W3C, but reputable
* * unoff - Unofficial
*/
export type FeatureStatus = "ls" | "rec" | "pr" | "cr" | "wd" | "other" | "unoff" | string;
/**
* Encoded support status:
* * `n` - not supported
* * `p` - not supported, polyfill available
* * `u` - unknown
* * `a x` - partially supported, vendor prefix
* * `a` - partially supported
* * `y x` - fully supported, vendor prefix
* * `y` - fully supported
*
* The support status can additionally have one or more footnote references as `#<n>`, f.e.
* `a x #1 #3`.
*/
export type SupportStatus = 'n' | 'p' | 'u' | "a x" | 'a' | "y x" | 'y' | string;
/**
* Provides information about the Agent.
*/
export interface Agent {
/**
* Global agent usage by version
*/
usage_global: UsageByVersion;
/**
* The agents vendor prefix
*/
prefix: string;
/**
* Version matrix. See [caniuse](https://caniuse.com)
*/
versions: [ // Tuple of 70 version slots:
string|null, string|null, string|null, string|null, string|null,
string|null, string|null, string|null, string|null, string|null,
string|null, string|null, string|null, string|null, string|null,
string|null, string|null, string|null, string|null, string|null,
string|null, string|null, string|null, string|null, string|null,
string|null, string|null, string|null, string|null, string|null,
string|null, string|null, string|null, string|null, string|null,
string|null, string|null, string|null, string|null, string|null,
string|null, string|null, string|null, string|null, string|null,
string|null, string|null, string|null, string|null, string|null,
string|null, string|null, string|null, string|null, string|null,
string|null, string|null, string|null, string|null, string|null,
string|null, string|null, string|null, string|null, string|null,
string|null, string|null, string|null, string|null, string|null ];
/**
* The agent's name
*/
browser: string;
/**
* Release dates as seconds since epoch by version.
*/
release_date: { [version: string]: number | undefined };
/**
* Exceptions to vendor prefix use.
*/
prefix_exceptions?: { [version: string]: string | undefined };
}
/**
* Specifies a feature and its support status in all known agent versions.
*/
export interface Feature {
/**
* Specification status of the feature.
*/
status: FeatureStatus;
/**
* Descriptive title of the feature.
*/
title: string;
/**
* Agent support matrix for this feature.
*/
stats: StatsByAgentID;
}
/**
* A space optimized version of Feature that can be unpacked using `feature(PackedFeature)`.
*/
export interface PackedFeature {
[encodedKey: string]: any;
}
/**
* A space optimized version of Region that can be unpacked using `region(PackedFeature)`.
*/
export interface PackedRegion {
[encodedKey: string]: 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",
"caniuse-lite-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+19 -1
View File
@@ -37,6 +37,24 @@ declare namespace convict {
parse: (content: string) => any;
}
type PredefinedFormat =
| '*'
| 'int'
| 'port'
| 'windows_named_pipe'
| 'port_or_windows_named_pipe'
| 'url'
| 'email'
| 'ipaddress'
| 'duration'
| 'timestamp'
| 'nat'
| String
| Object
| Number
| RegExp
| Boolean;
interface SchemaObj<T = any> {
default: T;
doc?: string;
@@ -52,7 +70,7 @@ declare namespace convict {
* If omitted, format will be set to the value of Object.prototype.toString.call
* for the default value
*/
format?: string | any[] | ((val: any) => void);
format?: PredefinedFormat | any[] | ((val: any) => void);
env?: string;
arg?: string;
sensitive?: boolean;
+2 -1
View File
@@ -426,8 +426,9 @@ declare class cropperjs {
/**
* Replace the image's src and rebuild the cropper.
* @param url A new image url
* @param hasSameSize If the new image has the same size with the old one, then it will not rebuilt the cropper and only update the urls of all related images. (Default: false)
*/
replace(url: string): void;
replace(url: string, hasSameSize?: boolean): void;
/**
* Enable (unfreeze) the cropper.
+1 -1
View File
@@ -48,7 +48,7 @@ brush = brush.extent(function(d, i, group) {
// chainable
brush = brush.filter(function(d, i, group) {
// Cast d3 event to D3ZoomEvent to be used in filter logic
const e = <d3Brush.D3BrushEvent<BrushDatum>> event;
const e = event as d3Brush.D3BrushEvent<BrushDatum>;
console.log('Owner SVG Element of svg group: ', this.ownerSVGElement); // this is of type SVGGElement
return e.sourceEvent.type !== 'zoom' || !d.filterZoomEvent; // datum type is BrushDatum (as propagated to SVGGElement with brush event attached)
+3 -3
View File
@@ -134,7 +134,7 @@ touchableFn = circleDrag.touchable();
circleCustomDrag.subject(function(d, i, g) {
// Cast event type for completeness, otherwise event is of type any.
const e = <d3Drag.D3DragEvent<SVGCircleElement, CircleDatum, CustomSubject | d3Drag.SubjectPosition>> event;
const e = event as d3Drag.D3DragEvent<SVGCircleElement, CircleDatum, CustomSubject | d3Drag.SubjectPosition>;
const that: SVGCircleElement = this;
const datum: CircleDatum = d;
const index: number = i;
@@ -163,14 +163,14 @@ subjectAccessor = circleCustomDrag.subject();
function dragstarted(this: SVGCircleElement, d: CircleDatum) {
// cast d3 event to drag event. Otherwise, d3 event is currently defined as type 'any'
const e = <d3Drag.D3DragEvent<SVGCircleElement, CircleDatum, CircleDatum | d3Drag.SubjectPosition>> event;
const e = event as d3Drag.D3DragEvent<SVGCircleElement, CircleDatum, CircleDatum | d3Drag.SubjectPosition>;
e.sourceEvent.stopPropagation();
select(this).classed('dragging', true);
}
function dragged(this: SVGCircleElement, d: CircleDatum) {
// cast d3 event to drag event. Otherwise, d3 event is currently defined as type 'any'
const e = <d3Drag.D3DragEvent<SVGCircleElement, CircleDatum, CircleDatum | d3Drag.SubjectPosition>> event;
const e = event as d3Drag.D3DragEvent<SVGCircleElement, CircleDatum, CircleDatum | d3Drag.SubjectPosition>;
select(this).attr('cx', d.x = e.x).attr('cy', d.y = e.y);
}
+1 -1
View File
@@ -1060,7 +1060,7 @@ interface SuccessEvent {
const successEvent = { type: 'wonEuro2016', team: 'Island' };
function customListener(this: HTMLBodyElement | null, finalOpponent: string): string {
const e = <SuccessEvent> d3Selection.event;
const e = d3Selection.event as SuccessEvent;
return `${e.team} defeated ${finalOpponent} in the EURO 2016 Cup. Who would have thought!!!`;
}
-1
View File
@@ -2,7 +2,6 @@
"extends": "dtslint/dt.json",
"rules": {
// TODO
"no-angle-bracket-type-assertion": false,
"no-this-assignment": false,
"unified-signatures": false,
"no-unnecessary-generics": false
+4 -4
View File
@@ -91,7 +91,7 @@ interface GroupDatum {
function zoomedCanvas(this: HTMLCanvasElement, d: CanvasDatum) {
// Cast d3 event to D3ZoomEvent to be used in zoom event handler
const e = <d3Zoom.D3ZoomEvent<HTMLCanvasElement, any>> event;
const e = event as d3Zoom.D3ZoomEvent<HTMLCanvasElement, any>;
if (context) {
context.save();
context.clearRect(0, 0, this.width, this.height); // this element
@@ -112,7 +112,7 @@ canvasZoom = d3Zoom.zoom<HTMLCanvasElement, CanvasDatum>()
function zoomedSVGOverlay(this: SVGRectElement) {
// Cast d3 event to D3ZoomEvent to be used in zoom event handler
const e = <d3Zoom.D3ZoomEvent<HTMLCanvasElement, any>> event;
const e = event as d3Zoom.D3ZoomEvent<HTMLCanvasElement, any>;
g.attr('transform', e.transform.toString());
}
@@ -146,7 +146,7 @@ constraintFn = svgZoom.constrain();
// chainable
svgZoom = svgZoom.filter(function(d, i, group) {
// Cast d3 event to D3ZoomEvent to be used in filter logic
const e = <d3Zoom.D3ZoomEvent<SVGRectElement, SVGDatum>> event;
const e = event as d3Zoom.D3ZoomEvent<SVGRectElement, SVGDatum>;
console.log('Overlay Rectangle width: ', this.width.baseVal.value); // this typing is SVGRectElement
return e.sourceEvent.type !== 'brush' || !d.filterBrushEvent; // datum type is SVGDatum (as propagated to SVGRectElement with zoom event attached)
@@ -178,7 +178,7 @@ touchableFn = svgZoom.touchable();
// chainable
svgZoom = svgZoom.wheelDelta(function(d, i, group) {
// Cast d3 event to D3ZoomEvent to be used in filter logic
const e = <WheelEvent> event;
const e = event as WheelEvent;
const that: SVGRectElement = this;
const datum: SVGDatum = d;
const index: number = i;
-1
View File
@@ -2,7 +2,6 @@
"extends": "dtslint/dt.json",
"rules": {
// TODO
"no-angle-bracket-type-assertion": false,
"no-this-assignment": false,
"unified-signatures": false,
"no-unnecessary-generics": false
+6 -1
View File
@@ -1 +1,6 @@
{ "extends": "dtslint/dt.json" }
{
"extends": "dtslint/dt.json",
"rules": {
"no-angle-bracket-type-assertion": false
}
}
+2 -1
View File
@@ -74,6 +74,7 @@
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
"whitespace": false,
"no-angle-bracket-type-assertion": false
}
}
+2 -1
View File
@@ -74,6 +74,7 @@
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
"whitespace": false,
"no-angle-bracket-type-assertion": false
}
}
+47 -7
View File
@@ -23,12 +23,7 @@ export namespace v2 {
searchAgents(
request: SearchAgentRequest,
options?: gax.CallOptions,
cb?: (
err: Error,
agents: Agent[],
arg3: any,
response: any
) => void
cb?: (err: Error, agents: Agent[], arg3: any, response: any) => void
): Promise<Agent[]>;
searchAgentsStream(
request: SearchAgentRequest,
@@ -213,7 +208,28 @@ export namespace v2 {
getProjectId(): Promise<string>;
getProjectId(callback?: (error: Error, id: string) => string): void;
// TODO: add Session Entity Types service methods
// TODO: add streaming calls
listSessionEntityTypes(
request: ListSessionEntityTypesRequest,
options?: gax.CallOptions
): Promise<[SessionEntityType[]]>;
getSessionEntityType(
request: GetSessionEntityTypeRequest,
options?: gax.CallOptions
): Promise<[SessionEntityType]>;
createSessionEntityType(
request: CreateSessionEntityTypeRequest,
options?: gax.CallOptions
): Promise<[SessionEntityType]>;
updateSessionEntityType(
request: UpdateSessionEntityTypeRequest,
options?: gax.CallOptions
): Promise<[SessionEntityType]>;
deleteSessionEntityType(
request: DeleteSessionEntityTypeRequest,
options?: gax.CallOptions
): Promise<void>;
}
class SessionsClient {
@@ -504,6 +520,30 @@ export interface DeleteEntityTypeRequest {
name: string;
}
export interface ListSessionEntityTypesRequest {
parent: string;
pageSize?: number;
}
export interface GetSessionEntityTypeRequest {
name: string;
}
export interface CreateSessionEntityTypeRequest {
parent: string;
sessionEntityType: SessionEntityType;
}
export interface UpdateSessionEntityTypeRequest {
sessionEntityType: SessionEntityType;
/** @link https://github.com/google/protobuf/blob/master/src/google/protobuf/field_mask.proto */
updateMask: any;
}
export interface DeleteSessionEntityTypeRequest {
name: string;
}
export interface ListIntentsRequest {
parent: string;
languageCode?: string;
+2 -1
View File
@@ -37,6 +37,7 @@
"radix": false,
"prefer-for-of": false,
"one-line": false,
"no-unnecessary-type-assertion": false
"no-unnecessary-type-assertion": false,
"no-angle-bracket-type-assertion": false
}
}
+25
View File
@@ -0,0 +1,25 @@
import emptyDir = require('empty-dir');
emptyDir('./', (err, isEmpty) => {
// $ExpectType ErrnoException
err;
// $ExpectType boolean
isEmpty;
});
// $ExpectType boolean
emptyDir.sync('./test/empty');
function filter(filepath: string) {
return !/(Thumbs\.db|\.DS_Store)$/i.test(filepath);
}
emptyDir('./', filter, (err, isEmpty) => {
// $ExpectType ErrnoException
err;
// $ExpectType boolean
isEmpty;
});
// $ExpectType boolean
emptyDir.sync('./test/empty', filter);
+22
View File
@@ -0,0 +1,22 @@
// Type definitions for empty-dir 1.0
// Project: https://github.com/js-cli/js-empty-dir
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
export = emptyDir;
declare function emptyDir(
dir: string,
cb: (err: NodeJS.ErrnoException, isEmpty: boolean) => void
): void;
declare function emptyDir(
dir: string,
filter: (path: string) => boolean,
cb: (err: NodeJS.ErrnoException, isEmpty: boolean) => void
): void;
declare namespace emptyDir {
function sync(dir: string, filter?: (path: string) => boolean): boolean;
}
+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",
"empty-dir-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
@@ -0,0 +1,19 @@
import { ExpiryManager } from "expirymanager";
const expiryManager = new ExpiryManager();
const keys = ['1', '2'];
expiryManager.expire(keys, 1);
expiryManager.unexpire(keys);
const expiry: number = expiryManager.getExpiry(keys[0]);
let expiredKeys = expiryManager.getExpiredKeys();
expiredKeys = expiryManager.getExpiredKeys(expiryManager.now());
expiredKeys = expiryManager.extractExpiredKeys();
expiredKeys = expiryManager.extractExpiredKeys(expiryManager.now());
expiryManager.clear();
+25
View File
@@ -0,0 +1,25 @@
// Type definitions for expirymanager 0.9
// Project: https://github.com/SocketCluster/expirymanager
// Definitions by: Daniel Rose <https://github.com/DanielRose>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export type Key = any;
export type Keys = Key[];
export class ExpiryManager {
constructor();
now(): number;
expire(keys: Keys, seconds: number): void;
unexpire(keys: Keys): void;
getExpiry(key: Key): number;
getKeysByExpiry(expiry: number): Keys;
getExpiredKeys(time?: number): Keys;
extractExpiredKeys(time?: number): Keys;
clear(): void;
}
+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",
"expirymanager-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+1 -1
View File
@@ -4529,7 +4529,7 @@ interface IUtilMisc {
* @param [context] Context to invoke callback in
* @param [crossOrigin] crossOrigin value to set image element to
*/
loadImage(url: string, callback: (image: HTMLImageElement) => void, context?: any, crossOrigin?: boolean): void;
loadImage(url: string, callback: (image: HTMLImageElement) => void, context?: any, crossOrigin?: string): void;
/**
* Creates corresponding fabric instances from their object representations
@@ -9,7 +9,7 @@ interface Services {
users: User;
}
const app = feathers() as Application<Services>;
const app = feathers<Services>();
app.service('users').get(0).then(u => {
const user: User = u;
+2 -1
View File
@@ -12,7 +12,8 @@
import { EventEmitter } from 'events';
import * as self from '@feathersjs/feathers';
declare const feathers: (() => Application<object>) & typeof self;
// tslint:disable-next-line no-unnecessary-generics
declare const feathers: (<T = any>() => Application<T>) & typeof self;
export default feathers;
export const version: string;
+1 -1
View File
@@ -11,7 +11,7 @@ declare namespace fined {
interface PathSpec {
path?: string;
name?: string;
extensions?: string | string[] | { [extension: string]: string };
extensions?: string | string[] | { [extension: string]: string | null };
cwd?: string;
findUp?: boolean;
}
+27
View File
@@ -0,0 +1,27 @@
import { FlexiMap } from "fleximap";
let flexiMap = new FlexiMap();
flexiMap = new FlexiMap({ arr: [] });
flexiMap = new FlexiMap([{ arr: [] }, { obj: {} }]);
flexiMap.set('keyA', {arr: [], obj: {}});
let result = flexiMap.get(['keyA', 'arr']);
flexiMap.add(['keyB1', 'keyB2', 'keyB3'], 123);
result = flexiMap.get(['keyB1', 'keyB2']);
const arr = [];
arr[5] = 'Hello world';
flexiMap.set(['keyC1', 'keyC2'], arr);
result = flexiMap.get(['keyC1', 'keyC2']);
flexiMap.set(['itemsA', 0], 'hello');
flexiMap.set(['itemsA', 2], 'world');
flexiMap.remove(['itemsA', 0]);
flexiMap.set(['itemsB', 0], 'a');
flexiMap.set(['itemsB', 1], 'b');
flexiMap.set(['itemsB', 2], 'c');
let splicedItems = flexiMap.splice(['itemsB'], 1, 1);
splicedItems = flexiMap.splice(['itemsB'], 1, 0, 'b2');
+38
View File
@@ -0,0 +1,38 @@
// Type definitions for fleximap 0.9
// Project: https://github.com/SocketCluster/fleximap
// Definitions by: Daniel Rose <https://github.com/DanielRose>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
export type KeyChain = any;
export class FlexiMap {
constructor(object?: any[] | object);
get(keyChain: KeyChain): any;
getRange(keyChain: KeyChain, fromIndex: number, toIndex: number): any;
getRaw(keyChain: KeyChain): any;
getAll(): any[] | object;
count(keyChain: KeyChain): number;
hasImmediateKey(key: string): boolean;
hasKey(keyChain: KeyChain): boolean;
hasType(keyChain: KeyChain, type: any): boolean;
hasValue(keyChain: KeyChain, value: any): boolean;
hasObject(keyChain: KeyChain, object: object): boolean;
set(keyChain: KeyChain, value: any): any;
add(keyChain: KeyChain, value: any): number;
concat(keyChain: KeyChain, value: any): any;
remove(keyChain: KeyChain): any;
removeRange(keyChain: KeyChain, fromIndex: number, toIndex: number): any[];
removeAll(): void;
splice(keyChain: KeyChain, index: number, count: number, ...items: any[]): any[];
pop(keyChain: KeyChain): 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",
"fleximap-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+4 -4
View File
@@ -4,10 +4,10 @@ export type SupportedImage = 'image/png' | 'image/jpeg' | 'image/bmp' | 'image/w
export type ValidQuality = 0.0 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 1.0;
export interface GLViewDOMProps {
onContextCreate: (gl: WebGLRenderingContext) => void;
onContextFailure: (e: Error) => void;
onContextLost: () => void;
onContextRestored: (gl: WebGLRenderingContext) => void;
onContextCreate?: (gl: WebGLRenderingContext) => void;
onContextFailure?: (e: Error) => void;
onContextLost?: () => void;
onContextRestored?: (gl: WebGLRenderingContext) => void;
webglContextAttributes?: WebGLContextAttributes;
pixelRatio?: number;
width: number;
+27
View File
@@ -0,0 +1,27 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { Surface } from 'gl-react-dom';
import { Shaders, GLSL, Node } from 'gl-react';
const shaders = Shaders.create({
Test: {
frag: GLSL`
precision highp float;
varying vec2 uv;
void main() {
gl_FragColor = vec4(uv.x, uv.y, 0.5, 1.0);
}`
}
});
const App = () => (
<div>
<Surface width={640} height={480}>
<Node shader={shaders.HelloBlue} />
</Surface>
</div>
);
const element = document.createElement('div');
document.body.appendChild(element);
ReactDOM.render(<App />, element);
+2 -1
View File
@@ -1,6 +1,7 @@
{
"files": [
"index.d.ts"
"index.d.ts",
"gl-react-dom-tests.tsx"
],
"compilerOptions": {
"module": "commonjs",
+1 -1
View File
@@ -3,7 +3,7 @@ import * as React from 'react';
// import { GLView as EXGLView } from 'expo';
export interface GLViewNativeProps {
onContextCreate: (gl: WebGLRenderingContext) => void;
onContextCreate?: (gl: WebGLRenderingContext) => void;
style?: any;
children?: any;
}
@@ -0,0 +1,27 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { Surface } from 'gl-react-expo';
import { Shaders, GLSL, Node } from 'gl-react';
const shaders = Shaders.create({
Test: {
frag: GLSL`
precision highp float;
varying vec2 uv;
void main() {
gl_FragColor = vec4(uv.x, uv.y, 0.5, 1.0);
}`
}
});
const App = () => (
<div>
<Surface>
<Node shader={shaders.HelloBlue} />
</Surface>
</div>
);
const element = document.createElement('div');
document.body.appendChild(element);
ReactDOM.render(<App />, element);
+2 -1
View File
@@ -1,6 +1,7 @@
{
"files": [
"index.d.ts"
"index.d.ts",
"gl-react-expo-tests.tsx"
],
"compilerOptions": {
"module": "commonjs",
+4 -4
View File
@@ -1,10 +1,10 @@
import * as React from 'react';
export interface GLViewHeadlessProps {
onContextCreate: (gl: WebGLRenderingContext) => void;
onContextFailure: (e: Error) => void;
onContextLost: () => void;
onContextRestored: (gl: WebGLRenderingContext) => void;
onContextCreate?: (gl: WebGLRenderingContext) => void;
onContextFailure?: (e: Error) => void;
onContextLost?: () => void;
onContextRestored?: (gl: WebGLRenderingContext) => void;
webglContextAttributes?: WebGLContextAttributes;
pixelRatio?: number;
width: number;
@@ -0,0 +1,27 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { Surface } from 'gl-react-headless';
import { Shaders, GLSL, Node } from 'gl-react';
const shaders = Shaders.create({
Test: {
frag: GLSL`
precision highp float;
varying vec2 uv;
void main() {
gl_FragColor = vec4(uv.x, uv.y, 0.5, 1.0);
}`
}
});
const App = () => (
<div>
<Surface width={640} height={480}>
<Node shader={shaders.HelloBlue} />
</Surface>
</div>
);
const element = document.createElement('div');
document.body.appendChild(element);
ReactDOM.render(<App />, element);
+2 -1
View File
@@ -1,6 +1,7 @@
{
"files": [
"index.d.ts"
"index.d.ts",
"gl-react-headless-tests.tsx"
],
"compilerOptions": {
"module": "commonjs",
+2 -2
View File
@@ -1,8 +1,8 @@
import * as React from 'react';
export interface GLViewNativeProps {
onContextCreate: (gl: WebGLRenderingContext) => void;
onContextFailure: (e: Error) => void;
onContextCreate?: (gl: WebGLRenderingContext) => void;
onContextFailure?: (e: Error) => void;
style?: any;
children?: any;
}
@@ -0,0 +1,27 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { Surface } from 'gl-react-native';
import { Shaders, GLSL, Node } from 'gl-react';
const shaders = Shaders.create({
Test: {
frag: GLSL`
precision highp float;
varying vec2 uv;
void main() {
gl_FragColor = vec4(uv.x, uv.y, 0.5, 1.0);
}`
}
});
const App = () => (
<div>
<Surface>
<Node shader={shaders.HelloBlue} />
</Surface>
</div>
);
const element = document.createElement('div');
document.body.appendChild(element);
ReactDOM.render(<App />, element);
+2 -1
View File
@@ -1,6 +1,7 @@
{
"files": [
"index.d.ts"
"index.d.ts",
"gl-react-native-tests.tsx"
],
"compilerOptions": {
"module": "commonjs",
+1 -1
View File
@@ -124,7 +124,7 @@ export interface Framebuffer {
export interface NodeProps {
shader: ShaderIdentifier | ShaderDefinition;
uniformsOptions?: any;
uniforms: { [key: string]: any };
uniforms?: { [key: string]: any };
ignoreUnusedUniforms?: string[] | boolean;
sync?: boolean;
width?: number;
+2 -1
View File
@@ -74,6 +74,7 @@
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
"whitespace": false,
"no-angle-bracket-type-assertion": false
}
}
+2 -1
View File
@@ -7,6 +7,7 @@
"no-declare-current-package": false,
"no-object-literal-type-assertion": false,
"no-self-import": false,
"no-unnecessary-generics": false
"no-unnecessary-generics": false,
"no-angle-bracket-type-assertion": false
}
}
+49
View File
@@ -0,0 +1,49 @@
import { Company } from "./Company";
import { Avatar, LocationData, Segment, SocialProfile, Tag } from './User';
export type LeadIdentifier = { "id": string } | { "user_id": string };
export interface Lead {
"type": "contact",
readonly "id": string,
"user_id": string | null,
"email": string | null,
"phone": string | null,
"name": string | null,
readonly "updated_at": number,
"last_seen_ip": string | null,
"unsubscribed_from_emails": boolean,
"last_request_at": number | null,
readonly "created_at": number,
"user_agent_data": string | null,
"custom_attributes": {
[key: string]: any
},
"avatar": Avatar,
"location_data": LocationData | {},
"social_profiles": {
"type": "social_profile.list",
"social_profiles": SocialProfile[]
},
"companies": {
"type": "company.list",
"companies": Company[]
},
"segments": {
"type": "segment.list",
"segments": Segment[]
},
"tags": {
"type": "tag.list",
"tags": Tag[]
},
"referrer": string | null,
}
export interface List {
"type": "user.list",
"total_count": number,
"contacts": Lead[],
"pages": { "next"?: string, "page": number, "per_page": number, "total_pages": number }
}
+36 -4
View File
@@ -6,6 +6,7 @@
/// <reference types="node" />
import { List as UserList, User, UserIdentifier } from './User';
import { List as LeadList, Lead, LeadIdentifier } from './Lead';
import { CompanyIdentifier, List as CompanyList, Company } from './Company';
import { TagIdentifier, List as TagList, Tag, TagOper } from './Tag';
import { List as EventList, Event, ListParam as EventListParam } from './Event';
@@ -33,6 +34,8 @@ export class Client {
companies: Companies;
tags: Tags;
events: Events;
contacts: Leads;
leads: Leads;
}
export class ApiResponse<T> extends IncomingMessage {
@@ -51,17 +54,46 @@ export class Users {
find(identifier: UserIdentifier): Promise<ApiResponse<User>>;
find(identifier: UserIdentifier, cb: callback<ApiResponse<User>>): void;
list(): Promise<ApiResponse<User>>;
list(cb: callback<ApiResponse<User>>): void;
list(): Promise<ApiResponse<UserList>>;
list(cb: callback<ApiResponse<UserList>>): void;
listBy(params: {tag_id?: string, segment_id?: string}): Promise<ApiResponse<UserList>>;
listBy(params: {tag_id?: string, segment_id?: string}, cb: callback<ApiResponse<UserList>>): void;
scroll: Scroll<User>;
archive(): Promise<User>;
archive(identifier: UserIdentifier): Promise<ApiResponse<User>>;
archive(identifier: UserIdentifier, cb: callback<ApiResponse<User>>): void;
requestPermanentDeletion(id: string): Promise<{ id: number }>;
requestPermanentDeletion(id: string, cb: callback<{ id: number }>): void;
requestPermanentDeletionByParams(identifier: UserIdentifier): Promise<{ id: number }>;
requestPermanentDeletionByParams(identifier: UserIdentifier, cb: callback<{ id: number }>): void;
}
export class Leads {
create(lead: Partial<Lead>): Promise<ApiResponse<Lead>>;
create(lead: Partial<Lead>, cb: callback<ApiResponse<Lead>>): void;
update(lead: UserIdentifier & Partial<Lead>): Promise<ApiResponse<Lead>>;
update(lead: UserIdentifier & Partial<Lead>, cb: callback<ApiResponse<Lead>>): void;
list(): Promise<ApiResponse<LeadList>>;
list(cb: callback<ApiResponse<LeadList>>): void;
listBy(params: { email?: string, tag_id?: string, segment_id?: string }): Promise<ApiResponse<LeadList>>;
listBy(params: { email?: string, tag_id?: string, segment_id?: string }, cb: callback<ApiResponse<LeadList>>): void;
find(identifier: LeadIdentifier): Promise<ApiResponse<Lead>>
find(identifier: LeadIdentifier, cb: callback<ApiResponse<Lead>>): void;
delete(id: string): Promise<ApiResponse<Lead>>;
delete(id: string, cb: callback<ApiResponse<Lead>>): void;
convert(params: { contact: LeadIdentifier, user: UserIdentifier }): Promise<ApiResponse<Lead>>;
convert(params: { contact: LeadIdentifier, user: UserIdentifier }, cb: callback<ApiResponse<Lead>>): void;
requestPermanentDeletion(): Promise<{id: number}>;
}
export class Companies {
+2 -1
View File
@@ -75,6 +75,7 @@
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
"whitespace": false,
"no-angle-bracket-type-assertion": false
}
}
+5
View File
@@ -8,6 +8,11 @@
export interface PartialMockInstance<T> {
mockReturnValue: jest.MockInstance<T>['mockReturnValue'];
mockReturnValueOnce: jest.MockInstance<T>['mockReturnValueOnce'];
mockResolvedValue: jest.MockInstance<T>['mockResolvedValue'];
mockResolvedValueOnce: jest.MockInstance<T>['mockResolvedValueOnce'];
mockRejectedValue: jest.MockInstance<T>['mockRejectedValue'];
mockRejectedValueOnce: jest.MockInstance<T>['mockRejectedValueOnce'];
}
export interface When {
+2 -2
View File
@@ -14,7 +14,7 @@ export interface FocusElements {
declare global {
interface JQuery {
focusExit(options?: { debug: boolean }): JQuery;
on(event: 'focusExit', handler: ((event: JQuery.Event<HTMLElement>, data: FocusElements) => void)): JQuery;
one(event: 'focusin', handler: ((event: JQuery.Event<HTMLElement>) => void)): JQuery;
on(event: 'focusExit', handler: ((event: JQuery.TriggeredEvent<HTMLElement>, data: FocusElements) => void)): JQuery;
one(event: 'focusin', handler: ((event: JQuery.TriggeredEvent<HTMLElement>) => void)): JQuery;
}
}
+1 -1
View File
@@ -18,6 +18,6 @@ export type FocusElements = Partial<{
declare global {
interface JQuery {
mouseExit(options?: Options): JQuery;
on(event: 'mouseExit', handler: ((event: JQuery.Event<HTMLElement>, data: FocusElements) => void)): JQuery;
on(event: 'mouseExit', handler: ((event: JQuery.TriggeredEvent<HTMLElement>, data: FocusElements) => void)): JQuery;
}
}
+2 -1
View File
@@ -74,6 +74,7 @@
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
"whitespace": false,
"no-angle-bracket-type-assertion": false
}
}
+2 -1
View File
@@ -74,6 +74,7 @@
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
"whitespace": false,
"no-angle-bracket-type-assertion": false
}
}
+2 -1
View File
@@ -74,6 +74,7 @@
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
"whitespace": false,
"no-angle-bracket-type-assertion": false
}
}
+319 -155
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1886 -337
View File
File diff suppressed because it is too large Load Diff
+10 -10
View File
@@ -384,7 +384,7 @@ function examples() {
}
function bind_2() {
function handler(event: JQuery.Event<HTMLElement, any>) {
function handler(event: JQuery.TriggeredEvent<HTMLElement>) {
alert(event.data.foo);
}
@@ -830,7 +830,7 @@ function examples() {
var len = kids.addClass('hilite').length;
$('#results span:first').text(len);
$('#results span:last').text(event.target.tagName);
$('#results span:last').text((event.target as Element).tagName);
event.preventDefault();
});
@@ -1578,7 +1578,7 @@ function examples() {
function event_related_target_0() {
$('a').mouseout(function(event) {
alert((<HTMLElement> event.relatedTarget).nodeName); // "DIV"
alert((event.relatedTarget as HTMLElement).nodeName); // "DIV"
});
}
@@ -1614,12 +1614,12 @@ function examples() {
function event_target_0() {
$('body').click(function(event) {
$('#log').html('clicked: ' + event.target.nodeName);
$('#log').html('clicked: ' + (event.target as Node).nodeName);
});
}
function event_target_1() {
function handler(event: JQuery.Event) {
function handler(event: JQuery.TriggeredEvent) {
var target = $(event.target);
if (target.is('li')) {
target.children().toggle();
@@ -3018,10 +3018,10 @@ function examples() {
function jQuery_proxy_0() {
var me = {
type: 'zombie',
test: function(event: JQuery.Event) {
test: function(event: JQuery.TriggeredEvent) {
// Without proxy, `this` would refer to the event target
// use event.target to reference that element.
var element = event.target;
var element = event.target as Element;
$(element).css('background-color', 'red');
// With proxy, `this` refers to the me object encapsulating
@@ -3033,7 +3033,7 @@ function examples() {
var you = {
type: 'person',
test: function(event: JQuery.Event) {
test: function(event: JQuery.TriggeredEvent) {
$('#log').append(this.type + ' ');
},
};
@@ -3075,7 +3075,7 @@ function examples() {
type: 'dog',
// Note that event comes *after* one and two
test: function(one: typeof you, two: typeof they, event: JQuery.Event<HTMLElement>) {
test: function(one: typeof you, two: typeof they, event: JQuery.TriggeredEvent<HTMLElement>) {
$('#log')
// `one` maps to `you`, the 1st additional
@@ -3796,7 +3796,7 @@ function examples() {
}
function on_1() {
function myHandler(event: JQuery.Event<HTMLElement, { foo: string; }>) {
function myHandler(event: JQuery.TriggeredEvent<HTMLElement, { foo: string; }>) {
alert(event.data.foo);
}
+1 -19
View File
@@ -21,24 +21,6 @@ jQuery("a").greenify(); // Makes all the links green.
// Events
function fixHooks() {
function setHook() {
jQuery.event.fixHooks.drop = {
props: ["dataTransfer"]
};
}
function conflictResolution() {
if (jQuery.event.fixHooks.drop) {
throw new Error("Someone else took the jQuery.event.fixHooks.drop hook!");
}
jQuery.event.fixHooks.drop = {
props: ["dataTransfer"]
};
}
}
function special() {
function defineSpecialEvent() {
jQuery.event.special.pushy = {
@@ -53,7 +35,7 @@ function special() {
bindType: "click",
handle(event) {
const handleObj = event.handleObj;
const targetData = jQuery.data(event.target);
const targetData = jQuery.data(event.target as Element);
let ret = null;
// If a multiple of the click count, run the handler
+4 -4
View File
@@ -538,7 +538,7 @@ function longdesc() {
$('#foo').slideUp(300).delay(800).fadeIn(400);
}
function delegate_0(elements: HTMLElement[], selector: string, events: any, data: any, handler: JQuery.EventHandler<HTMLElement>) {
function delegate_0(elements: HTMLElement[], selector: string, events: string, data: any, handler: JQuery.TypeEventHandler<HTMLElement, any, any, any, string>) {
// jQuery 1.4.3+
$(elements).delegate(selector, events, data, handler);
// jQuery 1.7+
@@ -886,7 +886,7 @@ function longdesc() {
var currentRequests: JQuery.PlainObject = {};
$.ajaxPrefilter(function(options, originalOptions, jqXHR) {
if ((<any> options).abortOnRetry) {
if ((options as any).abortOnRetry) {
if (currentRequests[options.url!]) {
currentRequests[options.url!].abort();
}
@@ -1297,7 +1297,7 @@ function longdesc() {
return $.css(elem, borderRadius!);
},
set: function(elem, value) {
(<any> elem.style)[borderRadius!] = value;
(elem.style as any)[borderRadius!] = value;
},
};
}
@@ -2016,7 +2016,7 @@ function longdesc() {
}
function on_3() {
function greet(event: JQuery.Event<HTMLElement, { name: string; }>) {
function greet(event: JQuery.TriggeredEvent<HTMLElement, { name: string; }>) {
alert('Hello ' + event.data.name);
}
+2
View File
@@ -41,6 +41,8 @@ export class Request<T> implements Promise<T> {
then<TResult1, TResult2>(onfulfilled?: ((value: T) => (PromiseLike<TResult1> | TResult1)) | null | undefined,
onrejected?: ((reason: any) => (PromiseLike<TResult2> | TResult2)) | null | undefined): Promise<TResult1 | TResult2>;
finally(onfinally?: () => void): Promise<T>;
thenCall(callback?: (err: Error, records: T) => void): Query<T>;
readonly [Symbol.toStringTag]: 'Promise';
+2
View File
@@ -124,6 +124,8 @@ export class AsyncResultLocator<T> extends EventEmitter implements Promise<T> {
then<TResult1, TResult2>(onfulfilled?: ((value: T) => (PromiseLike<TResult1> | TResult1)) | null | undefined,
onrejected?: ((reason: any) => (PromiseLike<TResult2> | TResult2)) | null | undefined): Promise<TResult1 | TResult2>;
finally(onfinally?: () => void): Promise<T>;
readonly [Symbol.toStringTag]: "Promise";
}
+72
View File
@@ -0,0 +1,72 @@
// Type definitions for json-server 0.14
// Project: https://github.com/typicode/json-server
// Definitions by: Jeremy Bensimon <https://github.com/jeremyben>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import { NextHandleFunction } from 'connect';
import { Application, RequestHandler, Router } from 'express';
/**
* Returns an Express server.
*/
export function create(): Application;
/**
* Returns middlewares used by JSON Server.
*/
export function defaults(options?: MiddlewaresOptions): RequestHandler[];
/**
* Returns JSON Server router.
* @param source Either a path to a json file (e.g. `'db.json'`) or an object in memory
* @param options Set foreign key suffix (default: `'Id'`)
*/
export function router(source: string | object, options?: { foreignKeySuffix: string }): Router;
/**
* Add custom rewrite rules.
*/
export function rewriter(rules: { [rule: string]: string }): Router;
/**
* Returns body-parser middleware used by JSON Server router.
*
* @returns
* ```
* [bodyParser.json({ limit: '10mb', extended: false }), bodyParser.urlencoded({ extended: false })]
* ```
*/
export const bodyParser: [NextHandleFunction, NextHandleFunction];
export interface MiddlewaresOptions {
/**
* Path to static files
* @default "public" (if folder exists)
*/
static?: string;
/**
* Enable logger middleware
* @default true
*/
logger?: boolean;
/**
* Enable body-parser middleware
* @default true
*/
bodyParser?: boolean;
/**
* Disable CORS
* @default false
*/
noCors?: boolean;
/**
* Accept only GET requests
* @default false
*/
readOnly?: boolean;
}
+41
View File
@@ -0,0 +1,41 @@
import * as jsonServer from 'json-server';
const server = jsonServer.create();
const inMemoryDbRouter = jsonServer.router({ todos: [] as any[], users: [] as any[] });
const router = jsonServer.router('db.json', { foreignKeySuffix: '_id' });
const middlewaresOptions: jsonServer.MiddlewaresOptions = {
bodyParser: true,
logger: false,
noCors: true,
readOnly: true,
static: 'assets',
};
const middlewares = jsonServer.defaults(middlewaresOptions);
const rewriter = jsonServer.rewriter({
'/api/*': '/$1',
'/blog/:resource/:id/show': '/:resource/:id',
});
server.use(jsonServer.bodyParser);
server.use((req, res, next) => {
if (req.method === 'POST') {
req.body.createdAt = Date.now();
}
next();
});
server.use(rewriter);
server.use(middlewares);
server.use(router);
server.listen(3000, () => {
console.log('JSON Server is running');
});
+16
View File
@@ -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", "json-server-tests.ts"]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+15
View File
@@ -0,0 +1,15 @@
// Type definitions for json_ml 0.0
// Project: https://github.com/59naga/json-ml
// Definitions by: Alan Plum <https://github.com/pluma>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0
/// <reference types="cheerio" />
export type Node = string | [string, ...any[]];
export function parse(xml: string, trim?: boolean): Node[];
export function stringify(
object: Node[],
replacer?: ((node: Cheerio) => any) | null,
indent?: number
): string;
+20
View File
@@ -0,0 +1,20 @@
/// <reference types="node" />
import { Node, parse, stringify } from "json_ml";
const nodes: Node[] = parse(
'<ul><li style="color:red">First Item</li><li title="Some hover text." style="color:green">Second Item</li><li><span class="code-example-third">Third</span>Item</li></ul>'
);
stringify(nodes, el => (el.is("li") ? null : el), 2);
stringify(
[
[
"ul",
["li", { style: "color: red" }],
["li", { title: "Some hover text", style: "color: green" }],
["li", ["span", { class: "code-example-third" }]]
]
],
null,
2
);
+16
View File
@@ -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", "json_ml-tests.ts"]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+2 -1
View File
@@ -74,6 +74,7 @@
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
"whitespace": false,
"no-angle-bracket-type-assertion": false
}
}
+33
View File
@@ -0,0 +1,33 @@
// Type definitions for koa-log 2.1
// Project: https://github.com/vicanso/koa-log#readme
// Definitions by: Uladzimir Havenchyk <https://github.com/havenchyk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as Koa from 'koa';
declare function koaLog(type: string): Koa.Middleware;
declare namespace koaLog {
namespace morgan {
function cookie(ctx: Koa.BaseContext, key: string): string;
function date(ctx: Koa.BaseContext, format: string): string;
function format(name: string): string;
function length(ctx: Koa.BaseContext): number | undefined;
function method(ctx: Koa.BaseContext): string;
function referrer(ctx: Koa.BaseContext): string;
function status(ctx: Koa.BaseContext): number;
function token(name: string, fn: (ctx: Koa.BaseContext) => string): void;
function url(ctx: Koa.BaseContext): string;
}
}
export = koaLog;
+10
View File
@@ -0,0 +1,10 @@
import Koa = require('koa');
import koaLogger = require('koa-log');
koaLogger.morgan.token('request-body', (ctx: Koa.BaseContext) => JSON.stringify(ctx.request.body));
koaLogger.morgan.token('response-body', (ctx: Koa.BaseContext) => JSON.stringify(ctx.body));
const app = new Koa();
app.use(
koaLogger(':status :method :url took :response-time ms :request-body :response-body')
);
+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",
"koa-log-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+203
View File
@@ -0,0 +1,203 @@
// Type definitions for liftoff 2.5
// Project: https://github.com/js-cli/js-liftoff#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { Extensions, Extension, ExtensionDescriptor } from 'interpret';
import { PathSpec } from 'fined';
import { EventEmitter } from 'events';
export = Liftoff;
declare class Liftoff extends EventEmitter {
/**
* Create an instance of Liftoff to invoke your application.
*/
constructor(options?: Liftoff.Options);
/**
* Launches your application with provided options, builds an environment,
* and invokes your callback, passing the calculated environment as the first argument.
*/
launch(
opts: Liftoff.LaunchOptions,
callback: (this: this, env: Liftoff.LiftoffEnv) => void
): void;
addListener(
event: 'require',
listener: (name: string, module: ExtensionDescriptor) => void
): this;
addListener(event: 'requireFail', listener: (name: string, err: any) => void): this;
addListener(event: 'respawn', listener: (flags: string[], child: NodeJS.Process) => void): this;
on(event: 'require', listener: (name: string, module: ExtensionDescriptor) => void): this;
on(event: 'requireFail', listener: (name: string, err: any) => void): this;
on(event: 'respawn', listener: (flags: string[], child: NodeJS.Process) => void): this;
once(event: 'require', listener: (name: string, module: ExtensionDescriptor) => void): this;
once(event: 'requireFail', listener: (name: string, err: any) => void): this;
once(event: 'respawn', listener: (flags: string[], child: NodeJS.Process) => void): this;
prependListener(
event: 'require',
listener: (name: string, module: ExtensionDescriptor) => void
): this;
prependListener(event: 'requireFail', listener: (name: string, err: any) => void): this;
prependListener(
event: 'respawn',
listener: (flags: string[], child: NodeJS.Process) => void
): this;
prependOnceListener(
event: 'require',
listener: (name: string, module: ExtensionDescriptor) => void
): this;
prependOnceListener(event: 'requireFail', listener: (name: string, err: any) => void): this;
prependOnceListener(
event: 'respawn',
listener: (flags: string[], child: NodeJS.Process) => void
): this;
removeListener(
event: 'require',
listener: (name: string, module: ExtensionDescriptor) => void
): this;
removeListener(event: 'requireFail', listener: (name: string, err: any) => void): this;
removeListener(
event: 'respawn',
listener: (flags: string[], child: NodeJS.Process) => void
): this;
off(event: 'require', listener: (name: string, module: ExtensionDescriptor) => void): this;
off(event: 'requireFail', listener: (name: string, err: any) => void): this;
off(event: 'respawn', listener: (flags: string[], child: NodeJS.Process) => void): this;
removeAllListeners(event?: 'require' | 'requireFail' | 'respawn'): this;
listeners(event: 'require' | 'requireFail' | 'respawn'): Function[]; // tslint:disable-line:ban-types
rawListeners(event: 'require' | 'requireFail' | 'respawn'): Function[]; // tslint:disable-line:ban-types
emit(event: 'require', name: string, module: ExtensionDescriptor): boolean;
emit(event: 'requireFail', name: string, err: any): boolean;
emit(event: 'respawn', flags: string[], child: NodeJS.Process): boolean;
eventNames(): Array<'require' | 'requireFail' | 'respawn'>;
listenerCount(type: 'require' | 'requireFail' | 'respawn'): number;
}
declare namespace Liftoff {
interface Options {
/**
* Sugar for setting processTitle, moduleName, configName automatically.
* @default null
*/
name?: string;
/**
* Sets which module your application expects to find locally when being run.
* @default null
*/
moduleName?: string;
/**
* Sets the name of the configuration file Liftoff will attempt to find. Case-insensitive.
* @default null
*/
configName?: string;
/**
* Set extensions to include when searching for a configuration file.
* If an external module is needed to load a given extension (e.g. .coffee),
* the module name should be specified as the value for the key.
* @default {".js":null,".json":null}
*/
extensions?: Extensions;
/**
* Any flag specified here will be applied to node, not your program.
* Useful for supporting invocations like myapp --harmony command,
* where --harmony should be passed to node, not your program.
* This functionality is implemented using flagged-respawn.
* To support all v8flags, see `v8flags`.
* @default null
*/
v8flags?: string[] | ((cb: (err: any, flags: string[]) => void) => void);
/**
* Sets what the process title will be.
* @default null
*/
processTitle?: string;
/**
* A method to handle bash/zsh/whatever completions.
* @default null
*/
completions?: (completion: string) => any;
/**
* An object of configuration files to find. Each property is keyed by the
* default basename of the file being found, and the value is an object
* of path arguments keyed by unique names.
* @default null
*/
configFiles?: {
[extension: string]: { [locationName: string]: string | PathSpec };
};
}
interface LaunchOptions {
/**
* Change the current working directory for this launch. Relative paths are calculated against `process.cwd()`.
* @default process.cwd()
*/
cwd?: string;
/**
* Don't search for a config, use the one provided.
* **Note**: Liftoff will assume the current working directory is the directory containing the config file
* unless an alternate location is explicitly specified using `cwd`.
* @default null
*/
configPath?: string;
/**
* A string or array of modules to attempt requiring from the local
* working directory before invoking the launch callback.
* @default null
*/
require?: string | any[];
/**
* Allows you to force node or V8 flags during the launch.
* This is useful if you need to make sure certain flags will always be enabled
* or if you need to enable flags that don't show up in `opts.v8flags`
* (as these flags aren't validated against opts.v8flags).
* @default null
*/
forcedFlags?: string | string[] | ((env: LiftoffEnv) => string | string[]);
completion?: string;
}
interface LiftoffEnv {
/**
* the current working directory
*/
cwd: string;
/**
* an array of modules that liftoff tried to pre-load
*/
require: string[];
/**
* the config files searched for
*/
configNameSearch: string[];
/**
* the full path to your configuration file (if found)
*/
configPath: string | undefined;
/**
* the base directory of your configuration file (if found)
*/
configBase: string | undefined;
/**
* the full path to the local module your project relies on (if found)
*/
modulePath: string | undefined;
/**
* the contents of the local module's package.json (if found)
*/
modulePackage: { [key: string]: any } | undefined;
/**
* an object of filepaths for each found config file (filepath values will be null if not found)
*/
configFiles: { [extensions: string]: { [path: string]: string | null } } | undefined;
}
}
+182
View File
@@ -0,0 +1,182 @@
import Liftoff = require('liftoff');
import v8flags = require('v8flags');
new Liftoff({
name: 'hacker',
processTitle: 'hacker',
moduleName: 'hacker',
configName: 'hackerfile',
extensions: {
'.js': null,
'.json': null,
'.coffee': 'coffee-script/register',
},
v8flags: ['--harmony'],
});
new Liftoff({
name: 'hacker',
processTitle: 'hacker',
moduleName: 'hacker',
configName: 'hackerfile',
extensions: {
'.js': null,
'.json': null,
'.coffee': 'coffee-script/register',
},
v8flags,
});
new Liftoff({ name: 'hacker' });
new Liftoff({
name: 'myapp',
extensions: {
'.js': null,
'.json': null,
'.coffee': 'coffee-script/register',
},
});
new Liftoff({
name: 'myapp',
configName: '.myapp',
extensions: {
rc: null,
},
});
new Liftoff({
name: 'myapp',
extensions: require('interpret').jsVariants,
});
new Liftoff({
v8flags: ['--trace-deprecation'],
});
new Liftoff({
v8flags(cb) {
cb(null, ['--trace-deprecation']);
},
});
new Liftoff({
name: 'hacker',
configFiles: {
'.hacker': {
cwd: '.',
},
},
});
new Liftoff({
name: 'hacker',
configFiles: {
'.hacker': {
home: {
path: '~',
extensions: {
rc: null,
},
},
},
},
});
new Liftoff({
name: 'hacker',
configFiles: {
'.hacker': {
up: {
path: '.',
findUp: true,
},
},
},
});
new Liftoff({
name: 'hacker',
configFiles: {
hacker: {
override: {
path: '.',
name: '.override',
},
},
},
});
new Liftoff({
name: 'hacker',
configFiles: {
'.hacker': {
home: {
path: '.',
cwd: '~',
},
},
},
});
new Liftoff().launch(
{
cwd: '',
configPath: '',
require: '',
completion: '',
},
env => {
// $ExpectType LiftoffEnv
env;
// $ExpectType string
env.cwd;
// $ExpectType string[]
env.require;
// $ExpectType string[]
env.configNameSearch;
// $ExpectType string | undefined
env.configPath;
// $ExpectType string | undefined
env.configBase;
// $ExpectType string | undefined
env.modulePath;
// $ExpectType { [key: string]: any; } | undefined
env.modulePackage;
// $ExpectType { [extensions: string]: { [path: string]: string | null; }; } | undefined
env.configFiles;
}
);
new Liftoff().launch({ cwd: '' }, () => {});
new Liftoff().launch({ configPath: '' }, () => {});
new Liftoff().launch({ require: '' }, () => {});
new Liftoff().launch({ forcedFlags: ['--trace-deprecation'] }, () => {});
new Liftoff().launch({ forcedFlags: '--trace-deprecation' }, () => {});
new Liftoff().launch(
{
forcedFlags: env => {
// $ExpectType LiftoffEnv
env;
return ['--trace-deprecation'];
},
},
() => {}
);
new Liftoff().launch(
{
forcedFlags: env => {
return '--trace-deprecation';
},
},
() => {}
);
new Liftoff().launch({ completion: '' }, () => {});
new Liftoff().on('require', (name, module) => {
// $ExpectType string
name;
// $ExpectType ExtensionDescriptor
module;
});
new Liftoff().on('requireFail', (name, err) => {
// $ExpectType string
name;
// $ExpectType any
err;
});
new Liftoff().on('respawn', (flags, child) => {
// $ExpectType string[]
flags;
// $ExpectType Process
child;
});
+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",
"liftoff-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+40
View File
@@ -0,0 +1,40 @@
// Type definitions for mockingoose 2.11
// Project: https://github.com/alonronin/mockingoose#readme
// Definitions by: Hiroshi Ioka <https://github.com/hirochachacha>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
type Op =
| 'find'
| 'findOne'
| 'count'
| 'countDocuments'
| 'estimatedDocumentCount'
| 'distinct'
| 'findOneAndUpdate'
| 'findOneAndRemove'
| 'remove'
| 'update'
| 'deleteOne'
| 'deleteMany'
| 'save';
declare class Mock {
toReturn(expected: any, op?: Op): this;
reset(op: Op): this;
toJSON(): any;
}
interface Target {
__mocks: any;
resetAll(): void;
toJSON(): any;
}
type Proxy = Target & {
[index: string]: Mock;
};
declare const mockingoose: Proxy;
export default mockingoose;
+9
View File
@@ -0,0 +1,9 @@
import mockingoose from 'mockingoose';
mockingoose.User
.toReturn({ name: 'name' })
.toReturn({ name: 'a name too' }, 'findOne')
.toReturn({ name: 'another name' }, 'save')
.reset('find');
mockingoose.resetAll();
+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",
"mockingoose-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

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