This commit is contained in:
Klaus Kopruch
2018-07-10 08:22:15 +02:00
79 changed files with 4080 additions and 1746 deletions
+1 -1
View File
@@ -2,6 +2,6 @@
// Project: https://git.coolaj86.com/coolaj86/atob.js.git
// Definitions by: John Wright <https://github.com/johngeorgewright>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
// TypeScript Version: 2.1
export default function(str: string): string;
+1 -1
View File
@@ -802,7 +802,7 @@ export class DocumentClient {
* @param [options] - Represents the feed options.
* @returns - An instance of queryIterator to handle reading feed.
*/
queryDocuments<TDocument>(collectionLink: string, query: DocumentQuery, options?: FeedOptions): QueryIterator<RetrievedDocument>;
queryDocuments<TDocument>(collectionLink: string, query: DocumentQuery, options?: FeedOptions): QueryIterator<RetrievedDocument & TDocument>;
/**
* Query the triggers for the collection.
+6
View File
@@ -333,6 +333,12 @@ fooStream.toArray((arr: Foo[]) => {});
fooStream.toCallback((err: Error, x: Foo) => {});
fooStream.toCallback((err: Error) => {});
fooStream.toNodeStream();
fooStream.toNodeStream({objectMode: false});
fooStream.toNodeStream({objectMode: true});
fooStream.toPromise(Promise);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// UTILS
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+21 -1
View File
@@ -1,9 +1,10 @@
// Type definitions for Highland 2.10.5
// Type definitions for Highland 2.12.0
// Project: http://highlandjs.org/
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
// Hugo Wood <https://github.com/hgwood>
// William Yu <https://github.com/iwllyu>
// Alvis HT Tang <https://github.com/alvis>
// Jack Wearden <https://github.com/notbobthebuilder>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -1319,6 +1320,25 @@ declare namespace Highland {
*/
toCallback(cb: (err?: Error, x?: R) => void): void;
/**
* Converts the stream to a node Readable Stream for use in methods
* or pipes that depend on the native stream type.
*
* The options parameter can be an object passed into the [`Readable`
* constructor](http://nodejs.org/api/stream.html#stream_class_stream_readable).
*
* @id toNodeStream
* @section Consumption
* @name Stream.toNodeStream(options)
* @param {Object} options - (optional) [`Readable` constructor](http://nodejs.org/api/stream.html#stream_class_stream_readable) options
* @api public
*
* _(fs.createReadStream('./abc')).toNodeStream()
* _(fs.createReadStream('./abc')).toNodeStream({objectMode: false})
* _([{a: 1}]).toNodeStream({objectMode: true})
*/
toNodeStream(options?: object): NodeJS.ReadableStream;
/**
* Converts the result of a stream to Promise.
*
+7
View File
@@ -458,6 +458,13 @@ declare namespace IORedis {
}
interface Pipeline {
redis: Redis;
isCluster: boolean;
options: RedisOptions;
_queue: Command[];
_result: any[];
_transactions: number;
_shaToScript: {};
bitcount(key: string, callback?: (err: Error, res: number) => void): Pipeline;
bitcount(key: string, start: number, end: number, callback?: (err: Error, res: number) => void): Pipeline;
+1 -1
View File
@@ -342,7 +342,7 @@ declare namespace jest {
}
interface ExpectExtendMap {
[key: string]: (this: MatcherUtils, received: any, ...actual: any[]) => { message(): string, pass: boolean } | Promise<{ message(): string, pass: boolean }>;
[key: string]: (this: MatcherUtils, received: any, ...actual: any[]) => { message(): string | (() => string), pass: boolean } | Promise<{ message(): string, pass: boolean }>;
}
interface SnapshotSerializerOptions {
+66
View File
@@ -425,6 +425,72 @@ expect.extend({
};
}
});
expect.extend({
async foo(this: jest.MatcherUtils, received: {}, ...actual: Array<{}>) {
return {
message: () => JSON.stringify(received),
pass: false,
};
}
});
expect.extend({
foo(this: jest.MatcherUtils) {
const isNot: boolean = this.isNot;
const expectedColor = this.utils.EXPECTED_COLOR("blue");
const receivedColor = this.utils.EXPECTED_COLOR("red");
this.utils.ensureActualIsNumber({});
this.utils.ensureActualIsNumber({}, "matcher");
this.utils.ensureExpectedIsNumber({});
this.utils.ensureExpectedIsNumber({}, "matcher");
this.utils.ensureNoExpected({});
this.utils.ensureNoExpected({}, "matcher");
this.utils.ensureNumbers({}, {});
this.utils.ensureNumbers({}, {}, "matcher");
const valueType: string = this.utils.getType({});
this.utils.matcherHint("matcher");
this.utils.matcherHint("matcher", "received");
this.utils.matcherHint("matcher", "received", "expected");
this.utils.matcherHint("matcher", "received", "expected", {});
this.utils.matcherHint("matcher", "received", "expected", {
isDirectExpectCall: true,
});
this.utils.matcherHint("matcher", "received", "expected", {
secondArgument: "",
});
this.utils.matcherHint("matcher", "received", "expected", {
isDirectExpectCall: true,
secondArgument: "",
});
const plural: string = this.utils.pluralize("word", 3);
const expectedPrinted: string = this.utils.printExpected({});
const receivedPrinted: string = this.utils.printReceived({});
const printedWithType: string = this.utils.printWithType(
"name",
{},
(value: {}) => "");
const stringified: string = this.utils.stringify({});
const stringifiedWithMaxDepth: string = this.utils.stringify({}, 3);
const equals: boolean = this.equals({}, {});
return {
message: () => "",
pass: false,
};
}
});
/* Basic matchers */
+43 -40
View File
@@ -23,51 +23,54 @@ declare module "koa" {
}
}
declare function bodyParser(opts?: {
/**
* parser will only parse when request type hits enableTypes, default is ['json', 'form'].
*/
enableTypes?: string[];
/**
* requested encoding. Default is utf-8 by co-body
*/
encode?: string;
declare function bodyParser(opts?: bodyParser.Options): Koa.Middleware;
/**
* limit of the urlencoded body. If the body ends up being larger than this limit
* a 413 error code is returned. Default is 56kb
*/
formLimit?: string;
declare namespace bodyParser {
interface Options {
/**
* parser will only parse when request type hits enableTypes, default is ['json', 'form'].
*/
enableTypes?: string[];
/**
* requested encoding. Default is utf-8 by co-body
*/
encode?: string;
/**
* limit of the json body. Default is 1mb
*/
jsonLimit?: string;
/**
* limit of the urlencoded body. If the body ends up being larger than this limit
* a 413 error code is returned. Default is 56kb
*/
formLimit?: string;
/**
* when set to true, JSON parser will only accept arrays and objects. Default is true
*/
strict?: boolean;
/**
* limit of the json body. Default is 1mb
*/
jsonLimit?: string;
/**
* custom json request detect function. Default is null
*/
detectJSON?: (ctx: Koa.Context) => boolean;
/**
* when set to true, JSON parser will only accept arrays and objects. Default is true
*/
strict?: boolean;
/**
* support extend types
*/
extendTypes?: {
json?: string[];
form?: string[];
text?: string[];
/**
* custom json request detect function. Default is null
*/
detectJSON?: (ctx: Koa.Context) => boolean;
/**
* support extend types
*/
extendTypes?: {
json?: string[];
form?: string[];
text?: string[];
};
/**
* support custom error handle
*/
onerror?: (err: Error, ctx: Koa.Context) => void;
}
}
/**
* support custom error handle
*/
onerror?: (err: Error, ctx: Koa.Context) => void;
}): Koa.Middleware;
declare namespace bodyParser { }
export = bodyParser;
+1 -1
View File
@@ -24,7 +24,7 @@ export = koaCsrf;
import { Middleware } from 'koa';
declare module "koa" {
interface Request {
interface Context {
csrf: string;
}
}
+3 -1
View File
@@ -390,6 +390,7 @@ export interface LayerOptions {
export interface InteractiveLayerOptions extends LayerOptions {
interactive?: boolean;
bubblingMouseEvents?: boolean;
}
export class Layer extends Evented {
@@ -542,12 +543,13 @@ export namespace tileLayer {
function wms(baseUrl: string, options?: WMSOptions): TileLayer.WMS;
}
export interface ImageOverlayOptions extends LayerOptions {
export interface ImageOverlayOptions extends InteractiveLayerOptions {
opacity?: number;
alt?: string;
interactive?: boolean;
attribution?: string;
crossOrigin?: boolean;
className?: string;
}
export class ImageOverlay extends Layer {
+23
View File
@@ -251,6 +251,29 @@ tileLayer = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png');
tileLayer = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', tileLayerOptions);
tileLayer = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png?{foo}&{bar}&{abc}', {foo: 'bar', bar: (data: any) => 'foo', abc: () => ''});
// imageOverlay
let imageOverlayOptions: L.ImageOverlayOptions;
imageOverlayOptions = {
opacity: 100,
alt: 'alt',
interactive: true,
attribution: 'attribution',
crossOrigin: true,
className: 'className',
bubblingMouseEvents: false,
pane: 'pane'
};
const imageOverlayBounds = latLngBounds;
let imageOverlay: L.ImageOverlay;
imageOverlay = L.imageOverlay('https://www.google.ru/images/branding/googlelogo/2x/googlelogo_color_120x44dp.png', imageOverlayBounds);
imageOverlay = L.imageOverlay('https://www.google.ru/images/branding/googlelogo/2x/googlelogo_color_120x44dp.png', imageOverlayBounds, imageOverlayOptions);
imageOverlay = L.imageOverlay('https://www.google.ru/images/branding/googlelogo/2x/googlelogo_color_120x44dp.png', imageOverlayBounds, {
opacity: 100,
alt: 'alt',
className: 'className',
});
const eventHandler = () => {};
const domEvent: Event = {} as Event;
L.DomEvent
+96
View File
@@ -2951,6 +2951,22 @@ declare module "../index" {
* _.omitBy(object, _.isNumber);
* // => { 'b': '2' }
*/
omitBy<T>(
object: Dictionary<T> | null | undefined,
predicate?: ValueKeyIteratee<T>
): Dictionary<T>;
/**
* @see _.omitBy
*/
omitBy<T>(
object: NumericDictionary<T> | null | undefined,
predicate?: ValueKeyIteratee<T>
): NumericDictionary<T>;
/**
* @see _.omitBy
*/
omitBy<T extends object>(
object: T | null | undefined,
predicate: ValueKeyIteratee<T[keyof T]>
@@ -2958,6 +2974,22 @@ declare module "../index" {
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.omitBy
*/
omitBy<T>(
this: LoDashImplicitWrapper<Dictionary<T> | null | undefined>,
predicate?: ValueKeyIteratee<T>
): LoDashImplicitWrapper<Dictionary<T>>;
/**
* @see _.omitBy
*/
omitBy<T>(
this: LoDashImplicitWrapper<NumericDictionary<T> | null | undefined>,
predicate?: ValueKeyIteratee<T>
): LoDashImplicitWrapper<NumericDictionary<T>>;
/**
* @see _.omitBy
*/
@@ -2968,6 +3000,22 @@ declare module "../index" {
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.omitBy
*/
omitBy<T>(
this: LoDashExplicitWrapper<Dictionary<T> | null | undefined>,
predicate?: ValueKeyIteratee<T>
): LoDashExplicitWrapper<Dictionary<T>>;
/**
* @see _.omitBy
*/
omitBy<T>(
this: LoDashExplicitWrapper<NumericDictionary<T> | null | undefined>,
predicate?: ValueKeyIteratee<T>
): LoDashExplicitWrapper<NumericDictionary<T>>;
/**
* @see _.omitBy
*/
@@ -3063,6 +3111,22 @@ declare module "../index" {
* _.pickBy(object, _.isNumber);
* // => { 'a': 1, 'c': 3 }
*/
pickBy<T>(
object: Dictionary<T> | null | undefined,
predicate?: ValueKeyIteratee<T>
): Dictionary<T>;
/**
* @see _.pickBy
*/
pickBy<T>(
object: NumericDictionary<T> | null | undefined,
predicate?: ValueKeyIteratee<T>
): NumericDictionary<T>;
/**
* @see _.pickBy
*/
pickBy<T extends object>(
object: T | null | undefined,
predicate?: ValueKeyIteratee<T[keyof T]>
@@ -3070,6 +3134,22 @@ declare module "../index" {
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.pickBy
*/
pickBy<T>(
this: LoDashImplicitWrapper<Dictionary<T> | null | undefined>,
predicate?: ValueKeyIteratee<T>
): LoDashImplicitWrapper<Dictionary<T>>;
/**
* @see _.pickBy
*/
pickBy<T>(
this: LoDashImplicitWrapper<NumericDictionary<T> | null | undefined>,
predicate?: ValueKeyIteratee<T>
): LoDashImplicitWrapper<NumericDictionary<T>>;
/**
* @see _.pickBy
*/
@@ -3080,6 +3160,22 @@ declare module "../index" {
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.pickBy
*/
pickBy<T>(
this: LoDashExplicitWrapper<Dictionary<T> | null | undefined>,
predicate?: ValueKeyIteratee<T>
): LoDashExplicitWrapper<Dictionary<T>>;
/**
* @see _.pickBy
*/
pickBy<T>(
this: LoDashExplicitWrapper<NumericDictionary<T> | null | undefined>,
predicate?: ValueKeyIteratee<T>
): LoDashExplicitWrapper<NumericDictionary<T>>;
/**
* @see _.pickBy
*/
+26 -6
View File
@@ -2289,11 +2289,21 @@ declare namespace _ {
}
interface LodashOmitBy {
<T>(predicate: lodash.ValueKeyIteratee<T>): LodashOmitBy1x1<T>;
<T extends object>(predicate: lodash.__, object: T | null | undefined): LodashOmitBy1x2<T>;
<T>(predicate: lodash.__, object: lodash.Dictionary<T> | null | undefined): LodashOmitBy1x2<T>;
<T>(predicate: lodash.ValueKeyIteratee<T>, object: lodash.Dictionary<T> | null | undefined): lodash.Dictionary<T>;
<T>(predicate: lodash.__, object: lodash.NumericDictionary<T> | null | undefined): LodashOmitBy2x2<T>;
<T>(predicate: lodash.ValueKeyIteratee<T>, object: lodash.NumericDictionary<T> | null | undefined): lodash.NumericDictionary<T>;
<T extends object>(predicate: lodash.__, object: T | null | undefined): LodashOmitBy3x2<T>;
<T extends object>(predicate: lodash.ValueKeyIteratee<T[keyof T]>, object: T | null | undefined): lodash.PartialObject<T>;
}
type LodashOmitBy1x1<T> = <T1 extends object>(object: T1 | null | undefined) => lodash.PartialObject<T1>;
type LodashOmitBy1x2<T> = (predicate: lodash.ValueKeyIteratee<T[keyof T]>) => lodash.PartialObject<T>;
interface LodashOmitBy1x1<T> {
(object: lodash.Dictionary<T> | null | undefined): lodash.Dictionary<T>;
(object: lodash.NumericDictionary<T> | null | undefined): lodash.NumericDictionary<T>;
<T1 extends object>(object: T1 | null | undefined): lodash.PartialObject<T1>;
}
type LodashOmitBy1x2<T> = (predicate: lodash.ValueKeyIteratee<T>) => lodash.Dictionary<T>;
type LodashOmitBy2x2<T> = (predicate: lodash.ValueKeyIteratee<T>) => lodash.NumericDictionary<T>;
type LodashOmitBy3x2<T> = (predicate: lodash.ValueKeyIteratee<T[keyof T]>) => lodash.PartialObject<T>;
type LodashOnce = <T extends (...args: any[]) => any>(func: T) => T;
interface LodashOrderBy {
<T>(iteratees: lodash.Many<(value: T) => lodash.NotVoid>): LodashOrderBy1x1<T>;
@@ -2873,11 +2883,21 @@ declare namespace _ {
type LodashPick2x2<T> = (props: lodash.PropertyPath) => lodash.PartialDeep<T>;
interface LodashPickBy {
<T>(predicate: lodash.ValueKeyIteratee<T>): LodashPickBy1x1<T>;
<T extends object>(predicate: lodash.__, object: T | null | undefined): LodashPickBy1x2<T>;
<T>(predicate: lodash.__, object: lodash.Dictionary<T> | null | undefined): LodashPickBy1x2<T>;
<T>(predicate: lodash.ValueKeyIteratee<T>, object: lodash.Dictionary<T> | null | undefined): lodash.Dictionary<T>;
<T>(predicate: lodash.__, object: lodash.NumericDictionary<T> | null | undefined): LodashPickBy2x2<T>;
<T>(predicate: lodash.ValueKeyIteratee<T>, object: lodash.NumericDictionary<T> | null | undefined): lodash.NumericDictionary<T>;
<T extends object>(predicate: lodash.__, object: T | null | undefined): LodashPickBy3x2<T>;
<T extends object>(predicate: lodash.ValueKeyIteratee<T[keyof T]>, object: T | null | undefined): lodash.PartialObject<T>;
}
type LodashPickBy1x1<T> = <T1 extends object>(object: T1 | null | undefined) => lodash.PartialObject<T1>;
type LodashPickBy1x2<T> = (predicate: lodash.ValueKeyIteratee<T[keyof T]>) => lodash.PartialObject<T>;
interface LodashPickBy1x1<T> {
(object: lodash.Dictionary<T> | null | undefined): lodash.Dictionary<T>;
(object: lodash.NumericDictionary<T> | null | undefined): lodash.NumericDictionary<T>;
<T1 extends object>(object: T1 | null | undefined): lodash.PartialObject<T1>;
}
type LodashPickBy1x2<T> = (predicate: lodash.ValueKeyIteratee<T>) => lodash.Dictionary<T>;
type LodashPickBy2x2<T> = (predicate: lodash.ValueKeyIteratee<T>) => lodash.NumericDictionary<T>;
type LodashPickBy3x2<T> = (predicate: lodash.ValueKeyIteratee<T[keyof T]>) => lodash.PartialObject<T>;
interface LodashProp {
<TObject extends object, TKey extends keyof TObject>(path: TKey | [TKey]): LodashProp1x1<TObject, TKey>;
<TObject extends object>(path: lodash.__, object: TObject): LodashProp1x2<TObject>;
+33 -9
View File
@@ -5561,13 +5561,23 @@ fp.now(); // $ExpectType number
// _.omitBy
{
const obj: AbcObject | null | undefined = anything;
const dictionary: _.Dictionary<boolean> | null | undefined = anything;
const numericDictionary: _.NumericDictionary<boolean> | null | undefined = anything;
const predicate = (element: string | number | boolean, key: string) => true;
const predicate2 = (element: boolean, key: string) => true;
_.omitBy(obj, predicate); // $ExpectType Partial<AbcObject>
_.omitBy(dictionary, predicate2); // $ExpectType Dictionary<boolean>
_.omitBy(numericDictionary, predicate2); // $ExpectType NumericDictionary<boolean>
_(obj).omitBy(predicate); // $ExpectType LoDashImplicitWrapper<Partial<AbcObject>>
_(dictionary).omitBy(predicate2); // $ExpectType LoDashImplicitWrapper<Dictionary<boolean>>
_(numericDictionary).omitBy(predicate2); // $ExpectType LoDashImplicitWrapper<NumericDictionary<boolean>>
_.chain(obj).omitBy(predicate); // $ExpectType LoDashExplicitWrapper<Partial<AbcObject>>
_.chain(dictionary).omitBy(predicate2); // $ExpectType LoDashExplicitWrapper<Dictionary<boolean>>
_.chain(numericDictionary).omitBy(predicate2); // $ExpectType LoDashExplicitWrapper<NumericDictionary<boolean>>
fp.omitBy(predicate, obj); // $ExpectType Partial<AbcObject>
fp.omitBy(predicate)(obj); // $ExpectType Partial<AbcObject>
fp.omitBy(predicate2)(dictionary); // $ExpectType Dictionary<boolean>
fp.omitBy(predicate2)(numericDictionary); // $ExpectType NumericDictionary<boolean>
}
// _.pick
@@ -5584,8 +5594,10 @@ fp.now(); // $ExpectType number
_.pick(obj1, readonlyArray); // $ExpectType PartialDeep<AbcObject>
// Broken in TS 2.4
// _.pick(obj2, "a", "b"); // Pick<AbcObject, "a" | "b">
_.pick(obj2, literalsArray); // $ExpectType Pick<AbcObject, "a" | "b">
_.pick(obj2, roLiteralsArray); // $ExpectType Pick<AbcObject, "a" | "b">
// We can't use ExpectType here because typescript keeps changing what order the types appear.
let result1: Pick<AbcObject, "a" | "b">;
result1 = _.pick(obj2, literalsArray);
result1 = _.pick(obj2, roLiteralsArray);
_(obj1).pick("a"); // $ExpectType LoDashImplicitWrapper<Partial<AbcObject>>
_(obj1).pick(0, "a"); // $ExpectType LoDashImplicitWrapper<Partial<AbcObject>>
@@ -5593,8 +5605,9 @@ fp.now(); // $ExpectType number
_(obj1).pick(readonlyArray); // $ExpectType LoDashImplicitWrapper<Partial<AbcObject>>
// Broken in TS 2.4
// _(obj2).pick("a", "b"); // LoDashImplicitWrapper<Pick<AbcObject, "a" | "b">>
_(obj2).pick(literalsArray); // $ExpectType LoDashImplicitWrapper<Pick<AbcObject, "a" | "b">>
_(obj2).pick(roLiteralsArray); // $ExpectType LoDashImplicitWrapper<Pick<AbcObject, "a" | "b">>
let result2: _.LoDashImplicitWrapper<Pick<AbcObject, "a" | "b">>;
result2 = _(obj2).pick(literalsArray);
result2 = _(obj2).pick(roLiteralsArray);
_.chain(obj1).pick("a"); // $ExpectType LoDashExplicitWrapper<Partial<AbcObject>>
_.chain(obj1).pick(0, "a"); // $ExpectType LoDashExplicitWrapper<Partial<AbcObject>>
@@ -5602,24 +5615,35 @@ fp.now(); // $ExpectType number
_.chain(obj1).pick(readonlyArray); // $ExpectType LoDashExplicitWrapper<Partial<AbcObject>>
// Broken in TS 2.4
// _.chain(obj2).pick("a", "b"); // LoDashExplicitWrapper<Pick<AbcObject, "a" | "b">>
_.chain(obj2).pick(literalsArray); // $ExpectType LoDashExplicitWrapper<Pick<AbcObject, "a" | "b">>
_.chain(obj2).pick(roLiteralsArray); // $ExpectType LoDashExplicitWrapper<Pick<AbcObject, "a" | "b">>
let result3: _.LoDashExplicitWrapper<Pick<AbcObject, "a" | "b">>;
result3 = _.chain(obj2).pick(literalsArray);
result3 = _.chain(obj2).pick(roLiteralsArray);
fp.pick<AbcObject, "a">("a", obj2); // $ExpectType Pick<AbcObject, "a">
fp.pick<AbcObject, "a">("a")(obj2); // $ExpectType Pick<AbcObject, "a">
fp.pick<AbcObject, "a" | "b">(literalsArray)(obj2); // $ExpectType Pick<AbcObject, "a" | "b">
result1 = fp.pick<AbcObject, "a" | "b">(literalsArray)(obj2);
}
// _.pickBy
{
const obj: AbcObject | null | undefined = anything;
const dictionary: _.Dictionary<boolean> | null | undefined = anything;
const numericDictionary: _.NumericDictionary<boolean> | null | undefined = anything;
const predicate = (element: string | number | boolean, key: string) => true;
const predicate2 = (element: boolean, key: string) => true;
_.pickBy(obj, predicate); // $ExpectType Partial<AbcObject>
_.pickBy(dictionary, predicate2); // $ExpectType Dictionary<boolean>
_.pickBy(numericDictionary, predicate2); // $ExpectType NumericDictionary<boolean>
_(obj).pickBy(predicate); // $ExpectType LoDashImplicitWrapper<Partial<AbcObject>>
_(dictionary).pickBy(predicate2); // $ExpectType LoDashImplicitWrapper<Dictionary<boolean>>
_(numericDictionary).pickBy(predicate2); // $ExpectType LoDashImplicitWrapper<NumericDictionary<boolean>>
_.chain(obj).pickBy(predicate); // $ExpectType LoDashExplicitWrapper<Partial<AbcObject>>
_.chain(dictionary).pickBy(predicate2); // $ExpectType LoDashExplicitWrapper<Dictionary<boolean>>
_.chain(numericDictionary).pickBy(predicate2); // $ExpectType LoDashExplicitWrapper<NumericDictionary<boolean>>
fp.pickBy(predicate, obj); // $ExpectType Partial<AbcObject>
fp.pickBy(predicate)(obj); // $ExpectType Partial<AbcObject>
fp.pickBy(predicate2)(dictionary); // $ExpectType Dictionary<boolean>
fp.pickBy(predicate2)(numericDictionary); // $ExpectType NumericDictionary<boolean>
}
// _.result
+32
View File
@@ -1273,6 +1273,14 @@ declare module "./index" {
this: LoDashExplicitSyncWrapper<T | null | undefined>,
...paths: Array<_.Many<_.PropertyName>>
): LoDashExplicitSyncWrapper<_.PartialObject<T>>;
omitBy<T>(
this: LoDashExplicitSyncWrapper<_.Dictionary<T> | null | undefined>,
predicate?: _.ValueKeyIteratee<T>
): LoDashExplicitSyncWrapper<_.Dictionary<T>>;
omitBy<T>(
this: LoDashExplicitSyncWrapper<_.NumericDictionary<T> | null | undefined>,
predicate?: _.ValueKeyIteratee<T>
): LoDashExplicitSyncWrapper<_.NumericDictionary<T>>;
omitBy<T extends object>(
this: LoDashExplicitSyncWrapper<T | null | undefined>,
predicate: _.ValueKeyIteratee<T[keyof T]>
@@ -1285,6 +1293,14 @@ declare module "./index" {
this: LoDashExplicitSyncWrapper<T | null | undefined>,
...props: _.PropertyPath[]
): LoDashExplicitSyncWrapper<_.PartialObject<T>>;
pickBy<T>(
this: LoDashExplicitSyncWrapper<_.Dictionary<T> | null | undefined>,
predicate?: _.ValueKeyIteratee<T>
): LoDashExplicitSyncWrapper<_.Dictionary<T>>;
pickBy<T>(
this: LoDashExplicitSyncWrapper<_.NumericDictionary<T> | null | undefined>,
predicate?: _.ValueKeyIteratee<T>
): LoDashExplicitSyncWrapper<_.NumericDictionary<T>>;
pickBy<T extends object>(
this: LoDashExplicitSyncWrapper<T | null | undefined>,
predicate?: _.ValueKeyIteratee<T[keyof T]>
@@ -2841,6 +2857,14 @@ declare module "./index" {
this: LoDashExplicitAsyncWrapper<T | null | undefined>,
...paths: Array<_.Many<_.PropertyName>>
): LoDashExplicitAsyncWrapper<_.PartialObject<T>>;
omitBy<T>(
this: LoDashExplicitAsyncWrapper<_.Dictionary<T> | null | undefined>,
predicate?: _.ValueKeyIteratee<T>
): LoDashExplicitAsyncWrapper<_.Dictionary<T>>;
omitBy<T>(
this: LoDashExplicitAsyncWrapper<_.NumericDictionary<T> | null | undefined>,
predicate?: _.ValueKeyIteratee<T>
): LoDashExplicitAsyncWrapper<_.NumericDictionary<T>>;
omitBy<T extends object>(
this: LoDashExplicitAsyncWrapper<T | null | undefined>,
predicate: _.ValueKeyIteratee<T[keyof T]>
@@ -2853,6 +2877,14 @@ declare module "./index" {
this: LoDashExplicitAsyncWrapper<T | null | undefined>,
...props: _.PropertyPath[]
): LoDashExplicitAsyncWrapper<_.PartialObject<T>>;
pickBy<T>(
this: LoDashExplicitAsyncWrapper<_.Dictionary<T> | null | undefined>,
predicate?: _.ValueKeyIteratee<T>
): LoDashExplicitAsyncWrapper<_.Dictionary<T>>;
pickBy<T>(
this: LoDashExplicitAsyncWrapper<_.NumericDictionary<T> | null | undefined>,
predicate?: _.ValueKeyIteratee<T>
): LoDashExplicitAsyncWrapper<_.NumericDictionary<T>>;
pickBy<T extends object>(
this: LoDashExplicitAsyncWrapper<T | null | undefined>,
predicate?: _.ValueKeyIteratee<T[keyof T]>
+1 -1
View File
@@ -43,7 +43,7 @@ declare namespace M {
previousMonth: string;
nextMonth: string;
months: string[];
monthsShort: string;
monthsShort: string[];
weekdays: string[];
weekdaysShort: string[];
weekdaysAbbrev: string[];
+148
View File
@@ -0,0 +1,148 @@
// Type definitions for node-dijkstra 2.5
// Project: https://github.com/albertorestifo/node-dijkstra
// Definitions by: Jorge López <https://github.com/nokutu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
declare class Graph {
/**
* Creates a new Graph, optionally initializing it a nodes graph representation.
*
* A graph representation is an object that has as keys the name of the point and as values
* the points reachable from that node, with the cost to get there:
*
* {
* node (Number|String): {
* neighbor (Number|String): cost (Number),
* ...,
* },
* }
*
* In alternative to an object, you can pass a `Map` of `Map`. This will
* allow you to specify numbers as keys.
*
* @param [graph] - Initial graph definition
* @example
*
* const route = new Graph();
*
* // Pre-populated graph
* const route = new Graph({
* A: { B: 1 },
* B: { A: 1, C: 2, D: 4 },
* });
*
* // Passing a Map
* const g = new Map()
*
* const a = new Map()
* a.set('B', 1)
*
* const b = new Map()
* b.set('A', 1)
* b.set('C', 2)
* b.set('D', 4)
*
* g.set('A', a)
* g.set('B', b)
*
* const route = new Graph(g)
*/
constructor(nodes?: any[]);
/**
* Adds a node to the graph
*
* @param name - Name of the node
* @param neighbors - Neighboring nodes and cost to reach them
* @example
*
* const route = new Graph();
*
* route.addNode('A', { B: 1 });
*
* // It's possible to chain the calls
* route
* .addNode('B', { A: 1 })
* .addNode('C', { A: 3 });
*
* // The neighbors can be expressed in a Map
* const d = new Map()
* d.set('A', 2)
* d.set('B', 8)
*
* route.addNode('D', d)
*/
addNode(name: string, neighbors: any): Graph;
/**
* Removes a node and all of its references from the graph
*
* @param key - Key of the node to remove from the graph
* @example
*
* const route = new Graph({
* A: { B: 1, C: 5 },
* B: { A: 3 },
* C: { B: 2, A: 2 },
* });
*
* route.removeNode('C');
* // The graph now is:
* // { A: { B: 1 }, B: { A: 3 } }
*/
removeNode(name: string): Graph;
/**
* Compute the shortest path between the specified nodes
*
* @param start - Starting node
* @param goal - Node we want to reach
* @param [options] - Options
*
* @param [options.trim] - Exclude the origin and destination nodes from the result
* @param [options.reverse] - Return the path in reversed order
* @param [options.cost] - Also return the cost of the path when set to true
*
* @return Computed path between the nodes.
*
* When `option.cost` is set to true, the returned value will be an object with shape:
* - `path` *(Array)*: Computed path between the nodes
* - `cost` *(Number)*: Cost of the path
*
* @example
*
* const route = new Graph()
*
* route.addNode('A', { B: 1 })
* route.addNode('B', { A: 1, C: 2, D: 4 })
* route.addNode('C', { B: 2, D: 1 })
* route.addNode('D', { C: 1, B: 4 })
*
* route.path('A', 'D') // => ['A', 'B', 'C', 'D']
*
* // trimmed
* route.path('A', 'D', { trim: true }) // => [B', 'C']
*
* // reversed
* route.path('A', 'D', { reverse: true }) // => ['D', 'C', 'B', 'A']
*
* // include the cost
* route.path('A', 'D', { cost: true })
* // => {
* // path: [ 'A', 'B', 'C', 'D' ],
* // cost: 4
* // }
*/
path(start: any, goal: any, options ?: PathOption): any;
}
interface PathOption {
trim ?: boolean;
reverse ?: boolean;
cost ?: boolean;
avoid ?: any[];
}
export = Graph;
@@ -0,0 +1,12 @@
import Graph = require('node-dijkstra');
const graph = new Graph();
const graph2 = new Graph([{A: {B: 1}}]);
graph
.addNode('A', {B: 1})
.removeNode('C');
graph2.path('A', 'B');
graph.path('A', 'B', {cost: false, reverse: true});
graph.path('A', 'B', {cost: true});
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"esModuleInterop": true,
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"node-dijkstra-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+25
View File
@@ -0,0 +1,25 @@
// Type definitions for promise-ftp-common 1.1
// Project: https://github.com/realtymaps/promise-ftp-common
// Definitions by: coolreader18 <https://github.com/coolreader18>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
export enum STATUSES {
NOT_YET_CONNECTED = "not yet connected",
CONNECTING = "connecting",
CONNECTED = "connected",
LOGGING_OUT = "logging out",
DISCONNECTING = "disconnecting",
DISCONNECTED = "disconnected",
RECONNECTING = "reconnecting"
}
export class FtpConnectionError extends Error {}
export class FtpReconnectError extends Error {
constructor(
disconnectError?: string | Error,
connectError?: string | Error,
onCwd?: boolean
);
connectError: string | Error;
disconnectError: string | Error;
}
@@ -0,0 +1,16 @@
import * as PromiseFtpCommon from "promise-ftp-common";
// $ExpectType typeof STATUSES
PromiseFtpCommon.STATUSES;
// $ExpectType typeof FtpReconnectError
PromiseFtpCommon.FtpReconnectError;
// $ExpectType typeof FtpConnectionError
PromiseFtpCommon.FtpConnectionError;
// $ExpectType FtpReconnectError
new PromiseFtpCommon.FtpReconnectError();
// $ExpectType FtpConnectionError
new PromiseFtpCommon.FtpConnectionError();
+16
View File
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"strictFunctionTypes": true
},
"files": ["index.d.ts", "promise-ftp-common-tests.ts"]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+257
View File
@@ -0,0 +1,257 @@
// Type definitions for promise-ftp 1.3
// Project: https://github.com/realtymaps/promise-ftp
// Definitions by: coolreader18 <https://github.com/coolreader18>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
/// <reference types="node" />
import * as FtpClient from "ftp";
import * as PromiseFtpCommon from "promise-ftp-common";
import * as Promise from "bluebird";
declare namespace PromiseFtp {
interface ERROR_CODES {
421: "Service not available, closing control connection";
425: "Can't open data connection";
426: "Connection closed, transfer aborted";
450: "Requested file action not taken / File unavailable (e.g., file busy)";
451: "Requested action aborted: local error in processing";
452: "Requested action not taken / Insufficient storage space in system";
500: "Syntax error / Command unrecognized";
501: "Syntax error in parameters or arguments";
502: "Command not implemented";
503: "Bad sequence of commands";
504: "Command not implemented for that parameter";
530: "Not logged in";
532: "Need account for storing files";
550: "Requested action not taken / File unavailable (e.g., file not found, no access)";
551: "Requested action aborted: page type unknown";
552: "Requested file action aborted / Exceeded storage allocation (for current directory or dataset)";
553: "Requested action not taken / File name not allowed";
}
const ERROR_CODES: ERROR_CODES;
// tslint:disable-next-line strict-export-declare-modifiers
export import FtpConnectionError = PromiseFtpCommon.FtpConnectionError;
// tslint:disable-next-line strict-export-declare-modifiers
export import FtpReconnectError = PromiseFtpCommon.FtpReconnectError;
// tslint:disable-next-line strict-export-declare-modifiers
export import STATUSES = PromiseFtpCommon.STATUSES;
/**
* Options for FtpPromise#connect()
*/
// tslint:disable-next-line strict-export-declare-modifiers
export import Options = FtpClient.Options;
/**
* Element returned by FtpPromise#list()
*/
// tslint:disable-next-line strict-export-declare-modifiers
export import ListingElement = FtpClient.ListingElement;
}
declare class PromiseFtp {
/**
* The underlying FtpClient instance
*/
rawClient: FtpClient;
getConnectionStatus(): PromiseFtpCommon.STATUSES;
/**
* Connect to an FTP server.
*/
connect: (options: PromiseFtp.Options) => Promise<string>;
/**
* Reconnect with the same options as previously connected with `#connect()`.
*/
reconnect: () => Promise<string>;
/**
* Close the connection to the server after any/all enqueued
* commands have been executed.
* @returns a promise that resolves with the last error recieved if there
* was an error, true if there was an error but the client didn't recieve it,
* or false if there was no error.
*/
end(): Promise<Error | boolean>;
/**
* Close the connection to the server immediately.
*/
destroy(): boolean;
/**
* Retrieve the directory listing of path.
* @param path - defaults to the current working directory.
* @param useCompression - defaults to false.
* @returns the contents of the specified directory
*/
list(path?: string, useCompression?: boolean): FtpClient.ListingElement[];
list(useCompression: boolean): FtpClient.ListingElement[];
/**
* Optional "standard" commands (RFC 959)
* Retrieve the directory listing of path.
* Similar to `#list()`, except the directory is temporarily changed to path to
* retrieve the directory listing. This is useful for servers that do not
* handle characters like spaces and quotes in directory names well for the
* LIST command. This function is "optional" because it relies on `#pwd()`
* being available.
* @param path - defaults to the current working directory.
* @param useCompression - defaults to false.
* @returns the contents of the specified directory
*/
listSafe(
path?: string,
useCompression?: boolean
): FtpClient.ListingElement[];
listSafe(useCompression: boolean): FtpClient.ListingElement[];
/**
* Retrieve a file at path from the server.
* @param path - the path of the file to get.
* @param useCompression - defaults to false.
* @returns a stream which empties to the contents of the specified file.
*/
get(path: string, useCompression?: boolean): Promise<NodeJS.ReadableStream>;
/**
* Send data to the server to be stored as a file.
* @param input - can be a ReadableStream, a Buffer, or a path to a local file.
* @param destPath - the path of the file to write to.
* @param useCompression - defaults to false.
*/
put(
input: NodeJS.ReadableStream | Buffer | string,
destPath: string,
useCompression?: boolean
): Promise<void>;
/**
* Create a new file on the server or append to one that already exists.
* @param input - can be a ReadableStream, a Buffer, or a pathto a local file.
* @param destPath - the path of the file to create or append to.
* @param useCompression - defaults to false.
*/
append(
input: NodeJS.ReadableStream | Buffer | string,
destPath: string,
useCompression?: boolean
): Promise<void>;
/**
* Rename a file on the server.
* @param oldPath - the old path of the file.
* @param newPath - the new path to move it to.
*/
rename: (oldPath: string, newPath: string) => Promise<void>;
/**
* Logout the user from the server.
*/
logout: () => Promise<void>;
/**
* Delete a file on the server.
*/
delete: (path: string) => Promise<void>;
/**
* Change the current working directory.
* @param cwd - the path to change the CWD to.
* @returns the current directory if the server replies with the path in the
* response text, otherwise undefined.
*/
cwd(path: string): Promise<string | undefined>;
/**
* Abort the current data transfer (e.g. from `#get()`, `#put()`, or `#list()`)
*/
abort(): Promise<void>;
/**
* Send command using SITE.
* @param command - the command to send, e.g 'CHMOD 755 foo' or 'QUOTA'.
*/
site(command: string): Promise<{ text: string; code: number }>;
/**
* Retrieve human-readable information about the server's status.
* @returns a string with the server's status.
*/
status: () => Promise<string>;
/**
* Set the transfer data type to ASCII.
*/
ascii(): Promise<void>;
/**
* Set the transfer data type to binary (default at time of connection).
*/
binary(): Promise<void>;
/**
* Optional "standard" commands (RFC 959)
* Create a new directory on the server.
* @param path - the path of the new directory.
* @param recursive - enables a `mkdir -p` algorithm, defaults to false.
*/
mkdir(path: string, recursive?: boolean): Promise<void>;
/**
* Optional "standard" commands (RFC 959)
* Remove a directory on the server.
* @param path - the path of the directory to remove.
* @param recursive - enables deleting the directory if not empty, defaults to false.
*/
rmdir(path: string, recursive?: boolean): Promise<void>;
/**
* Optional "standard" commands (RFC 959)
* Change the working directory to the parent of the current directory.
* Like `cd ..`.
*/
cdup(): Promise<void>;
/**
* Optional "standard" commands (RFC 959)
* Retrieve the current working directory.
*/
pwd(): Promise<string>;
/**
* Optional "standard" commands (RFC 959)
* Retrieve information about the system running the server.
* @returns the server's OS.
*/
system(): Promise<string>;
/**
* Extended commands (RFC 3659)
* Retrieve the size of a file on the server.
* @param path - the path of the file whose size is to be retrieved.
* @returns the size of the specified file.
*/
size(path: string): Promise<number>;
/**
* Extended commands (RFC 3659)
* Retrieve the last modified date and time for a file or directory.
* @param path - the path of the file/directory whose modified date is to
* be retrieved.
* @returns the last modified date at the specified path.
*/
lastMod(path: string): Promise<Date>;
/**
* Extended commands (RFC 3659)
* Set the file byte offset for the next file transfer action (get/put).
* @param byteOffset - The file byte offset.
*/
restart(byteOffset: number): Promise<void>;
}
export = PromiseFtp;
+4
View File
@@ -0,0 +1,4 @@
import PromiseFtp = require("promise-ftp");
// $ExpectType FtpConnectionError
new PromiseFtp.FtpConnectionError();
+16
View File
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"strictFunctionTypes": true
},
"files": ["index.d.ts", "promise-ftp-tests.ts"]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+605
View File
@@ -0,0 +1,605 @@
// Type definitions for promise-sftp 1.3
// Project: https://github.com/realtymaps/promise-sftp
// Definitions by: coolreader18 <https://github.com/coolreader18>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
/// <reference types="node" />
import * as PromiseFtpCommon from "promise-ftp-common";
import * as Promise from "bluebird";
import * as ssh2 from "ssh2";
import * as ssh2Streams from "ssh2-streams";
import * as fs from "fs";
declare namespace PromiseSftp {
enum ERROR_CODES {
OK,
EOF,
NO_SUCH_FILE,
PERMISSION_DENIED,
FAILURE,
BAD_MESSAGE,
NO_CONNECTION,
CONNECTION_LOST,
OP_UNSUPPORTED,
INVALID_HANDLE,
NO_SUCH_PATH,
FILE_ALREADY_EXISTS,
WRITE_PROTECT,
NO_MEDIA,
NO_SPACE_ON_FILESYSTEM,
QUOTA_EXCEEDED,
UNKNOWN_PRINCIPAL,
LOCK_CONFLICT,
DIR_NOT_EMPTY,
NOT_A_DIRECTORY,
INVALID_FILENAME,
LINK_LOOP,
CANNOT_DELETE,
INVALID_PARAMETER,
FILE_IS_A_DIRECTORY,
BYTE_RANGE_LOCK_CONFLICT,
BYTE_RANGE_LOCK_REFUSED,
DELETE_PENDING,
FILE_CORRUPT,
OWNER_INVALID,
GROUP_INVALID,
NO_MATCHING_BYTE_RANGE_LOCK
}
// tslint:disable-next-line strict-export-declare-modifiers
export import FtpConnectionError = PromiseFtpCommon.FtpConnectionError;
// tslint:disable-next-line strict-export-declare-modifiers
export import FtpReconnectError = PromiseFtpCommon.FtpReconnectError;
// tslint:disable-next-line strict-export-declare-modifiers
export import STATUSES = PromiseFtpCommon.STATUSES;
/**
* Options for SftpPromise#connect()
*/
type Options = ssh2.ConnectConfig & {
/**
* When using password-based user authentication, set this option to
* handle password change requests. If this option isn't set, and the
* server requests a password change, I haven't tested what will happen.
*/
changePassword?: (message: string, language: string) => Promise<string>;
/**
* Whether to attempt to automatically reconnect using the existing
* config if the connection is unexpectedly closed. Auto-reconnection is
* lazy, and so will wait until a command needs to be issued before
* attempting to reconnect.
*/
autoReconnect?: boolean;
/**
* Path and name of a file containing a private key as would be passed
* to the privateKey option. If privateKey is also set, priority is
* given to the privateKey option.
*/
privateKeyFile?: string;
/**
* Set this option to a function to try keyboard-interactive user
* authentication if primary user authentication method fails.
*
* NOTE: This function may be called more than once, with the same or different prompts.
* @param name - is generally what you'd use as a header or GUI window
* title to describe the purpose of the `prompts`
*/
tryKeyboard?: (
name: string,
instructions: string,
instructionsLang: string,
prompts: Array<{
/** The query to pose to the user */
prompt: string;
/** Whether the user's input should be displayed on-screen */
echo: boolean;
}>
) => Array<string | Promise<string>> | Promise<string[]>;
/** Alias for `username` */
user?: string;
/** Alias for `readyTimeout` */
connTimeout?: number;
/** Alias for `readyTimeout` */
pasvTimeout?: number;
/** Alias for `keepaliveInterval` */
keepalive?: number;
};
/** Output of `PromiseSftp#list()` */
interface DirectoryListing {
/** `d` for directory, `-` for file, and `l` for symlink only on *NIX. */
type: "d" | "-" | "l";
/** The name of the entry. */
name: string;
/** The last modified date of the entry. */
date: Date;
/** The various permissions for this entry. *NIX only */
rights?: {
user: string;
group: string;
other: string;
};
/** The user name or ID that this entry belongs to. *NIX only */
owner?: string;
/** The group name or ID that this entry belongs to. *NIX only */
group?: string;
/** For symlink entries, this is the symlink's target. *NIX only */
target?: string;
/** True if the sticky bit is set for this entry */
sticky?: boolean;
}
/** Options for `PromiseSftp#fast{Get,Put}` */
interface FastOptions {
/**
* Number of concurrent reads
* @default 25
*/
concurrency?: number;
/**
* Size of each read in bytes
* @default 32768
*/
chunkSize: number;
/** Called every time a part of a file is transferred */
step?: (totalTransferred: number, chunk: number, total: number) => void;
}
/** From the [statvfs struct](http://linux.die.net/man/2/statvfs). */
interface Statvfs {
/** file system block size */
f_bsize: number;
/** fragment size */
f_frsize: number;
/** size of fs in f_frsize units */
f_blocks: number;
/** free blocks */
f_bfree: number;
/** free blocks for unprivileged users */
f_bavail: number;
/** inodes */
f_files: number;
/** free inodes */
f_ffree: number;
/** free inodes for unprivileged users */
f_favail: number;
/** file system ID */
f_fsid: number;
/** mount flags */
f_flag: number;
/** maximum filename length */
f_namemax: number;
}
}
declare class PromiseSftp {
/**
* Connects to an SFTP server; returned promise resolves to the server's
* greeting message. If multiple authentication methods are available based
* on the passed config, they are attempted in the following order: Password
* > Private Key > Agent > keyboard-interactive (if tryKeyboard is set) >
* Host-based > None. NOTE: many of the config properties below are NOT
* relevant for promise-ftp. However, all promise-ftp connect options will
* work here, except for secure, secureOptions, and preserveCwd.
*/
connect(options: PromiseSftp.Options): null | ssh2.SFTPWrapper;
/**
* Connects to an SFTP server using the config from the most recent call to
* #connect().
* @returns promise that resolves to the server's greeting message.
*/
reconnect(): Promise<string>;
/**
* Closes the connection to the server after any/all enqueued commands have
* been executed.
* @returns a promise that resolves to whether or not there was an error
* associated with closing the connection.
*/
end(): Promise<boolean>;
/** Alias to `#end()` */
logout(): Promise<boolean>;
/**
* Closes the connection to the server immediately.
* @returns whether the connection was connected prior to the call to **destroy()**.
*/
destroy(): boolean;
/**
* @returns a string describing the current connection state.
*/
getConnectionStatus(): PromiseSftp.STATUSES;
/**
* Retrieves a directory listing.
* @param path - The path of the directory to get the listing of.
*/
list(path?: string): Promise<PromiseSftp.DirectoryListing>;
/** Alias to `#list()` */
listSafe(path: string): Promise<PromiseSftp.DirectoryListing>;
/**
* Retrieve a file from the server.
* @param path - The file to retrieve from the server.
*/
get(path: string): Promise<NodeJS.ReadableStream>;
/**
* Sends data to the server.
* @param destPath - The file to store the data in. If string the path to a
* local file.
*/
put(
input: NodeJS.ReadableStream | Buffer | string,
destPath: string
): Promise<void>;
/**
* Same as `#append()`, but appends to `destPath` if it already exists.
*/
append(
input: NodeJS.ReadableStream | Buffer | string,
destPath: string
): Promise<void>;
/**
* Renames/moves one file/directory to another on the server.
* @param oldPath - The source file/directory.
* @param newPath - The destination file/directory.
*/
rename(oldPath: string, newPath: string): Promise<void>;
/**
* Create a new directory.
* @param path - The path to create a new directory at.
* @param recursive - Enables a `mkdir -p` algorithm, defaults to false.
* @param attributes - The attributes to use when creating directories.
*/
mkdir(
path: string,
recursive?: boolean,
attributes?: ssh2Streams.InputAttributes
): Promise<void>;
mkdir(path: string, attributes: ssh2Streams.InputAttributes): Promise<void>;
/**
* Remove a directory on the server.
* @param path - The path of the directory to remove.
*/
rmdir(path: string): Promise<void>;
/**
* Retrieve the size of a file on the server.
* @param path - The path to the file to retrieve the size of.
*/
size(path: string): Promise<number>;
/**
* Retrieve the last modified date of a file on the server.
* @param path - The path to the file to get the last modified date of.
*/
lastMod(path: string): Date;
/**
* Sets the file byte offset for the next file transfer action initiated via
* #get() or #put() to `byteOffset`.
*/
restart(byteOffset: number): Promise<void>;
/**
* Download a file from the server using parallel reads for faster throughput.
* @param remotePath - The path to the remote file to read from.
* @param localPath - The path to the local file to write to.
*/
fastGet(
remotePath: string,
localPath: string,
options?: PromiseSftp.FastOptions
): Promise<void>;
/**
* Upload a file to the server using parallel reads for faster throughput.
* @param localPath - The path to the local file to read from.
* @param remotePath - The path to the remote file to write to.
*/
fastPut(
localPath: string,
remotePath: string,
options?: PromiseSftp.FastOptions
): Promise<void>;
/**
* Creates a read stream from a file on the server.
* @param path - The path of the file to create a read stream from.
* @returns a new `ReadableStream` for `path`.
*/
createReadStream(
path: string,
options?:
| string
| {
flags?: string;
encoding?: string;
fd?: number;
mode?: number;
autoClose?: boolean;
start?: number;
end?: number;
highWaterMark?: number;
}
): Promise<NodeJS.ReadableStream>;
/**
* Creates a write stream to a file on the server.
* @param path - The path of the file to create a write stream to.
* @returns a new `WriteableStream` for `path`.
*/
createWriteStream(
path: string,
options?:
| string
| {
flags?: string;
encoding?: string;
fd?: number;
mode?: number;
autoClose?: boolean;
start?: number;
end?: number;
highWaterMark?: number;
}
): Promise<NodeJS.WritableStream>;
/**
* Opens a file on the server.
* @param filename - The path of the file to open.
* @param mode - Any of the modes supported by `fs.open()`.
* @returns a promise that resolves to a `Buffer` containing a handle to the file.
*/
open(
filename: string,
mode: string | number,
attributes?: ssh2Streams.InputAttributes
): Promise<Buffer>;
/**
* Close a resource on the server.
* @param handle - A file handle returned from `#open()` or `#opendir()`.
*/
close(handle: Buffer): Promise<void>;
/**
* Read binary data from a file on the server to a buffer.
* @param handle - A file handle returned from `#open()` or `#opendir()`.
* @param buffer - The buffer to write to.
* @param offset - The offset from the start of the buffer to begin writing to.
* @param length - The number of bytes to read from the resource.
* @param position - The position of the file to begin reading from.
*/
read(
handle: Buffer,
buffer: Buffer,
offset: number,
length: number,
position: number
): Promise<{
/** The number of bytes successfully read */
bytesRead: number;
/** The buffer passed to `#read()`, but offset-adjusted */
buffer: Buffer;
/** The position passed to `#read()` */
position: number;
}>;
/**
* Write binary data from a buffer to a file on the server.
* @param handle - A file handle returned from `#open()` or `#opendir()`.
* @param buffer - The buffer to read from.
* @param offset - The offset from the start of the buffer to begin reading from.
* @param length - The number of bytes to read from the buffer.
* @param position - The position of the file to begin writing to.
*/
read(
handle: Buffer,
buffer: Buffer,
offset: number,
length: number,
position: number
): Promise<void>;
/**
* Retrieves attributes from a resource on the server.
* @param handle - A file handle returned from `#open()` or `#opendir()`
*/
fstat(handle: Buffer): Promise<ssh2Streams.Stats>;
/**
* Set the attributes for a resource on the server.
* @param handle - A resource handle returned from `#open()` or `#fopen()`.
*/
fsetstat(handle: Buffer, attributes: ssh2Streams.Attributes): Promise<void>;
/**
* Set the access and modified times for a resource on the server.
* @param handle - A resource handle returned from `#open()` or `#fopen()`.
* @param atime - A Date or unix timestamp representing the new access time for the resource
* @param mtime - A Date or unix timestamp representing the new modify time for the resource
*/
futimes(
handle: Buffer,
atime: Date | number,
mtime: Date | number
): Promise<void>;
/**
* Set the ownership for a resource on the server.
* @param handle - A resource handle returned from `#open()` or `#fopen()`.
* @param uid - The id of the new owner user.
* @param gid - The id of the new owner group.
*/
fchown(handle: Buffer, uid: number, gid: number): Promise<void>;
/**
* Set the mode for a resource on the server.
* @param handle - A resource handle returned from `#open()` or `#fopen()`.
* @param mode - The new mode, a number or a string with an octal number.
*/
fchmod(handle: Buffer, mode: number | string): Promise<void>;
/**
* Open a directory on the server.
* @param path - The path of the directory to open.
* @returns a buffer with the handle of the opened directory.
*/
opendir(path: string): Promise<Buffer>;
/**
* Read a directory on the server.
* @param location - The path of the directory to read or a handle returned from `#opendir()`.
*/
readdir(
location: Buffer | string
): Promise<{
filename: string;
longname: string;
attrs: ssh2Streams.Attributes;
}>;
/**
* Remove a file or symlink on the server.
* @param path - The path of the file/symlink to remove.
*/
unlink(path: string): Promise<void>;
/** Alias for `#unlink()` */
remove(path: string): Promise<void>;
/**
* Retrieve attributes for a resource on the server.
* @param path - The path to the resource to retrieve the attributes of.
*/
stat(path: string): Promise<ssh2Streams.Stats>;
/**
* Retrieve attributes for a resource on the server. If the resource is a
* symlink, it retrieves the stats for the link itself instead of the
* resource it refers to.
* @param path - The path to the resource to retrieve the attributes of.
*/
lstat(path: string): Promise<ssh2Streams.Stats>;
/**
* Set the attributes of a resource on the server.
* @param path - The path to the resource to set the attributes of.
* @param attributes - The new attributes for the resource.
*/
setstat(path: string, attributes: ssh2Streams.Attributes): Promise<void>;
/**
* Set the access and modified times for a resource on the server.
* @param path - The path of the resource to set times of.
* @param atime - A Date or unix timestamp representing the new access time for the resource
* @param mtime - A Date or unix timestamp representing the new modify time for the resource
*/
utimes(
path: string,
atime: Date | number,
mtime: Date | number
): Promise<void>;
/**
* Set the ownership for a resource on the server.
* @param path - The path to the resource to change ownership of.
* @param uid - The id of the new owner user.
* @param gid - The id of the new owner group.
*/
chown(path: string, uid: number, gid: number): Promise<void>;
/**
* Set the mode for a resource on the server.
* @param path - The path of the resource to set the mode of.
* @param mode - The new mode, a number or a string with an octal number.
*/
chmod(path: string, mode: number | string): Promise<void>;
/**
* Read the target of a symlink on the server.
* @param path - The path of the symlink to read the target of.
*/
readlink(path: string): Promise<string>;
/**
* Create a symlink on the server.
* @param targetPath - The path to the target of the symlink.
* @param linkPath - The path of the new symlink.
*/
symlink(targetPath: string, linkPath: string): Promise<void>;
/**
* Get the absolute path from a relative path on the server.
* @param path - The path to get the absolute path of.
*/
realpath(path: string): Promise<string>;
/**
* **OpenSSH extension**
* Performs POSIX rename(3) on a resource on the server.
* @param srcPath - The original path of the resource.
* @param destPath - The new path to rename the resource to.
*/
ext_openssh_rename(srcPath: string, destPath: string): Promise<void>;
/**
* **OpenSSH extension**
* Perform POSIX fstatvfs(2) on a resource on the server.
* @param path - The path to get the statvfs of.
*/
ext_openssh_statvfs(path: string): Promise<PromiseSftp.Statvfs>;
/**
* **OpenSSH extension**
* Perform POSIX fstatvfs(2) on a resource on the server.
* @param handle - A resource handle returned from `#open()` or `#fopen()`.
*/
ext_openssh_fstatvfs(handle: Buffer): Promise<PromiseSftp.Statvfs>;
/**
* **OpenSSH extension**
* Performs POSIX link(2) to create a hard link on the server.
* @param targetPath - The path of a file to hardlink from.
* @param linkPath - The path of the newly created hardlink.
*/
ext_openssh_hardlink(targetPath: string, linkPath: string): Promise<void>;
/**
* **OpenSSH extension**
* Perform POSIX fsync(3) on a resource on the server.
* @param handle - A resource handle returned from `#open()` or `#fopen()`.
*/
ext_openssh_fsync(handle: Buffer): Promise<void>;
}
export = PromiseSftp;
+9
View File
@@ -0,0 +1,9 @@
import PromiseSftp = require("promise-sftp");
const sftp = new PromiseSftp();
// $ExpectType () => boolean
sftp.destroy;
// $ExpectType typeof STATUSES
PromiseSftp.STATUSES;
+16
View File
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"strictFunctionTypes": true
},
"files": ["index.d.ts", "promise-sftp-tests.ts"]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+2 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for randomColor 0.4.1
// Type definitions for randomColor 0.5.0
// Project: https://github.com/davidmerfield/randomColor
// Definitions by: Mathias Feitzinger <https://github.com/feitzi>, Brady Liles <https://github.com/BradyLiles>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -11,6 +11,7 @@ interface RandomColorOptions {
count?: number;
seed?: number | string;
format?: "hsvArray" | "hslArray" | "hsl" | "hsla" | "rgbArray" | "rgb" | "rgba" | "hex";
alpha?: number;
}
declare module "randomcolor" {
+2
View File
@@ -8,6 +8,8 @@ import * as React from "react";
export interface IconBaseProps extends React.SVGProps<React.ReactSVGElement> {
size?: string | number;
style?: any;
color?: string;
}
export default class IconBaseClass extends React.Component<IconBaseProps> {}
+209 -3
View File
@@ -9,12 +9,218 @@ import * as ReactNative from "react-native";
export type onChangeTextCallback = (formatted: string, extracted: string) => void;
export interface TextInputMaskProps {
export interface TextInputMaskProps extends ReactNative.ViewProps, ReactNative.TextInputIOSProps, ReactNative.TextInputAndroidProps, ReactNative.AccessibilityProps {
maskDefaultValue?: boolean;
mask: string;
value?: string;
onChangeText: onChangeTextCallback;
keyboardType?: 'default' | 'numeric' | 'email-address' | 'phone-pad';
// Export standard TextInputProps from here on.
// Workaround for not being able to override onChangeText
// Copied from React-Native types version: 0.55
/**
* Specifies whether fonts should scale to respect Text Size accessibility settings.
* The default is `true`.
*/
allowFontScaling?: boolean;
/**
* Can tell TextInput to automatically capitalize certain characters.
* characters: all characters,
* words: first letter of each word
* sentences: first letter of each sentence (default)
* none: don't auto capitalize anything
*
* https://facebook.github.io/react-native/docs/textinput.html#autocapitalize
*/
autoCapitalize?: "none" | "sentences" | "words" | "characters";
/**
* If false, disables auto-correct.
* The default value is true.
*/
autoCorrect?: boolean;
/**
* If true, focuses the input on componentDidMount.
* The default value is false.
*/
autoFocus?: boolean;
/**
* If true, the text field will blur when submitted.
* The default value is true.
*/
blurOnSubmit?: boolean;
/**
* If true, caret is hidden. The default value is false.
*/
caretHidden?: boolean;
/**
* Provides an initial value that will change when the user starts typing.
* Useful for simple use-cases where you don't want to deal with listening to events
* and updating the value prop to keep the controlled state in sync.
*/
defaultValue?: string;
/**
* If false, text is not editable. The default value is true.
*/
editable?: boolean;
/**
* enum("default", 'numeric', 'email-address', "ascii-capable", 'numbers-and-punctuation', 'url', 'number-pad', 'phone-pad', 'name-phone-pad',
* 'decimal-pad', 'twitter', 'web-search', 'visible-password')
* Determines which keyboard to open, e.g.numeric.
* The following values work across platforms: - default - numeric - email-address - phone-pad
* The following values work on iOS: - ascii-capable - numbers-and-punctuation - url - number-pad - name-phone-pad - decimal-pad - twitter - web-search
* The following values work on Android: - visible-password
*/
keyboardType?: ReactNative.KeyboardTypeOptions;
/**
* Limits the maximum number of characters that can be entered.
* Use this instead of implementing the logic in JS to avoid flicker.
*/
maxLength?: number;
/**
* If true, the text input can be multiple lines. The default value is false.
*/
multiline?: boolean;
/**
* Callback that is called when the text input is blurred
*/
onBlur?: (e: ReactNative.NativeSyntheticEvent<ReactNative.TextInputFocusEventData>) => void;
/**
* Callback that is called when the text input's text changes.
*/
onChange?: (
event: {
nativeEvent: {
text: string;
contentSize: { width: number; height: number };
target: number;
eventCount: number;
};
}
) => void;
/**
* Callback that is called when the text input's content size changes.
* This will be called with
* `{ nativeEvent: { contentSize: { width, height } } }`.
*
* Only called for multiline text inputs.
*/
onContentSizeChange?: (event: { nativeEvent: { contentSize: { width: number; height: number } } }) => void;
/**
* Callback that is called when text input ends.
*/
onEndEditing?: (event: { nativeEvent: { text: string } }) => void;
/**
* Callback that is called when the text input is focused
*/
onFocus?: (e: ReactNative.NativeSyntheticEvent<ReactNative.TextInputFocusEventData>) => void;
/**
* Callback that is called when the text input selection is changed.
*/
onSelectionChange?: (e: ReactNative.NativeSyntheticEvent<ReactNative.TextInputSelectionChangeEventData>) => void;
/**
* Callback that is called when the text input's submit button is pressed.
*/
onSubmitEditing?: (event: { nativeEvent: { text: string } }) => void;
/**
* Invoked on content scroll with
* `{ nativeEvent: { contentOffset: { x, y } } }`.
*
* May also contain other properties from ScrollEvent but on Android contentSize is not provided for performance reasons.
*/
onScroll?: (e: ReactNative.NativeSyntheticEvent<ReactNative.TextInputScrollEventData>) => void;
/**
* Callback that is called when a key is pressed.
* This will be called with
* `{ nativeEvent: { key: keyValue } }`
* where keyValue is 'Enter' or 'Backspace' for respective keys and the typed-in character otherwise including ' ' for space.
*
* Fires before onChange callbacks.
* Note: on Android only the inputs from soft keyboard are handled, not the hardware keyboard inputs.
*/
onKeyPress?: (e: ReactNative.NativeSyntheticEvent<ReactNative.TextInputKeyPressEventData>) => void;
/**
* The string that will be rendered before text input has been entered
*/
placeholder?: string;
/**
* The text color of the placeholder string
*/
placeholderTextColor?: string;
/**
* enum('default', 'go', 'google', 'join', 'next', 'route', 'search', 'send', 'yahoo', 'done', 'emergency-call')
* Determines how the return key should look.
*/
returnKeyType?: ReactNative.ReturnKeyTypeOptions;
/**
* If true, the text input obscures the text entered so that sensitive text like passwords stay secure.
* The default value is false.
*/
secureTextEntry?: boolean;
/**
* If true, all text will automatically be selected on focus
*/
selectTextOnFocus?: boolean;
/**
* The start and end of the text input's selection. Set start and end to
* the same value to position the cursor.
*/
selection?: { start: number; end?: number };
/**
* The highlight (and cursor on ios) color of the text input
*/
selectionColor?: string;
/**
* Styles
*/
style?: ReactNative.StyleProp<ReactNative.TextStyle>;
/**
* Used to locate this view in end-to-end tests
*/
testID?: string;
/**
* Used to connect to an InputAccessoryView. Not part of react-natives documentation, but present in examples and
* code.
* See https://facebook.github.io/react-native/docs/inputaccessoryview.html for more information.
*/
inputAccessoryViewID?: string;
/**
* The value to show for the text input. TextInput is a controlled component,
* which means the native value will be forced to match this value prop if provided.
* For most uses this works great, but in some cases this may cause flickering - one common cause is preventing edits by keeping value the same.
* In addition to simply setting the same value, either set editable={false},
* or set/update maxLength to prevent unwanted edits without flicker.
*/
value?: string;
}
export default class TextInputMask extends React.Component<TextInputMaskProps> { }
+49
View File
@@ -0,0 +1,49 @@
// Type definitions for react-native-toast-native 0.1
// Project: https://github.com/onemolegames/react-native-toast-native/blob/master/README.md
// Definitions by: Michele Bombardi <https://github.com/bm-software>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
import { Platform } from 'react-native';
export interface Style {
width?: number;
height?: number;
backgroundColor?: string;
color?: string;
borderWidth?: number;
borderRadius?: number;
// iOS-only
borderColor?: string;
// Android-only
paddingLeft?: number;
paddingRight?: number;
paddingBottom?: number;
paddingTop?: number;
fontSize?: number;
lines?: number;
lineHeight?: number;
xOffset?: number;
yOffset?: number;
letterSpacing?: number;
fontWeight?: string;
}
interface ToastNative {
// Toast duration constants
SHORT: any;
LONG: any;
// Toast gravity constants
TOP: any;
BOTTOM: any;
CENTER: any;
show(message?: string): void;
show(message: string, duration: any, position: any, styles: Style): void;
}
declare const ToastNative: ToastNative;
export default ToastNative;
@@ -0,0 +1,28 @@
import * as React from 'react';
import { View, Button } from 'react-native';
import Toast, { Style } from 'react-native-toast-native';
class Test extends React.Component<any> {
showToast() {
const style: Style = {
color: 'white',
backgroundColor: '#5CB85C',
fontSize: 16,
height: 140,
borderRadius: 15,
fontWeight: 'bold',
yOffset: 40
};
Toast.show("I'm a toast!", Toast.SHORT, Toast.BOTTOM, style);
}
render() {
return (
<View>
<Button
onPress={() => this.showToast()}
title="Show Toast" />
</View>);
}
}
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react"
},
"files": [
"index.d.ts",
"react-native-toast-native-tests.tsx"
]
}
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+27 -12
View File
@@ -1,4 +1,4 @@
// Type definitions for react-native 0.55
// Type definitions for react-native 0.56
// Project: https://github.com/facebook/react-native
// Definitions by: Eloy Durán <https://github.com/alloy>
// HuHuanming <https://github.com/huhuanming>
@@ -571,7 +571,7 @@ export interface FlexStyle {
flexDirection?: "row" | "column" | "row-reverse" | "column-reverse";
flexGrow?: number;
flexShrink?: number;
flexWrap?: "wrap" | "nowrap";
flexWrap?: "wrap" | "nowrap" | "wrap-reverse";
height?: number | string;
justifyContent?: "flex-start" | "flex-end" | "center" | "space-between" | "space-around" | "space-evenly";
left?: number | string;
@@ -1359,6 +1359,7 @@ interface TextInputState {
currentlyFocusedField(): number;
/**
* @deprecated
* @param TextInputID id of the text field to focus
* Focuses the specified text field
* noop if the text field was already focused
@@ -1366,6 +1367,7 @@ interface TextInputState {
focusTextInput(textFieldID?: number): void;
/**
* @deprecated
* @param textFieldID id of the text field to focus
* Unfocuses the specified text field
* noop if it wasn't focused
@@ -1830,7 +1832,7 @@ export interface AccessibilityPropsIOS {
* Is this element a label? A button? A header? These questions are answered by accessibilityTraits.
* @platform ios
*/
accessibilityTraits?: AccessibilityTraits | AccessibilityTraits[];
accessibilityTraits?: AccessibilityTrait | AccessibilityTrait[];
/**
* When `accessible` is true, the system will try to invoke this function when the user performs accessibility tap gesture.
@@ -1845,7 +1847,7 @@ export interface AccessibilityPropsIOS {
onMagicTap?: () => void;
}
type AccessibilityTraits =
type AccessibilityTrait =
| "none"
| "button"
| "link"
@@ -2101,6 +2103,11 @@ Possible values for mixedContentMode are:
'compatibility' - WebView will attempt to be compatible with the approach of a modern web browser with regard to mixed content.
*/
mixedContentMode?: "never" | "always" | "compatibility";
/**
* Controls whether form autocomplete data should be saved
*/
saveFormDataDisabled?: boolean;
}
export interface WebViewIOSLoadRequestEvent {
@@ -2303,6 +2310,14 @@ export interface WebViewProps extends ViewProps, WebViewPropsAndroid, WebViewPro
* sets whether the webpage scales to fit the view and the user can change the scale
*/
scalesPageToFit?: boolean;
/**
* List of origin strings to allow being navigated to.
* The strings allow wildcards and get matched against just the origin (not the full URL).
* If the user taps to navigate to a new page but the new page is not in this whitelist, the URL will be handled by the OS.
* The default whitelisted origins are "http://" and "https://".
*/
originWhitelist?: string[];
}
export class WebView extends React.Component<WebViewProps> {
@@ -3436,11 +3451,6 @@ export interface ImagePropsIOS {
*/
capInsets?: Insets;
/**
* A static image to display while downloading the final image off the network.
*/
defaultSource?: ImageURISource | number;
/**
* Invoked on download progress with {nativeEvent: {loaded, total}}
*/
@@ -3625,13 +3635,18 @@ export interface ImagePropsBase extends ImagePropsIOS, ImagePropsAndroid, Access
*/
testID?: string;
/**
* A static image to display while downloading the final image off the network.
*/
defaultSource?: ImageURISource | number;
/**
* Currently broken
* @see https://github.com/facebook/react-native/pull/19281
*/
width?: never,
height?: never,
tintColor?: never,
width?: never;
height?: never;
tintColor?: never;
}
export interface ImageProps extends ImagePropsBase {
+20 -3
View File
@@ -66,6 +66,7 @@ import {
TextInputContentSizeChangeEventData,
TextInputEndEditingEventData,
TextInputSubmitEditingEventData,
WebView,
} from "react-native";
declare module "react-native" {
@@ -608,6 +609,17 @@ class StatusBarTest extends React.Component {
}
}
class WebViewTest extends React.Component {
render() {
return (
<WebView
originWhitelist={['https://origin.test']}
saveFormDataDisabled={false}
/>
);
}
}
export class ImageTest extends React.Component {
componentDidMount(): void {
const image: ImageResolvedAssetSource = Image.resolveAssetSource({
@@ -660,7 +672,7 @@ class StylePropsTest extends React.PureComponent {
margin={20}
overflow="visible" // ps: must fail if "scroll"
source={{ uri }}
style={{ width: 200, height: 200, tintColor: 'green' }}
style={{ width: 200, height: 200, tintColor: 'green', flexWrap: 'wrap-reverse' }}
// tintColor="green"
// width={200}
/>
@@ -671,10 +683,15 @@ class StylePropsTest extends React.PureComponent {
const listViewDataSourceTest = new ListView.DataSource({rowHasChanged: () => true})
class AccessibilityViewHidingTest extends React.Component {
class AccessibilityTest extends React.Component {
render() {
return (
<View accessibilityElementsHidden importantForAccessibility="no-hide-descendants">
<View
accessibilityElementsHidden={true}
importantForAccessibility={"no-hide-descendants"}
accessibilityTraits={'none'}
>
<Text accessibilityTraits={['key', 'text']}>Text</Text>
<View />
</View>
);
+2 -2
View File
@@ -41,8 +41,8 @@ import {
Store
} from 'redux';
// Diff / Omit taken from https://github.com/Microsoft/TypeScript/issues/12215#issuecomment-311923766
type Omit<T, K extends keyof T> = Pick<T, ({ [P in keyof T]: P } & { [P in K]: never } & { [x: string]: never, [x: number]: never })[keyof T]>;
// Omit taken from https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
export interface DispatchProp<A extends Action = AnyAction> {
dispatch: Dispatch<A>;
+7 -6
View File
@@ -1,24 +1,25 @@
// Type definitions for React-Tags (react-tag-input) 4.7
// Type definitions for React-Tags (react-tag-input) 5.0
// Project: https://github.com/prakhar1989/react-tags
// Definitions by: Ogglas <https://github.com/Ogglas>
// Jan Karres <https://github.com/jankarres>
// Matthew Berryman <https://github.com/matthewberryman>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
import * as React from "react";
export interface ReactTagsProps {
tags?: Array<{ id: number, text: string }>;
suggestions?: string[];
tags?: Array<{ id: string, text: string }>;
suggestions?: Array<{ id: string, text: string }>;
delimiters?: number[];
placeholder?: string;
labelField?: string;
handleAddition: ((tag: string) => void);
handleAddition: ((tag: {id: string, text: string}) => void);
handleDelete: ((i: number) => void);
handleDrag?: ((tag: { id: number; text: string; }, currPos: number, newPos: number) => void);
handleDrag?: ((tag: { id: string; text: string; }, currPos: number, newPos: number) => void);
handleInputChange?: ((value: string) => void);
handleFilterSuggestions?: ((textInputValue: string, possibleSuggestionsArray: string[]) => boolean);
handleFilterSuggestions?: ((textInputValue: string, possibleSuggestionsArray: Array<{ id: string, text: string }>) => boolean);
handleInputBlur?: ((textInputValue: string) => void);
autofocus?: boolean;
@@ -2,9 +2,9 @@ import * as React from "react";
import * as ReactDOM from "react-dom";
import { WithContext as ReactTags } from "react-tag-input";
const tags = Array({ id: 0, text: "test" }, { id: 1, text: "testing" });
const tags = Array({ id: "0", text: "test" }, { id: "1", text: "testing" });
const suggestions = Array("test1", "test2");
const suggestions = Array({ id: "0", text: "test" }, { id: "1", text: "testing" });
ReactDOM.render(
<ReactTags
@@ -14,11 +14,11 @@ ReactDOM.render(
placeholder="Some placeholder text"
labelField="Some label"
handleAddition={(tag: string) => console.log("Add: " + tag)}
handleAddition={(tag: { id: string, text: string }) => console.log("Add: " + tag.text)}
handleDelete={(i: number) => console.log("Delete: " + i)}
handleDrag={(tag: { id: number; text: string; }, currPos: number, newPos: number) => console.log("Drag: " + tag.text)}
handleDrag={(tag: { id: string; text: string; }, currPos: number, newPos: number) => console.log("Drag: " + tag.text)}
handleInputChange={(value: string) => console.log("Changed to: ", value)}
handleFilterSuggestions={(textInputValue: string, possibleSuggestionsArray: string[]) => true}
handleFilterSuggestions={(textInputValue: string, possibleSuggestionsArray: Array<{ id: string, text: string }>) => true}
handleInputBlur={() => console.log("Blured")}
autofocus={false}
+3 -2
View File
@@ -4,6 +4,7 @@
// viggyfresh <https://github.com/viggyfresh>
// janb87 <https://github.com/janb87>
// corydeppen <https://github.com/corydeppen>
// jscinoz <https://github.com/jscinoz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
@@ -12,7 +13,7 @@ import {
Store,
Reducer,
Middleware,
GenericStoreEnhancer
StoreEnhancer
} from 'redux';
import { History } from 'history';
@@ -233,7 +234,7 @@ export function connectRoutes<TKeys = {}, TState = any>(
reducer: Reducer<LocationState<TKeys, TState>>;
middleware: Middleware;
thunk(store: Store<TState>): Promise<Nullable<RouteThunk<TState>>>;
enhancer: GenericStoreEnhancer;
enhancer: StoreEnhancer;
initialDispatch?(): void;
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"private": true,
"dependencies": {
"redux": "^3.7.0"
"redux": "^4.0.0"
}
}
@@ -10,6 +10,7 @@ import {
pathToAction
} from 'redux-first-router';
import {
AnyAction,
createStore,
applyMiddleware,
Middleware,
@@ -18,7 +19,7 @@ import {
Dispatch,
compose,
Action,
GenericStoreEnhancer,
StoreEnhancer,
StoreEnhancerStoreCreator,
combineReducers
} from 'redux';
@@ -32,7 +33,6 @@ interface Keys {
}
interface State {
location: LocationState<Keys, State>;
stale: boolean;
}
type StoreCreator = StoreEnhancerStoreCreator<State>;
@@ -78,7 +78,7 @@ const dumbMiddleware: Middleware = store => next => action => next(action);
const composedMiddleware = applyMiddleware(middleware, dumbMiddleware);
const storeEnhancer = compose<StoreCreator, StoreCreator, StoreCreator>(
const storeEnhancer = compose(
enhancer,
composedMiddleware
);
@@ -112,7 +112,7 @@ const action: ReduxFirstRouterAction = {
};
redirect(action); // $ExpectType Action
// $ExpectType Store<State>
// $ExpectType Store<State, AnyAction>
store;
store.getState().location.routesMap; // $ExpectType RoutesMap<Keys, State>
+4
View File
@@ -2,6 +2,9 @@ export {
Field,
FieldArray,
Fields,
Form,
FormName,
FormSection,
reduxForm,
reducer,
formValueSelector,
@@ -19,6 +22,7 @@ export {
isInvalid,
isPristine,
isSubmitting,
isAsyncValidating,
isValid,
SubmissionError
} from "../";
+2 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for redux-form 7.3
// Type definitions for redux-form 7.4
// Project: https://github.com/erikras/redux-form
// Definitions by: Carson Full <https://github.com/carsonf>
// Daniel Lytkin <https://github.com/aikoven>
@@ -47,6 +47,7 @@ export * from "./lib/Field";
export * from "./lib/Fields";
export * from "./lib/FieldArray";
export * from "./lib/Form";
export * from "./lib/FormName";
export * from "./lib/FormSection";
export * from "./lib/formValues";
export * from "./lib/formValueSelector";
+1
View File
@@ -46,6 +46,7 @@ export interface BaseFieldProps<P = {}> extends Partial<CommonFieldProps> {
validate?: Validator | Validator[];
warn?: Validator | Validator[];
withRef?: boolean;
immutableProps?: string[];
}
export interface GenericField<P> extends Component<BaseFieldProps<P> & P> {
-1
View File
@@ -1,5 +1,4 @@
import { Component, FormHTMLAttributes, FormEvent, FormEventHandler } from "react";
import { Dispatch } from "redux";
import { FormProps, FormErrors, FormSubmitHandler, Omit } from "../index";
interface FormSubmitProp<FormData = {}, P = {}> {
+9
View File
@@ -0,0 +1,9 @@
import { ReactNode, StatelessComponent } from "react";
export interface FormNameProps {
children: (props: { form: string }) => ReactNode,
}
export const FormName: StatelessComponent<FormNameProps>;
export default FormName;
+2 -1
View File
@@ -30,7 +30,8 @@ export interface InitializeOptions {
keepValues: boolean;
}
export declare function initialize(form: string, data: any, keepDirty?: boolean | InitializeOptions, options?: InitializeOptions): FormAction;
export declare function initialize(form: string, data: any, keepDirty?: boolean, options?: Partial<InitializeOptions>): FormAction;
export declare function initialize(form: string, data: any, options?: Partial<InitializeOptions>): FormAction;
export declare function registerField(form: string, name: string, type: FieldType): FormAction;
export declare function reset(form: string): FormAction;
export declare function resetSection(form: string, ...sections: string[]): FormAction;
+3 -1
View File
@@ -1,4 +1,4 @@
import { Action, Reducer } from "redux";
import { Reducer } from "redux";
import { FieldType } from "../index";
export interface FormReducer extends Reducer<FormStateMap> {
@@ -8,6 +8,8 @@ export interface FormReducer extends Reducer<FormStateMap> {
export const reducer: FormReducer;
export interface FormReducerMapObject {
// and `<any>` to make it compatible with redux@3
// tslint:disable-next-line use-default-type-parameter
[formName: string]: Reducer<any>;
}
+4 -2
View File
@@ -4,6 +4,7 @@ export type DataSelector<FormData = {}, State = {}> = (formName: string, getForm
export type ErrorSelector<FormData = {}, State = {}> = (formName: string, getFormState?: GetFormState) => (state: State) => FormErrors<FormData>;
export type BooleanSelector<State = {}> = (formName: string, getFormState?: GetFormState) => (state: State) => boolean;
export type NamesSelector<State = {}> = (getFormState?: GetFormState) => (state: State) => string[];
export type FormOrFieldsBooleanSelector<State = {}> = (formName: string, getFormState?: GetFormState) => (state: State, ...fields: string[]) => boolean;
export const getFormValues: DataSelector;
export const getFormInitialValues: DataSelector;
@@ -14,10 +15,11 @@ export const getFormSyncWarnings: ErrorSelector;
export const getFormSubmitErrors: ErrorSelector;
export const getFormError: ErrorSelector;
export const getFormNames: NamesSelector;
export const isDirty: BooleanSelector;
export const isPristine: BooleanSelector;
export const isDirty: FormOrFieldsBooleanSelector;
export const isPristine: FormOrFieldsBooleanSelector;
export const isValid: BooleanSelector;
export const isInvalid: BooleanSelector;
export const isSubmitting: BooleanSelector;
export const isAsyncValidating: BooleanSelector;
export const hasSubmitSucceeded: BooleanSelector;
export const hasSubmitFailed: BooleanSelector;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"private": true,
"dependencies": {
"redux": "^3.6.0"
"redux": "^3.6.0 || ^4.0.0"
}
}
+11
View File
@@ -4,6 +4,7 @@ import {
reduxForm,
InjectedFormProps,
Form,
FormName,
GenericForm,
FormSection,
GenericFormSection,
@@ -399,3 +400,13 @@ class HandleSubmitTest extends React.Component {
return <HandleSubmitTestForm onSubmit={this.handleSubmit} />;
}
}
class FormNameTest extends React.Component {
render() {
return (
<FormName>
{({ form }) => <span>Form Name is: {form}</span>}
</FormName>
);
}
}
+2
View File
@@ -1230,6 +1230,8 @@ export namespace plugins {
reviver?: any;
maxFieldsSize?: number;
maxFileSize: number;
}
/**
+1
View File
@@ -308,6 +308,7 @@ declare namespace stripe {
}
interface ElementChangeResponse {
elementType: string;
brand: string;
complete: boolean;
empty: boolean;
+3
View File
@@ -28,6 +28,9 @@ describe("Stripe", () => {
card.on('ready', () => {
console.log('ready');
});
card.on('change', (resp: stripe.elements.ElementChangeResponse) => {
console.log(resp.elementType);
});
card.on('change', (resp: stripe.elements.ElementChangeResponse) => {
console.log(resp.brand);
});
+22
View File
@@ -0,0 +1,22 @@
// Type definitions for swagger-ui-dist 3.x
// Project: https://github.com/swagger-api/swagger-ui#readme
// Definitions by: Haowen <https://github.com/haowen737>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/* =================== USAGE ===================
import * as SwaggerUIDist from "swagger-ui-dist"
const swaggerUiAssetPath = SwaggerUIDist.getAbsoluteFSPath()
=============================================== */
export as namespace SwaggerUIDist;
/**
* get an absolute path to swagger ui for static file serving
*/
export function getAbsoluteFSPath(): string;
export function absolutePath(): string;
export const SwaggerUIBundle: any;
export const SwaggerUIStandalonePreset: any;
@@ -0,0 +1,4 @@
import * as SwaggerUIDist from "swagger-ui-dist";
SwaggerUIDist.getAbsoluteFSPath(); // $ExpectType string
SwaggerUIDist.absolutePath(); // $ExpectType string
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"strictFunctionTypes": true
},
"files": [
"index.d.ts",
"swagger-ui-dist-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+6 -6
View File
@@ -1,6 +1,6 @@
// Type definitions for throttle-debounce 1.0
// Type definitions for throttle-debounce 1.1
// Project: https://github.com/niksy/throttle-debounce
// Definitions by: Marek Buchar <https://github.com/czbuchi>
// Definitions by: Marek Buchar <https://github.com/czbuchi>, Frank Li <https://github.com/franklixuefei>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
@@ -30,7 +30,7 @@
* @return
* A new, throttled, function.
*/
export function throttle<T>(
export function throttle<T extends (...args: any[]) => any>(
delay: number,
noTrailing: boolean,
callback: T,
@@ -57,7 +57,7 @@ export function throttle<T>(
* @return
* A new, throttled, function.
*/
export function throttle<T>(
export function throttle<T extends (...args: any[]) => any>(
delay: number,
callback: T,
debounceMode?: boolean,
@@ -87,7 +87,7 @@ export function throttle<T>(
* @return
* A new, debounced function.
*/
export function debounce<T>(delay: number, atBegin: boolean, callback: T): T;
export function debounce<T extends (...args: any[]) => any>(delay: number, atBegin: boolean, callback: T): T;
/**
* Debounce execution of a function. Debouncing, unlike throttling,
@@ -106,4 +106,4 @@ export function debounce<T>(delay: number, atBegin: boolean, callback: T): T;
* @return
* A new, debounced function.
*/
export function debounce<T>(delay: number, callback: T): T;
export function debounce<T extends (...args: any[]) => any>(delay: number, callback: T): T;
+1876 -1617
View File
File diff suppressed because it is too large Load Diff
+47 -4
View File
@@ -1,4 +1,4 @@
// Type definitions for virtual-dom 2.0.1
// Type definitions for virtual-dom 2.1.1
// Project: https://github.com/Matt-Esch/virtual-dom
// Definitions by: Christopher Brown <https://github.com/chbrown>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -42,13 +42,20 @@ declare namespace VirtualDOM {
type: string; // 'VirtualNode'
}
interface VNodeConstructor {
new (tagName: string, properties: VProperties, children: VTree[], key?: string, namespace?: string): VNode;
}
interface VText {
text: string;
new(text: any): VText;
version: string;
type: string; // 'VirtualText'
}
interface VTextConstructor {
new (text: string): VText;
}
interface Widget {
type: string; // 'Widget'
init(): Element;
@@ -78,7 +85,6 @@ declare namespace VirtualDOM {
interface VPatch {
vNode: VNode;
patch: any;
new(type: number, vNode: VNode, patch: any): VPatch;
version: string;
/**
type is set to 'VirtualPatch' on the prototype, but overridden in the
@@ -87,6 +93,12 @@ declare namespace VirtualDOM {
type: number;
}
type PatchFn<T extends Element> = (rootNode: T, patches: VPatch[], renderOptions: VPatchOptions<T>) => T;
interface VPatchOptions<T extends Element> {
patch?: PatchFn<T>;
}
interface createProperties extends VProperties {
key?: string;
namespace?: string;
@@ -107,7 +119,12 @@ declare namespace VirtualDOM {
patch() usually just returns rootNode after doing stuff to it, so we want
to preserve that type (though it will usually be just Element).
*/
function patch<T extends Element>(rootNode: T, patches: VPatch[], renderOptions?: any): T;
function patch<T extends Element>(rootNode: T, patches: VPatch[], renderOptions?: VPatchOptions<T>): T;
function isVNode(vTree: VTree): vTree is VNode;
function isVText(vTree: VTree): vTree is VText;
function isWidget(vTree: VTree): vTree is Widget;
function isThunk(vTree: VTree): vTree is Thunk;
}
declare module "virtual-dom/h" {
@@ -130,3 +147,29 @@ declare module "virtual-dom/patch" {
declare module "virtual-dom" {
export = VirtualDOM;
}
declare module "virtual-dom/vnode/vnode" {
import VNodeConstructor = VirtualDOM.VNodeConstructor;
const VNode: VNodeConstructor;
export = VNode;
}
declare module "virtual-dom/vnode/vtext" {
import VTextConstructor = VirtualDOM.VTextConstructor;
const VText: VTextConstructor;
export = VText;
}
declare module "virtual-dom/vnode/is-vnode" {
import isVNode = VirtualDOM.isVNode;
export = isVNode;
}
declare module "virtual-dom/vnode/is-vtext" {
import isVText = VirtualDOM.isVText;
export = isVText;
}
declare module "virtual-dom/vnode/is-widget" {
import isWidget = VirtualDOM.isWidget;
export = isWidget;
}
declare module "virtual-dom/vnode/is-thunk" {
import isThunk = VirtualDOM.isThunk;
export = isThunk;
}
+29 -3
View File
@@ -1,9 +1,13 @@
import virtual_dom = require("virtual-dom");
import VNode = virtual_dom.VNode;
import VNode = require("virtual-dom/vnode/vnode");
import VText = require("virtual-dom/vnode/vtext");
import h = virtual_dom.h;
import isVNode = virtual_dom.isVNode;
import isVText = virtual_dom.isVText;
import isWidget = virtual_dom.isWidget;
import isThunk = virtual_dom.isThunk;
function renderAny(object: any): VNode {
function renderAny(object: any): virtual_dom.VNode {
if (object === undefined) {
return h('i.undefined', 'undefined');
}
@@ -31,3 +35,25 @@ function renderAny(object: any): VNode {
}
return h('span.string', object.toString());
}
const newNode = new VNode("tag", {}, []);
const newText = new VText("text");
newText.text = "new-text";
const tree: any = newNode;
if (isVNode(tree)) {
tree.children = [];
} else if (isVText(tree)) {
tree.text = "hello";
} else if (isWidget(tree)) {
tree.init();
} else if (isThunk(tree)) {
tree.vnode = newNode;
}
virtual_dom.patch(document.createElement("div"), []);
virtual_dom.patch(document.createElement("div"), [], {
patch: (rootNode: HTMLDivElement, patches: virtual_dom.VPatch[]) => {
return rootNode;
}
});
+57
View File
@@ -0,0 +1,57 @@
// Type definitions for vue2-datepicker 2.0
// Project: https://github.com/mengxiong10/vue2-datepicker
// Definitions by: ChristianStornowski <https://github.com/ChristianStornowski>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { Component } from "vue/types/options";
declare namespace Datepicker {
interface Shortcuts {
text: string;
start: Date;
end: Date;
}
interface TimePickerOptions {
start: string;
step: string;
end: string;
}
interface Lang {
days: string[];
months: string[];
pickers: string[];
placeholder: {
date: string;
dateRange: string;
};
}
}
declare const Datepicker: Component<any, any, any, {
type?: string;
range?: boolean;
format?: string;
lang?: string | Datepicker.Lang;
clearable?: boolean;
confirm?: boolean;
editable?: boolean;
disabled?: boolean;
placeholder?: string;
width?: number | string;
notBefore?: string | Date;
notAfter?: string | Date;
disabledDays?: number[] | string[] | ((date: Date) => Date[]);
shortcuts?: boolean | Datepicker.Shortcuts[]
timePickerOptions?: Datepicker.TimePickerOptions[] | (() => Datepicker.TimePickerOptions[]);
minuteStep?: number;
firstDayOfWeek?: number;
inputClass?: string;
inputName?: string;
confirmText?: string;
rangeSeparator?: string;
}>;
export default Datepicker;
+6
View File
@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"vue": ">=2.0.0"
}
}
+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",
"vue2-datepicker-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
@@ -0,0 +1,23 @@
import Vue from 'vue';
import DatePicker from "vue2-datepicker";
new Vue({
el: '#app',
components: {
DatePicker
},
template: `
<date-picker
:placeholder="placeholder"
v-model="dateOfBirth"
format="YYYY-MM-DD"
lang="en">
<template slot="calendar-icon">
<span class="input-datepicker__icon"></span>
</template>
</date-picker>
`,
data() {
return { dateOfBirth: new Date() };
}
});
+3 -1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/webpack/webpack-dev-middleware
// Definitions by: Benjamin Lim <https://github.com/bumbleblym>
// reduckted <https://github.com/reduckted>
// Chris Abrams <https://github.com/chrisabrams>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -23,7 +24,7 @@ declare namespace WebpackDevMiddleware {
lazy?: boolean;
watchOptions?: webpack.Options.WatchOptions;
publicPath: string;
index?: string;
index?: string | boolean;
headers?: {
[name: string]: string;
};
@@ -32,6 +33,7 @@ declare namespace WebpackDevMiddleware {
serverSideRender?: boolean;
logger?: Logger;
filename?: string;
writeToDisk?: boolean | ((filename: string) => boolean);
}
interface ReporterOptions {
@@ -23,6 +23,7 @@ webpackDevMiddlewareInstance = webpackDevMiddleware(compiler, {
},
reporter: null,
serverSideRender: false,
writeToDisk: false,
});
const app = express();
+4 -1
View File
@@ -1,6 +1,8 @@
// Type definitions for webpack-hot-middleware 2.16
// Project: https://github.com/glenjamin/webpack-hot-middleware#readme
// Definitions by: Benjamin Lim <https://github.com/bumbleblym>, Ron Martinez <https://github.com/icylace>
// Definitions by: Benjamin Lim <https://github.com/bumbleblym>
// Ron Martinez <https://github.com/icylace>
// Chris Abrams <https://github.com/chrisabrams>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -19,6 +21,7 @@ declare namespace WebpackHotMiddleware {
log?: false | Logger;
path?: string;
heartbeat?: number;
reload?: boolean;
}
type Logger = (message?: any, ...optionalParams: any[]) => void;
@@ -10,6 +10,7 @@ webpackHotMiddlewareInstance = webpackHotMiddleware(compiler, {
log: console.log.bind(console),
path: '/__what',
heartbeat: 2000,
reload: false,
});
const app = express();
+2 -2
View File
@@ -13,8 +13,8 @@ declare function readSqlFiles(
): string;
declare namespace readSqlFiles {
function pg(query: string): (data: object) => string;
function mysql(query: string): (data: object) => string;
function pg(query: string): (data: object) => {text: string, values: any[]};
function mysql(query: string): (data: object) => {sql: string, values: any[]};
}
export = readSqlFiles;
+4 -4
View File
@@ -4,14 +4,14 @@ yesql(''); // $ExpectType string
yesql('', {pg: true}); // $ExpectType string
yesql('', {type: 'mysql'}); // $ExpectType string
yesql.pg(''); // $ExpectType (data: object) => string
yesql.pg('')({}); // $ExpectType string
yesql.pg(''); // $ExpectType (data: object) => { text: string; values: any[]; }
yesql.pg('')({}); // $ExpectType { text: string; values: any[]; }
yesql.pg('')('demo'); // $ExpectError
yesql.pg('')(42); // $ExpectError
yesql.mysql(''); // $ExpectType (data: object) => string
yesql.mysql('')({}); // $ExpectType string
yesql.mysql(''); // $ExpectType (data: object) => { sql: string; values: any[]; }
yesql.mysql('')({}); // $ExpectType { sql: string; values: any[]; }
yesql.mysql('')('demo'); // $ExpectError
yesql.mysql('')(42); // $ExpectError