mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
Merge branch 'master' into nodeSplit
This commit is contained in:
42
README.md
42
README.md
@@ -255,12 +255,30 @@ Here are the [currently requested definitions](https://github.com/DefinitelyType
|
||||
|
||||
If types are part of a web standard, they should be contributed to [TSJS-lib-generator](https://github.com/Microsoft/TSJS-lib-generator) so that they can become part of the default `lib.dom.d.ts`.
|
||||
|
||||
#### Should I add an empty namespace to a package that doesn't export a module to use ES6 style imports?
|
||||
|
||||
Some packages, like [chai-http](https://github.com/chaijs/chai-http), export a function.
|
||||
|
||||
Importing this module with an ES6 style import in the form `import * as foo from "foo";` leads to the error:
|
||||
|
||||
> error TS2497: Module 'foo' resolves to a non-module entity and cannot be imported using this construct
|
||||
|
||||
This error can be suppressed by merging the function declaration with an empty namespace of the same name, but this practice is discouraged.
|
||||
This is a commonly cited [Stack Overflow answer](https://stackoverflow.com/questions/39415661/what-does-resolves-to-a-non-module-entity-and-cannot-be-imported-using-this) regarding this matter.
|
||||
|
||||
It is more appropriate to import the module using the `import foo = require("foo");` syntax.
|
||||
Nevertheless, if you want to use a default import like `import foo from "foo";` you have two options:
|
||||
- you can use the [`--allowSyntheticDefaultImports` compiler option](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-1-8.html#support-for-default-import-interop-with-systemjs) if your module runtime supports an interop scheme for non-ECMAScript modules, i.e. if default imports work in your environment (e.g. Webpack, SystemJS, esm).
|
||||
- you can use the [`--esModuleInterop` compiler option](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html#support-for-import-d-from-cjs-form-commonjs-modules-with---esmoduleinterop) if you want TypeScript to take care of non-ECMAScript interop (since Typescript 2.7).
|
||||
|
||||
#### A package uses `export =`, but I prefer to use default imports. Can I change `export =` to `export default`?
|
||||
|
||||
If you are using TypeScript 2.7 or later, use `--esModuleInterop` in your project.
|
||||
Otherwise, if default imports work in your environment (e.g. Webpack, SystemJS, esm), consider turning on the [`--allowSyntheticDefaultImports`](http://www.typescriptlang.org/docs/handbook/compiler-options.html) compiler option.
|
||||
Like in the previous question, refer to using either the [`--allowSyntheticDefaultImports`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-1-8.html#support-for-default-import-interop-with-systemjs)
|
||||
or [`--esModuleInterop`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html#support-for-import-d-from-cjs-form-commonjs-modules-with---esmoduleinterop)
|
||||
compiler options.
|
||||
|
||||
Do not change the type definition if it is accurate.
|
||||
For an NPM package, `export =` is accurate if `node -p 'require("foo")'` is the export, and `export default` is accurate if `node -p 'require("foo").default'` is the export.
|
||||
For an NPM package, `export =` is accurate if `node -p 'require("foo")'` works to import a module, and `export default` is accurate if `node -p 'require("foo").default'` works to import a module.
|
||||
|
||||
#### I want to use features from TypeScript 2.1 or above.
|
||||
|
||||
@@ -268,8 +286,9 @@ Then you will have to add a comment to the last line of your definition header (
|
||||
|
||||
#### I want to use features from TypeScript 3.1 or above.
|
||||
|
||||
You will need to use the `typesVersions` feature of TypeScript 3.1 and above. You can find a detailed explanation
|
||||
of this feature in the [official TypeScript documentation](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-1.html#version-selection-with-typesversions).
|
||||
You can use the same `// TypeScript Version: 3.1` comment as above.
|
||||
However, if your project needs to maintain types that are compatible with 3.1 and above *at the same time as* types that are compatible with 3.0 or below, you will need to use the `typesVersions` feature, which is available in TypeScript 3.1 and above.
|
||||
You can find a detailed explanation of this feature in the [official TypeScript documentation](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-1.html#version-selection-with-typesversions).
|
||||
|
||||
Here's a short explanation to get you started:
|
||||
|
||||
@@ -368,19 +387,6 @@ When `dts-gen` is used to scaffold a scoped package, the `paths` property has to
|
||||
|
||||
GitHub doesn't [support](http://stackoverflow.com/questions/5646174/how-to-make-github-follow-directory-history-after-renames) file history for renamed files. Use [`git log --follow`](https://www.git-scm.com/docs/git-log) instead.
|
||||
|
||||
#### Should I add an empty namespace to a package that doesn't export a module to use ES6 style imports?
|
||||
|
||||
Some packages, like [chai-http](https://github.com/chaijs/chai-http), export a function.
|
||||
|
||||
Importing this module with an ES6 style import in the form `import * as foo from "foo";` leads to the error:
|
||||
|
||||
> error TS2497: Module 'foo' resolves to a non-module entity and cannot be imported using this construct
|
||||
|
||||
This error can be suppressed by merging the function declaration with an empty namespace of the same name, but this practice is discouraged.
|
||||
This is a commonly cited [Stack Overflow answer](https://stackoverflow.com/questions/39415661/what-does-resolves-to-a-non-module-entity-and-cannot-be-imported-using-this) regarding this matter.
|
||||
|
||||
It is more appropriate to import the module using the `import foo = require("foo");` syntax, or to use a default import like `import foo from "foo";` if using the `--allowSyntheticDefaultImports` flag if your module runtime supports an interop scheme for non-ECMAScript modules as such.
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT license.
|
||||
|
||||
88
types/asn1/asn1-tests.ts
Normal file
88
types/asn1/asn1-tests.ts
Normal file
@@ -0,0 +1,88 @@
|
||||
import { Ber, BerReader, BerWriter } from 'asn1';
|
||||
|
||||
let buf: Buffer = Buffer.alloc(0);
|
||||
let bool = false;
|
||||
let str = '';
|
||||
let num = 0;
|
||||
let numOrNull: number | null = 0;
|
||||
const roStrArray: ReadonlyArray<string> = [str];
|
||||
|
||||
const reader = new BerReader(buf);
|
||||
numOrNull = reader.peek();
|
||||
bool = reader.readBoolean();
|
||||
numOrNull = reader.readByte(bool);
|
||||
num = reader.readEnumeration();
|
||||
num = reader.readInt();
|
||||
num = reader.readLength();
|
||||
num = reader.readLength(num);
|
||||
str = reader.readOID();
|
||||
str = reader.readOID(num);
|
||||
numOrNull = reader.readSequence();
|
||||
numOrNull = reader.readSequence(num);
|
||||
str = reader.readString();
|
||||
str = reader.readString(num);
|
||||
buf = reader.readString(num, bool);
|
||||
num = reader._readTag();
|
||||
num = reader._readTag(num);
|
||||
|
||||
let writer = new BerWriter();
|
||||
writer = new BerWriter({
|
||||
size: num,
|
||||
growthFactor: num,
|
||||
});
|
||||
|
||||
buf = writer.buffer;
|
||||
buf = writer._buf;
|
||||
num = writer._size;
|
||||
num = writer._offset;
|
||||
|
||||
writer.endSequence();
|
||||
writer.startSequence();
|
||||
writer.startSequence(num);
|
||||
writer.writeBoolean(bool);
|
||||
writer.writeBoolean(bool, num);
|
||||
writer.writeBuffer(buf, num);
|
||||
writer.writeByte(num);
|
||||
writer.writeEnumeration(num);
|
||||
writer.writeEnumeration(num, num);
|
||||
writer.writeInt(num);
|
||||
writer.writeInt(num, num);
|
||||
writer.writeLength(num);
|
||||
writer.writeNull();
|
||||
writer.writeOID(str, num);
|
||||
writer.writeString(str);
|
||||
writer.writeString(str, num);
|
||||
writer.writeStringArray(roStrArray);
|
||||
writer._ensure(num);
|
||||
|
||||
num = Ber.BMPString;
|
||||
num = Ber.BitString;
|
||||
num = Ber.Boolean;
|
||||
num = Ber.CharacterString;
|
||||
num = Ber.Constructor;
|
||||
num = Ber.Context;
|
||||
num = Ber.EOC;
|
||||
num = Ber.Enumeration;
|
||||
num = Ber.External;
|
||||
num = Ber.GeneralString;
|
||||
num = Ber.GeneralizedTime;
|
||||
num = Ber.GraphicString;
|
||||
num = Ber.IA5String;
|
||||
num = Ber.Integer;
|
||||
num = Ber.Null;
|
||||
num = Ber.NumericString;
|
||||
num = Ber.OID;
|
||||
num = Ber.ObjectDescriptor;
|
||||
num = Ber.OctetString;
|
||||
num = Ber.PDV;
|
||||
num = Ber.PrintableString;
|
||||
num = Ber.Real;
|
||||
num = Ber.RelativeOID;
|
||||
num = Ber.Sequence;
|
||||
num = Ber.Set;
|
||||
num = Ber.T61String;
|
||||
num = Ber.UTCTime;
|
||||
num = Ber.UniversalString;
|
||||
num = Ber.Utf8String;
|
||||
num = Ber.VideotexString;
|
||||
num = Ber.VisibleString;
|
||||
126
types/asn1/index.d.ts
vendored
Normal file
126
types/asn1/index.d.ts
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
// Type definitions for asn1 0.2
|
||||
// Project: https://github.com/joyent/node-asn1
|
||||
// Definitions by: Jim Geurts <https://github.com/jgeurts>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
/// <reference types="node" />
|
||||
|
||||
export class BerReader {
|
||||
readonly buffer: Buffer;
|
||||
readonly offset: number;
|
||||
readonly length: number;
|
||||
readonly remain: number;
|
||||
readonly _buf: Buffer;
|
||||
_size: number;
|
||||
_offset: number;
|
||||
|
||||
constructor(data: Buffer);
|
||||
|
||||
peek(): number | null;
|
||||
readBoolean(): boolean;
|
||||
readByte(peek: boolean): number | null;
|
||||
readEnumeration(): number;
|
||||
readInt(): number;
|
||||
readLength(offset?: number): number;
|
||||
readOID(tag?: number): string;
|
||||
readSequence(tag?: number): number | null;
|
||||
readString(tag?: number): string;
|
||||
readString(tag: number, retbuf: boolean): Buffer;
|
||||
_readTag(tag?: number): number;
|
||||
}
|
||||
|
||||
export class BerWriter {
|
||||
readonly buffer: Buffer;
|
||||
readonly _buf: Buffer;
|
||||
readonly _size: number;
|
||||
_offset: number;
|
||||
|
||||
constructor(options?: {
|
||||
size: number;
|
||||
growthFactor: number;
|
||||
});
|
||||
|
||||
endSequence(): void;
|
||||
startSequence(tag?: number): void;
|
||||
writeBoolean(b: boolean, tag?: number): void;
|
||||
writeBuffer(buf: Buffer, tag: number): void;
|
||||
writeByte(b: number): void;
|
||||
writeEnumeration(i: number, tag?: number): void;
|
||||
writeInt(i: number, tag?: number): void;
|
||||
writeLength(len: number): void;
|
||||
writeNull(): void;
|
||||
writeOID(s: string, tag: number): void;
|
||||
writeString(s: string, tag?: number): void;
|
||||
writeStringArray(strings: ReadonlyArray<string>): void;
|
||||
_ensure(length: number): void;
|
||||
}
|
||||
|
||||
export namespace Ber {
|
||||
const BMPString: number;
|
||||
const BitString: number;
|
||||
const Boolean: number;
|
||||
const CharacterString: number;
|
||||
const Constructor: number;
|
||||
const Context: number;
|
||||
const EOC: number;
|
||||
const Enumeration: number;
|
||||
const External: number;
|
||||
const GeneralString: number;
|
||||
const GeneralizedTime: number;
|
||||
const GraphicString: number;
|
||||
const IA5String: number;
|
||||
const Integer: number;
|
||||
const Null: number;
|
||||
const NumericString: number;
|
||||
const OID: number;
|
||||
const ObjectDescriptor: number;
|
||||
const OctetString: number;
|
||||
const PDV: number;
|
||||
const PrintableString: number;
|
||||
const Real: number;
|
||||
const RelativeOID: number;
|
||||
const Sequence: number;
|
||||
const Set: number;
|
||||
const T61String: number;
|
||||
const UTCTime: number;
|
||||
const UniversalString: number;
|
||||
const Utf8String: number;
|
||||
const VideotexString: number;
|
||||
const VisibleString: number;
|
||||
}
|
||||
/*
|
||||
declare enum BerType {
|
||||
EOC = 0,
|
||||
Boolean = 1,
|
||||
Integer = 2,
|
||||
BitString = 3,
|
||||
OctetString = 4,
|
||||
Null = 5,
|
||||
OID = 6,
|
||||
ObjectDescriptor = 7,
|
||||
External = 8,
|
||||
Real = 9, // float
|
||||
Enumeration = 10,
|
||||
PDV = 11,
|
||||
Utf8String = 12,
|
||||
RelativeOID = 13,
|
||||
Sequence = 16,
|
||||
Set = 17,
|
||||
NumericString = 18,
|
||||
PrintableString = 19,
|
||||
T61String = 20,
|
||||
VideotexString = 21,
|
||||
IA5String = 22,
|
||||
UTCTime = 23,
|
||||
GeneralizedTime = 24,
|
||||
GraphicString = 25,
|
||||
VisibleString = 26,
|
||||
GeneralString = 28,
|
||||
UniversalString = 29,
|
||||
CharacterString = 30,
|
||||
BMPString = 31,
|
||||
Constructor = 32,
|
||||
Context = 128,
|
||||
}
|
||||
|
||||
*/
|
||||
25
types/asn1/tsconfig.json
Normal file
25
types/asn1/tsconfig.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"noUnusedParameters": true,
|
||||
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"asn1-tests.ts"
|
||||
]
|
||||
}
|
||||
3
types/asn1/tslint.json
Normal file
3
types/asn1/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
2
types/auth0-js/index.d.ts
vendored
2
types/auth0-js/index.d.ts
vendored
@@ -812,6 +812,8 @@ export interface AuthorizeOptions {
|
||||
login_hint?: string;
|
||||
prompt?: string;
|
||||
mode?: "login" | "signUp";
|
||||
accessType?: string;
|
||||
approvalPrompt?: string;
|
||||
}
|
||||
|
||||
export interface CheckSessionOptions extends AuthorizeOptions {
|
||||
|
||||
@@ -1056,3 +1056,113 @@ const firehoseEventHandler: AWSLambda.FirehoseTransformationHandler = (
|
||||
]
|
||||
});
|
||||
};
|
||||
|
||||
declare let lexEvent: AWSLambda.LexEvent;
|
||||
lexEvent = {
|
||||
currentIntent: {
|
||||
name: 'intent-name',
|
||||
slots: {
|
||||
slot1: null,
|
||||
slot2: 'value2',
|
||||
},
|
||||
slotDetails: {
|
||||
slot1: {
|
||||
resolutions: [
|
||||
{ value: 'value1' },
|
||||
],
|
||||
originalValue: 'originalValue',
|
||||
}
|
||||
},
|
||||
confirmationStatus: 'None',
|
||||
},
|
||||
bot: {
|
||||
name: 'bot name',
|
||||
alias: 'bot alias',
|
||||
version: 'bot version',
|
||||
},
|
||||
userId: 'User ID specified in the POST request to Amazon Lex.',
|
||||
inputTranscript: 'Text used to process the request',
|
||||
invocationSource: 'FulfillmentCodeHook',
|
||||
outputDialogMode: 'Text',
|
||||
messageVersion: '1.0',
|
||||
sessionAttributes: {
|
||||
key1: 'value1',
|
||||
key2: 'value2',
|
||||
},
|
||||
requestAttributes: {
|
||||
key1: 'value1',
|
||||
key2: 'value2',
|
||||
}
|
||||
};
|
||||
|
||||
declare let lexResult: AWSLambda.LexResult;
|
||||
declare let lexDialogAction: AWSLambda.LexDialogAction;
|
||||
declare let lexDialogActionBase: AWSLambda.LexDialogActionBase;
|
||||
declare let lexDialogActionClose: AWSLambda.LexDialogActionClose;
|
||||
declare let lexDialogActionConfirmIntent: AWSLambda.LexDialogActionConfirmIntent;
|
||||
declare let lexDialogActionDelegate: AWSLambda.LexDialogActionDelegate;
|
||||
declare let lexDialogActionElicitIntent: AWSLambda.LexDialogActionElicitIntent;
|
||||
declare let lexDialogActionElicitSlot: AWSLambda.LexDialogActionElicitSlot;
|
||||
declare let lexGenericAttachment: AWSLambda.LexGenericAttachment;
|
||||
|
||||
lexResult = {
|
||||
sessionAttributes: {
|
||||
attrib1: 'Value One',
|
||||
},
|
||||
dialogAction: {
|
||||
type: 'Close',
|
||||
fulfillmentState: 'Failed',
|
||||
},
|
||||
};
|
||||
|
||||
str = lexGenericAttachment.title;
|
||||
str = lexGenericAttachment.subTitle;
|
||||
str = lexGenericAttachment.imageUrl;
|
||||
str = lexGenericAttachment.attachmentLinkUrl;
|
||||
str = lexGenericAttachment.buttons[0].text;
|
||||
str = lexGenericAttachment.buttons[0].value;
|
||||
|
||||
lexDialogAction.type === 'Close';
|
||||
lexDialogAction.type === 'ConfirmIntent';
|
||||
lexDialogAction.type === 'Delegate';
|
||||
lexDialogAction.type === 'ElicitIntent';
|
||||
lexDialogAction.type === 'ElicitSlot';
|
||||
|
||||
lexDialogActionBase.message!.contentType === 'CustomPayload';
|
||||
lexDialogActionBase.message!.contentType === 'PlainText';
|
||||
lexDialogActionBase.message!.contentType === 'SSML';
|
||||
str = lexDialogActionBase.message!.content;
|
||||
num = lexDialogActionBase.responseCard!.version;
|
||||
lexDialogActionBase.responseCard!.contentType === 'application/vnd.amazonaws.card.generic';
|
||||
// $ExpectType LexGenericAttachment
|
||||
lexDialogActionBase.responseCard!.genericAttachments[0];
|
||||
|
||||
lexDialogActionClose.type === 'Close';
|
||||
lexDialogActionClose.fulfillmentState === 'Failed';
|
||||
lexDialogActionClose.fulfillmentState === 'Fulfilled';
|
||||
|
||||
lexDialogActionConfirmIntent.type === 'ConfirmIntent';
|
||||
str = lexDialogActionConfirmIntent.intentName;
|
||||
strOrNull = lexDialogActionConfirmIntent.slots['example'];
|
||||
|
||||
lexDialogActionDelegate.type === 'Delegate';
|
||||
strOrNull = lexDialogActionDelegate.slots['example'];
|
||||
|
||||
lexDialogActionElicitIntent.type === 'ElicitIntent';
|
||||
lexDialogActionElicitSlot.type === 'ElicitSlot';
|
||||
strOrNull = lexDialogActionElicitSlot.slots['example'];
|
||||
str = lexDialogActionElicitSlot.slotToElicit;
|
||||
str = lexDialogActionElicitSlot.intentName;
|
||||
|
||||
const lexEventHandler: AWSLambda.LexHandler = async (
|
||||
event: AWSLambda.LexEvent,
|
||||
context: AWSLambda.Context,
|
||||
) => {
|
||||
// $ExpectType LexEvent
|
||||
event;
|
||||
|
||||
// $ExpectType Context
|
||||
context;
|
||||
str = context.functionName;
|
||||
return lexResult;
|
||||
};
|
||||
|
||||
97
types/aws-lambda/index.d.ts
vendored
97
types/aws-lambda/index.d.ts
vendored
@@ -876,6 +876,100 @@ export interface SQSMessageAttributes {
|
||||
[name: string]: SQSMessageAttribute;
|
||||
}
|
||||
|
||||
// Lex
|
||||
// https://docs.aws.amazon.com/lambda/latest/dg/invoking-lambda-function.html#supported-event-source-lex
|
||||
export interface LexEvent {
|
||||
currentIntent: {
|
||||
name: string;
|
||||
slots: { [name: string]: string | null };
|
||||
slotDetails: LexSlotDetails;
|
||||
confirmationStatus: 'None' | 'Confirmed' | 'Denied';
|
||||
};
|
||||
bot: {
|
||||
name: string;
|
||||
alias: string;
|
||||
version: string;
|
||||
};
|
||||
userId: string;
|
||||
inputTranscript: string;
|
||||
invocationSource: 'DialogCodeHook' | 'FulfillmentCodeHook';
|
||||
outputDialogMode: 'Text' | 'Voice';
|
||||
messageVersion: '1.0';
|
||||
sessionAttributes: { [key: string]: string };
|
||||
requestAttributes: { [key: string]: string } | null;
|
||||
}
|
||||
|
||||
export interface LexSlotResolution {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface LexSlotDetails {
|
||||
[name: string]: {
|
||||
// The following line only works in TypeScript Version: 3.0, The array should have at least 1 and no more than 5 items
|
||||
// resolutions: [LexSlotResolution, LexSlotResolution?, LexSlotResolution?, LexSlotResolution?, LexSlotResolution?];
|
||||
resolutions: LexSlotResolution[]
|
||||
originalValue: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface LexGenericAttachment {
|
||||
title: string;
|
||||
subTitle: string;
|
||||
imageUrl: string;
|
||||
attachmentLinkUrl: string;
|
||||
buttons: Array<{
|
||||
text: string;
|
||||
value: string;
|
||||
}>;
|
||||
}
|
||||
|
||||
export interface LexDialogActionBase {
|
||||
type: 'Close' | 'ElicitIntent' | 'ElicitSlot' | 'ConfirmIntent';
|
||||
message?: {
|
||||
contentType: 'PlainText' | 'SSML' | 'CustomPayload';
|
||||
content: string;
|
||||
};
|
||||
responseCard?: {
|
||||
version: number;
|
||||
contentType: 'application/vnd.amazonaws.card.generic';
|
||||
genericAttachments: LexGenericAttachment[];
|
||||
};
|
||||
}
|
||||
|
||||
export interface LexDialogActionClose extends LexDialogActionBase {
|
||||
type: 'Close';
|
||||
fulfillmentState: 'Fulfilled' | 'Failed';
|
||||
}
|
||||
|
||||
export interface LexDialogActionElicitIntent extends LexDialogActionBase {
|
||||
type: 'ElicitIntent';
|
||||
}
|
||||
|
||||
export interface LexDialogActionElicitSlot extends LexDialogActionBase {
|
||||
type: 'ElicitSlot';
|
||||
intentName: string;
|
||||
slots: { [name: string]: string | null };
|
||||
slotToElicit: string;
|
||||
}
|
||||
|
||||
export interface LexDialogActionConfirmIntent extends LexDialogActionBase {
|
||||
type: 'ConfirmIntent';
|
||||
intentName: string;
|
||||
slots: { [name: string]: string | null };
|
||||
}
|
||||
|
||||
export interface LexDialogActionDelegate {
|
||||
type: 'Delegate';
|
||||
slots: { [name: string]: string | null };
|
||||
}
|
||||
|
||||
export type LexDialogAction = LexDialogActionClose | LexDialogActionElicitIntent | LexDialogActionElicitSlot | LexDialogActionConfirmIntent | LexDialogActionDelegate;
|
||||
|
||||
export interface LexResult {
|
||||
sessionAttributes?: { [key: string]: string };
|
||||
dialogAction: LexDialogAction;
|
||||
}
|
||||
|
||||
/**
|
||||
* AWS Lambda handler function.
|
||||
* http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html
|
||||
@@ -938,6 +1032,9 @@ export type ScheduledHandler = Handler<ScheduledEvent, void>;
|
||||
|
||||
// TODO: Alexa
|
||||
|
||||
export type LexHandler = Handler<LexEvent, LexResult>;
|
||||
export type LexCallback = Callback<LexResult>;
|
||||
|
||||
export type APIGatewayProxyHandler = Handler<APIGatewayProxyEvent, APIGatewayProxyResult>;
|
||||
export type APIGatewayProxyCallback = Callback<APIGatewayProxyResult>;
|
||||
export type ProxyHandler = APIGatewayProxyHandler; // Old name
|
||||
|
||||
6
types/axios-case-converter/axios-case-converter-tests.ts
Normal file
6
types/axios-case-converter/axios-case-converter-tests.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import axios from "axios";
|
||||
import applyConverters from "axios-case-converter";
|
||||
|
||||
applyConverters(); // $ExpectError
|
||||
|
||||
applyConverters(axios.create()); // $ExpectType AxiosInstance
|
||||
7
types/axios-case-converter/index.d.ts
vendored
Normal file
7
types/axios-case-converter/index.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Type definitions for axios-case-converter 0.3
|
||||
// Project: https://github.com/mpyw/axios-case-converter
|
||||
// Definitions by: Derek Kniffin <https://github.com/dkniffin>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
import { AxiosInstance } from "axios";
|
||||
|
||||
export default function applyConverters(axios: AxiosInstance): AxiosInstance;
|
||||
6
types/axios-case-converter/package.json
Normal file
6
types/axios-case-converter/package.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"axios": "^0.16.1"
|
||||
}
|
||||
}
|
||||
23
types/axios-case-converter/tsconfig.json
Normal file
23
types/axios-case-converter/tsconfig.json
Normal 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",
|
||||
"axios-case-converter-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/axios-case-converter/tslint.json
Normal file
1
types/axios-case-converter/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -69,3 +69,12 @@ trans.default('name');
|
||||
trans.deferred('name');
|
||||
trans.immediate('name');
|
||||
trans.exclusive('name');
|
||||
|
||||
const transTyped = db.transaction((param: number) => stmt.all(param));
|
||||
transTyped(1);
|
||||
trans.default(1);
|
||||
trans.deferred(1);
|
||||
trans.immediate(1);
|
||||
trans.exclusive(1);
|
||||
// $ExpectError
|
||||
transTyped('name');
|
||||
|
||||
23
types/better-sqlite3/index.d.ts
vendored
23
types/better-sqlite3/index.d.ts
vendored
@@ -4,10 +4,17 @@
|
||||
// Mathew Rumsey <https://github.com/matrumz>
|
||||
// Santiago Aguilar <https://github.com/sant123>
|
||||
// Alessandro Vergani <https://github.com/loghorn>
|
||||
// Andrew Kaiser <https://github.com/andykais>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.0
|
||||
|
||||
import Integer = require("integer");
|
||||
|
||||
type VariableArgFunction = (...params: any[]) => any;
|
||||
type ArgumentTypes<F extends VariableArgFunction> = F extends (...args: infer A) => any
|
||||
? A
|
||||
: never;
|
||||
|
||||
declare namespace BetterSqlite3 {
|
||||
interface Statement {
|
||||
database: Database;
|
||||
@@ -34,12 +41,12 @@ declare namespace BetterSqlite3 {
|
||||
type: string | null;
|
||||
}
|
||||
|
||||
interface Transaction {
|
||||
(...params: any[]): any;
|
||||
default(...params: any[]): any;
|
||||
deferred(...params: any[]): any;
|
||||
immediate(...params: any[]): any;
|
||||
exclusive(...params: any[]): any;
|
||||
interface Transaction<F extends VariableArgFunction> {
|
||||
(...params: ArgumentTypes<F>): any;
|
||||
default(...params: ArgumentTypes<F>): any;
|
||||
deferred(...params: ArgumentTypes<F>): any;
|
||||
immediate(...params: ArgumentTypes<F>): any;
|
||||
exclusive(...params: ArgumentTypes<F>): any;
|
||||
}
|
||||
|
||||
interface Database {
|
||||
@@ -50,7 +57,7 @@ declare namespace BetterSqlite3 {
|
||||
inTransaction: boolean;
|
||||
|
||||
prepare(source: string): Statement;
|
||||
transaction(fn: (...params: any[]) => any): Transaction;
|
||||
transaction<F extends VariableArgFunction>(fn: F): Transaction<F>;
|
||||
exec(source: string): this;
|
||||
pragma(source: string, options?: Database.PragmaOptions): any;
|
||||
checkpoint(databaseName?: string): this;
|
||||
@@ -113,7 +120,7 @@ declare namespace Database {
|
||||
type SqliteError = typeof SqliteError;
|
||||
type Statement = BetterSqlite3.Statement;
|
||||
type ColumnDefinition = BetterSqlite3.ColumnDefinition;
|
||||
type Transaction = BetterSqlite3.Transaction;
|
||||
type Transaction = BetterSqlite3.Transaction<VariableArgFunction>;
|
||||
type Database = BetterSqlite3.Database;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import btoa from 'btoa';
|
||||
import btoa = require('btoa');
|
||||
|
||||
btoa('foo');
|
||||
|
||||
5
types/btoa/index.d.ts
vendored
5
types/btoa/index.d.ts
vendored
@@ -1,7 +1,10 @@
|
||||
// Type definitions for btoa 1.2
|
||||
// Project: https://git.coolaj86.com/coolaj86/btoa.js
|
||||
// Definitions by: John Wright <https://github.com/johngeorgewright>
|
||||
// Alex Brick <https://github.com/bricka>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
export default function(str: string): string;
|
||||
declare function btoa(str: string): string;
|
||||
|
||||
export = btoa;
|
||||
|
||||
@@ -8,7 +8,7 @@ const input = 'const answer = () => 42;';
|
||||
|
||||
console.log(output.code);
|
||||
console.log(output.map.toString());
|
||||
console.log(output.map.toUrl);
|
||||
console.log(output.map.toUrl());
|
||||
})();
|
||||
|
||||
// Transform for Chrome & Firefox
|
||||
|
||||
10
types/buble/index.d.ts
vendored
10
types/buble/index.d.ts
vendored
@@ -1,7 +1,10 @@
|
||||
// Type definitions for buble 0.19
|
||||
// Project: https://github.com/Rich-Harris/buble#README
|
||||
// Definitions by: Kocal <https://github.com/Kocal>
|
||||
// Definitions by: Hugo Alliaume <https://github.com/Kocal>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
import { SourceMap } from "magic-string";
|
||||
|
||||
export interface TransformOptions {
|
||||
// source: https://github.com/Rich-Harris/buble/blob/master/src/support.js
|
||||
@@ -56,10 +59,7 @@ export interface TransformOptions {
|
||||
|
||||
export interface TransformOutput {
|
||||
code: string;
|
||||
map: {
|
||||
toString(): string;
|
||||
toUrl(): string;
|
||||
};
|
||||
map: SourceMap;
|
||||
}
|
||||
|
||||
export function transform(content: string, options?: TransformOptions): TransformOutput;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"csstype": "^2.2.0"
|
||||
"magic-string": "^0.25.0"
|
||||
}
|
||||
}
|
||||
5
types/bull/index.d.ts
vendored
5
types/bull/index.d.ts
vendored
@@ -585,6 +585,11 @@ declare namespace Bull {
|
||||
*/
|
||||
getJobCounts(): Promise<JobCounts>;
|
||||
|
||||
/**
|
||||
* Returns a promise that resolves with the job counts for the given queue of the given types.
|
||||
*/
|
||||
getJobCountByTypes(types: string[] | string): Promise<JobCounts>;
|
||||
|
||||
/**
|
||||
* Returns a promise that resolves with the quantity of completed jobs.
|
||||
*/
|
||||
|
||||
7
types/bytebuffer/index.d.ts
vendored
7
types/bytebuffer/index.d.ts
vendored
@@ -127,7 +127,7 @@ declare class ByteBuffer
|
||||
* Calculates the number of UTF8 characters of a string.JavaScript itself uses UTF- 16, so that a string's length property does not reflect its actual UTF8 size if it contains code points larger than 0xFFFF.
|
||||
*/
|
||||
static calculateUTF8Chars( str: string ): number;
|
||||
|
||||
|
||||
/**
|
||||
* Calculates the number of UTF8 bytes of a string. This is an alias of ByteBuffer#calculateUTF8Bytes.
|
||||
*/
|
||||
@@ -574,6 +574,11 @@ declare class ByteBuffer
|
||||
*/
|
||||
writeInt8( value: number, offset?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Write a 64bit signed integer. This is an alias of ByteBuffer#writeInt64.
|
||||
*/
|
||||
writeLong( value: number | Long, offset?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Writes a 16bit signed integer. This is an alias of ByteBuffer#writeInt16.
|
||||
*/
|
||||
|
||||
28
types/cacheable-request/cacheable-request-tests.ts
Normal file
28
types/cacheable-request/cacheable-request-tests.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import * as http from 'http';
|
||||
import * as https from 'https';
|
||||
import CacheableRequest = require('cacheable-request');
|
||||
import QuickLRU = require('quick-lru');
|
||||
|
||||
// You can do
|
||||
let cacheableRequest = new CacheableRequest(http.request);
|
||||
const cacheReq = cacheableRequest('http://example.com', res => {
|
||||
res; // $ExpectType ServerResponse | ResponseLike
|
||||
});
|
||||
cacheReq.on('request', req => req.end());
|
||||
|
||||
cacheableRequest = new CacheableRequest(https.request);
|
||||
|
||||
cacheableRequest = new CacheableRequest(http.request, 'redis://user:pass@localhost:6379');
|
||||
cacheableRequest = new CacheableRequest(http.request, new Map());
|
||||
cacheableRequest = new CacheableRequest(http.request, new QuickLRU({ maxSize: 1000 }));
|
||||
|
||||
cacheableRequest('example.com', res => {
|
||||
res; // $ExpectType ServerResponse | ResponseLike
|
||||
})
|
||||
.on('error', err => {
|
||||
err; // $ExpectType RequestErrorCls | CacheErrorCls
|
||||
})
|
||||
.on('request', req => {
|
||||
req.on('error', () => {});
|
||||
req.end();
|
||||
});
|
||||
134
types/cacheable-request/index.d.ts
vendored
Normal file
134
types/cacheable-request/index.d.ts
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
// Type definitions for cacheable-request 6.0
|
||||
// Project: https://github.com/lukechilds/cacheable-request#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { request, RequestOptions, ClientRequest, ServerResponse } from 'http';
|
||||
import { URL } from 'url';
|
||||
import { EventEmitter } from 'events';
|
||||
import { Store } from 'keyv';
|
||||
import { Options as CacheSemanticsOptions } from 'http-cache-semantics';
|
||||
import ResponseLike = require('responselike');
|
||||
|
||||
export = CacheableRequest;
|
||||
|
||||
declare const CacheableRequest: CacheableRequest;
|
||||
|
||||
type RequestFn = typeof request;
|
||||
|
||||
interface CacheableRequest {
|
||||
new (requestFn: RequestFn, storageAdapter?: string | Store<any>): (
|
||||
opts: string | URL | (RequestOptions & CacheSemanticsOptions),
|
||||
cb?: (response: ServerResponse | ResponseLike) => void
|
||||
) => CacheableRequest.Emitter;
|
||||
|
||||
RequestError: typeof RequestErrorCls;
|
||||
CacheError: typeof CacheErrorCls;
|
||||
}
|
||||
|
||||
declare namespace CacheableRequest {
|
||||
interface Options {
|
||||
/**
|
||||
* If the cache should be used. Setting this to `false` will completely bypass the cache for the current request.
|
||||
* @default true
|
||||
*/
|
||||
cache?: boolean;
|
||||
|
||||
/**
|
||||
* If set to `true` once a cached resource has expired it is deleted and will have to be re-requested.
|
||||
*
|
||||
* If set to `false`, after a cached resource's TTL expires it is kept in the cache and will be revalidated
|
||||
* on the next request with `If-None-Match`/`If-Modified-Since` headers.
|
||||
* @default false
|
||||
*/
|
||||
strictTtl?: boolean;
|
||||
|
||||
/**
|
||||
* Limits TTL. The `number` represents milliseconds.
|
||||
* @default undefined
|
||||
*/
|
||||
maxTtl?: number;
|
||||
|
||||
/**
|
||||
* When set to `true`, if the DB connection fails we will automatically fallback to a network request.
|
||||
* DB errors will still be emitted to notify you of the problem even though the request callback may succeed.
|
||||
* @default false
|
||||
*/
|
||||
automaticFailover?: boolean;
|
||||
|
||||
/**
|
||||
* Forces refreshing the cache. If the response could be retrieved from the cache, it will perform a
|
||||
* new request and override the cache instead.
|
||||
* @default false
|
||||
*/
|
||||
forceRefresh?: boolean;
|
||||
}
|
||||
|
||||
interface Emitter extends EventEmitter {
|
||||
addListener(event: 'request', listener: (request: ClientRequest) => void): this;
|
||||
addListener(
|
||||
event: 'response',
|
||||
listener: (response: ServerResponse | ResponseLike) => void
|
||||
): this;
|
||||
addListener(event: 'error', listener: (error: RequestError | CacheError) => void): this;
|
||||
on(event: 'request', listener: (request: ClientRequest) => void): this;
|
||||
on(event: 'response', listener: (response: ServerResponse | ResponseLike) => void): this;
|
||||
on(event: 'error', listener: (error: RequestError | CacheError) => void): this;
|
||||
once(event: 'request', listener: (request: ClientRequest) => void): this;
|
||||
once(event: 'response', listener: (response: ServerResponse | ResponseLike) => void): this;
|
||||
once(event: 'error', listener: (error: RequestError | CacheError) => void): this;
|
||||
prependListener(event: 'request', listener: (request: ClientRequest) => void): this;
|
||||
prependListener(
|
||||
event: 'response',
|
||||
listener: (response: ServerResponse | ResponseLike) => void
|
||||
): this;
|
||||
prependListener(event: 'error', listener: (error: RequestError | CacheError) => void): this;
|
||||
prependOnceListener(event: 'request', listener: (request: ClientRequest) => void): this;
|
||||
prependOnceListener(
|
||||
event: 'response',
|
||||
listener: (response: ServerResponse | ResponseLike) => void
|
||||
): this;
|
||||
prependOnceListener(
|
||||
event: 'error',
|
||||
listener: (error: RequestError | CacheError) => void
|
||||
): this;
|
||||
removeListener(event: 'request', listener: (request: ClientRequest) => void): this;
|
||||
removeListener(
|
||||
event: 'response',
|
||||
listener: (response: ServerResponse | ResponseLike) => void
|
||||
): this;
|
||||
removeListener(event: 'error', listener: (error: RequestError | CacheError) => void): this;
|
||||
off(event: 'request', listener: (request: ClientRequest) => void): this;
|
||||
off(event: 'response', listener: (response: ServerResponse | ResponseLike) => void): this;
|
||||
off(event: 'error', listener: (error: RequestError | CacheError) => void): this;
|
||||
removeAllListeners(event?: 'request' | 'response' | 'error'): this;
|
||||
listeners(event: 'request'): Array<(request: ClientRequest) => void>;
|
||||
listeners(event: 'response'): Array<(response: ServerResponse | ResponseLike) => void>;
|
||||
listeners(event: 'error'): Array<(error: RequestError | CacheError) => void>;
|
||||
rawListeners(event: 'request'): Array<(request: ClientRequest) => void>;
|
||||
rawListeners(event: 'response'): Array<(response: ServerResponse | ResponseLike) => void>;
|
||||
rawListeners(event: 'error'): Array<(error: RequestError | CacheError) => void>;
|
||||
emit(event: 'request', request: ClientRequest): boolean;
|
||||
emit(event: 'response', response: ServerResponse | ResponseLike): boolean;
|
||||
emit(event: 'error', error: RequestError | CacheError): boolean;
|
||||
eventNames(): Array<'request' | 'response' | 'error'>;
|
||||
listenerCount(type: 'request' | 'response' | 'error'): number;
|
||||
}
|
||||
|
||||
type RequestError = RequestErrorCls;
|
||||
type CacheError = CacheErrorCls;
|
||||
}
|
||||
|
||||
declare class RequestErrorCls extends Error {
|
||||
readonly name: 'RequestError';
|
||||
|
||||
constructor(error: Error);
|
||||
}
|
||||
declare class CacheErrorCls extends Error {
|
||||
readonly name: 'CacheError';
|
||||
|
||||
constructor(error: Error);
|
||||
}
|
||||
24
types/cacheable-request/tsconfig.json
Normal file
24
types/cacheable-request/tsconfig.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cacheable-request-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/cacheable-request/tslint.json
Normal file
1
types/cacheable-request/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
2
types/catbox/index.d.ts
vendored
2
types/catbox/index.d.ts
vendored
@@ -231,7 +231,7 @@ export interface DecoratedPolicyOptions<T> extends PolicyOptions<T> {
|
||||
/**
|
||||
* @default false
|
||||
*/
|
||||
getDecoratedValue?: boolean;
|
||||
getDecoratedValue: boolean | undefined;
|
||||
}
|
||||
|
||||
export interface GenerateFuncFlags {
|
||||
|
||||
6
types/chai-webdriverio/package.json
Normal file
6
types/chai-webdriverio/package.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@types/webdriverio": "^4.0.0"
|
||||
}
|
||||
}
|
||||
1
types/chart.js/index.d.ts
vendored
1
types/chart.js/index.d.ts
vendored
@@ -537,6 +537,7 @@ declare namespace Chart {
|
||||
interface LinearTickOptions extends TickOptions {
|
||||
maxTicksLimit?: number;
|
||||
stepSize?: number;
|
||||
precision?: number;
|
||||
suggestedMin?: number;
|
||||
suggestedMax?: number;
|
||||
}
|
||||
|
||||
@@ -485,3 +485,53 @@ new Chartist.Candle('.ct-chart', {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Create a simple bar chart and line chart with two dimensional arrays
|
||||
new Chartist.Bar('.ct-chart', {
|
||||
labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
||||
series: [
|
||||
[
|
||||
{value: 1},
|
||||
{value: 2},
|
||||
{value: 3},
|
||||
{value: 4},
|
||||
{value: 5},
|
||||
{value: 6},
|
||||
{value: 7}
|
||||
],
|
||||
[
|
||||
{value: 7},
|
||||
{value: 6},
|
||||
{value: 5},
|
||||
{value: 4},
|
||||
{value: 3},
|
||||
{value: 2},
|
||||
{value: 1}
|
||||
]
|
||||
]
|
||||
}, {})
|
||||
|
||||
new Chartist.Line('.ct-chart', {
|
||||
labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
||||
series: [
|
||||
[
|
||||
{value: 1},
|
||||
{value: 2},
|
||||
{value: 3},
|
||||
{value: 4},
|
||||
{value: 5},
|
||||
{value: 6},
|
||||
{value: 7}
|
||||
],
|
||||
[
|
||||
{value: 7},
|
||||
{value: 6},
|
||||
{value: 5},
|
||||
{value: 4},
|
||||
{value: 3},
|
||||
{value: 2},
|
||||
{value: 1}
|
||||
]
|
||||
]
|
||||
}, {})
|
||||
|
||||
2
types/chartist/index.d.ts
vendored
2
types/chartist/index.d.ts
vendored
@@ -93,7 +93,7 @@ declare namespace Chartist {
|
||||
// TODO: come in and tidy this up and make it fit better
|
||||
interface IChartistData {
|
||||
labels?: Array<string> | Array<number> | Array<Date>;
|
||||
series: Array<IChartistSeriesData> | Array<Array<IChartistData>> | Array<number> | Array<Array<number>>;
|
||||
series: Array<IChartistSeriesData> | Array<Array<IChartistSeriesData>> | Array<Array<IChartistData>> | Array<number> | Array<Array<number>>;
|
||||
}
|
||||
|
||||
interface IChartistSeriesData {
|
||||
|
||||
@@ -289,6 +289,17 @@ function test_dom_node() {
|
||||
strong.insertBefore(em);
|
||||
strong.insertBeforeMe(em);
|
||||
element.isReadOnly();
|
||||
var prev = node.getPreviousSourceNode();
|
||||
prev = node.getPreviousSourceNode(true);
|
||||
prev = node.getPreviousSourceNode(true, CKEDITOR.NODE_TEXT);
|
||||
prev = node.getPreviousSourceNode(true, CKEDITOR.NODE_COMMENT, node);
|
||||
prev = node.getPreviousSourceNode(true, CKEDITOR.NODE_COMMENT, (current: CKEDITOR.dom.node) => false);
|
||||
var next = node.getNextSourceNode();
|
||||
next = node.getNextSourceNode(true);
|
||||
next = node.getNextSourceNode(true, CKEDITOR.NODE_ELEMENT);
|
||||
next = node.getNextSourceNode(true, CKEDITOR.NODE_DOCUMENT, node);
|
||||
next = node.getNextSourceNode(true, CKEDITOR.NODE_DOCUMENT_FRAGMENT, (current: CKEDITOR.dom.node) => true);
|
||||
console.log(node.type);
|
||||
}
|
||||
|
||||
function test_dom_nodeList() {
|
||||
|
||||
5
types/ckeditor/index.d.ts
vendored
5
types/ckeditor/index.d.ts
vendored
@@ -333,6 +333,7 @@ declare namespace CKEDITOR {
|
||||
}
|
||||
|
||||
class node extends domObject {
|
||||
type: number;
|
||||
constructor(domNode: Node);
|
||||
appendTo(element: element): element;
|
||||
clone(includeChildren: boolean, cloneId: boolean): node;
|
||||
@@ -347,12 +348,12 @@ declare namespace CKEDITOR {
|
||||
getDocument(): document;
|
||||
getIndex(normalized?: boolean): number;
|
||||
getNext(evaluator?: (node: node) => boolean): node;
|
||||
getNextSourceNode(startFromSibling: boolean, nodeType: number, guard: node | ((node: node) => boolean)): void;
|
||||
getNextSourceNode(startFromSibling?: boolean, nodeType?: number, guard?: node | ((node: node) => boolean)): node;
|
||||
getParent(allowFragmentParent?: boolean): element;
|
||||
getParents(closerFirst?: boolean): node[];
|
||||
getPosition(otherNode: node): void;
|
||||
getPrevious(evaluator?: (node: node) => boolean): node;
|
||||
getPreviousSourceNode(startFromSibling: boolean, nodeType: number, guard: node | ((node: node) => boolean)): void;
|
||||
getPreviousSourceNode(startFromSibling?: boolean, nodeType?: number, guard?: node | ((node: node) => boolean)): node;
|
||||
hasAscendant(name: string, includeSelf: boolean): boolean;
|
||||
remove(preserveChildren?: boolean): node;
|
||||
replace(nodeToReplace: node): void;
|
||||
|
||||
@@ -81,3 +81,18 @@ new CleanCSS({ returnPromise: true, sourceMap: true }).minify(source, inputSourc
|
||||
console.log(error);
|
||||
}
|
||||
);
|
||||
|
||||
// test object return when passing options as object
|
||||
let CleanCssOptions: CleanCSS.Options = { returnPromise: true };
|
||||
new CleanCSS(CleanCssOptions).minify(source)
|
||||
.then((minified: CleanCSS.Output): void => {
|
||||
console.log(minified.styles);
|
||||
}).catch((error: any): void => {
|
||||
console.log(error);
|
||||
}
|
||||
);
|
||||
|
||||
CleanCssOptions = { returnPromise: false };
|
||||
new CleanCSS(CleanCssOptions).minify(source, (error: any, minified: CleanCSS.Output): void => {
|
||||
console.log(minified.styles);
|
||||
});
|
||||
|
||||
155
types/clean-css/index.d.ts
vendored
155
types/clean-css/index.d.ts
vendored
@@ -8,83 +8,78 @@
|
||||
import { RequestOptions as HttpsRequestOptions } from "https";
|
||||
import { RequestOptions as HttpRequestOptions } from "http";
|
||||
|
||||
declare namespace CleanCSS {
|
||||
/**
|
||||
* Shared options passed when initializing a new instance of CleanCSS that returns either a promise or output
|
||||
*/
|
||||
interface OptionsBase {
|
||||
/**
|
||||
* Options passed when initializing a new instance of CleanCSS
|
||||
* Controls compatibility mode used; defaults to ie10+ using `'*'`.
|
||||
* Compatibility hash exposes the following properties: `colors`, `properties`, `selectors`, and `units`
|
||||
*/
|
||||
interface Options {
|
||||
/**
|
||||
* Controls compatibility mode used; defaults to ie10+ using `'*'`.
|
||||
* Compatibility hash exposes the following properties: `colors`, `properties`, `selectors`, and `units`
|
||||
*/
|
||||
compatibility?: "*" | "ie9" | "ie8" | "ie7" | CompatibilityOptions;
|
||||
compatibility?: "*" | "ie9" | "ie8" | "ie7" | CleanCSS.CompatibilityOptions;
|
||||
|
||||
/**
|
||||
* Controls a function for handling remote requests; Defaults to the build in `loadRemoteResource` function
|
||||
*/
|
||||
fetch?: (uri: string, inlineRequest: HttpRequestOptions | HttpsRequestOptions, inlineTimeout: number, done: (message: string | number, body: string) => void) => void;
|
||||
/**
|
||||
* Controls a function for handling remote requests; Defaults to the build in `loadRemoteResource` function
|
||||
*/
|
||||
fetch?: (uri: string, inlineRequest: HttpRequestOptions | HttpsRequestOptions, inlineTimeout: number, done: (message: string | number, body: string) => void) => void;
|
||||
|
||||
/**
|
||||
* Controls output CSS formatting; defaults to `false`.
|
||||
* Format hash exposes the following properties: `breaks`, `breakWith`, `indentBy`, `indentWith`, `spaces`, and `wrapAt`.
|
||||
*/
|
||||
format?: "beautify" | "keep-breaks" | FormatOptions | false;
|
||||
/**
|
||||
* Controls output CSS formatting; defaults to `false`.
|
||||
* Format hash exposes the following properties: `breaks`, `breakWith`, `indentBy`, `indentWith`, `spaces`, and `wrapAt`.
|
||||
*/
|
||||
format?: "beautify" | "keep-breaks" | CleanCSS.FormatOptions | false;
|
||||
|
||||
/**
|
||||
* inline option whitelists which @import rules will be processed. Defaults to `'local'`
|
||||
* Accepts the following values:
|
||||
* 'local': enables local inlining;
|
||||
* 'remote': enables remote inlining;
|
||||
* 'none': disables all inlining;
|
||||
* 'all': enables all inlining, same as ['local', 'remote'];
|
||||
* '[uri]': enables remote inlining from the specified uri;
|
||||
* '![url]': disables remote inlining from the specified uri;
|
||||
*/
|
||||
inline?: ReadonlyArray<string> | false;
|
||||
/**
|
||||
* inline option whitelists which @import rules will be processed. Defaults to `'local'`
|
||||
* Accepts the following values:
|
||||
* 'local': enables local inlining;
|
||||
* 'remote': enables remote inlining;
|
||||
* 'none': disables all inlining;
|
||||
* 'all': enables all inlining, same as ['local', 'remote'];
|
||||
* '[uri]': enables remote inlining from the specified uri;
|
||||
* '![url]': disables remote inlining from the specified uri;
|
||||
*/
|
||||
inline?: ReadonlyArray<string> | false;
|
||||
|
||||
/**
|
||||
* Controls extra options for inlining remote @import rules
|
||||
*/
|
||||
inlineRequest?: HttpRequestOptions | HttpsRequestOptions;
|
||||
/**
|
||||
* Controls extra options for inlining remote @import rules
|
||||
*/
|
||||
inlineRequest?: HttpRequestOptions | HttpsRequestOptions;
|
||||
|
||||
/**
|
||||
* Controls number of milliseconds after which inlining a remote @import fails; defaults to `5000`;
|
||||
*/
|
||||
inlineTimeout?: number;
|
||||
/**
|
||||
* Controls number of milliseconds after which inlining a remote @import fails; defaults to `5000`;
|
||||
*/
|
||||
inlineTimeout?: number;
|
||||
|
||||
/**
|
||||
* Controls optimization level used; defaults to `1`.
|
||||
* Level hash exposes `1`, and `2`.
|
||||
*/
|
||||
level?: 0 | 1 | 2 | OptimizationsOptions;
|
||||
/**
|
||||
* Controls optimization level used; defaults to `1`.
|
||||
* Level hash exposes `1`, and `2`.
|
||||
*/
|
||||
level?: 0 | 1 | 2 | CleanCSS.OptimizationsOptions;
|
||||
|
||||
/**
|
||||
* Controls URL rebasing; defaults to `true`;
|
||||
*/
|
||||
rebase?: boolean;
|
||||
/**
|
||||
* Controls URL rebasing; defaults to `true`;
|
||||
*/
|
||||
rebase?: boolean;
|
||||
|
||||
/**
|
||||
* controls a directory to which all URLs are rebased, most likely the directory under which the output file
|
||||
* will live; defaults to the current directory;
|
||||
*/
|
||||
rebaseTo?: string;
|
||||
/**
|
||||
* controls a directory to which all URLs are rebased, most likely the directory under which the output file
|
||||
* will live; defaults to the current directory;
|
||||
*/
|
||||
rebaseTo?: string;
|
||||
|
||||
/**
|
||||
* If you prefer clean-css to return a Promise object then you need to explicitely ask for it; defaults to `false`
|
||||
*/
|
||||
returnPromise?: boolean;
|
||||
/**
|
||||
* Controls whether an output source map is built; defaults to `false`
|
||||
*/
|
||||
sourceMap?: boolean;
|
||||
|
||||
/**
|
||||
* Controls whether an output source map is built; defaults to `false`
|
||||
*/
|
||||
sourceMap?: boolean;
|
||||
|
||||
/**
|
||||
* Controls embedding sources inside a source map's `sourcesContent` field; defaults to `false`
|
||||
*/
|
||||
sourceMapInlineSources?: boolean;
|
||||
}
|
||||
/**
|
||||
* Controls embedding sources inside a source map's `sourcesContent` field; defaults to `false`
|
||||
*/
|
||||
sourceMapInlineSources?: boolean;
|
||||
}
|
||||
|
||||
declare namespace CleanCSS {
|
||||
/**
|
||||
* Output returned when calling minify functions
|
||||
*/
|
||||
@@ -650,12 +645,40 @@ declare namespace CleanCSS {
|
||||
minify(sources: Sources, sourceMap?: string): Promise<Output>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options when returning a promise
|
||||
*/
|
||||
type OptionsPromise = OptionsBase & {
|
||||
/**
|
||||
* If you prefer clean-css to return a Promise object then you need to explicitly ask for it; defaults to `false`
|
||||
*/
|
||||
returnPromise: true
|
||||
};
|
||||
|
||||
/**
|
||||
* Options when returning an output
|
||||
*/
|
||||
type OptionsOutput = OptionsBase & {
|
||||
/**
|
||||
* If you prefer clean-css to return a Promise object then you need to explicitly ask for it; defaults to `false`
|
||||
*/
|
||||
returnPromise?: false
|
||||
};
|
||||
|
||||
/**
|
||||
* Discriminant union of both sets of options types. If you initialize without setting `returnPromise: true`
|
||||
* and want to return a promise, you will need to cast to the correct options type so that TypeScript
|
||||
* knows what the expected return type will be:
|
||||
* `(options = options as CleanCSS.OptionsPromise).returnPromise = true`
|
||||
*/
|
||||
type Options = OptionsPromise | OptionsOutput;
|
||||
|
||||
/**
|
||||
* Constructor interface for CleanCSS
|
||||
*/
|
||||
interface Constructor {
|
||||
new(options: Options & { returnPromise: true }): MinifierPromise;
|
||||
new(options?: Options): MinifierOutput;
|
||||
new(options: OptionsPromise): MinifierPromise;
|
||||
new(options?: OptionsOutput): MinifierOutput;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as React from "react";
|
||||
import Cleave = require("cleave.js");
|
||||
import CleaveReact = require("cleave.js/react");
|
||||
import { Props } from "cleave.js/react/props";
|
||||
import { Props, ChangeEvent } from "cleave.js/react/props";
|
||||
|
||||
const ExampleSelector1 = () => {
|
||||
const cleave = new Cleave("#my-input", { phone: true });
|
||||
@@ -41,3 +41,17 @@ const ExampleReact2 = (props: Props) => {
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
const ExampleReact3 = (props: Props) => {
|
||||
const handleChange = (e: ChangeEvent<HTMLInputElement>) => {
|
||||
return e.target.rawValue;
|
||||
};
|
||||
return (
|
||||
<CleaveReact
|
||||
value="test"
|
||||
className="form-control"
|
||||
options={{ date: true }}
|
||||
onChange={handleChange}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
2
types/cleave.js/index.d.ts
vendored
2
types/cleave.js/index.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for cleave.js 1.3
|
||||
// Type definitions for cleave.js 1.4
|
||||
// Project: https://github.com/nosir/cleave.js
|
||||
// Definitions by: C Lentfort <https://github.com/clentfort>,
|
||||
// J Giancono <https://github.com/jasongi-at-sportsbet>,
|
||||
|
||||
7
types/cleave.js/react/props.d.ts
vendored
7
types/cleave.js/react/props.d.ts
vendored
@@ -3,8 +3,15 @@ import { CleaveOptions } from "../options";
|
||||
|
||||
export type InitHandler = (owner: React.ReactInstance) => void;
|
||||
|
||||
export interface ChangeEvent<T> extends React.ChangeEvent<T> {
|
||||
target: { rawValue: string } & EventTarget & T;
|
||||
}
|
||||
|
||||
export type ChangeEventHandler<T = Element> = React.EventHandler<ChangeEvent<T>>;
|
||||
|
||||
export interface Props extends React.InputHTMLAttributes<HTMLInputElement> {
|
||||
onInit?: InitHandler;
|
||||
options: CleaveOptions;
|
||||
htmlRef?: (i: any) => void;
|
||||
onChange?: ChangeEventHandler<HTMLInputElement>;
|
||||
}
|
||||
|
||||
6
types/clusterize.js/index.d.ts
vendored
6
types/clusterize.js/index.d.ts
vendored
@@ -32,9 +32,9 @@ declare namespace Clusterize {
|
||||
}
|
||||
|
||||
interface Callbacks {
|
||||
clusterWillChange?(cb: () => void): void;
|
||||
clusterChanged?(cb: () => void): void;
|
||||
scrollingProgress?(cb: (progress: number) => void): void;
|
||||
clusterWillChange?: () => void;
|
||||
clusterChanged?: () => void;
|
||||
scrollingProgress?: (progress: number) => void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ client.getAccount("abcdef", (error: Error, account: coinbase.Account): void => {
|
||||
|
||||
account.getBuy("abcdef", (error: Error, buy: coinbase.Buy): void => undefined);
|
||||
|
||||
account.getBuys((error: Error, buy: coinbase.Buy[]): void => undefined);
|
||||
account.getBuys(null, (error: Error, buy: coinbase.Buy[]): void => undefined);
|
||||
|
||||
account.getDeposit("abcdef", (error: Error, deposit: coinbase.Deposit): void => undefined);
|
||||
|
||||
@@ -33,7 +33,7 @@ client.getAccount("abcdef", (error: Error, account: coinbase.Account): void => {
|
||||
|
||||
account.getSell("abcdef", (error: Error, deposit: coinbase.Sell): void => undefined);
|
||||
|
||||
account.getSells((error: Error, deposit: coinbase.Sell[]): void => undefined);
|
||||
account.getSells(null, (error: Error, deposit: coinbase.Sell[]): void => undefined);
|
||||
|
||||
account.getTransaction("abcdef", (error: Error, deposit: coinbase.Transaction): void => undefined);
|
||||
|
||||
|
||||
67
types/coinbase/index.d.ts
vendored
67
types/coinbase/index.d.ts
vendored
@@ -536,6 +536,21 @@ export class Account implements Resource {
|
||||
*/
|
||||
balance: MoneyHash;
|
||||
|
||||
/**
|
||||
* Allow deposits
|
||||
*/
|
||||
allow_deposits: boolean;
|
||||
|
||||
/**
|
||||
* Allow withdrawls
|
||||
*/
|
||||
allow_withdrawals: boolean;
|
||||
|
||||
/**
|
||||
* Account worth in fiat.
|
||||
*/
|
||||
native_balance: MoneyHash;
|
||||
|
||||
/**
|
||||
* Promote an account as primary account.
|
||||
* Scope: wallet:accounts:update
|
||||
@@ -630,7 +645,7 @@ export class Account implements Resource {
|
||||
* Lists buys for an account.
|
||||
* Scope: wallet:buys:read
|
||||
*/
|
||||
getBuys(cb: (error: Error, result: Buy[]) => void): void;
|
||||
getBuys(opts: null, cb: (error: Error, result: Buy[]) => void): void;
|
||||
|
||||
/**
|
||||
* Show an individual buy.
|
||||
@@ -663,7 +678,7 @@ export class Account implements Resource {
|
||||
* Lists sells for an account.
|
||||
* Scope: wallet:sells:read
|
||||
*/
|
||||
getSells(cb: (error: Error, result: Sell[]) => void): void;
|
||||
getSells(opts: null, cb: (error: Error, result: Sell[]) => void): void;
|
||||
|
||||
/**
|
||||
* Show an individual sell.
|
||||
@@ -883,7 +898,7 @@ export class Buy implements Resource {
|
||||
/**
|
||||
* Fee associated to this buy
|
||||
*/
|
||||
fee: MoneyHash;
|
||||
fees: Fee[];
|
||||
|
||||
/**
|
||||
* Has this buy been committed?
|
||||
@@ -900,6 +915,26 @@ export class Buy implements Resource {
|
||||
*/
|
||||
payout_at?: string;
|
||||
|
||||
/**
|
||||
* Unit price of the base currency.
|
||||
*/
|
||||
unit_price: UnitPrice;
|
||||
|
||||
/**
|
||||
* Hold period for transfer.
|
||||
*/
|
||||
hold_business_days: number;
|
||||
|
||||
/**
|
||||
* Is it the first buy for this symbol?
|
||||
*/
|
||||
is_first_buy: boolean;
|
||||
|
||||
/**
|
||||
* Is there another action required to make the transfer pass?
|
||||
*/
|
||||
requires_completion_step: boolean;
|
||||
|
||||
/**
|
||||
* Completes a buy that is created in commit: false state.
|
||||
* If the exchange rate has changed since the buy was created, this call will fail with the error “The exchange rate updated while you
|
||||
@@ -910,6 +945,32 @@ export class Buy implements Resource {
|
||||
commit(cb: (error: Error, transaction: Buy) => void): void;
|
||||
}
|
||||
|
||||
export interface Fee {
|
||||
/**
|
||||
* Amount associated to this fee
|
||||
*/
|
||||
amount: MoneyHash;
|
||||
/**
|
||||
* Fee beneficiary ("bank", "coinbase", ...)
|
||||
*/
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface UnitPrice {
|
||||
/**
|
||||
* Amount as floating-point in a string
|
||||
*/
|
||||
amount: string;
|
||||
/**
|
||||
* Currency e.g. "BTC" (see Client#getCurrencies() for available strings)
|
||||
*/
|
||||
currency: string;
|
||||
/**
|
||||
* Type of price
|
||||
*/
|
||||
scale: number;
|
||||
}
|
||||
|
||||
export type SellStatus = "created" | "completed" | "canceled";
|
||||
|
||||
/**
|
||||
|
||||
9
types/commonmark/index.d.ts
vendored
9
types/commonmark/index.d.ts
vendored
@@ -4,15 +4,18 @@
|
||||
// Leonard Thieu <https://github.com/leonard-thieu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export type NodeType =
|
||||
'text' |'softbreak' | 'linebreak' | 'emph' | 'strong' | 'html_inline' | 'link' | 'image' | 'code' | 'document' | 'paragraph' |
|
||||
'block_quote' | 'item' | 'list' | 'heading' | 'code_block' | 'html_block' | 'thematic_break' | 'custom_inline' | 'custom_block';
|
||||
|
||||
export class Node {
|
||||
constructor(nodeType: string, sourcepos?: Position);
|
||||
constructor(nodeType: NodeType, sourcepos?: Position);
|
||||
|
||||
/**
|
||||
* (read-only): a String, one of text, softbreak, linebreak, emph, strong, html_inline, link, image, code, document, paragraph,
|
||||
* block_quote, item, list, heading, code_block, html_block, thematic_break.
|
||||
*/
|
||||
readonly type: 'text' | 'softbreak' | 'linebreak' | 'emph' | 'strong' | 'html_inline' | 'link' | 'image' | 'code' | 'document' | 'paragraph' |
|
||||
'block_quote' | 'item' | 'list' | 'heading' | 'code_block' | 'html_block' | 'thematic_break' | 'custom_inline' | 'custom_block';
|
||||
readonly type: NodeType;
|
||||
/**
|
||||
* (read-only): a Node or null.
|
||||
*/
|
||||
|
||||
23
types/content-range/content-range-tests.ts
Normal file
23
types/content-range/content-range-tests.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { format, parse } from 'content-range';
|
||||
|
||||
format({
|
||||
first: 10,
|
||||
last: 100,
|
||||
length: 100,
|
||||
limit: 20,
|
||||
unit: 'items',
|
||||
});
|
||||
|
||||
format({
|
||||
length: null,
|
||||
unit: 'bytes',
|
||||
});
|
||||
|
||||
const parts = parse('items 10-29/100');
|
||||
|
||||
if (parts) {
|
||||
parts.first;
|
||||
parts.last;
|
||||
parts.length;
|
||||
parts.unit;
|
||||
}
|
||||
22
types/content-range/index.d.ts
vendored
Normal file
22
types/content-range/index.d.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
// Type definitions for content-range 1.1
|
||||
// Project: https://github.com/neoziro/content-range
|
||||
// Definitions by: Alex Brick <https://github.com/bricka>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface ContentRangeFormatOptions {
|
||||
first?: number;
|
||||
last?: number;
|
||||
length: number | null;
|
||||
limit?: number;
|
||||
unit: string;
|
||||
}
|
||||
|
||||
export interface ContentRangeParts {
|
||||
first: number | null;
|
||||
last: number | null;
|
||||
length: number | null;
|
||||
unit: string;
|
||||
}
|
||||
|
||||
export function format(options: ContentRangeFormatOptions): string;
|
||||
export function parse(str: string): ContentRangeParts | null;
|
||||
23
types/content-range/tsconfig.json
Normal file
23
types/content-range/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"content-range-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/content-range/tslint.json
Normal file
1
types/content-range/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
27
types/cron/index.d.ts
vendored
27
types/cron/index.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for cron 1.3
|
||||
// Type definitions for cron 1.6
|
||||
// Project: https://www.npmjs.com/package/cron
|
||||
// Definitions by: Hiroki Horiuchi <https://github.com/horiuchi>
|
||||
// Lundarl Gholoi <https://github.com/winup>
|
||||
@@ -9,8 +9,9 @@ export declare class CronTime {
|
||||
* Create a new ```CronTime```.
|
||||
* @param source The time to fire off your job. This can be in the form of cron syntax or a JS ```Date``` object.
|
||||
* @param zone Timezone name. You can check all timezones available at [Moment Timezone Website](http://momentjs.com/timezone/).
|
||||
* @param utcOffset UTC offset. Don't use both ```zone``` and ```utcOffset``` together or weird things may happen.
|
||||
*/
|
||||
constructor(source: string | Date, zone?: string);
|
||||
constructor(source: string | Date, zone?: string, utcOffset?: string | number);
|
||||
|
||||
/**
|
||||
* Tells you when ```CronTime``` will be run.
|
||||
@@ -29,19 +30,19 @@ export declare interface CronJobParameters {
|
||||
*/
|
||||
cronTime: string | Date;
|
||||
/**
|
||||
* The function to fire at the specified time.
|
||||
* The function to fire at the specified time. If an ```onComplete``` callback was provided, ```onTick``` will receive it as an argument. ```onTick``` may call ```onComplete``` when it has finished its work.
|
||||
*/
|
||||
onTick: () => void;
|
||||
/**
|
||||
* A function that will fire when the job is complete, when it is stopped.
|
||||
* A function that will fire when the job is stopped with ```job.stop()```, and may also be called by ```onTick``` at the end of each run.
|
||||
*/
|
||||
onComplete?: () => void;
|
||||
/**
|
||||
* Specifies whether to start the job just before exiting the constructor. By default this is set to false. If left at default you will need to call ```job.start()``` in order to start the job (assuming ```job``` is the variable you set the cronjob to). This does not immediately fire your onTick function, it just gives you more control over the behavior of your jobs.
|
||||
* Specifies whether to start the job just before exiting the constructor. By default this is set to false. If left at default you will need to call ```job.start()``` in order to start the job (assuming ```job``` is the variable you set the cronjob to). This does not immediately fire your ```onTick``` function, it just gives you more control over the behavior of your jobs.
|
||||
*/
|
||||
start?: boolean;
|
||||
/**
|
||||
* Specify the timezone for the execution. This will modify the actual time relative to your timezone. If the timezone is invalid, an error is thrown. You can check all timezones available at [Moment Timezone Website](http://momentjs.com/timezone/).
|
||||
* Specify the timezone for the execution. This will modify the actual time relative to your timezone. If the timezone is invalid, an error is thrown. You can check all timezones available at [Moment Timezone Website](http://momentjs.com/timezone/). Probably don't use both ```timeZone``` and ```utcOffset``` together or weird things may happen.
|
||||
*/
|
||||
timeZone?: string;
|
||||
/**
|
||||
@@ -52,6 +53,14 @@ export declare interface CronJobParameters {
|
||||
* This will immediately fire your ```onTick``` function as soon as the requisit initialization has happened. This option is set to ```false``` by default for backwards compatibility.
|
||||
*/
|
||||
runOnInit?: boolean;
|
||||
/**
|
||||
* This allows you to specify the offset of your timezone rather than using the ```timeZone``` param. Probably don't use both ```timeZone``` and ```utcOffset``` together or weird things may happen.
|
||||
*/
|
||||
utcOffset?: string | number;
|
||||
/**
|
||||
* If you have code that keeps the event loop running and want to stop the node process when that finishes regardless of the state of your cronjob, you can do so making use of this parameter. This is off by default and cron will run as if it needs to control the event loop. For more information take a look at [timers#timers_timeout_unref](https://nodejs.org/api/timers.html#timers_timeout_unref) from the NodeJS docs.
|
||||
*/
|
||||
unrefTimeout?: boolean;
|
||||
}
|
||||
|
||||
export declare class CronJob {
|
||||
@@ -73,8 +82,10 @@ export declare class CronJob {
|
||||
* @param timeZone Specify the timezone for the execution. This will modify the actual time relative to your timezone. If the timezone is invalid, an error is thrown. You can check all timezones available at [Moment Timezone Website](http://momentjs.com/timezone/).
|
||||
* @param context The context within which to execute the onTick method. This defaults to the cronjob itself allowing you to call ```this.stop()```. However, if you change this you'll have access to the functions and values within your context object.
|
||||
* @param runOnInit This will immediately fire your ```onTick``` function as soon as the requisit initialization has happened. This option is set to ```false``` by default for backwards compatibility.
|
||||
* @param utcOffset This allows you to specify the offset of your timezone rather than using the ```timeZone``` param. Probably don't use both ```timeZone``` and ```utcOffset``` together or weird things may happen.
|
||||
* @param unrefTimeout If you have code that keeps the event loop running and want to stop the node process when that finishes regardless of the state of your cronjob, you can do so making use of this parameter. This is off by default and cron will run as if it needs to control the event loop. For more information take a look at [timers#timers_timeout_unref](https://nodejs.org/api/timers.html#timers_timeout_unref) from the NodeJS docs.
|
||||
*/
|
||||
constructor(cronTime: string | Date, onTick: () => void, onComplete?: () => void, start?: boolean, timeZone?: string, context?: any, runOnInit?: boolean);
|
||||
constructor(cronTime: string | Date, onTick: () => void, onComplete?: () => void, start?: boolean, timeZone?: string, context?: any, runOnInit?: boolean, utcOffset?: string | number, unrefTimeout?: boolean);
|
||||
/**
|
||||
* Create a new ```CronJob```.
|
||||
* @param options Job parameters.
|
||||
@@ -111,7 +122,7 @@ export declare class CronJob {
|
||||
}
|
||||
|
||||
export declare var job:
|
||||
((cronTime: string | Date, onTick: () => void, onComplete?: () => void, start?: boolean, timeZone?: string, context?: any, runOnInit?: boolean) => CronJob)
|
||||
((cronTime: string | Date, onTick: () => void, onComplete?: () => void, start?: boolean, timeZone?: string, context?: any, runOnInit?: boolean, utcOffset?: string | number, unrefTimeout?: boolean) => CronJob)
|
||||
| ((options: CronJobParameters) => CronJob);
|
||||
export declare var time: (source: string | Date, zone?: string) => CronTime;
|
||||
export declare var sendAt: (cronTime: CronTime) => Date;
|
||||
|
||||
@@ -10,17 +10,20 @@ CustomFunctions.associate({
|
||||
RANDOM: (n: number) => n * Math.random()
|
||||
});
|
||||
|
||||
function callerAddress(invocation: CustomFunctions.Invocation) {
|
||||
return invocation.address;
|
||||
}
|
||||
|
||||
async function getStockValues(ticker: string): Promise<number> {
|
||||
const response = await fetch(`myService.com/prices/${ticker}`);
|
||||
return (await response.json())["price"];
|
||||
}
|
||||
|
||||
async function getStockValuesCancellable(
|
||||
ticker: string,
|
||||
handler: CustomFunctions.CancelableHandler
|
||||
): Promise<number> {
|
||||
async function getStockValuesCancellable(ticker: string,
|
||||
invocation: CustomFunctions.CancelableInvocation): Promise<number> {
|
||||
const address = invocation.address;
|
||||
let shouldStop = false;
|
||||
handler.onCanceled = () => (shouldStop = true);
|
||||
invocation.onCanceled = () => (shouldStop = true);
|
||||
await pause(1000);
|
||||
|
||||
if (shouldStop) {
|
||||
@@ -31,10 +34,9 @@ async function getStockValuesCancellable(
|
||||
return (await response.json())["price"];
|
||||
}
|
||||
|
||||
function stockPriceStream(
|
||||
ticker: string,
|
||||
handler: CustomFunctions.StreamingHandler<number>
|
||||
) {
|
||||
function stockPriceStream(ticker: string,
|
||||
invocation: CustomFunctions.StreamingInvocation<number>) {
|
||||
const address = invocation.address;
|
||||
const updateFrequency = 10 /* milliseconds*/;
|
||||
let isPending = false;
|
||||
|
||||
@@ -49,14 +51,14 @@ function stockPriceStream(
|
||||
try {
|
||||
const response = await fetch(url);
|
||||
const data = await response.json();
|
||||
handler.setResult(data.price);
|
||||
invocation.setResult(data.price);
|
||||
} catch (error) {
|
||||
handler.setResult(error);
|
||||
invocation.setResult(error);
|
||||
}
|
||||
isPending = false;
|
||||
}, updateFrequency);
|
||||
|
||||
handler.onCanceled = () => {
|
||||
invocation.onCanceled = () => {
|
||||
clearInterval(timer);
|
||||
};
|
||||
}
|
||||
|
||||
66
types/custom-functions-runtime/index.d.ts
vendored
66
types/custom-functions-runtime/index.d.ts
vendored
@@ -1,6 +1,9 @@
|
||||
// Type definitions for Custom Functions 1.4
|
||||
// Project: https://github.com/OfficeDev/office-js
|
||||
// Definitions by: OfficeDev <https://github.com/OfficeDev>, Michael Zlatkovsky <https://github.com/Zlatkovsky>, Michelle Scharlock <https://github.com/mscharlock>
|
||||
// Definitions by: OfficeDev <https://github.com/OfficeDev>,
|
||||
// Adam Krantz <https://github.com/akrantz>,
|
||||
// Michael Zlatkovsky <https://github.com/Zlatkovsky>,
|
||||
// Michelle Scharlock <https://github.com/mscharlock>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
@@ -10,8 +13,8 @@ Copyright (c) Microsoft Corporation
|
||||
*/
|
||||
|
||||
/**
|
||||
* CustomFunctions namespace, used by Excel Custom Functions
|
||||
* @beta
|
||||
* CustomFunctions namespace, used by Excel Custom Functions
|
||||
*/
|
||||
declare namespace CustomFunctions {
|
||||
/**
|
||||
@@ -26,30 +29,67 @@ declare namespace CustomFunctions {
|
||||
function associate(mappings: { [key: string]: Function }): void;
|
||||
|
||||
/**
|
||||
* A handler passed automatically as the last parameter
|
||||
* to a streaming function. With this parameter, a
|
||||
* function can use handler.setResult to set a cell value
|
||||
* or hook into the handler.onCanceled event to
|
||||
* to handle what happens when the function stops streaming.
|
||||
* @beta
|
||||
* Provides information about the invocation of a custom function.
|
||||
*/
|
||||
interface StreamingHandler<T> extends CancelableHandler {
|
||||
interface Invocation {
|
||||
/**
|
||||
* Sets the returned result for a streaming custom function.
|
||||
* @beta
|
||||
* The cell address where the function is being called, if requested, otherwise undefined.
|
||||
*
|
||||
* To request the address for the function, in the metadata JSON file, the function options should specify:
|
||||
* `{ "requiresAddress": true }`
|
||||
*
|
||||
* If the metadata JSON file is being generated from JSDoc comments, include the tag `@requiresAddress`.
|
||||
*/
|
||||
setResult: (value: T | Error) => void;
|
||||
address?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* CancelableHandler interface
|
||||
* Provides information about the invocation of a cancelable custom function.
|
||||
* A cancelable custom function can provide a handler for the onCanceled event.
|
||||
*
|
||||
* To indicate that a function is cancelable, in the metadata JSON file, the function options should specify:
|
||||
* `{ "cancelable": true }`
|
||||
*
|
||||
* If the metadata JSON file is being generated from JSDoc comments, include the tag `@cancelable`.
|
||||
*/
|
||||
interface CancelableHandler {
|
||||
interface CancelableInvocation extends Invocation {
|
||||
/**
|
||||
* Handles what should occur when a custom function is canceled.
|
||||
* @beta
|
||||
* Event handler called when the custom function is canceled.
|
||||
*/
|
||||
onCanceled: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* @deprecated Use `CancelableInvocation` instead.
|
||||
*/
|
||||
interface CancelableHandler extends CancelableInvocation {
|
||||
}
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* Provides information about the invocation of a streaming custom function.
|
||||
* A streaming custom function can provide results which can change over time.
|
||||
*
|
||||
* Call `setResult()` one or more times to provide the result instead of returning
|
||||
* a result from the function.
|
||||
*/
|
||||
interface StreamingInvocation<ResultType> extends CancelableInvocation {
|
||||
/**
|
||||
* @beta
|
||||
* Set the result for the custom function. May be called more than once.
|
||||
*/
|
||||
setResult: (value: ResultType | Error) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* @beta
|
||||
* @deprecated Use `StreamingInvocation<ResultType>` instead.
|
||||
*/
|
||||
interface StreamingHandler<ResultType> extends StreamingInvocation<ResultType> {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"ban-types": false,
|
||||
"file-name-casing": false
|
||||
"file-name-casing": false,
|
||||
"no-empty-interface": false
|
||||
}
|
||||
}
|
||||
|
||||
2
types/d3-array/index.d.ts
vendored
2
types/d3-array/index.d.ts
vendored
@@ -181,7 +181,7 @@ export function ascending(a: Primitive | undefined, b: Primitive | undefined): n
|
||||
|
||||
// NB. this is limited to primitive values due to D3's use of the <, >, and >= operators. Results get weird for object instances.
|
||||
/**
|
||||
* Compares two primitive values for sorting (in ascending order).
|
||||
* Compares two primitive values for sorting (in descending order).
|
||||
*/
|
||||
export function descending(a: Primitive | undefined, b: Primitive | undefined): number;
|
||||
|
||||
|
||||
7
types/defaults-deep/defaults-deep-tests.ts
Normal file
7
types/defaults-deep/defaults-deep-tests.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import defaults = require('defaults-deep');
|
||||
|
||||
defaults();
|
||||
defaults({a: 'foo'});
|
||||
defaults({a: 'foo'}, {a: 'bar'});
|
||||
defaults({a: 'foo'}, {a: 'bar'}, {a: 'foobar'});
|
||||
defaults({a: {b: 'foo'}}, {a: {b: 'bar'}});
|
||||
12
types/defaults-deep/index.d.ts
vendored
Normal file
12
types/defaults-deep/index.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// Type definitions for defaults-deep 0.2
|
||||
// Project: https://github.com/jonschlinkert/defaults-deep
|
||||
// Definitions by: Hugo Alliaume <https://github.com/Kocal>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface Obj {
|
||||
[k: string]: any;
|
||||
}
|
||||
|
||||
declare function defaultsDeep(...objs: Obj[]): Obj;
|
||||
|
||||
export = defaultsDeep;
|
||||
23
types/defaults-deep/tsconfig.json
Normal file
23
types/defaults-deep/tsconfig.json
Normal 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",
|
||||
"defaults-deep-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/defaults-deep/tslint.json
Normal file
1
types/defaults-deep/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
6
types/dhtmlxgantt/index.d.ts
vendored
6
types/dhtmlxgantt/index.d.ts
vendored
@@ -1455,13 +1455,13 @@ interface GanttStatic {
|
||||
* exports a Gantt chart into the PDF format
|
||||
* @param _export_ an object with export settings (see the details)
|
||||
*/
|
||||
exportToPDF(_export_: any): void;
|
||||
exportToPDF(_export_?: any): void;
|
||||
|
||||
/**
|
||||
* exports a Gantt chart into the PNG format
|
||||
* @param _export_ an object with export settings (see the details)
|
||||
*/
|
||||
exportToPNG(_export_: any): void;
|
||||
exportToPNG(_export_?: any): void;
|
||||
|
||||
/**
|
||||
* returns all dependency loops in the chart
|
||||
@@ -2242,4 +2242,4 @@ declare module "gantt" {
|
||||
|
||||
declare module "Gantt" {
|
||||
export = Gantt;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,47 +1,55 @@
|
||||
import jsdiff = require('diff');
|
||||
import * as diff from 'diff';
|
||||
|
||||
const one = 'beep boop';
|
||||
const other = 'beep boob blah';
|
||||
|
||||
let diff = jsdiff.diffChars(one, other);
|
||||
printDiff(diff);
|
||||
let changes = diff.diffChars(one, other);
|
||||
examineChanges(changes);
|
||||
|
||||
const diffArraysResult = jsdiff.diffArrays<string>(['a', 'b', 'c'], ['a', 'c', 'd']);
|
||||
// $ExpectType void
|
||||
diff.diffChars(one, other, {
|
||||
callback: (err, value) => {
|
||||
err; // $ExpectType undefined
|
||||
value; // $ExpectType Change[] | undefined
|
||||
},
|
||||
});
|
||||
// $ExpectType void
|
||||
diff.diffChars(one, other, (err, value) => {
|
||||
err; // $ExpectType undefined
|
||||
value; // $ExpectType Change[] | undefined
|
||||
});
|
||||
|
||||
const diffArraysResult = diff.diffArrays(['a', 'b', 'c'], ['a', 'c', 'd']);
|
||||
diffArraysResult.forEach(result => {
|
||||
if (result.added) {
|
||||
console.log(`added ${result.value.length} line(s):`, ...result.value);
|
||||
} else if (result.removed) {
|
||||
console.log(`removed ${result.value.length} line(s):`, ...result.value);
|
||||
} else {
|
||||
console.log(`no changes`);
|
||||
}
|
||||
result.added; // $ExpectType boolean | undefined
|
||||
result.removed; // $ExpectType boolean | undefined
|
||||
result.value; // $ExpectType string[]
|
||||
result.count; // $ExpectType number | undefined
|
||||
});
|
||||
|
||||
interface DiffObj {
|
||||
value: number;
|
||||
}
|
||||
const a: DiffObj = {value: 0};
|
||||
const b: DiffObj = {value: 1};
|
||||
const c: DiffObj = {value: 2};
|
||||
const d: DiffObj = {value: 3};
|
||||
const arrayOptions: jsdiff.IArrayOptions = {
|
||||
comparator: (left: DiffObj, right: DiffObj) => {
|
||||
return left.value === right.value;
|
||||
}
|
||||
const a: DiffObj = { value: 0 };
|
||||
const b: DiffObj = { value: 1 };
|
||||
const c: DiffObj = { value: 2 };
|
||||
const d: DiffObj = { value: 3 };
|
||||
const arrayOptions: diff.ArrayOptions<DiffObj, DiffObj> = {
|
||||
comparator: (left, right) => {
|
||||
return left.value === right.value;
|
||||
},
|
||||
};
|
||||
const diffResult = jsdiff.diffArrays([a, b, c], [a, b, d], arrayOptions);
|
||||
diffResult.forEach(result => {
|
||||
if (result.added) {
|
||||
console.log(`added ${result.value.length} line(s):`, ...result.value);
|
||||
} else if (result.removed) {
|
||||
console.log(`removed ${result.value.length} line(s):`, ...result.value);
|
||||
} else {
|
||||
console.log(`no changes`);
|
||||
}
|
||||
const arrayChanges = diff.diffArrays([a, b, c], [a, b, d], arrayOptions);
|
||||
arrayChanges.forEach(result => {
|
||||
result.added; // $ExpectType boolean | undefined
|
||||
result.removed; // $ExpectType boolean | undefined
|
||||
result.value; // $ExpectType DiffObj[]
|
||||
result.count; // $ExpectType number | undefined
|
||||
});
|
||||
|
||||
// --------------------------
|
||||
|
||||
class LineDiffWithoutWhitespace extends jsdiff.Diff {
|
||||
class LineDiffWithoutWhitespace extends diff.Diff {
|
||||
tokenize(value: string): any {
|
||||
return value.split(/^/m);
|
||||
}
|
||||
@@ -52,71 +60,62 @@ class LineDiffWithoutWhitespace extends jsdiff.Diff {
|
||||
}
|
||||
|
||||
const obj = new LineDiffWithoutWhitespace();
|
||||
diff = obj.diff(one, other);
|
||||
printDiff(diff);
|
||||
changes = obj.diff(one, other);
|
||||
examineChanges(changes);
|
||||
|
||||
function printDiff(diff: jsdiff.IDiffResult[]) {
|
||||
function addLineHeader(decorator: string, str: string | string[]) {
|
||||
return (typeof str === 'string' ? str.split("\n") : str).map((line, index, array) => {
|
||||
if (index === array.length - 1 && line === "") {
|
||||
return line;
|
||||
} else {
|
||||
return decorator + line;
|
||||
}
|
||||
}).join("\n");
|
||||
}
|
||||
|
||||
diff.forEach((part) => {
|
||||
if (part.added) {
|
||||
console.log(addLineHeader("+", part.value));
|
||||
} else if (part.removed) {
|
||||
console.log(addLineHeader("-", part.value));
|
||||
} else {
|
||||
console.log(addLineHeader(" ", part.value));
|
||||
}
|
||||
function examineChanges(diff: diff.Change[]) {
|
||||
diff.forEach(part => {
|
||||
part.added; // $ExpectType boolean | undefined
|
||||
part.removed; // $ExpectType boolean | undefined
|
||||
part.value; // $ExpectType string
|
||||
part.count; // $ExpectType number | undefined
|
||||
});
|
||||
}
|
||||
|
||||
function verifyPatchMethods(oldStr: string, newStr: string, uniDiff: jsdiff.IUniDiff) {
|
||||
const verifyPatch = jsdiff.parsePatch(
|
||||
jsdiff.createTwoFilesPatch("oldFile.ts", "newFile.ts", oldStr, newStr,
|
||||
"old", "new", { context: 1 }));
|
||||
function verifyPatchMethods(oldStr: string, newStr: string, uniDiff: diff.ParsedDiff) {
|
||||
const verifyPatch = diff.parsePatch(
|
||||
diff.createTwoFilesPatch('oldFile.ts', 'newFile.ts', oldStr, newStr, 'old', 'new', {
|
||||
context: 1,
|
||||
})
|
||||
);
|
||||
|
||||
if (JSON.stringify(verifyPatch[0], Object.keys(verifyPatch[0]).sort()) !== JSON.stringify(uniDiff, Object.keys(uniDiff).sort())) {
|
||||
console.error("Patch did not match uniDiff");
|
||||
if (
|
||||
JSON.stringify(verifyPatch[0], Object.keys(verifyPatch[0]).sort()) !==
|
||||
JSON.stringify(uniDiff, Object.keys(uniDiff).sort())
|
||||
) {
|
||||
throw new Error('Patch did not match uniDiff');
|
||||
}
|
||||
}
|
||||
function verifyApplyMethods(oldStr: string, newStr: string, uniDiff: jsdiff.IUniDiff) {
|
||||
const verifyApply = [
|
||||
jsdiff.applyPatch(oldStr, uniDiff),
|
||||
jsdiff.applyPatch(oldStr, [uniDiff])
|
||||
];
|
||||
jsdiff.applyPatches([uniDiff], {
|
||||
loadFile: (index: number, callback: (err: Error, data: string) => void) => {
|
||||
function verifyApplyMethods(oldStr: string, newStr: string, uniDiff: diff.ParsedDiff) {
|
||||
const verifyApply = [diff.applyPatch(oldStr, uniDiff), diff.applyPatch(oldStr, [uniDiff])];
|
||||
diff.applyPatches([uniDiff], {
|
||||
loadFile: (index, callback) => {
|
||||
index; // $ExpectType ParsedDiff
|
||||
callback(undefined, one);
|
||||
},
|
||||
patched: (index: number, content: string) => {
|
||||
patched: (index, content) => {
|
||||
index; // $ExpectType ParsedDiff
|
||||
verifyApply.push(content);
|
||||
},
|
||||
complete: (err?: Error) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
throw err;
|
||||
}
|
||||
|
||||
verifyApply.forEach(result => {
|
||||
if (result !== newStr) {
|
||||
console.error("Result did not match newStr");
|
||||
throw new Error('Result did not match newStr');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const uniDiffPatch = jsdiff.structuredPatch("oldFile.ts", "newFile.ts", one, other,
|
||||
"old", "new", { context: 1 });
|
||||
const uniDiffPatch = diff.structuredPatch('oldFile.ts', 'newFile.ts', one, other, 'old', 'new', {
|
||||
context: 1,
|
||||
});
|
||||
verifyPatchMethods(one, other, uniDiffPatch);
|
||||
|
||||
const uniDiffStr = jsdiff.createPatch("file.ts", one, other, "old", "new",
|
||||
{ context: 1 });
|
||||
const uniDiffApply = jsdiff.parsePatch(uniDiffStr)[0];
|
||||
const uniDiffStr = diff.createPatch('file.ts', one, other, 'old', 'new', { context: 1 });
|
||||
const uniDiffApply = diff.parsePatch(uniDiffStr)[0];
|
||||
verifyApplyMethods(one, other, uniDiffApply);
|
||||
|
||||
503
types/diff/index.d.ts
vendored
503
types/diff/index.d.ts
vendored
@@ -1,121 +1,402 @@
|
||||
// Type definitions for diff 3.5
|
||||
// Type definitions for diff 4.0
|
||||
// Project: https://github.com/kpdecker/jsdiff
|
||||
// Definitions by: vvakame <https://github.com/vvakame>
|
||||
// szdc <https://github.com/szdc>
|
||||
// moc-yuto <https://github.com/moc-yuto>
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
export = JsDiff;
|
||||
export as namespace JsDiff;
|
||||
export as namespace Diff;
|
||||
|
||||
declare namespace JsDiff {
|
||||
interface IOptions {
|
||||
ignoreCase: boolean;
|
||||
}
|
||||
export type Callback = (err: undefined, value?: Change[]) => void;
|
||||
|
||||
interface ILinesOptions extends IOptions {
|
||||
ignoreWhitespace?: boolean;
|
||||
newlineIsToken?: boolean;
|
||||
}
|
||||
|
||||
interface IArrayOptions {
|
||||
comparator?: (left: any, right: any) => boolean;
|
||||
}
|
||||
|
||||
interface IDiffResult {
|
||||
value: string;
|
||||
count?: number;
|
||||
added?: boolean;
|
||||
removed?: boolean;
|
||||
}
|
||||
|
||||
interface IDiffArraysResult<T> {
|
||||
value: T[];
|
||||
count?: number;
|
||||
added?: boolean;
|
||||
removed?: boolean;
|
||||
}
|
||||
|
||||
interface IBestPath {
|
||||
newPos: number;
|
||||
componenets: IDiffResult[];
|
||||
}
|
||||
|
||||
interface IHunk {
|
||||
oldStart: number;
|
||||
oldLines: number;
|
||||
newStart: number;
|
||||
newLines: number;
|
||||
lines: string[];
|
||||
}
|
||||
|
||||
interface IUniDiff {
|
||||
oldFileName: string;
|
||||
newFileName: string;
|
||||
oldHeader: string;
|
||||
newHeader: string;
|
||||
index: string;
|
||||
hunks: IHunk[];
|
||||
}
|
||||
|
||||
class Diff {
|
||||
diff(oldString: string, newString: string, options?: IOptions): IDiffResult[];
|
||||
|
||||
pushComponent(components: IDiffResult[], added: boolean, removed: boolean): void;
|
||||
|
||||
extractCommon(basePath: IBestPath, newString: string, oldString: string, diagonalPath: number): number;
|
||||
|
||||
equals(left: string, right: string): boolean;
|
||||
|
||||
removeEmpty(array: any[]): any[];
|
||||
|
||||
castInput(value: any): any;
|
||||
|
||||
join(chars: string[]): string;
|
||||
|
||||
tokenize(value: string): any; // return types are string or string[]
|
||||
}
|
||||
|
||||
function diffChars(oldStr: string, newStr: string, options?: IOptions): IDiffResult[];
|
||||
|
||||
function diffWords(oldStr: string, newStr: string, options?: IOptions): IDiffResult[];
|
||||
|
||||
function diffWordsWithSpace(oldStr: string, newStr: string, options?: IOptions): IDiffResult[];
|
||||
|
||||
function diffJson(oldObj: object, newObj: object, options?: IOptions): IDiffResult[];
|
||||
|
||||
function diffLines(oldStr: string, newStr: string, options?: ILinesOptions): IDiffResult[];
|
||||
|
||||
function diffCss(oldStr: string, newStr: string, options?: IOptions): IDiffResult[];
|
||||
|
||||
function diffTrimmedLines(oldStr: string, newStr: string, options?: ILinesOptions): IDiffResult[];
|
||||
|
||||
function diffSentences(oldStr: string, newStr: string, options?: IOptions): IDiffResult[];
|
||||
|
||||
function diffArrays<T>(oldArr: T[], newArr: T[], options?: IArrayOptions): Array<IDiffArraysResult<T>>;
|
||||
|
||||
function createPatch(fileName: string, oldStr: string, newStr: string, oldHeader: string, newHeader: string, options?: {context: number}): string;
|
||||
|
||||
function createTwoFilesPatch(oldFileName: string, newFileName: string, oldStr: string, newStr: string, oldHeader: string, newHeader: string, options?: {context: number}): string;
|
||||
|
||||
function structuredPatch(oldFileName: string, newFileName: string, oldStr: string, newStr: string, oldHeader: string, newHeader: string, options?: {context: number}): IUniDiff;
|
||||
|
||||
function applyPatch(oldStr: string, uniDiff: string | IUniDiff | IUniDiff[]): string;
|
||||
|
||||
function applyPatches(uniDiff: IUniDiff[], options: {
|
||||
loadFile(index: number, callback: (err: Error, data: string) => void): void,
|
||||
patched(index: number, content: string): void,
|
||||
complete(err?: Error): void
|
||||
}): void;
|
||||
|
||||
function parsePatch(diffStr: string, options?: {strict: boolean}): IUniDiff[];
|
||||
|
||||
function convertChangesToXML(changes: IDiffResult[]): string;
|
||||
|
||||
function convertChangesToDMP(changes: IDiffResult[]): Array<{0: number; 1: string; }>;
|
||||
|
||||
function merge(mine: string, theirs: string, base: string): IUniDiff;
|
||||
|
||||
function canonicalize(obj: any, stack: any[], replacementStack: any[]): any;
|
||||
export interface CallbackOptions {
|
||||
/**
|
||||
* Callback to call with the result instead of returning the result directly.
|
||||
*/
|
||||
callback: Callback;
|
||||
}
|
||||
|
||||
export interface BaseOptions {
|
||||
/**
|
||||
* `true` to ignore casing difference.
|
||||
* @default false
|
||||
*/
|
||||
ignoreCase?: boolean;
|
||||
}
|
||||
|
||||
export interface WordsOptions extends BaseOptions {
|
||||
/**
|
||||
* `true` to ignore leading and trailing whitespace. This is the same as `diffWords()`.
|
||||
*/
|
||||
ignoreWhitespace?: boolean;
|
||||
}
|
||||
|
||||
export interface LinesOptions extends BaseOptions {
|
||||
/**
|
||||
* `true` to ignore leading and trailing whitespace. This is the same as `diffTrimmedLines()`.
|
||||
*/
|
||||
ignoreWhitespace?: boolean;
|
||||
|
||||
/**
|
||||
* `true` to treat newline characters as separate tokens. This allows for changes to the newline structure
|
||||
* to occur independently of the line content and to be treated as such. In general this is the more
|
||||
* human friendly form of `diffLines()` and `diffLines()` is better suited for patches and other computer
|
||||
* friendly output.
|
||||
*/
|
||||
newlineIsToken?: boolean;
|
||||
}
|
||||
|
||||
export interface JsonOptions extends LinesOptions {
|
||||
/**
|
||||
* Replacer used to stringify the properties of the passed objects.
|
||||
*/
|
||||
stringifyReplacer?: (key: string, value: any) => any;
|
||||
|
||||
/**
|
||||
* The value to use when `undefined` values in the passed objects are encountered during stringification.
|
||||
* Will only be used if `stringifyReplacer` option wasn't specified.
|
||||
* @default undefined
|
||||
*/
|
||||
undefinedReplacement?: any;
|
||||
}
|
||||
|
||||
export interface ArrayOptions<TLeft, TRight> extends BaseOptions {
|
||||
/**
|
||||
* Comparator for custom equality checks.
|
||||
*/
|
||||
comparator?: (left: TLeft, right: TRight) => boolean;
|
||||
}
|
||||
|
||||
export interface PatchOptions extends LinesOptions {
|
||||
/**
|
||||
* Describes how many lines of context should be included.
|
||||
* @default 4
|
||||
*/
|
||||
context?: number;
|
||||
}
|
||||
|
||||
export interface ApplyPatchOptions {
|
||||
/**
|
||||
* Number of lines that are allowed to differ before rejecting a patch.
|
||||
* @default 0
|
||||
*/
|
||||
fuzzFactor?: number;
|
||||
|
||||
/**
|
||||
* Callback used to compare to given lines to determine if they should be considered equal when patching.
|
||||
* Should return `false` if the lines should be rejected.
|
||||
*
|
||||
* @default strict equality
|
||||
*/
|
||||
compareLine?: (
|
||||
lineNumber: number,
|
||||
line: string,
|
||||
operation: '-' | ' ',
|
||||
patchContent: string
|
||||
) => boolean;
|
||||
}
|
||||
|
||||
export interface ApplyPatchesOptions {
|
||||
loadFile(index: ParsedDiff, callback: (err: any, data: string) => void): void;
|
||||
patched(index: ParsedDiff, content: string, callback: (err: any) => void): void;
|
||||
complete(err: any): void;
|
||||
}
|
||||
|
||||
export interface Change {
|
||||
count?: number;
|
||||
/**
|
||||
* Text content.
|
||||
*/
|
||||
value: string;
|
||||
/**
|
||||
* `true` if the value was inserted into the new string.
|
||||
*/
|
||||
added?: boolean;
|
||||
/**
|
||||
* `true` if the value was removed from the old string.
|
||||
*/
|
||||
removed?: boolean;
|
||||
}
|
||||
|
||||
export interface ArrayChange<T> {
|
||||
value: T[];
|
||||
count?: number;
|
||||
added?: boolean;
|
||||
removed?: boolean;
|
||||
}
|
||||
|
||||
export interface ParsedDiff {
|
||||
index?: string;
|
||||
oldFileName?: string;
|
||||
newFileName?: string;
|
||||
oldHeader?: string;
|
||||
newHeader?: string;
|
||||
hunks: Hunk[];
|
||||
}
|
||||
|
||||
export interface Hunk {
|
||||
oldStart: number;
|
||||
oldLines: number;
|
||||
newStart: number;
|
||||
newLines: number;
|
||||
lines: string[];
|
||||
}
|
||||
|
||||
export interface BestPath {
|
||||
newPos: number;
|
||||
componenets: Change[];
|
||||
}
|
||||
|
||||
export class Diff {
|
||||
diff(
|
||||
oldString: string,
|
||||
newString: string,
|
||||
options?: Callback | (ArrayOptions<any, any> & Partial<CallbackOptions>)
|
||||
): Change[];
|
||||
|
||||
pushComponent(components: Change[], added: boolean, removed: boolean): void;
|
||||
|
||||
extractCommon(
|
||||
basePath: BestPath,
|
||||
newString: string,
|
||||
oldString: string,
|
||||
diagonalPath: number
|
||||
): number;
|
||||
|
||||
equals(left: any, right: any): boolean;
|
||||
|
||||
removeEmpty(array: any[]): any[];
|
||||
|
||||
castInput(value: any): any;
|
||||
|
||||
join(chars: string[]): string;
|
||||
|
||||
tokenize(value: string): any; // return types are string or string[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Diffs two blocks of text, comparing character by character.
|
||||
*
|
||||
* @returns A list of change objects.
|
||||
*/
|
||||
export function diffChars(oldStr: string, newStr: string, options?: BaseOptions): Change[];
|
||||
export function diffChars(
|
||||
oldStr: string,
|
||||
newStr: string,
|
||||
options: Callback | (BaseOptions & CallbackOptions)
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Diffs two blocks of text, comparing word by word, ignoring whitespace.
|
||||
*
|
||||
* @returns A list of change objects.
|
||||
*/
|
||||
export function diffWords(oldStr: string, newStr: string, options?: WordsOptions): Change[];
|
||||
export function diffWords(
|
||||
oldStr: string,
|
||||
newStr: string,
|
||||
options: Callback | (WordsOptions & CallbackOptions)
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Diffs two blocks of text, comparing word by word, treating whitespace as significant.
|
||||
*
|
||||
* @returns A list of change objects.
|
||||
*/
|
||||
export function diffWordsWithSpace(
|
||||
oldStr: string,
|
||||
newStr: string,
|
||||
options?: WordsOptions
|
||||
): Change[];
|
||||
export function diffWordsWithSpace(
|
||||
oldStr: string,
|
||||
newStr: string,
|
||||
options: Callback | (WordsOptions & CallbackOptions)
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Diffs two blocks of text, comparing line by line.
|
||||
*
|
||||
* @returns A list of change objects.
|
||||
*/
|
||||
export function diffLines(oldStr: string, newStr: string, options?: LinesOptions): Change[];
|
||||
export function diffLines(
|
||||
oldStr: string,
|
||||
newStr: string,
|
||||
options: Callback | (LinesOptions & CallbackOptions)
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Diffs two blocks of text, comparing line by line, ignoring leading and trailing whitespace.
|
||||
*
|
||||
* @returns A list of change objects.
|
||||
*/
|
||||
export function diffTrimmedLines(oldStr: string, newStr: string, options?: LinesOptions): Change[];
|
||||
export function diffTrimmedLines(
|
||||
oldStr: string,
|
||||
newStr: string,
|
||||
options: Callback | (LinesOptions & CallbackOptions)
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Diffs two blocks of text, comparing sentence by sentence.
|
||||
*
|
||||
* @returns A list of change objects.
|
||||
*/
|
||||
export function diffSentences(oldStr: string, newStr: string, options?: BaseOptions): Change[];
|
||||
export function diffSentences(
|
||||
oldStr: string,
|
||||
newStr: string,
|
||||
options: Callback | (BaseOptions & CallbackOptions)
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Diffs two blocks of text, comparing CSS tokens.
|
||||
*
|
||||
* @returns A list of change objects.
|
||||
*/
|
||||
export function diffCss(oldStr: string, newStr: string, options?: BaseOptions): Change[];
|
||||
export function diffCss(
|
||||
oldStr: string,
|
||||
newStr: string,
|
||||
options: Callback | (BaseOptions & CallbackOptions)
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Diffs two JSON objects, comparing the fields defined on each. The order of fields, etc does not matter
|
||||
* in this comparison.
|
||||
*
|
||||
* @returns A list of change objects.
|
||||
*/
|
||||
export function diffJson(
|
||||
oldObj: string | object,
|
||||
newObj: string | object,
|
||||
options?: JsonOptions
|
||||
): Change[];
|
||||
export function diffJson(
|
||||
oldObj: string | object,
|
||||
newObj: string | object,
|
||||
options: Callback | (JsonOptions & CallbackOptions)
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Diffs two arrays, comparing each item for strict equality (`===`).
|
||||
*
|
||||
* @returns A list of change objects.
|
||||
*/
|
||||
export function diffArrays<TOld, TNew>(
|
||||
oldArr: TOld[],
|
||||
newArr: TNew[],
|
||||
options?: ArrayOptions<TOld, TNew>
|
||||
): Array<ArrayChange<TOld | TNew>>;
|
||||
|
||||
/**
|
||||
* Creates a unified diff patch.
|
||||
*
|
||||
* @param oldFileName String to be output in the filename section of the patch for the removals.
|
||||
* @param newFileName String to be output in the filename section of the patch for the additions.
|
||||
* @param oldStr Original string value.
|
||||
* @param newStr New string value.
|
||||
* @param oldHeader Additional information to include in the old file header.
|
||||
* @param newHeader Additional information to include in the new file header.
|
||||
*/
|
||||
export function createTwoFilesPatch(
|
||||
oldFileName: string,
|
||||
newFileName: string,
|
||||
oldStr: string,
|
||||
newStr: string,
|
||||
oldHeader?: string,
|
||||
newHeader?: string,
|
||||
options?: PatchOptions
|
||||
): string;
|
||||
|
||||
/**
|
||||
* Creates a unified diff patch.
|
||||
* Just like `createTwoFilesPatch()`, but with `oldFileName` being equal to `newFileName`.
|
||||
*
|
||||
* @param fileName String to be output in the filename section.
|
||||
* @param oldStr Original string value.
|
||||
* @param newStr New string value.
|
||||
* @param oldHeader Additional information to include in the old file header.
|
||||
* @param newHeader Additional information to include in the new file header.
|
||||
*/
|
||||
export function createPatch(
|
||||
fileName: string,
|
||||
oldStr: string,
|
||||
newStr: string,
|
||||
oldHeader?: string,
|
||||
newHeader?: string,
|
||||
options?: PatchOptions
|
||||
): string;
|
||||
|
||||
/**
|
||||
* This method is similar to `createTwoFilesPatch()`, but returns a data structure suitable for further processing.
|
||||
* Parameters are the same as `createTwoFilesPatch()`.
|
||||
*
|
||||
* @param oldFileName String to be output in the `oldFileName` hunk property.
|
||||
* @param newFileName String to be output in the `newFileName` hunk property.
|
||||
* @param oldStr Original string value.
|
||||
* @param newStr New string value.
|
||||
* @param oldHeader Additional information to include in the `oldHeader` hunk property.
|
||||
* @param newHeader Additional information to include in the `newHeader` hunk property.
|
||||
* @returns An object with an array of hunk objects.
|
||||
*/
|
||||
export function structuredPatch(
|
||||
oldFileName: string,
|
||||
newFileName: string,
|
||||
oldStr: string,
|
||||
newStr: string,
|
||||
oldHeader?: string,
|
||||
newHeader?: string,
|
||||
options?: PatchOptions
|
||||
): ParsedDiff;
|
||||
|
||||
/**
|
||||
* Applies a unified diff patch.
|
||||
*
|
||||
* @param patch May be a string diff or the output from the `parsePatch()` or `structuredPatch()` methods.
|
||||
* @returns A string containing new version of provided data.
|
||||
*/
|
||||
export function applyPatch(
|
||||
source: string,
|
||||
patch: string | ParsedDiff | [ParsedDiff],
|
||||
options?: ApplyPatchOptions
|
||||
): string;
|
||||
|
||||
/**
|
||||
* Applies one or more patches.
|
||||
* This method will iterate over the contents of the patch and apply to data provided through callbacks.
|
||||
*
|
||||
* The general flow for each patch index is:
|
||||
*
|
||||
* 1. `options.loadFile(index, callback)` is called. The caller should then load the contents of the file
|
||||
* and then pass that to the `callback(err, data)` callback. Passing an `err` will terminate further patch execution.
|
||||
* 2. `options.patched(index, content, callback)` is called once the patch has been applied. `content` will be
|
||||
* the return value from `applyPatch()`. When it's ready, the caller should call `callback(err)` callback.
|
||||
* Passing an `err` will terminate further patch execution.
|
||||
* 3. Once all patches have been applied or an error occurs, the `options.complete(err)` callback is made.
|
||||
*/
|
||||
export function applyPatches(patch: string | ParsedDiff[], options: ApplyPatchesOptions): void;
|
||||
|
||||
/**
|
||||
* Parses a patch into structured data.
|
||||
*
|
||||
* @returns A JSON object representation of the a patch, suitable for use with the `applyPatch()` method.
|
||||
*/
|
||||
export function parsePatch(diffStr: string, options?: { strict?: boolean }): ParsedDiff[];
|
||||
|
||||
/**
|
||||
* Converts a list of changes to a serialized XML format.
|
||||
*/
|
||||
export function convertChangesToXML(changes: Change[]): string;
|
||||
|
||||
/**
|
||||
* Converts a list of changes to [DMP](http://code.google.com/p/google-diff-match-patch/wiki/API) format.
|
||||
*/
|
||||
export function convertChangesToDMP(changes: Change[]): Array<[1 | 0 | -1, string]>;
|
||||
|
||||
export function merge(mine: string, theirs: string, base: string): ParsedDiff;
|
||||
|
||||
export function canonicalize(obj: any, stack: any[], replacementStack: any[]): any;
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
@@ -21,4 +20,4 @@
|
||||
"index.d.ts",
|
||||
"diff-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"interface-name": false,
|
||||
"export-just-namespace": false
|
||||
}
|
||||
}
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
|
||||
122
types/diff/v3/diff-tests.ts
Normal file
122
types/diff/v3/diff-tests.ts
Normal file
@@ -0,0 +1,122 @@
|
||||
import jsdiff = require('diff');
|
||||
const one = 'beep boop';
|
||||
const other = 'beep boob blah';
|
||||
|
||||
let diff = jsdiff.diffChars(one, other);
|
||||
printDiff(diff);
|
||||
|
||||
const diffArraysResult = jsdiff.diffArrays<string>(['a', 'b', 'c'], ['a', 'c', 'd']);
|
||||
diffArraysResult.forEach(result => {
|
||||
if (result.added) {
|
||||
console.log(`added ${result.value.length} line(s):`, ...result.value);
|
||||
} else if (result.removed) {
|
||||
console.log(`removed ${result.value.length} line(s):`, ...result.value);
|
||||
} else {
|
||||
console.log(`no changes`);
|
||||
}
|
||||
});
|
||||
|
||||
interface DiffObj {
|
||||
value: number;
|
||||
}
|
||||
const a: DiffObj = {value: 0};
|
||||
const b: DiffObj = {value: 1};
|
||||
const c: DiffObj = {value: 2};
|
||||
const d: DiffObj = {value: 3};
|
||||
const arrayOptions: jsdiff.IArrayOptions = {
|
||||
comparator: (left: DiffObj, right: DiffObj) => {
|
||||
return left.value === right.value;
|
||||
}
|
||||
};
|
||||
const diffResult = jsdiff.diffArrays([a, b, c], [a, b, d], arrayOptions);
|
||||
diffResult.forEach(result => {
|
||||
if (result.added) {
|
||||
console.log(`added ${result.value.length} line(s):`, ...result.value);
|
||||
} else if (result.removed) {
|
||||
console.log(`removed ${result.value.length} line(s):`, ...result.value);
|
||||
} else {
|
||||
console.log(`no changes`);
|
||||
}
|
||||
});
|
||||
|
||||
// --------------------------
|
||||
|
||||
class LineDiffWithoutWhitespace extends jsdiff.Diff {
|
||||
tokenize(value: string): any {
|
||||
return value.split(/^/m);
|
||||
}
|
||||
|
||||
equals(left: string, right: string): boolean {
|
||||
return left.trim() === right.trim();
|
||||
}
|
||||
}
|
||||
|
||||
const obj = new LineDiffWithoutWhitespace();
|
||||
diff = obj.diff(one, other);
|
||||
printDiff(diff);
|
||||
|
||||
function printDiff(diff: jsdiff.IDiffResult[]) {
|
||||
function addLineHeader(decorator: string, str: string | string[]) {
|
||||
return (typeof str === 'string' ? str.split("\n") : str).map((line, index, array) => {
|
||||
if (index === array.length - 1 && line === "") {
|
||||
return line;
|
||||
} else {
|
||||
return decorator + line;
|
||||
}
|
||||
}).join("\n");
|
||||
}
|
||||
|
||||
diff.forEach((part) => {
|
||||
if (part.added) {
|
||||
console.log(addLineHeader("+", part.value));
|
||||
} else if (part.removed) {
|
||||
console.log(addLineHeader("-", part.value));
|
||||
} else {
|
||||
console.log(addLineHeader(" ", part.value));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function verifyPatchMethods(oldStr: string, newStr: string, uniDiff: jsdiff.IUniDiff) {
|
||||
const verifyPatch = jsdiff.parsePatch(
|
||||
jsdiff.createTwoFilesPatch("oldFile.ts", "newFile.ts", oldStr, newStr,
|
||||
"old", "new", { context: 1 }));
|
||||
|
||||
if (JSON.stringify(verifyPatch[0], Object.keys(verifyPatch[0]).sort()) !== JSON.stringify(uniDiff, Object.keys(uniDiff).sort())) {
|
||||
console.error("Patch did not match uniDiff");
|
||||
}
|
||||
}
|
||||
function verifyApplyMethods(oldStr: string, newStr: string, uniDiff: jsdiff.IUniDiff) {
|
||||
const verifyApply = [
|
||||
jsdiff.applyPatch(oldStr, uniDiff),
|
||||
jsdiff.applyPatch(oldStr, [uniDiff])
|
||||
];
|
||||
jsdiff.applyPatches([uniDiff], {
|
||||
loadFile: (index: number, callback: (err: Error, data: string) => void) => {
|
||||
callback(undefined, one);
|
||||
},
|
||||
patched: (index: number, content: string) => {
|
||||
verifyApply.push(content);
|
||||
},
|
||||
complete: (err?: Error) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
verifyApply.forEach(result => {
|
||||
if (result !== newStr) {
|
||||
console.error("Result did not match newStr");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const uniDiffPatch = jsdiff.structuredPatch("oldFile.ts", "newFile.ts", one, other,
|
||||
"old", "new", { context: 1 });
|
||||
verifyPatchMethods(one, other, uniDiffPatch);
|
||||
|
||||
const uniDiffStr = jsdiff.createPatch("file.ts", one, other, "old", "new",
|
||||
{ context: 1 });
|
||||
const uniDiffApply = jsdiff.parsePatch(uniDiffStr)[0];
|
||||
verifyApplyMethods(one, other, uniDiffApply);
|
||||
121
types/diff/v3/index.d.ts
vendored
Normal file
121
types/diff/v3/index.d.ts
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
// Type definitions for diff 3.5
|
||||
// Project: https://github.com/kpdecker/jsdiff
|
||||
// Definitions by: vvakame <https://github.com/vvakame>
|
||||
// szdc <https://github.com/szdc>
|
||||
// moc-yuto <https://github.com/moc-yuto>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
export = JsDiff;
|
||||
export as namespace JsDiff;
|
||||
|
||||
declare namespace JsDiff {
|
||||
interface IOptions {
|
||||
ignoreCase: boolean;
|
||||
}
|
||||
|
||||
interface ILinesOptions extends IOptions {
|
||||
ignoreWhitespace?: boolean;
|
||||
newlineIsToken?: boolean;
|
||||
}
|
||||
|
||||
interface IArrayOptions {
|
||||
comparator?: (left: any, right: any) => boolean;
|
||||
}
|
||||
|
||||
interface IDiffResult {
|
||||
value: string;
|
||||
count?: number;
|
||||
added?: boolean;
|
||||
removed?: boolean;
|
||||
}
|
||||
|
||||
interface IDiffArraysResult<T> {
|
||||
value: T[];
|
||||
count?: number;
|
||||
added?: boolean;
|
||||
removed?: boolean;
|
||||
}
|
||||
|
||||
interface IBestPath {
|
||||
newPos: number;
|
||||
componenets: IDiffResult[];
|
||||
}
|
||||
|
||||
interface IHunk {
|
||||
oldStart: number;
|
||||
oldLines: number;
|
||||
newStart: number;
|
||||
newLines: number;
|
||||
lines: string[];
|
||||
}
|
||||
|
||||
interface IUniDiff {
|
||||
oldFileName: string;
|
||||
newFileName: string;
|
||||
oldHeader: string;
|
||||
newHeader: string;
|
||||
index: string;
|
||||
hunks: IHunk[];
|
||||
}
|
||||
|
||||
class Diff {
|
||||
diff(oldString: string, newString: string, options?: IOptions): IDiffResult[];
|
||||
|
||||
pushComponent(components: IDiffResult[], added: boolean, removed: boolean): void;
|
||||
|
||||
extractCommon(basePath: IBestPath, newString: string, oldString: string, diagonalPath: number): number;
|
||||
|
||||
equals(left: string, right: string): boolean;
|
||||
|
||||
removeEmpty(array: any[]): any[];
|
||||
|
||||
castInput(value: any): any;
|
||||
|
||||
join(chars: string[]): string;
|
||||
|
||||
tokenize(value: string): any; // return types are string or string[]
|
||||
}
|
||||
|
||||
function diffChars(oldStr: string, newStr: string, options?: IOptions): IDiffResult[];
|
||||
|
||||
function diffWords(oldStr: string, newStr: string, options?: IOptions): IDiffResult[];
|
||||
|
||||
function diffWordsWithSpace(oldStr: string, newStr: string, options?: IOptions): IDiffResult[];
|
||||
|
||||
function diffJson(oldObj: object, newObj: object, options?: IOptions): IDiffResult[];
|
||||
|
||||
function diffLines(oldStr: string, newStr: string, options?: ILinesOptions): IDiffResult[];
|
||||
|
||||
function diffCss(oldStr: string, newStr: string, options?: IOptions): IDiffResult[];
|
||||
|
||||
function diffTrimmedLines(oldStr: string, newStr: string, options?: ILinesOptions): IDiffResult[];
|
||||
|
||||
function diffSentences(oldStr: string, newStr: string, options?: IOptions): IDiffResult[];
|
||||
|
||||
function diffArrays<T>(oldArr: T[], newArr: T[], options?: IArrayOptions): Array<IDiffArraysResult<T>>;
|
||||
|
||||
function createPatch(fileName: string, oldStr: string, newStr: string, oldHeader: string, newHeader: string, options?: {context: number}): string;
|
||||
|
||||
function createTwoFilesPatch(oldFileName: string, newFileName: string, oldStr: string, newStr: string, oldHeader: string, newHeader: string, options?: {context: number}): string;
|
||||
|
||||
function structuredPatch(oldFileName: string, newFileName: string, oldStr: string, newStr: string, oldHeader: string, newHeader: string, options?: {context: number}): IUniDiff;
|
||||
|
||||
function applyPatch(oldStr: string, uniDiff: string | IUniDiff | IUniDiff[]): string;
|
||||
|
||||
function applyPatches(uniDiff: IUniDiff[], options: {
|
||||
loadFile(index: number, callback: (err: Error, data: string) => void): void,
|
||||
patched(index: number, content: string): void,
|
||||
complete(err?: Error): void
|
||||
}): void;
|
||||
|
||||
function parsePatch(diffStr: string, options?: {strict: boolean}): IUniDiff[];
|
||||
|
||||
function convertChangesToXML(changes: IDiffResult[]): string;
|
||||
|
||||
function convertChangesToDMP(changes: IDiffResult[]): Array<{0: number; 1: string; }>;
|
||||
|
||||
function merge(mine: string, theirs: string, base: string): IUniDiff;
|
||||
|
||||
function canonicalize(obj: any, stack: any[], replacementStack: any[]): any;
|
||||
}
|
||||
29
types/diff/v3/tsconfig.json
Normal file
29
types/diff/v3/tsconfig.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"paths": {
|
||||
"diff": [
|
||||
"diff/v3"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"diff-tests.ts"
|
||||
]
|
||||
}
|
||||
7
types/diff/v3/tslint.json
Normal file
7
types/diff/v3/tslint.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"interface-name": false,
|
||||
"export-just-namespace": false
|
||||
}
|
||||
}
|
||||
44
types/dlv/dlv-tests.ts
Normal file
44
types/dlv/dlv-tests.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import dlv from 'dlv';
|
||||
|
||||
const obj = {
|
||||
undef: undefined,
|
||||
zero: 0,
|
||||
one: 1,
|
||||
n: null,
|
||||
f: false,
|
||||
a: {
|
||||
two: 2,
|
||||
b: {
|
||||
three: 3,
|
||||
c: {
|
||||
four: 4
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Test without defaults
|
||||
dlv(obj, '');
|
||||
dlv(obj, 'one');
|
||||
dlv(obj, 'one.two');
|
||||
dlv(obj, 'a');
|
||||
dlv(obj, 'a.two');
|
||||
dlv(obj, 'a.b');
|
||||
dlv(obj, 'a.b.three');
|
||||
dlv(obj, 'a.b.c');
|
||||
dlv(obj, 'a.b.c.four');
|
||||
dlv(obj, 'n');
|
||||
dlv(obj, 'n.badkey');
|
||||
dlv(obj, 'f');
|
||||
dlv(obj, 'f.badkey');
|
||||
|
||||
// Test defaults
|
||||
dlv(obj, '', 'foo');
|
||||
dlv(obj, 'undef', 'foo');
|
||||
dlv(obj, 'n', null);
|
||||
dlv(obj, 'n.badkey', 'foo');
|
||||
dlv(obj, 'zero', 0);
|
||||
dlv(obj, 'a.badkey', 'foo');
|
||||
dlv(obj, 'a.badkey.anotherbadkey', 'foo');
|
||||
dlv(obj, 'f', false);
|
||||
dlv(obj, 'f.badkey', 'foo');
|
||||
12
types/dlv/index.d.ts
vendored
Normal file
12
types/dlv/index.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// Type definitions for dlv 1.1
|
||||
// Project: https://github.com/developit/dlv#readme
|
||||
// Definitions by: Ryan Sonshine <https://github.com/ryansonshine>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/**
|
||||
* Safely get a dot-notated path within a nested object, with ability to
|
||||
* return a default if the full key path does not exist or the value is
|
||||
* undefined
|
||||
*/
|
||||
export default function dlv(object: object, key: string | string[], defaultValue?: any): any;
|
||||
23
types/dlv/tsconfig.json
Normal file
23
types/dlv/tsconfig.json
Normal 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",
|
||||
"dlv-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/dlv/tslint.json
Normal file
1
types/dlv/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -1,4 +1,4 @@
|
||||
import { dasherize, camelize, capitalize, classify, decamelize, htmlSafe, loc, underscore, w } from '@ember/string';
|
||||
import { dasherize, camelize, capitalize, classify, decamelize, htmlSafe, loc, underscore, w, isHTMLSafe } from '@ember/string';
|
||||
import { SafeString } from 'handlebars';
|
||||
|
||||
dasherize(); // $ExpectError
|
||||
@@ -36,3 +36,11 @@ loc("_Hello %@ %@", ["John", "Smith"]); // $ExpectType string
|
||||
const handlebarsSafeString: SafeString = htmlSafe('lorem ipsum...');
|
||||
htmlSafe('lorem ipsum...'); // $ExpectType SafeString
|
||||
const regularString: string = htmlSafe('lorem ipsum...'); // $ExpectError
|
||||
|
||||
function isSafeTest(a: string|Handlebars.SafeString) {
|
||||
if (isHTMLSafe(a)) {
|
||||
a = a.toString();
|
||||
}
|
||||
|
||||
camelize(a);
|
||||
}
|
||||
|
||||
4
types/ember__string/index.d.ts
vendored
4
types/ember__string/index.d.ts
vendored
@@ -11,8 +11,8 @@ export function capitalize(str: string): string;
|
||||
export function classify(str: string): string;
|
||||
export function dasherize(str: string): string;
|
||||
export function decamelize(str: string): string;
|
||||
export function htmlSafe(str: string): Handlebars.SafeString;
|
||||
export function isHTMLSafe(str: string): boolean;
|
||||
export function htmlSafe(str: string): SafeString;
|
||||
export function isHTMLSafe(str: any): str is SafeString;
|
||||
export function loc(template: string, args?: string[]): string;
|
||||
export function underscore(str: string): string;
|
||||
export function w(str: string): string[];
|
||||
|
||||
2
types/emoji-mart/index.d.ts
vendored
2
types/emoji-mart/index.d.ts
vendored
@@ -1,6 +1,6 @@
|
||||
// Type definitions for emoji-mart 2.8
|
||||
// Project: https://github.com/missive/emoji-mart
|
||||
// Definitions by: Jessica Franco <https://github.com/Kovensky>
|
||||
// Definitions by: Jessica Franco <https://github.com/Jessidhia>
|
||||
// Nick Winans <https://github.com/Nicell>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@@ -35,6 +35,10 @@ interface MyComponentState {
|
||||
stateProperty: string;
|
||||
}
|
||||
|
||||
function toComponentType<T>(Component: ComponentClass<T> | StatelessComponent<T>): ComponentClass<T> | StatelessComponent<T> {
|
||||
return Component;
|
||||
}
|
||||
|
||||
class MyComponent extends Component<MyComponentProps, MyComponentState> {
|
||||
handleEcho(value: string) {
|
||||
return value;
|
||||
@@ -59,6 +63,8 @@ const MyStatelessComponent = (props: StatelessProps) => <span />;
|
||||
|
||||
const AnotherStatelessComponent = (props: AnotherStatelessProps) => <span />;
|
||||
|
||||
const ComponentType = toComponentType(MyComponent);
|
||||
|
||||
// Enzyme.configure
|
||||
function configureTest() {
|
||||
const configureAdapter: { adapter: EnzymeAdapter } = { adapter: {} };
|
||||
@@ -859,6 +865,14 @@ function ReactWrapperTest() {
|
||||
reactWrapper = new ReactWrapper<MyComponentProps, MyComponentState>(<MyComponent stringProp="1" numberProp={1} />, undefined, { attachTo: document.createElement('div') });
|
||||
reactWrapper = new ReactWrapper<MyComponentProps, MyComponentState>(<MyComponent stringProp="1" numberProp={1} />, reactWrapper, { attachTo: document.createElement('div') });
|
||||
}
|
||||
|
||||
function test_component_type() {
|
||||
const wrapper1 = shallow(<div><ComponentType stringProp={"S"} numberProp={1} /></div>);
|
||||
wrapper1.find<MyComponentProps>(ComponentType).props().stringProp; // $ExpectType string
|
||||
|
||||
const wrapper2 = mount(<div><ComponentType stringProp={"S"} numberProp={1} /></div>);
|
||||
wrapper2.find<MyComponentProps>(ComponentType).props().stringProp; // $ExpectType string
|
||||
}
|
||||
}
|
||||
|
||||
// CheerioWrapper
|
||||
|
||||
24
types/enzyme/index.d.ts
vendored
24
types/enzyme/index.d.ts
vendored
@@ -27,7 +27,9 @@ export interface ComponentClass<Props> {
|
||||
new(props: Props, context?: any): Component<Props>;
|
||||
}
|
||||
|
||||
export type StatelessComponent<Props> = (props: Props, context?: any) => JSX.Element;
|
||||
export type StatelessComponent<Props> = (props: Props, context?: any) => JSX.Element | null;
|
||||
|
||||
export type ComponentType<Props> = ComponentClass<Props> | StatelessComponent<Props>;
|
||||
|
||||
/**
|
||||
* Many methods in Enzyme's API accept a selector as an argument. Selectors in Enzyme can fall into one of the
|
||||
@@ -372,8 +374,8 @@ export class ShallowWrapper<P = {}, S = {}, C = Component> {
|
||||
* Find every node in the render tree that matches the provided selector.
|
||||
* @param selector The selector to match.
|
||||
*/
|
||||
find<P2>(component: ComponentClass<P2>): ShallowWrapper<P2, any>;
|
||||
find<P2>(statelessComponent: StatelessComponent<P2>): ShallowWrapper<P2, never>;
|
||||
find<P2>(component: ComponentType<P2>): ShallowWrapper<P2, any>;
|
||||
find(props: EnzymePropSelector): ShallowWrapper<any, any>;
|
||||
find(selector: string): ShallowWrapper<HTMLAttributes, any>;
|
||||
|
||||
@@ -381,8 +383,8 @@ export class ShallowWrapper<P = {}, S = {}, C = Component> {
|
||||
* Removes nodes in the current wrapper that do not match the provided selector.
|
||||
* @param selector The selector to match.
|
||||
*/
|
||||
filter<P2>(component: ComponentClass<P2>): ShallowWrapper<P2, any>;
|
||||
filter<P2>(statelessComponent: StatelessComponent<P2>): ShallowWrapper<P2, never>;
|
||||
filter<P2>(component: ComponentType<P2>): ShallowWrapper<P2, any>;
|
||||
filter(props: EnzymePropSelector | string): ShallowWrapper<P, S>;
|
||||
|
||||
/**
|
||||
@@ -394,8 +396,8 @@ export class ShallowWrapper<P = {}, S = {}, C = Component> {
|
||||
* Returns a new wrapper with all of the children of the node(s) in the current wrapper. Optionally, a selector
|
||||
* can be provided and it will filter the children by this selector.
|
||||
*/
|
||||
children<P2>(component: ComponentClass<P2>): ShallowWrapper<P2, any>;
|
||||
children<P2>(statelessComponent: StatelessComponent<P2>): ShallowWrapper<P2, never>;
|
||||
children<P2>(component: ComponentType<P2>): ShallowWrapper<P2, any>;
|
||||
children(selector: string): ShallowWrapper<HTMLAttributes, any>;
|
||||
children(props?: EnzymePropSelector): ShallowWrapper<any, any>;
|
||||
|
||||
@@ -425,8 +427,8 @@ export class ShallowWrapper<P = {}, S = {}, C = Component> {
|
||||
*
|
||||
* Note: can only be called on a wrapper of a single node.
|
||||
*/
|
||||
parents<P2>(component: ComponentClass<P2>): ShallowWrapper<P2, any>;
|
||||
parents<P2>(statelessComponent: StatelessComponent<P2>): ShallowWrapper<P2, never>;
|
||||
parents<P2>(component: ComponentType<P2>): ShallowWrapper<P2, any>;
|
||||
parents(selector: string): ShallowWrapper<HTMLAttributes, any>;
|
||||
parents(props?: EnzymePropSelector): ShallowWrapper<any, any>;
|
||||
|
||||
@@ -436,8 +438,8 @@ export class ShallowWrapper<P = {}, S = {}, C = Component> {
|
||||
*
|
||||
* Note: can only be called on a wrapper of a single node.
|
||||
*/
|
||||
closest<P2>(component: ComponentClass<P2>): ShallowWrapper<P2, any>;
|
||||
closest<P2>(statelessComponent: StatelessComponent<P2>): ShallowWrapper<P2, never>;
|
||||
closest<P2>(component: ComponentType<P2>): ShallowWrapper<P2, any>;
|
||||
closest(props: EnzymePropSelector): ShallowWrapper<any, any>;
|
||||
closest(selector: string): ShallowWrapper<HTMLAttributes, any>;
|
||||
|
||||
@@ -487,8 +489,8 @@ export class ReactWrapper<P = {}, S = {}, C = Component> {
|
||||
* Find every node in the render tree that matches the provided selector.
|
||||
* @param selector The selector to match.
|
||||
*/
|
||||
find<P2>(component: ComponentClass<P2>): ReactWrapper<P2, any>;
|
||||
find<P2>(statelessComponent: StatelessComponent<P2>): ReactWrapper<P2, never>;
|
||||
find<P2>(component: ComponentType<P2>): ReactWrapper<P2, any>;
|
||||
find(props: EnzymePropSelector): ReactWrapper<any, any>;
|
||||
find(selector: string): ReactWrapper<HTMLAttributes, any>;
|
||||
|
||||
@@ -501,16 +503,16 @@ export class ReactWrapper<P = {}, S = {}, C = Component> {
|
||||
* Removes nodes in the current wrapper that do not match the provided selector.
|
||||
* @param selector The selector to match.
|
||||
*/
|
||||
filter<P2>(component: ComponentClass<P2>): ReactWrapper<P2, any>;
|
||||
filter<P2>(statelessComponent: StatelessComponent<P2>): ReactWrapper<P2, never>;
|
||||
filter<P2>(component: ComponentType<P2>): ReactWrapper<P2, any>;
|
||||
filter(props: EnzymePropSelector | string): ReactWrapper<P, S>;
|
||||
|
||||
/**
|
||||
* Returns a new wrapper with all of the children of the node(s) in the current wrapper. Optionally, a selector
|
||||
* can be provided and it will filter the children by this selector.
|
||||
*/
|
||||
children<P2>(component: ComponentClass<P2>): ReactWrapper<P2, any>;
|
||||
children<P2>(statelessComponent: StatelessComponent<P2>): ReactWrapper<P2, never>;
|
||||
children<P2>(component: ComponentType<P2>): ReactWrapper<P2, any>;
|
||||
children(selector: string): ReactWrapper<HTMLAttributes, any>;
|
||||
children(props?: EnzymePropSelector): ReactWrapper<any, any>;
|
||||
|
||||
@@ -526,8 +528,8 @@ export class ReactWrapper<P = {}, S = {}, C = Component> {
|
||||
*
|
||||
* Note: can only be called on a wrapper of a single node.
|
||||
*/
|
||||
parents<P2>(component: ComponentClass<P2>): ReactWrapper<P2, any>;
|
||||
parents<P2>(statelessComponent: StatelessComponent<P2>): ReactWrapper<P2, never>;
|
||||
parents<P2>(component: ComponentType<P2>): ReactWrapper<P2, any>;
|
||||
parents(selector: string): ReactWrapper<HTMLAttributes, any>;
|
||||
parents(props?: EnzymePropSelector): ReactWrapper<any, any>;
|
||||
|
||||
@@ -537,8 +539,8 @@ export class ReactWrapper<P = {}, S = {}, C = Component> {
|
||||
*
|
||||
* Note: can only be called on a wrapper of a single node.
|
||||
*/
|
||||
closest<P2>(component: ComponentClass<P2>): ReactWrapper<P2, any>;
|
||||
closest<P2>(statelessComponent: StatelessComponent<P2>): ReactWrapper<P2, never>;
|
||||
closest<P2>(component: ComponentType<P2>): ReactWrapper<P2, any>;
|
||||
closest(props: EnzymePropSelector): ReactWrapper<any, any>;
|
||||
closest(selector: string): ReactWrapper<HTMLAttributes, any>;
|
||||
|
||||
|
||||
@@ -539,4 +539,12 @@ ruleTester.run('my-rule', rule, {
|
||||
]
|
||||
});
|
||||
|
||||
ruleTester.run('simple-valid-test', rule, {
|
||||
valid: [
|
||||
'foo',
|
||||
'bar',
|
||||
{ code: 'foo', options: [{ allowFoo: true }] },
|
||||
]
|
||||
});
|
||||
|
||||
//#endregion
|
||||
|
||||
2
types/eslint/index.d.ts
vendored
2
types/eslint/index.d.ts
vendored
@@ -540,7 +540,7 @@ export class RuleTester {
|
||||
name: string,
|
||||
rule: Rule.RuleModule,
|
||||
tests: {
|
||||
valid?: RuleTester.ValidTestCase[];
|
||||
valid?: Array<string | RuleTester.ValidTestCase>;
|
||||
invalid?: RuleTester.InvalidTestCase[];
|
||||
},
|
||||
): void;
|
||||
|
||||
2
types/expo/index.d.ts
vendored
2
types/expo/index.d.ts
vendored
@@ -2451,6 +2451,8 @@ export interface SvgCommonProps {
|
||||
export interface SvgRectProps extends SvgCommonProps {
|
||||
width: number | string;
|
||||
height: number | string;
|
||||
rx?: number | string;
|
||||
ry?: number | string;
|
||||
}
|
||||
|
||||
export interface SvgCircleProps extends SvgCommonProps {
|
||||
|
||||
2
types/expo/v24/index.d.ts
vendored
2
types/expo/v24/index.d.ts
vendored
@@ -1949,6 +1949,8 @@ export interface SvgCommonProps {
|
||||
export interface SvgRectProps extends SvgCommonProps {
|
||||
width: number | string;
|
||||
height: number | string;
|
||||
rx?: number | string;
|
||||
ry?: number | string;
|
||||
}
|
||||
|
||||
export interface SvgCircleProps extends SvgCommonProps {
|
||||
|
||||
2
types/expo/v25/index.d.ts
vendored
2
types/expo/v25/index.d.ts
vendored
@@ -1978,6 +1978,8 @@ export interface SvgCommonProps {
|
||||
export interface SvgRectProps extends SvgCommonProps {
|
||||
width: number | string;
|
||||
height: number | string;
|
||||
rx?: number | string;
|
||||
ry?: number | string;
|
||||
}
|
||||
|
||||
export interface SvgCircleProps extends SvgCommonProps {
|
||||
|
||||
2
types/expo/v26/index.d.ts
vendored
2
types/expo/v26/index.d.ts
vendored
@@ -2006,6 +2006,8 @@ export interface SvgCommonProps {
|
||||
export interface SvgRectProps extends SvgCommonProps {
|
||||
width: number | string;
|
||||
height: number | string;
|
||||
rx?: number | string;
|
||||
ry?: number | string;
|
||||
}
|
||||
|
||||
export interface SvgCircleProps extends SvgCommonProps {
|
||||
|
||||
2
types/expo/v27/index.d.ts
vendored
2
types/expo/v27/index.d.ts
vendored
@@ -2083,6 +2083,8 @@ export interface SvgCommonProps {
|
||||
export interface SvgRectProps extends SvgCommonProps {
|
||||
width: number | string;
|
||||
height: number | string;
|
||||
rx?: number | string;
|
||||
ry?: number | string;
|
||||
}
|
||||
|
||||
export interface SvgCircleProps extends SvgCommonProps {
|
||||
|
||||
2
types/expo/v30/index.d.ts
vendored
2
types/expo/v30/index.d.ts
vendored
@@ -2083,6 +2083,8 @@ export interface SvgCommonProps {
|
||||
export interface SvgRectProps extends SvgCommonProps {
|
||||
width: number | string;
|
||||
height: number | string;
|
||||
rx?: number | string;
|
||||
ry?: number | string;
|
||||
}
|
||||
|
||||
export interface SvgCircleProps extends SvgCommonProps {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import { View, Text, TabBarIOS } from 'react-native';
|
||||
import { createIconSet, MaterialIcons, FontAwesome, Ionicons } from 'expo__vector-icons';
|
||||
import { createIconSet, MaterialIcons, FontAwesome, AntDesign } from 'expo__vector-icons';
|
||||
|
||||
const glyphMap = {
|
||||
custom: 58918
|
||||
@@ -48,7 +48,7 @@ class TabTest extends React.Component<{}, { selectedTab: string }> {
|
||||
render() {
|
||||
return (
|
||||
<TabBarIOS barTintColor="white">
|
||||
<Ionicons.TabBarItemIOS
|
||||
<AntDesign.TabBarItemIOS
|
||||
title="Tab1"
|
||||
iconName="ios-keypad-outline"
|
||||
selectedIconName="ios-keypad"
|
||||
@@ -58,9 +58,9 @@ class TabTest extends React.Component<{}, { selectedTab: string }> {
|
||||
onPress={() => this.setState({ selectedTab: 'tab1' })}
|
||||
>
|
||||
<View />
|
||||
</Ionicons.TabBarItemIOS>
|
||||
</AntDesign.TabBarItemIOS>
|
||||
|
||||
<Ionicons.TabBarItemIOS
|
||||
<AntDesign.TabBarItemIOS
|
||||
title="Tab2"
|
||||
iconName="ios-bookmark-outline"
|
||||
selectedIconName="ios-bookmark"
|
||||
@@ -70,7 +70,7 @@ class TabTest extends React.Component<{}, { selectedTab: string }> {
|
||||
onPress={() => this.setState({ selectedTab: 'tab2' })}
|
||||
>
|
||||
<View />
|
||||
</Ionicons.TabBarItemIOS>
|
||||
</AntDesign.TabBarItemIOS>
|
||||
</TabBarIOS>
|
||||
);
|
||||
}
|
||||
|
||||
5
types/expo__vector-icons/index.d.ts
vendored
5
types/expo__vector-icons/index.d.ts
vendored
@@ -1,13 +1,16 @@
|
||||
// Type definitions for @expo/vector-icons 6.2
|
||||
// Type definitions for @expo/vector-icons 9.0
|
||||
// Project: https://github.com/expo/vector-icons
|
||||
// Definitions by: Hyeonsu Lee <https://github.com/incleaf>
|
||||
// Robert Ying <https://github.com/robertying>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import * as React from 'react';
|
||||
import { TextProps } from 'react-native';
|
||||
import { Icon } from 'react-native-vector-icons/Icon';
|
||||
|
||||
export { createIconSet, createIconSetFromFontello, createIconSetFromIcoMoon } from 'react-native-vector-icons';
|
||||
export { Icon as AntDesign };
|
||||
export { default as Entypo } from 'react-native-vector-icons/Entypo';
|
||||
export { default as EvilIcons } from 'react-native-vector-icons/EvilIcons';
|
||||
export { default as Feather } from 'react-native-vector-icons/Feather';
|
||||
|
||||
22
types/fastify-rate-limit/fastify-rate-limit-tests.ts
Normal file
22
types/fastify-rate-limit/fastify-rate-limit-tests.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import fastifyRateLimit = require("fastify-rate-limit");
|
||||
import * as IORedis from 'ioredis';
|
||||
import { FastifyRequest, DefaultQuery } from "fastify";
|
||||
import { IncomingMessage } from "http";
|
||||
|
||||
fastifyRateLimit();
|
||||
|
||||
const fastifyRateLimitOptions: fastifyRateLimit.FastifyRateLimitOptions<FastifyRequest<IncomingMessage, DefaultQuery, {test: string}>> = {
|
||||
max: 3,
|
||||
timeWindow: 5000,
|
||||
cache: 10000,
|
||||
whitelist: ['127.0.0.1'],
|
||||
redis: new IORedis({ host: '127.0.0.1' }),
|
||||
skipOnError: true, // default false
|
||||
keyGenerator: (req) => {
|
||||
return req.headers['x-real-ip']
|
||||
|| req.headers['x-client-ip']
|
||||
|| req.headers['x-forwarded-for']
|
||||
|| req.params.test
|
||||
|| req.ip;
|
||||
},
|
||||
};
|
||||
74
types/fastify-rate-limit/index.d.ts
vendored
Normal file
74
types/fastify-rate-limit/index.d.ts
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
// Type definitions for fastify-rate-limit 2.0
|
||||
// Project: https://github.com/fastify/fastify-rate-limit#readme
|
||||
// Definitions by: Christian D <https://github.com/pc-jedi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import { Redis } from "ioredis";
|
||||
import { FastifyRequest } from "fastify";
|
||||
import { IncomingMessage } from "http";
|
||||
|
||||
declare function fastifyRateLimit(): void;
|
||||
|
||||
declare namespace fastifyRateLimit {
|
||||
interface FastifyRateLimitOptions<T = FastifyRequest<IncomingMessage>> {
|
||||
/**
|
||||
* Is the maximum number of requests a single client can perform inside a
|
||||
* timeWindow.
|
||||
*
|
||||
* default: 1000
|
||||
*/
|
||||
max?: number;
|
||||
|
||||
/**
|
||||
* The duration of the time window, can be expressed in milliseconds (as a
|
||||
* number) or as a string, see ms too see the supported formats
|
||||
*
|
||||
* default: 1000 * 60
|
||||
*/
|
||||
timeWindow?: number;
|
||||
|
||||
/**
|
||||
* This plugin internally uses a lru cache to handle the clients, you can
|
||||
* change the size of the cache with this option.
|
||||
*
|
||||
* default: 5000
|
||||
*/
|
||||
cache?: number;
|
||||
|
||||
/**
|
||||
* Array of string of ips to exclude from rate limiting.
|
||||
*
|
||||
* default: []
|
||||
*/
|
||||
whitelist?: string[];
|
||||
|
||||
/**
|
||||
* By default this plugins uses an in-memory store, which is fast but if
|
||||
* you application works on more than one server it is useless, since the
|
||||
* data is store locally. You can pass a Redis client here and magically
|
||||
* the issue is solved. To achieve the maximum speed, this plugins requires
|
||||
* the use of ioredis.
|
||||
*
|
||||
* default: null
|
||||
*/
|
||||
redis?: Redis;
|
||||
|
||||
/**
|
||||
* If `true` it will skip errors generated by the storage (eg, redis not
|
||||
* reachable).
|
||||
*
|
||||
* default: false
|
||||
*/
|
||||
skipOnError?: boolean;
|
||||
|
||||
/**
|
||||
* Function to generate a unique identifier for each incoming request.
|
||||
*
|
||||
* default: (req) => req.ip
|
||||
*/
|
||||
keyGenerator?: (req: T) => string;
|
||||
}
|
||||
}
|
||||
|
||||
export = fastifyRateLimit;
|
||||
6
types/fastify-rate-limit/package.json
Normal file
6
types/fastify-rate-limit/package.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"fastify": "^1.11.2"
|
||||
}
|
||||
}
|
||||
21
types/fastify-rate-limit/tsconfig.json
Normal file
21
types/fastify-rate-limit/tsconfig.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "fastify-rate-limit-tests.ts"],
|
||||
"exclude": ["node-modules"]
|
||||
}
|
||||
1
types/fastify-rate-limit/tslint.json
Normal file
1
types/fastify-rate-limit/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
16
types/forge-apis/README.md
Normal file
16
types/forge-apis/README.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Installation
|
||||
> `npm install --save @types/forge-apis`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for Forge Node.js SDK (https://github.com/Autodesk-Forge/forge-api-nodejs-client).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/forge-apis
|
||||
|
||||
Additional Details
|
||||
* Last updated: Fri, 11 Jan 2019 10:39:13 GMT
|
||||
* Dependencies: @types/three
|
||||
* Global values: none
|
||||
|
||||
# Credits
|
||||
<a href="mailto:forge.help@autodesk.com">Forge Partner Development</a>
|
||||
13
types/forge-apis/forge-apis-tests.ts
Normal file
13
types/forge-apis/forge-apis-tests.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { AuthClientTwoLegged, AuthClientThreeLegged, BucketsApi, HubsApi, FoldersApi, DerivativesApi } from 'forge-apis';
|
||||
|
||||
const authClientTwoLegged: AuthClientTwoLegged = new AuthClientTwoLegged("", "", []);
|
||||
|
||||
const authClientThreeLegged: AuthClientThreeLegged = new AuthClientThreeLegged("", "", "", []);
|
||||
|
||||
const bucketsApi: BucketsApi = new BucketsApi();
|
||||
|
||||
const hubsApi: HubsApi = new HubsApi();
|
||||
|
||||
const foldersApi: FoldersApi = new FoldersApi();
|
||||
|
||||
const derivativesApi: DerivativesApi = new DerivativesApi();
|
||||
193
types/forge-apis/index.d.ts
vendored
Normal file
193
types/forge-apis/index.d.ts
vendored
Normal file
@@ -0,0 +1,193 @@
|
||||
// Type definitions for Forge-apis 0.4
|
||||
// Project: https://github.com/Autodesk-Forge/forge-api-nodejs-client
|
||||
// Definitions by: Autodesk Forge Partner Development <https://github.com/Autodesk-Forge>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
// Copyright (c) Autodesk, Inc. All rights reserved
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software in
|
||||
// object code form for any purpose and without fee is hereby granted,
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both that copyright notice and the limited warranty and
|
||||
// restricted rights notice below appear in all supporting
|
||||
// documentation.
|
||||
//
|
||||
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
|
||||
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
|
||||
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
|
||||
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
|
||||
// UNINTERRUPTED OR ERROR FREE.
|
||||
//
|
||||
|
||||
export class AuthClientTwoLegged {
|
||||
constructor(clientId: string, clientSecret: string, scope: string[]);
|
||||
|
||||
authenticate(): Promise<AuthToken>;
|
||||
getCredentials(): AuthToken;
|
||||
setCredentials(credentials: AuthToken): void;
|
||||
isAuthorized(): boolean;
|
||||
}
|
||||
|
||||
export class AuthClientThreeLegged {
|
||||
constructor(clientId: string, clientSecret: string, redirectUri: string, scope: string[]);
|
||||
|
||||
generateAuthUrl(): string;
|
||||
getToken(code: string): Promise<AuthToken>;
|
||||
refreshToken(credentials: AuthToken): Promise<AuthToken>;
|
||||
}
|
||||
|
||||
export interface ApiResponse {
|
||||
body: any;
|
||||
headers: any;
|
||||
statusCode: number;
|
||||
}
|
||||
|
||||
export interface ApiError {
|
||||
statusCode: number;
|
||||
statusMessage: string;
|
||||
}
|
||||
|
||||
export class BucketsApi {
|
||||
constructor();
|
||||
|
||||
createBucket(postBuckets: object, opts: object, credentials: AuthToken): Promise<ApiResponse>;
|
||||
deleteBucket(bucketKey: string, credentials: AuthToken): Promise<ApiResponse>;
|
||||
getBucketDetails(bucketKey: string, credentials: AuthToken): Promise<ApiResponse>;
|
||||
getBuckets(options: object, credentials: AuthToken): Promise<ApiResponse>;
|
||||
}
|
||||
|
||||
export class HubsApi {
|
||||
constructor();
|
||||
|
||||
getHub(hubId: string, opts: object, credentials: AuthToken): Promise<ApiResponse>;
|
||||
getHubs(opts: object, credentials: AuthToken): Promise<ApiResponse>;
|
||||
getHubProjects(hubId: string, opts: object, credentials: AuthToken): Promise<ApiResponse>;
|
||||
}
|
||||
|
||||
export class FoldersApi {
|
||||
constructor();
|
||||
|
||||
getFolderContents(projectId: string, folderId: string, opts: object, credentials: AuthToken): Promise<ApiResponse>;
|
||||
}
|
||||
|
||||
export interface JobPayload {
|
||||
input: JobPayloadInput;
|
||||
output: JobPayloadOutput;
|
||||
}
|
||||
|
||||
export interface JobPayloadInput {
|
||||
urn: string;
|
||||
compressedUrn?: boolean;
|
||||
rootFilename?: string;
|
||||
}
|
||||
|
||||
export interface JobPayloadOutput {
|
||||
formats: JobPayloadItem[];
|
||||
}
|
||||
|
||||
export interface JobPayloadItem {
|
||||
type: string;
|
||||
views?: string[];
|
||||
advanced?: {
|
||||
applicationProtocol: string;
|
||||
tolerance: number;
|
||||
};
|
||||
format?: string;
|
||||
exportColor?: boolean;
|
||||
exportFileStructure?: string;
|
||||
}
|
||||
|
||||
export class DerivativesApi {
|
||||
constructor();
|
||||
|
||||
deleteManifest(urn: string, credentials: AuthToken): Promise<ApiResponse>;
|
||||
getDerivativeManifest(urn: string, derivativeUrn: string, opts: object, credentials: AuthToken): Promise<ApiResponse>;
|
||||
getFormats(opts: object, credentials: AuthToken): Promise<ApiResponse>;
|
||||
getManifest(urn: string, opts: object, credentials: AuthToken): Promise<ApiResponse>;
|
||||
getMetadata(urn: string, opts: object, credentials: AuthToken): Promise<ApiResponse>;
|
||||
getModelviewMetadata(urn: string, guid: string, opts: object, credentials: AuthToken): Promise<ApiResponse>;
|
||||
getModelviewProperties(urn: string, guid: string, opts: object, credentials: AuthToken): Promise<ApiResponse>;
|
||||
getThumbnail(urn: string, opts: object, credentials: AuthToken): Promise<ApiResponse>;
|
||||
translate(job: JobPayload, opts: { xAdsForce?: boolean }, credentials: AuthToken): Promise<ApiResponse>;
|
||||
}
|
||||
|
||||
export interface Credentials {
|
||||
client_id: string;
|
||||
client_secret: string;
|
||||
grant_type: string;
|
||||
scope?: string;
|
||||
}
|
||||
|
||||
export interface AuthToken {
|
||||
access_token: string;
|
||||
expires_in: number;
|
||||
token_type: string;
|
||||
refresh_token?: string;
|
||||
}
|
||||
|
||||
export namespace Dm {
|
||||
interface BucketResponse {
|
||||
bucketKey: string;
|
||||
bucketOwner: string;
|
||||
createdDate: number;
|
||||
permissions: Array<{
|
||||
access: string;
|
||||
authId: string;
|
||||
}>;
|
||||
policyKey: string;
|
||||
}
|
||||
|
||||
interface ItemResponse {
|
||||
data: any[];
|
||||
included: Item[];
|
||||
jsonapi: {
|
||||
version: string;
|
||||
};
|
||||
links: any;
|
||||
}
|
||||
|
||||
interface Item {
|
||||
attributes: {
|
||||
createTime: string;
|
||||
createUserId: string;
|
||||
displayName: string;
|
||||
extension: object;
|
||||
fileType: string;
|
||||
lastModifiedTime: string;
|
||||
lastModifiedUserId: string;
|
||||
mimeType: string;
|
||||
name: string;
|
||||
storageSize: number;
|
||||
versionNumber: number;
|
||||
};
|
||||
id: string;
|
||||
links: {
|
||||
self: {
|
||||
href: string;
|
||||
};
|
||||
};
|
||||
relationships: {
|
||||
derivatives: {
|
||||
data: {
|
||||
id: string;
|
||||
},
|
||||
meta: {
|
||||
link: {
|
||||
href: string;
|
||||
}
|
||||
}
|
||||
},
|
||||
item: any;
|
||||
refs: any;
|
||||
storage: {
|
||||
data: {
|
||||
id: string;
|
||||
type: string;
|
||||
}
|
||||
};
|
||||
thumbnail: any;
|
||||
};
|
||||
type: string;
|
||||
}
|
||||
}
|
||||
24
types/forge-apis/tsconfig.json
Normal file
24
types/forge-apis/tsconfig.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"forge-apis-tests.ts"
|
||||
]
|
||||
}
|
||||
3
types/forge-apis/tslint.json
Normal file
3
types/forge-apis/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -18,4 +18,9 @@ describe('Test Suite 1', () => {
|
||||
.expect('status', 418)
|
||||
.done(done);
|
||||
});
|
||||
|
||||
it('should handle jest matchers', () => {
|
||||
const str = 'bar';
|
||||
expect(str).toHaveLength(3);
|
||||
});
|
||||
});
|
||||
|
||||
2
types/frisby/index.d.ts
vendored
2
types/frisby/index.d.ts
vendored
@@ -5,7 +5,7 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
/// <reference types='jasmine'/>
|
||||
/// <reference types='jest'/>
|
||||
|
||||
// #region Imports
|
||||
export import nodeFetch = require('node-fetch'); // Import all definitions from node-fetch.
|
||||
|
||||
@@ -34,7 +34,7 @@ const opts = {
|
||||
priorityRange: 5,
|
||||
autostart: false,
|
||||
evictionRunIntervalMillis: 200,
|
||||
numTestsPerRun: 3,
|
||||
numTestsPerEvictionRun: 3,
|
||||
softIdleTimeoutMillis: 100,
|
||||
idleTimeoutMillis: 5000
|
||||
};
|
||||
|
||||
2
types/generic-pool/index.d.ts
vendored
2
types/generic-pool/index.d.ts
vendored
@@ -43,7 +43,7 @@ export interface Options {
|
||||
priorityRange?: number;
|
||||
autostart?: boolean;
|
||||
evictionRunIntervalMillis?: number;
|
||||
numTestsPerRun?: number;
|
||||
numTestsPerEvictionRun?: number;
|
||||
softIdleTimeoutMillis?: number;
|
||||
idleTimeoutMillis?: number;
|
||||
}
|
||||
|
||||
2
types/google__maps/index.d.ts
vendored
2
types/google__maps/index.d.ts
vendored
@@ -3107,7 +3107,7 @@ export interface QueryAutocompleteResult {
|
||||
* contains an `offset` value and a `length`.
|
||||
* These describe the location of the entered term in the prediction result text, so that the term can be highlighted if desired.
|
||||
*/
|
||||
matched_substring: PredictionSubstring[];
|
||||
matched_substrings: PredictionSubstring[];
|
||||
}
|
||||
|
||||
/** A Radar Search request must include at least one of `keyword`, `name`, or `type`. */
|
||||
|
||||
7
types/happypack/happypack-tests.ts
Normal file
7
types/happypack/happypack-tests.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import * as happyPack from 'happypack';
|
||||
|
||||
const ref: happyPack = new happyPack({
|
||||
id: '1',
|
||||
threads: 1,
|
||||
loaders: ['ts-loader']
|
||||
});
|
||||
21
types/happypack/index.d.ts
vendored
Normal file
21
types/happypack/index.d.ts
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
// Type definitions for happypack 5.0
|
||||
// Project: https://github.com/amireh/happypack
|
||||
// Definitions by: Akash Vishwakarma <https://github.com/akashishu777>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import { Plugin } from 'webpack';
|
||||
|
||||
export = happypack;
|
||||
|
||||
declare namespace happypack {
|
||||
interface PluginOptions {
|
||||
id?: string;
|
||||
threads?: number;
|
||||
loaders: any;
|
||||
}
|
||||
}
|
||||
|
||||
declare class happypack extends Plugin {
|
||||
constructor(options: happypack.PluginOptions);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user