This commit is contained in:
Adi Bardan
2017-09-17 11:40:34 +02:00
146 changed files with 110269 additions and 1152 deletions
+3 -2
View File
@@ -88,6 +88,7 @@ First, [fork](https://guides.github.com/activities/forking/) this repository, in
* `cd types/my-package-to-edit`
* Make changes. Remember to edit tests.
* You may also want to add yourself to "Definitions by" section of the package header.
- This will cause you to be notified (via your GitHub username) whenever someone makes a pull request or issue about the package.
- Do this by adding your name to the end of the line, as in `// Definitions by: Alice <https://github.com/alice>, Bob <https://github.com/bob>`.
- Or if there are more people, it can be multiline
```typescript
@@ -145,7 +146,7 @@ For a good example package, see [base64-js](https://github.com/DefinitelyTyped/D
Example where it is not acceptable: `function parseJson<T>(json: string): T;`.
Exception: `new Map<string, number>()` is OK.
* Using the types `Function` and `Object` is almost never a good idea. In 99% of cases it's possible to specify a more specific type. Examples are `(x: number) => number` for [functions](http://www.typescriptlang.org/docs/handbook/functions.html#function-types) and `{ x: number, y: number }` for objects. If there is no certainty at all about the type, [`any`](http://www.typescriptlang.org/docs/handbook/basic-types.html#any) is the right choice, not `Object`. If the only known fact about the type is that it's some object, use the type [`object`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#object-type), not `Object` or `{ [key: string]: any }`.
* `var foo: string | any`:
* `var foo: string | any`:
When `any` is used in a union type, the resulting type is still `any`. So while the `string` portion of this type annotation may _look_ useful, it in fact offers no additional typechecking over simply using `any`.
Depending on the intention, acceptable alternatives could be `any`, `string`, or `string | object`.
@@ -297,7 +298,7 @@ When `dts-gen` is used to scaffold a scoped package, the `paths` property has to
"@foo/bar": ["foo__bar"]
}
}
```
```
#### The file history in GitHub looks incomplete.
+5 -7
View File
@@ -44,16 +44,14 @@ declare namespace accepts {
/**
* Return the first accepted type (and it is returned as the same text as what appears in the `types` array). If nothing in `types` is accepted, then `false` is returned.
* If no types are supplied, return the entire set of acceptable types.
*
* The `types` array can contain full MIME types or file extensions. Any value that is not a full MIME types is passed to `require('mime-types').lookup`.
*/
type(types: string[]): string | false;
type(...types: string[]): string | false;
/**
* Return the types that the request accepts, in the order of the client's preference (most preferred first).
*/
types(): string[];
type(types: string[]): string[] | string | false;
type(...types: string[]): string[] | string | false;
types(types: string[]): string[] | string | false;
types(...types: string[]): string[] | string | false;
}
}
@@ -0,0 +1,171 @@
(() => {
// https://wiki.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Bridge/Automation_Bridge
// This is a JScript example
// The service manager is always the starting point
// If there is no office running then an office is started up
const serviceManager = new ActiveXObject('com.sun.star.ServiceManager');
// Create the CoreReflection service that is later used to create structs
const coreReflection = serviceManager.createInstance("com.sun.star.reflection.CoreReflection");
// Create the Desktop
const desktop = serviceManager.defaultContext.getByName('/singleton/com.sun.star.frame.theDesktop');
// Open a new empty writer document
const args: any[] = [];
const document = desktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, args); // as com.sun.star.text.TextDocument;
// Create a text object
const text = document.Text;
// Create a cursor object
const cursor = (text.createTextCursor() as any) as com.sun.star.text.TextCursor;
// Inserting some Text
text.insertString(cursor, "The first line in the newly created text document.\n", false);
// Inserting a second line
text.insertString(cursor, "Now we're in the second line", false);
// Create instance of a text table with 4 columns and 4 rows
const table = document.createInstance("com.sun.star.text.TextTable");
table.initialize(4, 4);
// Insert the table
text.insertTextContent(cursor, table, false);
// Get first row
const rows = table.Rows;
const row = rows.getByIndex(0) as com.sun.star.table.TableRow;
// Set the table background color
((table as any) as com.sun.star.beans.XPropertySet).setPropertyValue("BackTransparent", false);
((table as any) as com.sun.star.beans.XPropertySet).setPropertyValue("BackColor", 13421823);
// Set a different background color for the first row
row.setPropertyValue("BackTransparent", false);
row.setPropertyValue("BackColor", 6710932);
// Fill the first table row
insertIntoCell("A1", "FirstColumn", table); // insertIntoCell is a helper function, see below
insertIntoCell("B1", "SecondColumn", table);
insertIntoCell("C1", "ThirdColumn", table);
insertIntoCell("D1", "SUM", table);
table.getCellByName("A2").setValue(22.5);
table.getCellByName("B2").setValue(5615.3);
table.getCellByName("C2").setValue(-2315.7);
table.getCellByName("D2").setFormula("sum ");
table.getCellByName("A3").setValue(21.5);
table.getCellByName("B3").setValue(615.3);
table.getCellByName("C3").setValue(- 315.7);
table.getCellByName("D3").setFormula("sum ");
table.getCellByName("A4").setValue(121.5);
table.getCellByName("B4").setValue(-615.3);
table.getCellByName("C4").setValue(415.7);
table.getCellByName("D4").setFormula("sum ");
// Change the CharColor and add a Shadow
cursor.setPropertyValue("CharColor", 255);
cursor.setPropertyValue("CharShadowed", true);
// Create a paragraph break
// The second argument is a com::sun::star::text::ControlCharacter::PARAGRAPH_BREAK constant
text.insertControlCharacter(cursor, 0, false);
// Inserting colored Text.
text.insertString(cursor, " This is a colored Text - blue with shadow\n", false);
// Create a paragraph break ( ControlCharacter::PARAGRAPH_BREAK).
text.insertControlCharacter(cursor, 0, false);
// Create a TextFrame.
const textFrame = document.createInstance("com.sun.star.text.TextFrame");
// Create a Size struct.
const size = createStruct("com.sun.star.awt.Size"); // helper function, see below
size.Width = 15000;
size.Height = 400;
textFrame.setSize(size);
// TextContentAnchorType.AS_CHARACTER = 1
textFrame.setPropertyValue("AnchorType", com.sun.star.text.TextContentAnchorType.AS_CHARACTER);
// insert the frame
text.insertTextContent(cursor, textFrame, false);
// Get the text object of the frame
const objFrameText = textFrame.Text;
// Create a cursor object
const objFrameTextCursor = objFrameText.createTextCursor();
// Inserting some Text
objFrameText.insertString(objFrameTextCursor, "The first line in the newly created text frame.", false);
objFrameText.insertString(objFrameTextCursor, "\nWith this second line the height of the frame raises.", false);
// Create a paragraph break
// The second argument is a com::sun::star::text::ControlCharacter::PARAGRAPH_BREAK constant
objFrameText.insertControlCharacter(cursor, 0, false);
// Change the CharColor and add a Shadow
cursor.setPropertyValue("CharColor", 65536);
cursor.setPropertyValue("CharShadowed", false);
// Insert another string
text.insertString(cursor, " That's all for now !!", false);
function insertIntoCell(strCellName: string, strText: string, objTable: com.sun.star.text.TextTable) {
const objCellText = objTable.getCellByName(strCellName) as com.sun.star.table.Cell;
const objCellCursor = (objCellText.createTextCursor() as any) as com.sun.star.text.TextCursor;
objCellCursor.setPropertyValue("CharColor", 16777215);
objCellText.insertString(objCellCursor, strText, false);
}
function createStruct<K extends keyof LibreOffice.StructNameMap>(strTypeName: K): LibreOffice.StructNameMap[K] {
const classSize = coreReflection.forName(strTypeName);
const aStruct: [LibreOffice.StructNameMap[K]] = [] as any;
classSize.createObject(aStruct);
return aStruct[0];
}
})();
(() => {
// This shows some specific features of the Automation bridge
const serviceManager = new ActiveXObject('com.sun.star.ServiceManager');
// singleton access
const desktop = serviceManager.defaultContext.getByName('/singleton/com.sun.star.frame.theDesktop');
// defaultContext property implements XNameAccess
// sequence is returned as a safearray
const elementNames = new VBArray(serviceManager.defaultContext.getElementNames()).toArray().join('\n');
WScript.Echo(elementNames);
// get/set methods exposed as properties -- getText => Text, getViewData/setViewData => ViewData
const document = desktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, []);
const viewData = document.ViewData;
WScript.Echo(viewData.Count);
const text = document.Text;
WScript.Echo(text);
})();
(() => {
// Forces use of tuple type for out parameters
// Instantiating via reflection
const serviceManager = new ActiveXObject('com.sun.star.ServiceManager');
const coreReflection = serviceManager.defaultContext.getByName('/singleton/com.sun.star.reflection.theCoreReflection');
const classInfo = coreReflection.forName('com.sun.star.accessibility.Accessible');
const accessible: [com.sun.star.accessibility.XAccessible] = [] as any;
classInfo.createObject(accessible);
accessible[0].acquire();
// Get a struct via Bridge_GetStruct
const size = serviceManager.Bridge_GetStruct('com.sun.star.awt.Size');
size.Height = 110;
size.Width = 120;
})();
+105882
View File
File diff suppressed because it is too large Load Diff
+21
View File
@@ -0,0 +1,21 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es5", "scripthost"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"activex-libreoffice-tests.ts"
]
}
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "dtslint/dt.json",
"rules": {
"interface-name": [false],
"ban-types": false,
"no-unnecessary-qualifier": false
}
}
+2 -2
View File
@@ -20,11 +20,11 @@ namespace AdoneRootTests {
{ const a: object = adone.o({}); }
{ const a: typeof Date = adone.Date; }
{ const a: typeof process.hrtime = adone.hrtime; }
{ const a: typeof setTimeout = adone.setTimeout; }
{ const a: typeof global.setTimeout = adone.setTimeout; }
{ const a: typeof clearTimeout = adone.clearTimeout; }
{ const a: typeof setInterval = adone.setInterval; }
{ const a: typeof clearInterval = adone.clearInterval; }
{ const a: typeof setImmediate = adone.setImmediate; }
{ const a: typeof global.setImmediate = adone.setImmediate; }
{ const a: typeof clearImmediate = adone.clearImmediate; }
adone.lazify({});
adone.lazify({}, {});
@@ -1,6 +1,4 @@
var testApp = angular.module('testApp');
const testApp = angular.module('testApp');
testApp.config((
$accordionConfig: ng.ui.bootstrap.IAccordionConfig,
@@ -176,7 +174,7 @@ testApp.controller('TestCtrl', (
/**
* test the $modal service
*/
var modalInstance = $modal.open({
const modalInstance = $modal.open({
ariaLabelledBy: "label",
ariaDescribedBy: "description",
animation: false,
@@ -220,10 +218,20 @@ testApp.controller('TestCtrl', (
backdrop: 'static'
});
$modal.open({
template: () => "<div>i'm a template!</div>"
});
$modal.open({
templateUrl: () => '/templates/modal.html'
});
$modal.getPromiseChain().then(() => {});
$modal.getPromiseChain().then((value) => value * 2);
$modal.getPromiseChain().then((value: string) => value);
/**
* test the $modalStack service
*/
@@ -240,13 +248,13 @@ testApp.controller('TestCtrl', (
/**
* test the $position service
*/
var elementLogger = (coordinates: ng.ui.bootstrap.IPositionCoordinates): void=> {
const elementLogger = (coordinates: ng.ui.bootstrap.IPositionCoordinates): void=> {
$log.log('height', coordinates.height);
$log.log('left', coordinates.left);
$log.log('top', coordinates.top);
$log.log('width', coordinates.width);
};
var element = angular.element('<div/>');
const element = angular.element('<div/>');
elementLogger($position.position(element));
elementLogger($position.offset(element));
@@ -257,7 +265,7 @@ testApp.controller('TestCtrl', (
$log.log('animationEndEventName', $transition.animationEndEventName);
$log.log('transitionEndEventName', $transition.transitionEndEventName);
var transitionElement = angular.element('<div/>');
const transitionElement = angular.element('<div/>');
$transition(transitionElement, 'transition-class', { animation: true });
$transition(transitionElement, { height: '100px', width: '50px' }, { animation: true });
$transition(transitionElement, ()=> {}, { animation: true });
+6 -1
View File
@@ -320,6 +320,11 @@ declare module 'angular' {
}
interface IModalService {
/**
* @returns {IPromise}
*/
getPromiseChain(): IPromise<any>;
/**
* @param {IModalSettings} options
* @returns {IModalInstanceService}
@@ -389,7 +394,7 @@ declare module 'angular' {
/**
* inline template representing the modal's content
*/
template?: string;
template?: string | (() => string);
/**
* a scope instance to be used for the modal's content (actually the $modal service is going to create a child scope of a provided scope).
@@ -197,6 +197,11 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
this.$state.get(this.$state.current);
this.$state.get(this.$state.current, "yourState");
this.$state.get(this.$state.current, this.$state.current);
// make sure get() accepts a discriminated union type as well
let myState: string | ng.ui.IState;
this.$state.get(myState);
this.$state.reload();
// http://angular-ui.github.io/ui-router/site/#/api/ui.router.state.$state#properties
+5 -6
View File
@@ -1,6 +1,8 @@
// Type definitions for Angular JS (ui.router module) 1.1.5
// Type definitions for Angular JS (ui.router module) 1.1.38
// Project: https://github.com/angular-ui/ui-router
// Definitions by: Michel Salib <https://github.com/michelsalib>, Ivan Matiishyn <https://github.com/matiishyn>
// Definitions by: Michel Salib <https://github.com/michelsalib>
// Ivan Matiishyn <https://github.com/matiishyn>
// Mike Haas <https://github.com/mikehaas763>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -272,10 +274,7 @@ declare module 'angular' {
is(state: IState, params?: {}): boolean;
href(state: IState, params?: {}, options?: IHrefOptions): string;
href(state: string, params?: {}, options?: IHrefOptions): string;
get(state: string, context?: string): IState;
get(state: IState, context?: string): IState;
get(state: string, context?: IState): IState;
get(state: IState, context?: IState): IState;
get(state: string | IState, context?: string | IState): IState;
get(): IState[];
/** A reference to the state's config object. However you passed it in. Useful for accessing custom data. */
current: IState;
+1
View File
@@ -13,5 +13,6 @@ blobUtil.blobToBase64String(testBlob); // $ExpectType Promise<string>
blobUtil.blobToBinaryString(testBlob); // $ExpectType Promise<string>
blobUtil.canvasToBlob(new HTMLCanvasElement()); // $ExpectType Promise<Blob>
blobUtil.dataURLToBlob('data:abcd'); // $ExpectType Promise<Blob>
blobUtil.blobToDataURL(testBlob); // $ExpectType Promise<string>
blobUtil.imgSrcToDataURL('test.jpg'); // $ExpectType Promise<string>
blobUtil.revokeObjectURL('blob:example'); // $ExpectType void
+2 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for blob-util 1.2
// Type definitions for blob-util 1.3
// Project: https://github.com/nolanlawson/blob-util#readme
// Definitions by: Max Battcher <https://github.com/WorldMaker>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -12,6 +12,7 @@ export function binaryStringToBlob(binary: string, type?: string): Promise<Blob>
export function blobToBase64String(blob: Blob): Promise<string>;
export function base64StringToBlob(base64: string, type?: string): Promise<Blob>;
export function dataURLToBlob(dataURL: string): Promise<Blob>;
export function blobToDataURL(blob: Blob): Promise<string>;
export function imgSrcToDataURL(src: string, type?: string, crossOrigin?: string): Promise<string>;
export function canvasToBlob(canvas: HTMLCanvasElement, type?: string): Promise<Blob>;
export function imgSrcToBlob(src: string, type?: string, crossOrigin?: string): Promise<Blob>;
+5 -5
View File
@@ -13,8 +13,8 @@ var num: number;
var str: string;
var err: Error;
var x: any;
var f: Function;
var func: Function;
var f: (...args: any[]) => any;
var asyncfunc: (...args: any[]) => Promise<any>;
var arr: any[];
var exp: RegExp;
var anyArr: any[];
@@ -746,7 +746,7 @@ fooProm = Promise.attempt(() => {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
func = Promise.method(function () {
asyncfunc = Promise.method(function () {
});
@@ -784,8 +784,8 @@ voidProm = Promise.delay(num);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
func = Promise.promisify(f);
func = Promise.promisify(f, obj);
asyncfunc = Promise.promisify(f);
asyncfunc = Promise.promisify(f, obj);
obj = Promise.promisifyAll(obj);
anyProm = Promise.fromNode(callback => nodeCallbackFunc(callback));
+6 -6
View File
@@ -609,7 +609,7 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
* Like calling `.then`, but the fulfillment value or rejection reason is assumed to be an array, which is flattened to the formal parameters of the handlers.
*/
spread<U, W>(fulfilledHandler: (...values: W[]) => U | PromiseLike<U>): Bluebird<U>;
spread<U>(fulfilledHandler: Function): Bluebird<U>;
spread<U>(fulfilledHandler: (...args: any[]) => U | PromiseLike<U>): Bluebird<U>;
/**
* Same as calling `Promise.all(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
@@ -695,7 +695,7 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
* Returns a new function that wraps the given function `fn`. The new function will always return a promise that is fulfilled with the original functions return values or rejected with thrown exceptions from the original function.
* This method is convenient when a function can sometimes return synchronously or throw synchronously.
*/
static method(fn: Function): Function;
static method<R>(fn: (...args: any[]) => R | PromiseLike<R>): (...args: any[]) => Bluebird<R>;
/**
* Create a promise that is resolved with the given `value`. If `value` is a thenable or promise, the returned promise will assume its state.
@@ -755,7 +755,7 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
static promisify<T, A1, A2, A3>(func: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any, result?: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1, arg2: A2, arg3: A3) => Bluebird<T>;
static promisify<T, A1, A2, A3, A4>(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any, result?: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Bluebird<T>;
static promisify<T, A1, A2, A3, A4, A5>(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any, result?: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Bluebird<T>;
static promisify(nodeFunction: Function, options?: Bluebird.PromisifyOptions): Function;
static promisify(nodeFunction: (...args: any[]) => void, options?: Bluebird.PromisifyOptions): (...args: any[]) => Bluebird<any>;
/**
* Promisifies the entire object by going through the object's properties and creating an async equivalent of each function on the object and its prototype chain. The promisified method name will be the original method name postfixed with `Async`. Returns the input object.
@@ -777,7 +777,7 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
* Returns a function that can use `yield` to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch.
*/
// TODO fix coroutine GeneratorFunction
static coroutine<R>(generatorFunction: Function): Function;
static coroutine(generatorFunction: (...args: any[]) => IterableIterator<any>): (...args: any[]) => Bluebird<any>;
/**
* Add `handler` as the handler to call when there is a possibly unhandled rejection. The default handler logs the error stack to stderr or `console.error` in browsers.
@@ -1011,9 +1011,9 @@ declare namespace Bluebird {
}
export interface PromisifyAllOptions extends PromisifyOptions {
suffix?: string;
filter?: (name: string, func: Function, target?: any, passesDefaultFilter?: boolean) => boolean;
filter?: (name: string, func: (...args: any[]) => any, target?: any, passesDefaultFilter?: boolean) => boolean;
// The promisifier gets a reference to the original method and should return a function which returns a promise
promisifier?: (originalMethod: Function) => () => PromiseLike<any>;
promisifier?: (originalMethod: (...args: any[]) => any, defaultPromisifer: (...args: any[]) => (...args: any[]) => Bluebird<any>) => () => PromiseLike<any>;
}
/**
@@ -0,0 +1,35 @@
import valid = require('card-validator');
const numberValidation = valid.number('4111');
if (!numberValidation.isPotentiallyValid && numberValidation.card) {
numberValidation.card.type;
}
valid.expirationDate('10/19');
const dateTest2 = valid.expirationDate({month: '1', year: '2019'});
if (dateTest2.isPotentiallyValid) {
dateTest2.month;
}
const expirationMonthCheck = valid.expirationMonth('10');
if (expirationMonthCheck.isPotentiallyValid) {
expirationMonthCheck.isValidForThisYear;
}
const expirationYearCheck = valid.expirationYear('10');
if (expirationYearCheck.isPotentiallyValid) {
expirationYearCheck.isCurrentYear;
}
let postalCodeCheck = valid.postalCode('123');
if (postalCodeCheck.isValid) {
postalCodeCheck = valid.postalCode('123', {});
postalCodeCheck = valid.postalCode('123', {minLength: 5});
}
const cvvCeck = valid.cvv('1234');
if (cvvCeck.isValid) {
valid.cvv('12345', 4);
}
+43
View File
@@ -0,0 +1,43 @@
// Type definitions for card-validator 4.1
// Project: https://github.com/braintree/card-validator
// Definitions by: Gregory Moore <https://github.com/ChanceM>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface Card {
niceType: string;
type: string;
pattern: string;
isAmex: boolean;
gaps: number[];
lengths: number[];
code: {name: string, size: number};
}
export interface valid {
isPotentiallyValid: boolean;
isValid: boolean;
}
export interface validNumber extends valid {
card: Card | null;
}
export interface validExpirationDate extends valid {
month: string | null;
year: string | null;
}
export interface validExpirationMonth extends valid {
isValidForThisYear: boolean;
}
export interface validExpirationYear extends valid {
isCurrentYear: boolean;
}
export function number(value: string): validNumber;
export function expirationDate(value: string | {month: string, year: string}): validExpirationDate;
export function expirationMonth(value: string): validExpirationMonth;
export function expirationYear(value: string): validExpirationYear;
export function cvv(value: string, maxLength?: number): valid;
export function postalCode(value: string, options?: {minLength?: number}): valid;
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"card-validator-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
-2
View File
@@ -513,12 +513,10 @@ export interface Client extends events.EventEmitter {
connect(callback: Callback): void;
eachRow(query: string, params?: any, options?: QueryOptions, rowCallback?: Callback, callback?: Callback): void;
execute(query: string, params: any, options: QueryOptions, callback: ResultCallback): void;
execute(query: string, params: any, callback: ResultCallback): void;
execute(query: string, callback: ResultCallback): void;
execute(query: string, params?: any, options?: QueryOptions): Promise<types.ResultSet>;
getReplicas(keyspace: string, token: Buffer): Array<any>; // TODO: Should this be a more explicit return?
shutdown(callback?: Callback): void;
stream(query: string, params?: any, options?: QueryOptions, callback?: Callback): NodeJS.ReadableStream;
+13
View File
@@ -46,6 +46,15 @@ commonTags.source`
</div>
`;
let userMessages = ['hi', 'what are you up to?', '<script>alert("something evil")</script>']
commonTags.html`
<div class="chat-list">
<ul>
${userMessages.map(message => commonTags.safeHtml`<li>${message}</li>`)}
</ul>
</div>
`
commonTags.oneLine`
foo
bar
@@ -145,6 +154,10 @@ new commonTags.TemplateTag(commonTags.stripIndentTransformer('initial'));
new commonTags.TemplateTag(commonTags.stripIndentTransformer('all'));
new commonTags.TemplateTag(commonTags.replaceResultTransformer('foo', 'bar'));
new commonTags.TemplateTag(commonTags.replaceSubstitutionTransformer(/baz/g, 'bar'));
new commonTags.TemplateTag(commonTags.replaceSubstitutionTransformer('foo', 'bar'));
new commonTags.TemplateTag(commonTags.replaceSubstitutionTransformer(/baz/g, 'bar'));
new commonTags.TemplateTag(commonTags.inlineArrayTransformer());
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({}));
+7 -2
View File
@@ -1,6 +1,7 @@
// Type definitions for common-tags v1.2.1
// Type definitions for common-tags v1.4.0
// Project: https://github.com/declandewet/common-tags
// Definitions by: Viktor Zozuliak <https://github.com/zuzusik>
// Paul Wang <https://github.com/tzupengwang>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'common-tags' {
@@ -24,6 +25,8 @@ declare module 'common-tags' {
export var source: TemplateTag;
export var safeHtml: TemplateTag;
export var oneLine: TemplateTag;
export var oneLineTrim: TemplateTag;
@@ -54,7 +57,9 @@ declare module 'common-tags' {
export var stripIndentTransformer: (type?: 'initial'|'all') => TemplateTransformer;
export var replaceResultTransformer: (replaceWhat: string, replaceWith: string) => TemplateTransformer;
export var replaceResultTransformer: (replaceWhat: string|RegExp, replaceWith: string) => TemplateTransformer;
export var replaceSubstitutionTransformer: (replaceWhat: string|RegExp, replaceWith: string) => TemplateTransformer;
export var inlineArrayTransformer: (opts?: {separator?: string, conjunction?: string}) => TemplateTransformer;
+2
View File
@@ -34,3 +34,5 @@ var configSources: config.IConfigSource[] = config.util.getConfigSources();
var configSource: config.IConfigSource = configSources[0];
var configSourceName: string = configSource.name;
var configSourceOriginal: string | undefined = configSource.original;
var moduleDefaults: any = config.util.setModuleDefaults("moduleName", {});
+10 -1
View File
@@ -1,6 +1,8 @@
// Type definitions for node-config
// Project: https://github.com/lorenwest/node-config
// Definitions by: Roman Korneev <https://github.com/RWander>
// Forrest Bice <https://github.com/forrestbice>
// James Donald <https://github.com/jndonald3>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -31,12 +33,19 @@ declare namespace c {
// Get the current value of a config environment variable
getEnv(varName: string): string;
// Return the config for the project based on directory param if not directory then return default one (config).
loadFileConfigs(configDir: string): any;
// Return the sources for the configurations
getConfigSources(): IConfigSource[];
/**
* This allows module developers to attach their configurations onto
* the 6 years agoInitial 0.4 checkin default configuration object so
* they can be configured by the consumers of the module.
*/
setModuleDefaults(moduleName:string, defaults:any): any;
}
interface IConfig {
+17
View File
@@ -2,6 +2,7 @@
// Project: https://cypress.io
// Definitions by: Gert Hengeveld <https://github.com/ghengeveld>
// Mike Woudenberg <https://github.com/mikewoudenberg>
// Robbert van Markus <https://github.com/rvanmarkus>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@@ -375,6 +376,12 @@ declare namespace Cypress {
*/
title(options?: Loggable): Chainable;
/**
* @description Trigger an event on a DOM element.
* @see https://docs.cypress.io/api/commands/trigger.html
*/
trigger(eventName: string, position?: PositionType, x?: number, y?: number, options?: TriggerOptions): Chainable;
/**
* @see https://on.cypress.io/api/type
*/
@@ -539,6 +546,16 @@ declare namespace Cypress {
onBeforeLoad?(args: any[]): void;
onLoad?(args: any[]): void;
}
interface TriggerOptions {
log?: boolean;
force?: boolean;
bubbles?: boolean;
cancable?: boolean;
timeout?: number;
}
type PositionType = "topLeft" | "top" | "topRight" | "left" | "center" | "right" | "bottomLeft" | "bottom" | "bottomRight";
}
declare const cy: Cypress.Chainable;
+7 -1
View File
@@ -1 +1,7 @@
{ "extends": "dtslint/dt.json" }
{
"extends": "dtslint/dt.json",
"rules": {
// TODO
"no-object-literal-type-assertion": false
}
}
@@ -0,0 +1,14 @@
import DragTimetable = require("drag-timetable");
const instance = DragTimetable.create(document.getElementById("timetable_container"), { hourStart: 0, hourEnd: 24 });
instance.addTask({id: 1, start: 9, end: 11, text: 'Task 1 - Get this stuff done!'}, true);
instance.addTask({id: 2, start: 12, end: 13, text: 'Task 2 - Get that stuff done!'}, true);
instance.setMoveCallback((task: any) => {
console.log('task moved: ' + task.id);
});
instance.setClickCallback((task: any) => {
console.log('task clicked: ' + task.id);
});
+36
View File
@@ -0,0 +1,36 @@
// Type definitions for drag-timetable 1.0
// Project: https://github.com/DJAndries/drag-timetable
// Definitions by: chinkan <https://github.com/chinkan>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/** Declaration file generated by dts-gen */
export function create(container: HTMLElement | null, options: any): TimetableInstance;
export namespace create {
const prototype: {
};
}
export class TimetableInstance {
constructor(contextObj: any);
setMoveCallback(moveCallback: (task: any) => void): void;
setClickCallback(clickCallback: (task: any) => void): void;
addTask(task: any, isAddingToTimetable: boolean): HTMLDivElement;
removeTask(taskId: any): void;
getTask(taskId: any): any;
}
export class TimetableTask {
constructor(task: any, taskAreaSize: any);
updateTaskUI(): void;
getTimeElement(): HTMLDivElement;
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"drag-timetable-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+4 -1
View File
@@ -2,7 +2,7 @@ import esprima = require('esprima');
import * as ESTree from 'estree';
let token: esprima.Token;
let program: ESTree.Program;
let program: esprima.Program;
let string: string;
// esprima
@@ -20,6 +20,9 @@ program = esprima.parseScript('"use strict"; with (x) {}', { tolerant: true });
program = esprima.parseScript('answer = 42', { range: true });
program = esprima.parseScript('answer = 42', { range: true });
program = esprima.parseScript('const answer = 42', { tokens: true });
if (program.tokens) {
token = program.tokens[0];
}
program = esprima.parseScript('answer = 42 // TODO: why', { comment: true });
program = esprima.parseScript('answer = 42 // TODO: why', { comment: true, range: true });
+6 -2
View File
@@ -7,10 +7,14 @@ import * as ESTree from 'estree';
export const version: string;
export function parseScript(input: string, config?: ParseOptions, delegate?: (node: ESTree.Node, meta: any) => void): ESTree.Program;
export function parseModule(input: string, config?: ParseOptions, delegate?: (node: ESTree.Node, meta: any) => void): ESTree.Program;
export function parseScript(input: string, config?: ParseOptions, delegate?: (node: ESTree.Node, meta: any) => void): Program;
export function parseModule(input: string, config?: ParseOptions, delegate?: (node: ESTree.Node, meta: any) => void): Program;
export function tokenize(input: string, config?: TokenizeOptions): Token[];
export interface Program extends ESTree.Program {
tokens?: Token[];
}
export interface Token {
type: string;
value: string;
+1 -1
View File
@@ -351,7 +351,7 @@ interface Request extends http.IncomingMessage, Express.Request {
*
* @param type
*/
is(type: string): boolean;
is(type: string): string | false;
/**
* Return the protocol string "http" or "https"
+1 -1
View File
@@ -1,4 +1,4 @@
import * as filenamify from 'filenamify';
import filenamify = require('filenamify');
filenamify('<foo/bar>');
// => 'foo!bar'
@@ -0,0 +1,8 @@
import * as webpack from 'webpack';
import * as FriendlyErrorsPlugin from 'friendly-errors-webpack-plugin';
const compiler = webpack({
plugins: [
new FriendlyErrorsPlugin(),
],
});
+40
View File
@@ -0,0 +1,40 @@
// Type definitions for friendly-errors-webpack-plugin 0.1
// Project: https://github.com/geowarin/friendly-errors-webpack-plugin
// Definitions by: Arne Bahlo <https://github.com/bahlo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
import { Plugin } from 'webpack';
export = FriendlyErrorsWebpackPlugin;
declare class FriendlyErrorsWebpackPlugin extends Plugin {
constructor(options?: FriendlyErrorsWebpackPlugin.Options);
}
declare namespace FriendlyErrorsWebpackPlugin {
enum Severity {
Error = "error",
Warning = "warning",
}
interface Options {
compilationSuccessInfo?: {
messages: string[],
notes: string[],
};
onErrors?(severity: Severity, errors: string): void;
clearConsole?: true;
additionalFormatters?: Array<(errors: WebpackError[], type: Severity) => string[]>;
additionalTransformers?: Array<(error: any) => any>;
}
interface WebpackError {
message: string;
file: string;
origin: string;
name: string;
severity: Severity;
webpackError: any;
}
}
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"friendly-errors-webpack-plugin-tests.ts"
]
}
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
-3
View File
@@ -671,7 +671,6 @@ $(document).ready(() => {
const y = date.getFullYear();
$('#calendar').fullCalendar({
theme: true,
header: {
left: 'prev,next today',
center: 'title',
@@ -790,7 +789,6 @@ $(document).ready(() => {
const y = date.getFullYear();
$('#calendar').fullCalendar({
theme: true,
header: {
left: 'prev,next today',
center: 'title',
@@ -824,7 +822,6 @@ $(document).ready(() => {
});
$('#calendar').fullCalendar({
theme: true,
header: {
left: 'prev,next today',
center: 'title',
+771 -79
View File
@@ -1,6 +1,9 @@
// Type definitions for FullCalendar 2.7
// Type definitions for FullCalendar 3.5
// Project: http://fullcalendar.io/
// Definitions by: Neil Stalker <https://github.com/nestalk>, Marcelo Camargo <https://github.com/hasellcamargo>, Patrick Niemann <https://github.com/panic175>
// Definitions by: Neil Stalker <https://github.com/nestalk>,
// Marcelo Camargo <https://github.com/hasellcamargo>,
// Patrick Niemann <https://github.com/panic175>
// Hadrien Milano <https://github.com/hmil>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -34,70 +37,627 @@ export interface Header {
right: string;
}
export interface Options extends AgendaOptions, EventDraggingResizingOptions, DroppingExternalElementsOptions, SelectionOptions {
// General display - http://fullcalendar.io/docs/display/
export interface CustomButtonDefinition {
text: string;
click(element: JQuery): void;
icon?: string;
themeIcon?: string;
bootstrapGlyphicon?: string;
}
export interface ButtonIconsDefinition {
prev: string;
next: string;
prevYear: string;
nextYear: string;
}
export interface EventSegment {
/**
* the Event Object
*/
event: EventObject;
/**
* the Moment for when this stretch of the event begins
*/
start: moment.Moment;
/**
* the Moment for when this stretch of the event ends (exclusive)
*/
end: moment.Moment;
/**
* boolean if this is chronologically the first segment for the event
*/
isStart: boolean;
/**
* boolean if this is chronologically the last segment for the event
*/
isEnd: boolean;
}
export interface CellInfo {
/**
* the Moment date of the day
*/
date: moment.Moment;
/**
* jQuery element for the day cell
*/
dayEl: JQuery;
/**
* jQuery element for the "more" link
*/
moreEl: JQuery;
/**
* array of all event "segment" objects for the given day
*/
segs: EventSegment[];
/**
* array of only the segment objects that were not displayed prior
*/
hiddenSegs: EventSegment[];
}
export interface TimeRange {
start: string | Date | moment.Moment;
end: string | Date | moment.Moment;
}
export interface DropInfo {
start: moment.Moment;
/**
* exclusive end date/time
*/
end: moment.Moment;
/**
* if you are using a Resource View
*/
resourceId?: string;
}
export interface Options extends
GeneralDisplayOptions,
TimezoneOptions,
ViewsOptions,
AgendaOptions,
ListViewOptions,
CurrentDateOptions,
TextTimeCustomizationOptions,
ClickingAndHoveringOptions,
SelectionOptions,
EventDataOptions,
EventRenderingOptions,
EventDraggingResizingOptions,
DroppingExternalElementsOptions {
// scheduler options
resourceAreaWidth?: number;
schedulerLicenseKey?: string;
resourceLabelText?: any;
resourceColumns?: any;
displayEventTime?: any;
}
/**
* General display - https://fullcalendar.io/docs/display/
*/
export interface GeneralDisplayOptions {
/**
* Defines the buttons and title at the top of the calendar.
*
* default:
* {
* left: 'title',
* center: '',
* right: 'today prev,next'
* }
*/
header?: boolean | Header;
theme?: boolean;
buttonIcons?: {
prev: string;
next: string;
};
/**
* Renders a set of controls at the bottom of the calendar.
*
* default: false
*/
footer?: boolean | Header;
/**
* Defines custom buttons that can be used in the header.
*/
customButtons?: { [name: string]: CustomButtonDefinition };
/**
* Determines which icons are displayed in buttons of the header.
*
* default:
* {
* prev: 'left-single-arrow',
* next: 'right-single-arrow',
* prevYear: 'left-double-arrow',
* nextYear: 'right-double-arrow'
* }
*
*/
buttonIcons?: boolean | ButtonIconsDefinition;
/**
* Renders the calendar with a given theme system.
*
* default: 'standard'
*/
themeSystem?: 'standard' | 'bootstrap3' | 'jquery-ui';
/**
* Determines which icons are displayed in buttons of the header when jQuery UI theming is on.
*/
themeButtonIcons?: boolean | ButtonIconsDefinition;
/**
* Determines which icons are displayed in buttons of the header when Bootstrap theming is on.
*/
bootstrapGlyphicons?: boolean | ButtonIconsDefinition;
/**
* The day that each week begins.
*
* 0 = Sunday
*
* default: set by the current `locale`
*/
firstDay?: number;
/**
* Displays the calendar in right-to-left mode.
*
* default: false
*/
isRTL?: boolean;
/**
* Whether to include Saturday/Sunday columns in any of the calendar views.
*
* default: true
*/
weekends?: boolean;
/**
* Exclude certain days-of-the-week from being displayed.
*
* default: []
*/
hiddenDays?: number[];
weekMode?: string;
/**
* Determines the number of weeks displayed in a month view.
*
* default: true
*/
fixedWeekCount?: boolean;
/**
* Determines if week numbers should be displayed on the calendar.
*
* default: false
*/
weekNumbers?: boolean;
weekNumberCalculation?: any; // String/Function
/**
* Determines the styling for week numbers in month view and the basic views.
*
* default: false
*/
weekNumbersWithinDays?: boolean;
/**
* The method for calculating week numbers that are displayed with the weekNumbers setting.
*
* default: 'local'
*/
weekNumberCalculation?: 'local' | 'ISO' | ((m: moment.Moment) => number);
/**
* Emphasizes certain time slots on the calendar. By default, Monday-Friday, 9am-5pm.
*
* default: false
*/
businessHours?: boolean | BusinessHours | BusinessHours[];
height?: number | 'auto' | 'parent';
contentHeight?: number;
/**
* In month view, whether dates in the previous or next month should be rendered at all.
*
* default: true
*/
showNonCurrentDates?: boolean;
/**
* Will make the entire calendar (including header) a pixel height.
*
* default: undefined
*/
height?: number | 'auto' | 'parent' | (() => number);
/**
* Will make the calendar's content area a pixel height.
*/
contentHeight?: number | 'auto' | (() => number);
/**
* Determines the width-to-height aspect ratio of the calendar.
*
* default: 1.35
*/
aspectRatio?: number;
/**
* Whether to automatically resize the calendar when the browser window resizes.
*
* default: true
*/
handleWindowResize?: boolean;
views?: ViewSpecificOptions;
/**
* Time, in milliseconds, the calendar will wait to adjust its size after a window resize event occurs.
*
* default: 100
*/
windowResizeDelay?: number;
/**
* Limits the number of events displayed on a day.
*
* default: false
*/
eventLimit?: boolean | number;
/**
* Determines the action taken when the user clicks on a "more" link created by the eventLimit option.
*/
eventLimitClick?: 'popover' | 'week' | 'day' | string | ((cellinfo: CellInfo, jsevent: Event) => void);
/**
* Triggered when a new date-range is rendered, or when the view type switches.
*/
viewRender?(view: ViewObject, element: JQuery): void;
/**
* Triggered when a rendered date-range needs to be torn down.
*/
viewDestroy?(view: ViewObject, element: JQuery): void;
dayRender?(date: Date, cell: JQuery): void;
/**
* A hook for modifying a day cell.
*/
dayRender?(date: moment.Moment, cell: JQuery): void;
/**
* Triggered after the calendar's dimensions have been changed due to the browser window being resized.
*/
windowResize?(view: ViewObject): void;
}
// Timezone
/**
* Timezone - https://fullcalendar.io/docs/timezone/
*/
export interface TimezoneOptions {
/**
* Determines the timezone in which dates throughout the API are parsed and rendered.
*
* default: false
*/
timezone?: string | boolean;
/**
* Explicitly sets the "today" date of the calendar. This is the day that is normally highlighted in yellow.
*/
now?: moment.Moment | Date | string | (() => moment.Moment);
}
// Views - http://fullcalendar.io/docs/views/
/**
* Views - https://fullcalendar.io/docs/views/
*/
export interface ViewsOptions {
/**
* The initial view when the calendar loads.
*
* default: 'month'
*/
defaultView?: string;
// Current Date - http://fullcalendar.io/docs/current_date/
views?: ViewSpecificOptions;
}
/**
* Agenda Options - https://fullcalendar.io/docs/agenda/
*/
export interface AgendaOptions {
/**
* Determines if the "all-day" slot is displayed at the top of the calendar.
*
* default: true
*/
allDaySlot?: boolean;
/**
* The text titling the "all-day" slot at the top of the calendar.
*
* default: 'all-day'
*/
allDayText?: string;
/**
* The frequency for displaying time slots.
*
* default: '00:30:00'
*/
slotDuration?: moment.Duration;
/**
* Determines the time-text that will be displayed on the vertical axis of the agenda views.
*
* default: 'h(:mm)a'
*/
slotLabelFormat?: string;
/**
* Determines how often the time-axis is labeled with text displaying the date/time of slots.
*/
slotLabelInterval?: moment.Duration;
/**
* The time interval at which a dragged event will snap to the agenda view time grid. Also affects the granularity at which `selections` can be made.
*/
snapDuration?: moment.Duration;
/**
* Determines how far down the scroll pane is initially scrolled down.
*
* default: '06:00:00' (6am)
*/
scrollTime?: moment.Duration;
/**
* Determines the starting time that will be displayed, even when the scrollbars have been scrolled all the way up.
*
* default: "00:00:00"
*/
minTime?: moment.Duration;
/**
* Determines the end time (exclusively) that will be displayed, even when the scrollbars have been scrolled all the way down.
*
* default: "24:00:00"
*/
maxTime?: moment.Duration;
/**
* Determines if timed events in agenda view should visually overlap.
*
* default: true
*/
slotEventOverlap?: boolean;
}
/**
* List View - https://fullcalendar.io/docs/list_view/
*/
export interface ListViewOptions {
/**
* A date formatting string that affects the text on the left side of the day headings in list view.
*/
listDayFormat?: string | boolean;
/**
* A date formatting string that affects the text on the right side of the day headings in list view.
*/
listDayAltFormat?: string | boolean;
/**
* The text that is displayed in the middle of list view, alerting the user that there are no events within the given range.
*
* default: "No events to display"
*/
noEventsMessage?: string;
}
/**
* Current Date - https://fullcalendar.io/docs/current_date/
*/
export interface CurrentDateOptions {
/**
* The initial date displayed when the calendar first loads.
*/
defaultDate?: moment.Moment | Date | string;
year?: number;
month?: number;
date?: number;
// Text/Time Customization - http://fullcalendar.io/docs/text/
/**
* Whether or not to display a marker indicating the current time.
*
* default: false
*/
nowIndicator?: boolean;
timeFormat?: any; // String
columnFormat?: any; // String
titleFormat?: any; // String
/**
* Sets the exact date range that is visible in a view.
*/
visibleRange?: ((currentDate: moment.Moment) => TimeRange) | TimeRange;
/**
* Limits which dates the user can navigate to and where events can go.
*/
validRange?: TimeRange;
/**
* How far into the future/past the calendar navigates when prev/next is executed.
*/
dateIncrement?: moment.Duration;
/**
* Determines the first visible day for a Custom or Generic view.
*/
dateAlignment?: string;
/**
* Sets the exact duration of a Custom or Generic view.
*/
duration?: moment.Duration;
/**
* Sets the exact number of days displayed in a Custom or Generic view, regardless of weekends or hiddenDays.
*/
dayCount?: number;
}
/**
* Text/Time Customization - https://fullcalendar.io/docs/text/
*/
export interface TextTimeCustomizationOptions {
/**
* Customize the language and localization options for the calendar.
*
* default 'en'
*/
locale?: string;
/**
* Determines the time-text that will be displayed on each event.
*/
timeFormat?: string;
/**
* Determines the text that will be displayed on the calendar's column headings.
*/
columnFormat?: string;
/**
* Determines the text that will be displayed in the header's title.
*/
titleFormat?: string;
/**
* Text that will be displayed on buttons of the header.
*/
buttonText?: ButtonTextObject;
/**
* Full names of months.
*/
monthNames?: string[];
/**
* Abbreviated names of months.
*/
monthNamesShort?: string[];
/**
* Full names of days-of-week.
*/
dayNames?: string[];
/**
* Abbreviated names of days-of-week.
*/
dayNamesShort?: string[];
/**
* The heading text for week numbers.
*
* default: 'W'
*/
weekNumberTitle?: string;
// Clicking & Hovering - http://fullcalendar.io/docs/mouse/
/**
* Whether or not to display the text for an event's time.
*/
displayEventTime?: boolean;
/**
* Whether or not to display an event's end time text when it is rendered on the calendar.
*/
displayEventEnd?: boolean;
/**
* Determines the text of the link created by eventLimit setting.
*
* default: "more"
*/
eventLimitText?: string | ((nEvents: number) => string);
/**
* Determines the date format of title of the popover created by the eventLimitClick option.
*/
dayPopoverFormat?: string;
}
/**
* Clicking & Hovering - https://fullcalendar.io/docs/mouse/
*/
export interface ClickingAndHoveringOptions {
/**
* Determines if day names and week names are clickable.
*
* default: false
*/
navLinks?: boolean;
/**
* Determines what happens upon a day heading nav-link click.
*/
navLinkDayClick?: string | ((date: any, jsEvent: Event) => void);
/**
* Determines what happens upon a week-number nav-link click.
*/
navLinkWeekClick?: string | ((weekStart: any, jsEvent: Event) => void);
/**
* Triggered when the user clicks on a day.
*/
dayClick?(date: Date, jsEvent: MouseEvent, view: ViewObject): void;
eventClick?(event: EventObject, jsEvent: MouseEvent, view: ViewObject): any; // return type boolean or void
/**
* Triggered when the user clicks an event.
*/
eventClick?(event: EventObject, jsEvent: MouseEvent, view: ViewObject): boolean | void; // return type boolean or void
/**
* Triggered when the user mouses over an event.
*/
eventMouseover?(event: EventObject, jsEvent: MouseEvent, view: ViewObject): void;
/**
* Triggered when the user mouses out of an event.
*/
eventMouseout?(event: EventObject, jsEvent: MouseEvent, view: ViewObject): void;
}
// Event Data - http://fullcalendar.io/docs/event_data/
/**
* Selection - https://fullcalendar.io/docs/selection/
*/
export interface SelectionOptions {
selectable?: boolean;
selectHelper?: boolean;
unselectAuto?: boolean;
unselectCancel?: string;
selectOverlap?: boolean | ((event: EventObject) => boolean);
selectConstraint?: Timespan | BusinessHours;
select?(start: moment.Moment, end: moment.Moment, jsEvent: MouseEvent, view: ViewObject, resource?: any): void;
unselect?(view: ViewObject, jsEvent: Event): void;
}
/**
* Event Data - https://fullcalendar.io/docs/event_data/
*
* TODO: update interface to v3
*/
export interface EventDataOptions {
/**
* This has one of the following types:
*
@@ -123,81 +683,206 @@ export interface Options extends AgendaOptions, EventDraggingResizingOptions, Dr
lazyFetching?: boolean;
eventDataTransform?(eventData: any): EventObject;
loading?(isLoading: boolean, view: ViewObject): void;
eventLimit?: boolean;
// Event Rendering - http://fullcalendar.io/docs/event_rendering/
eventColor?: string;
eventBackgroundColor?: string;
eventBorderColor?: string;
eventTextColor?: string;
eventRender?(event: EventObject, element: JQuery, view: ViewObject): void;
eventAfterRender?(event: EventObject, element: JQuery, view: ViewObject): void;
eventAfterAllRender?(view: ViewObject): void;
eventDestroy?(event: EventObject, element: JQuery, view: ViewObject): void;
// scheduler options
resourceAreaWidth?: number;
schedulerLicenseKey?: string;
customButtons?: any;
resourceLabelText?: any;
resourceColumns?: any;
displayEventTime?: any;
}
/**
* Agenda Options - http://fullcalendar.io/docs/agenda/
* Event Rendering - https://fullcalendar.io/docs/event_rendering/
*/
export interface AgendaOptions {
allDaySlot?: boolean;
allDayText?: string;
slotDuration?: moment.DurationInputArg1;
slotLabelFormat?: string;
slotLabelInterval?: moment.Duration;
snapDuration?: moment.Duration;
scrollTime?: moment.Duration;
minTime?: moment.Duration; // Integer/String
maxTime?: moment.Duration; // Integer/String
slotEventOverlap?: boolean;
export interface EventRenderingOptions {
/**
* Sets the background and border colors for all events on the calendar.
*/
eventColor?: string;
/**
* Sets the background color for all events on the calendar.
*/
eventBackgroundColor?: string;
/**
* Sets the border color for all events on the calendar.
*/
eventBorderColor?: string;
/**
* Sets the text color for all events on the calendar.
*/
eventTextColor?: string;
/**
* When an event's end time spans into another day, the minimum time it must be in order for it to render as if it were on that day.
*
* default: "09:00:00" (9am)
*/
nextDayThreshold?: moment.Duration;
/**
* Determines the vertical ordering events that have the same dates / times.
*
* default 'title'
*/
eventOrder?: string | Array<((a: EventObject, b: EventObject) => number) | (string | ((a: EventObject, b: EventObject) => number))>;
/**
* The amount of milliseconds to wait after an operation, before rendering events.
*
* default: null
*/
eventRenderWait?: number | null;
/**
* Triggered while an event is being rendered.
*/
eventRender?(event: EventObject, element: JQuery, view: ViewObject): void;
/**
* Triggered after an event has been placed on the calendar in its final position.
*/
eventAfterRender?(event: EventObject, element: JQuery, view: ViewObject): void;
/**
* Triggered after all events have finished rendering.
*/
eventAfterAllRender?(view: ViewObject): void;
/**
* Called before an event's element is removed from the DOM.
*/
eventDestroy?(event: EventObject, element: JQuery, view: ViewObject): void;
}
/*
* Event Dragging & Resizing
*/
/**
* Event Dragging & Resizing - https://fullcalendar.io/docs/event_ui/
*/
export interface EventDraggingResizingOptions {
/**
* Determines whether the events on the calendar can be modified.
*
* default: false
*/
editable?: boolean;
/**
* Allow events' start times to be editable through dragging.
*
* default: true
*/
eventStartEditable?: boolean;
/**
* Allow events' durations to be editable through resizing.
*
* default: true
*/
eventDurationEditable?: boolean;
/**
* Time it takes for an event to revert to its original position after an unsuccessful drag.
*
* default: 500
*/
dragRevertDuration?: number; // integer, milliseconds
dragOpacity?: number; // float
/**
* The opacity of an event while it is being dragged.
*
* default: .75
*/
dragOpacity?: number;
/**
* Whether to automatically move scroll containers during event drag-and-drop or while selecting.
*
* default: true
*/
dragScroll?: boolean;
/**
* Determines if events on the calendar, when dragged and resized, are allowed to overlap each other.
*
* default: true
*/
eventOverlap?: boolean | ((stillEvent: EventObject, movingEvent: EventObject) => boolean);
eventConstraint?: "businessHours" | BusinessHours | Timespan;
/**
* Limits event dragging and resizing to certain windows of time.
*/
eventConstraint?: "businessHours" | BusinessHours | Timespan | string;
/**
* Exact programmatic control over where an event can be dropped.
*/
eventAllow?: ((dropInfo: DropInfo, draggedEvent: Event) => boolean);
/**
* For touch devices, the amount of time the user most hold down before an event becomes draggable or a date becomes selectable.
*
* default: 1000
*/
longPressDelay?: number;
/**
* For touch devices, the amount of time the user most hold down before an event becomes draggable.
*
* default: 1000
*/
eventLongPressDelay?: number;
/**
* Triggered when event dragging begins.
*/
eventDragStart?(event: EventObject, jsEvent: MouseEvent, ui: any, view: ViewObject): void;
/**
* Triggered when event dragging stops.
*/
eventDragStop?(event: EventObject, jsEvent: MouseEvent, ui: any, view: ViewObject): void;
/**
* Triggered when dragging stops and the event has moved to a different day/time.
*/
eventDrop?(event: EventObject, delta: moment.Duration, revertFunc: Function, jsEvent: Event, ui: any, view: ViewObject): void;
/**
* Triggered when event resizing begins.
*/
eventResizeStart?(event: EventObject, jsEvent: MouseEvent, ui: any, view: ViewObject): void;
/**
* Triggered when event resizing stops.
*/
eventResizeStop?(event: EventObject, jsEvent: MouseEvent, ui: any, view: ViewObject): void;
/**
* Triggered when resizing stops and the event has changed in duration.
*/
eventResize?(event: EventObject, delta: moment.Duration, revertFunc: Function, jsEvent: Event, ui: any, view: ViewObject): void;
}
/*
* Selection - http://fullcalendar.io/docs/selection/
*/
export interface SelectionOptions {
selectable?: boolean;
selectHelper?: boolean;
unselectAuto?: boolean;
unselectCancel?: string;
selectOverlap?: boolean | ((event: EventObject) => boolean);
selectConstraint?: Timespan | BusinessHours;
select?(start: moment.Moment, end: moment.Moment, jsEvent: MouseEvent, view: ViewObject, resource?: any): void;
unselect?(view: ViewObject, jsEvent: Event): void;
}
/**
* Dropping External Elements - https://fullcalendar.io/docs/dropping/
*/
export interface DroppingExternalElementsOptions {
/**
* Determines if jQuery UI draggables can be dropped onto the calendar.
*
* default: false
*/
droppable?: boolean;
/**
* Provides a way to filter which elements can be dropped onto the calendar.
*/
dropAccept?: string | ((draggable: any) => boolean);
/**
* Called when a valid jQuery UI draggable has been dropped onto the calendar.
*/
drop?(date: moment.Moment, jsEvent: MouseEvent, ui: any): void;
/**
* Called when an external element, containing event data, is dropped on the calendar.
*/
eventReceive?(event: EventObject): void;
}
@@ -210,8 +895,10 @@ export interface ButtonTextObject {
month?: string;
week?: string;
day?: string;
list?: string;
}
// TODO: check compatibility with v3 and update if necessary
/* Refer to http://fullcalendar.io/docs/event_data/Event_Object/ */
export interface EventObject extends Timespan {
id?: any; // String/number
@@ -234,6 +921,7 @@ export interface EventObject extends Timespan {
[x: string]: any;
}
// TODO: check compatibility with v3 and update if necessary
export interface ViewObject extends Timespan {
name: string;
title: string;
@@ -241,6 +929,7 @@ export interface ViewObject extends Timespan {
intervalEnd: moment.Moment;
}
// TODO: check compatibility with v3 and update if necessary
export interface EventSource extends JQueryAjaxSettings {
/**
* This has one of the following types:
@@ -266,6 +955,7 @@ export interface EventSource extends JQueryAjaxSettings {
/*
* View Specific Options - http://fullcalendar.io/docs/views/View-Specific-Options/
* TODO: check compatibility with v3 and update if necessary
*/
export interface ViewSpecificOptions {
basic?: Options;
@@ -278,7 +968,9 @@ export interface ViewSpecificOptions {
agendaWeek?: Options;
agendaDay?: Options;
}
declare global {
// TODO: check compatibility with v3 and update if necessary
interface JQuery {
/**
* Get/Set option value
+12 -12
View File
@@ -410,7 +410,7 @@ declare namespace google {
}
export interface ChartArea {
backgroundColor: string | { stroke: string; strokeWidth?: number };
backgroundColor?: string | { stroke: string; strokeWidth?: number };
top?: number | string;
left?: number | string;
right?: number | string;
@@ -584,7 +584,7 @@ declare namespace google {
draw(data: DataTable | DataView, options: ColumnChartOptions): void;
}
// https://developers.google.com/chart/interactive/docs/gallery/columnchart#Configuration_Options
// https://developers.google.com/chart/interactive/docs/gallery/columnchart#configuration-options
export interface ColumnChartOptions {
aggregationTarget?: string;
animation?: TransitionAnimation;
@@ -600,7 +600,7 @@ declare namespace google {
fontName?: string;
hAxis?: ChartAxis;
height?: number;
isStacked?: boolean;
isStacked?: boolean | 'percent' | 'relative' | 'absolute';
legend?: ChartLegend | 'none';
reverseCategories?: boolean;
selectionMode?: string // single / multiple
@@ -663,7 +663,7 @@ declare namespace google {
//#endregion
//#region BarChart
// https://developers.google.com/chart/interactive/docs/gallery/barchart#Configuration_Options
// https://developers.google.com/chart/interactive/docs/gallery/barchart#configuration-options
export interface BarChartOptions {
aggregationTarget?: string;
animation?: TransitionAnimation;
@@ -681,7 +681,7 @@ declare namespace google {
hAxes?: any;
hAxis?: ChartAxis;
height?: number;
isStacked?: boolean;
isStacked?: boolean | 'percent' | 'relative' | 'absolute';
legend?: ChartLegend | 'none';
reverseCategories?: boolean;
series?: any;
@@ -708,7 +708,7 @@ declare namespace google {
draw(data: DataTable | DataView, options: HistogramOptions): void;
}
// https://developers.google.com/chart/interactive/docs/gallery/histogram#Configuration_Options
// https://developers.google.com/chart/interactive/docs/gallery/histogram#configuration-options
export interface HistogramOptions {
animation?: TransitionAnimation;
axisTitlesPosition?: string; // in, out, none
@@ -725,7 +725,7 @@ declare namespace google {
histogram?: HistogramHistogramOptions;
height?: number;
interpolateNulls?: boolean;
isStacked?: boolean;
isStacked?: boolean | 'percent' | 'relative' | 'absolute';
legend?: ChartLegend | 'none';
orientation?: string;
reverseCategories?: boolean;
@@ -754,7 +754,7 @@ declare namespace google {
draw(data: DataTable | DataView, options: AreaChartOptions): void;
}
// https://developers.google.com/chart/interactive/docs/gallery/areachart#Configuration_Options
// https://developers.google.com/chart/interactive/docs/gallery/areachart#configuration-options
export interface AreaChartOptions {
aggregationTarget?: string;
animation?: TransitionAnimation;
@@ -774,7 +774,7 @@ declare namespace google {
hAxis?: ChartAxis;
height?: number;
interpolateNulls?: boolean;
isStacked?: boolean;
isStacked?: boolean | 'percent' | 'relative' | 'absolute';
legend?: ChartLegend | 'none';
lineWidth?: number;
orientation?: string;
@@ -842,7 +842,7 @@ declare namespace google {
draw(data: DataTable | DataView, options: SteppedAreaChartOptions): void;
}
// https://developers.google.com/chart/interactive/docs/gallery/areachart#Configuration_Options
// https://developers.google.com/chart/interactive/docs/gallery/steppedareachart#configuration-options
export interface SteppedAreaChartOptions {
aggregationTarget?: string;
animation?: TransitionAnimation;
@@ -859,7 +859,7 @@ declare namespace google {
hAxis?: ChartAxis;
height?: number;
interpolateNulls?: boolean;
isStacked?: boolean;
isStacked?: boolean | 'percent' | 'relative' | 'absolute';
legend?: ChartLegend | 'none';
reverseCategories?: boolean;
selectionMode?: string // single / multiple
@@ -882,7 +882,7 @@ declare namespace google {
draw(data: DataTable | DataView, options: PieChartOptions): void;
}
// https://developers.google.com/chart/interactive/docs/gallery/piechart#Configuration_Options
// https://developers.google.com/chart/interactive/docs/gallery/piechart#configuration-options
export interface PieChartOptions {
backgroundColor?: any;
chartArea?: ChartArea;
+13
View File
@@ -36,6 +36,16 @@ export interface ExecutionResult {
errors?: GraphQLError[];
}
export type ExecutionArgs = {
schema: GraphQLSchema,
document: DocumentNode,
rootValue?: any,
contextValue?: any,
variableValues?: {[key: string]: any},
operationName?: string,
fieldResolver?: GraphQLFieldResolver<any, any>
};
/**
* Implements the "Evaluating requests" section of the GraphQL specification.
*
@@ -43,7 +53,10 @@ export interface ExecutionResult {
*
* If the arguments to this function do not result in a legal execution context,
* a GraphQLError will be thrown immediately explaining the invalid input.
*
* Accepts either an object with named arguments, or individual arguments.
*/
export function execute(args: ExecutionArgs): Promise<ExecutionResult>;
export function execute(
schema: GraphQLSchema,
document: DocumentNode,
+1
View File
@@ -2,6 +2,7 @@ export {
execute,
defaultFieldResolver,
responsePathAsArray,
ExecutionArgs,
ExecutionResult
} from './execute';
+24 -4
View File
@@ -1,3 +1,5 @@
import { Source } from './language/source';
import { GraphQLFieldResolver } from './type/definition';
import { GraphQLSchema } from './type/schema';
import { ExecutionResult } from './execution/execute';
@@ -10,9 +12,11 @@ import { ExecutionResult } from './execution/execute';
* may wish to separate the validation and execution phases to a static time
* tooling step, and a server runtime step.
*
* Accepts either an object with named arguments, or individual arguments:
*
* schema:
* The GraphQL type system to use when validating and executing a query.
* requestString:
* source:
* A GraphQL language formatted string representing the requested operation.
* rootValue:
* The value provided as the first argument to resolver functions on the top
@@ -24,14 +28,30 @@ import { ExecutionResult } from './execution/execute';
* The name of the operation to use if requestString contains multiple
* possible operations. Can be omitted if requestString contains only
* one operation.
* fieldResolver:
* A resolver function to use when one is not provided by the schema.
* If not provided, the default field resolver is used (which looks for a
* value or method on the source value with the field's name).
*/
export function graphql(
export function graphql(args: {
schema: GraphQLSchema,
requestString: string,
source: string | Source,
rootValue?: any,
contextValue?: any,
variableValues?: {
[key: string]: any
},
operationName?: string
operationName?: string,
fieldResolver?: GraphQLFieldResolver<any, any>
}): Promise<ExecutionResult>;
export function graphql(
schema: GraphQLSchema,
source: string | Source,
rootValue?: any,
contextValue?: any,
variableValues?: {
[key: string]: any
},
operationName?: string,
fieldResolver?: GraphQLFieldResolver<any, any>
): Promise<ExecutionResult>;
+1
View File
@@ -30,6 +30,7 @@ export {
defaultFieldResolver,
responsePathAsArray,
getDirectiveValues,
ExecutionArgs,
ExecutionResult,
} from './execution';
+7 -1
View File
@@ -6,4 +6,10 @@ export { createLexer, TokenKind, Lexer } from './lexer';
export { parse, parseValue, parseType, ParseOptions } from './parser';
export { print } from './printer';
export { Source } from './source';
export { visit, visitInParallel, visitWithTypeInfo, BREAK } from './visitor';
export {
visit,
visitInParallel,
visitWithTypeInfo,
getVisitFn,
BREAK
} from './visitor';
+6
View File
@@ -47,3 +47,9 @@ export function visit(root: any, visitor: any, keyMap?: any): any;
export function visitInParallel(visitors: any): any;
export function visitWithTypeInfo(typeInfo: any, visitor: any): any;
/**
* Given a visitor instance, if it is leaving or not, and a node kind, return
* the function the visitor runtime should call.
*/
export function getVisitFn(visitor: any, kind: any, isLeaving: any): any;
+12
View File
@@ -0,0 +1,12 @@
import gravatarUrl = require('gravatar-url');
gravatarUrl('sindresorhus@gmail.com'); // $ExpectType string
gravatarUrl('sindresorhus@gmail.com', { default: 'monsterid' }); // $ExpectType string
gravatarUrl('sindresorhus@gmail.com', { default: 'monsterid', size: 200 }); // $ExpectType string
gravatarUrl('sindresorhus@gmail.com', { default: 'monsterid', rating: 'g', size: 200 }); // $ExpectType string
gravatarUrl('sindresorhus@gmail.com', { rating: 'g' }); // $ExpectType string
gravatarUrl('sindresorhus@gmail.com', { rating: 'pg' }); // $ExpectType string
gravatarUrl('sindresorhus@gmail.com', { rating: 'r' }); // $ExpectType string
gravatarUrl('sindresorhus@gmail.com', { rating: 'x' }); // $ExpectType string
gravatarUrl('sindresorhus@gmail.com', { rating: 'g', size: 200 }); // $ExpectType string
gravatarUrl('sindresorhus@gmail.com', { size: 200 }); // $ExpectType string
+16
View File
@@ -0,0 +1,16 @@
// Type definitions for gravatar-url 2.0
// Project: https://github.com/sindresorhus/gravatar-url
// Definitions by: Ivan Gabriele <https://github.com/ivangabriele>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = GravatarUrl;
declare function GravatarUrl(email: string, options?: GravatarUrl.Options): string;
declare namespace GravatarUrl {
interface Options {
default?: string;
rating?: 'g' | 'pg' | 'r' | 'x';
size?: number;
}
}
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"gravatar-url-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+8
View File
@@ -0,0 +1,8 @@
// Type definitions for hexo-bunyan 1.0
// Project: https://github.com/trentm/node-bunyan#readme
// Definitions by: segayuu <https://github.com/segayuu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import bunyan = require("bunyan");
export = bunyan;
+21
View File
@@ -0,0 +1,21 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+90
View File
@@ -0,0 +1,90 @@
import mocha = require('mocha');
import chai = require('chai');
const should = chai.should();
import rewire = require('rewire');
import sinon = require('sinon');
import logger = require('hexo-log');
const _c = logger();
type HexoLogger = typeof _c;
describe('hexo-log', () => {
const loggerModule = rewire<(options?: { name?: string; silent?: boolean; debug?: boolean; }) => HexoLogger>('./');
it('add alias for levels', () => {
const log = logger();
log.d.should.eql(log.debug);
log.i.should.eql(log.info);
log.w.should.eql(log.warn);
log.e.should.eql(log.error);
log.log.should.eql(log.info);
});
it('default name is hexo', () => {
const log = logger();
log.fields.name.should.eql('hexo');
});
it('options.name', () => {
const log = logger({ name: 'foo' });
log.fields.name.should.eql('foo');
});
it('level should be trace if options.debug is true', () => {
const log: any = logger({ debug: true });
log.streams[0].level.should.eql(10);
});
it('should add file stream if options.debug is true', () => {
const log: any = logger({ debug: true });
log.streams[1].path.should.eql('debug.log');
});
it('should remove console stream if options.silent is true', () => {
const log: any = logger({ silent: true });
log.streams.length.should.eql(0);
});
it('should display time if options.debug is true', () => {
const spy = sinon.spy();
const now = new Date();
loggerModule.__with__({
process: {
stdout: {
write: spy
}
}
})(() => {
sinon.useFakeTimers(now.valueOf());
const log = loggerModule({ debug: true });
log.info('test');
sinon.restore(undefined);
});
spy.args[0][0].should.contain(now.toISOString().substring(11, 23));
});
it('should print error to process.stderr stream', () => {
const spy = sinon.spy();
loggerModule.__with__({
process: {
stderr: {
write: spy
}
}
})(() => {
const log = loggerModule();
log.error('test');
});
spy.calledOnce.should.be.true;
});
});
+163
View File
@@ -0,0 +1,163 @@
// Type definitions for hexo-log 0.2
// Project: http://hexo.io/
// Definitions by: segayuu <https://github.com/segayuu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
import bunyan = require('hexo-bunyan');
import streams = require('stream');
declare class HexoLogger extends bunyan {
/* tslint:disable:unified-signatures */
/**
* Returns a boolean: is the `debug` level enabled?
*
* This is equivalent to `log.isDebugEnabled()` or `log.isEnabledFor(DEBUG)` in log4j.
*/
d(): boolean;
/**
* Special case to log an `Error` instance to the record.
* This adds an `err` field with exception details
* (including the stack) and sets `msg` to the exception
* message or you can specify the `msg`.
*/
d(error: Error, ...params: any[]): void;
/**
* The first field can optionally be a "fields" object, which
* is merged into the log record.
*
* To pass in an Error *and* other fields, use the `err`
* field name for the Error instance.
*/
d(obj: object, ...params: any[]): void;
/**
* Uses `util.format` for msg formatting.
*/
d(format: any, ...params: any[]): void;
/**
* Returns a boolean: is the `info` level enabled?
*
* This is equivalent to `log.isInfoEnabled()` or `log.isEnabledFor(INFO)` in log4j.
*/
i(): boolean;
/**
* Special case to log an `Error` instance to the record.
* This adds an `err` field with exception details
* (including the stack) and sets `msg` to the exception
* message or you can specify the `msg`.
*/
i(error: Error, ...params: any[]): void;
/**
* The first field can optionally be a "fields" object, which
* is merged into the log record.
*
* To pass in an Error *and* other fields, use the `err`
* field name for the Error instance.
*/
i(obj: object, ...params: any[]): void;
/**
* Uses `util.format` for msg formatting.
*/
i(format: any, ...params: any[]): void;
/**
* Returns a boolean: is the `warn` level enabled?
*
* This is equivalent to `log.isWarnEnabled()` or `log.isEnabledFor(WARN)` in log4j.
*/
w(): boolean;
/**
* Special case to log an `Error` instance to the record.
* This adds an `err` field with exception details
* (including the stack) and sets `msg` to the exception
* message or you can specify the `msg`.
*/
w(error: Error, ...params: any[]): void;
/**
* The first field can optionally be a "fields" object, which
* is merged into the log record.
*
* To pass in an Error *and* other fields, use the `err`
* field name for the Error instance.
*/
w(obj: object, ...params: any[]): void;
/**
* Uses `util.format` for msg formatting.
*/
w(format: any, ...params: any[]): void;
/**
* Returns a boolean: is the `error` level enabled?
*
* This is equivalent to `log.isErrorEnabled()` or `log.isEnabledFor(ERROR)` in log4j.
*/
e(): boolean;
/**
* Special case to log an `Error` instance to the record.
* This adds an `err` field with exception details
* (including the stack) and sets `msg` to the exception
* message or you can specify the `msg`.
*/
e(error: Error, ...params: any[]): void;
/**
* The first field can optionally be a "fields" object, which
* is merged into the log record.
*
* To pass in an Error *and* other fields, use the `err`
* field name for the Error instance.
*/
e(obj: object, ...params: any[]): void;
/**
* Uses `util.format` for msg formatting.
*/
e(format: any, ...params: any[]): void;
/**
* Returns a boolean: is the `info` level enabled?
*
* This is equivalent to `log.isInfoEnabled()` or `log.isEnabledFor(INFO)` in log4j.
*/
log(): boolean;
/**
* Special case to log an `Error` instance to the record.
* This adds an `err` field with exception details
* (including the stack) and sets `msg` to the exception
* message or you can specify the `msg`.
*/
log(error: Error, ...params: any[]): void;
/**
* The first field can optionally be a "fields" object, which
* is merged into the log record.
*
* To pass in an Error *and* other fields, use the `err`
* field name for the Error instance.
*/
log(obj: object, ...params: any[]): void;
/**
* Uses `util.format` for msg formatting.
*/
log(format: any, ...params: any[]): void;
/* tslint:enable:unified-signatures */
}
declare function createLogger(options?: { name?: string; silent?: boolean; debug?: boolean; }): HexoLogger;
export = createLogger;
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"hexo-log-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+2 -2
View File
@@ -1430,9 +1430,9 @@ declare namespace Hls {
*/
levelId?: number;
/**
* ErrorDetails type
* ErrorDetails type or Level Details
*/
details?: string;
details?: string | LevelDetails;
/**
* PTS drift observed when parsing last fragment
*/
+2 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for Jasmine 2.5.2
// Type definitions for Jasmine 2.6.0
// Project: http://jasmine.github.io/
// Definitions by: Boris Yankov <https://github.com/borisyankov>, Theodore Brown <https://github.com/theodorejb>, David Pärsson <https://github.com/davidparsson>, Gabe Moothart <https://github.com/gmoothart>, Lukas Zech <https://github.com/lukas-zech-software>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -427,6 +427,7 @@ declare namespace jasmine {
toBeTruthy(expectationFailOutput?: any): boolean;
toBeFalsy(expectationFailOutput?: any): boolean;
toHaveBeenCalled(): boolean;
toHaveBeenCalledBefore(expected: Spy): boolean;
toHaveBeenCalledWith(...params: any[]): boolean;
toHaveBeenCalledTimes(expected: number): boolean;
toContain(expected: any, expectationFailOutput?: any): boolean;
+10 -1
View File
@@ -270,19 +270,24 @@ describe("Pending specs", () => {
});
describe("A spy", () => {
var foo: any, bar: any = null;
var foo: any, bar: any, baz: any = null;
beforeEach(() => {
foo = {
setBar: (value: any) => {
bar = value;
},
setBaz: (value: any) => {
baz = value;
}
};
spyOn(foo, 'setBar');
spyOn(foo, 'setBaz');
foo.setBar(123);
foo.setBar(456, 'another param');
foo.setBaz(789);
});
it("tracks that the spy was called", () => {
@@ -294,6 +299,10 @@ describe("A spy", () => {
expect(foo.setBar).toHaveBeenCalledWith(456, 'another param');
});
it("tracks the order in which spies were called", () => {
expect(foo.setBar).toHaveBeenCalledBefore(foo.setBaz);
});
it("stops all execution on a function", () => {
expect(bar).toBeNull();
});
+279 -357
View File
File diff suppressed because it is too large Load Diff
+58 -75
View File
@@ -8,7 +8,7 @@ var num: number = 0;
var str: string = '';
var bool: boolean = false;
var exp: RegExp = null;
var obj: Object = null;
var obj: object = null;
var date: Date = null;
var err: Error = null;
var func: Function = null;
@@ -18,15 +18,16 @@ var numArr: number[] = [];
var strArr: string[] = [];
var boolArr: boolean[] = [];
var expArr: RegExp[] = [];
var objArr: Object[] = [];
var objArr: object[] = [];
var errArr: Error[] = [];
var funcArr: Function[] = [];
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
var schema: Joi.Schema = null;
var schemaLike: Joi.SchemaLike = null;
var anySchema: Joi.AnySchema<Joi.Schema> = null;
var anySchema: Joi.AnySchema = null;
var numSchema: Joi.NumberSchema = null;
var strSchema: Joi.StringSchema = null;
var arrSchema: Joi.ArraySchema = null;
@@ -40,6 +41,7 @@ var altSchema: Joi.AlternativesSchema = null;
var schemaArr: Joi.Schema[] = [];
var ref: Joi.Reference = null;
var description: Joi.Description = null;
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
@@ -53,10 +55,25 @@ validOpts = { stripUnknown: bool };
validOpts = { stripUnknown: { arrays: bool } };
validOpts = { stripUnknown: { objects: bool } };
validOpts = { stripUnknown: { arrays: bool, objects: bool } };
validOpts = { language: bool };
validOpts = { presence: str };
validOpts = { presence: 'optional' || 'required' || 'forbidden' };
validOpts = { context: obj };
validOpts = { noDefaults: bool };
validOpts = {
language: {
root: str,
key: str,
messages: { wrapArrays: bool },
string: { base: str },
number: { base: str },
object: {
base: false,
children: { childRule: str }
},
customType: {
customRule: str
}
}
};
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
@@ -96,11 +113,12 @@ uriOpts = { scheme: expArr };
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
var whenOpts: Joi.WhenOptions<any> = null;
var whenOpts: Joi.WhenOptions = null;
whenOpts = { is: x };
whenOpts = { is: schema, then: schema };
whenOpts = { is: schema, otherwise: schema };
whenOpts = { is: schemaLike, then: schemaLike, otherwise: schemaLike };
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
@@ -146,8 +164,6 @@ schema = dateSchema;
schema = funcSchema;
schema = objSchema;
schema = ref;
anySchema = anySchema;
anySchema = numSchema;
anySchema = strSchema;
@@ -179,8 +195,20 @@ schemaMap = {
{ b1: strSchema },
{ b2: anySchema }
],
c: arrSchema
c: arrSchema,
d: schemaLike
};
schemaMap = {
a: 1,
b: {
b1: '1',
b2: 2
},
c: [
{ c1: true },
{ c2: null }
]
}
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
@@ -256,9 +284,9 @@ arrSchema = arrSchema.sparse(bool);
arrSchema = arrSchema.single();
arrSchema = arrSchema.single(bool);
arrSchema = arrSchema.ordered(anySchema);
arrSchema = arrSchema.ordered(anySchema, numSchema, strSchema, arrSchema, boolSchema, binSchema, dateSchema, funcSchema, objSchema);
arrSchema = arrSchema.ordered(anySchema, numSchema, strSchema, arrSchema, boolSchema, binSchema, dateSchema, funcSchema, objSchema, schemaLike);
arrSchema = arrSchema.ordered(schemaMap);
arrSchema = arrSchema.ordered([schemaMap, schemaMap]);
arrSchema = arrSchema.ordered([schemaMap, schemaMap, schemaLike]);
arrSchema = arrSchema.min(num);
arrSchema = arrSchema.max(num);
arrSchema = arrSchema.length(num);
@@ -268,11 +296,11 @@ arrSchema = arrSchema.unique('customer.id');
arrSchema = arrSchema.items(numSchema);
arrSchema = arrSchema.items(numSchema, strSchema);
arrSchema = arrSchema.items([numSchema, strSchema]);
arrSchema = arrSchema.items(numSchema, strSchema, schemaLike);
arrSchema = arrSchema.items([numSchema, strSchema, schemaLike]);
arrSchema = arrSchema.items(schemaMap);
arrSchema = arrSchema.items(schemaMap, schemaMap);
arrSchema = arrSchema.items([schemaMap, schemaMap]);
arrSchema = arrSchema.items(schemaMap, schemaMap, schemaLike);
arrSchema = arrSchema.items([schemaMap, schemaMap, schemaLike]);
// - - - - - - - -
@@ -609,6 +637,7 @@ objSchema = objSchema.max(num);
objSchema = objSchema.length(num);
objSchema = objSchema.pattern(exp, schema);
objSchema = objSchema.pattern(exp, schemaLike);
objSchema = objSchema.and(str);
objSchema = objSchema.and(str, str);
@@ -843,8 +872,8 @@ namespace validate_tests {
});
let returnValue: Joi.ValidationResult<typeof value>;
returnValue = Joi.validate(value);
value = Joi.validate(value, (err, value) => value);
returnValue = schema.validate(value);
value = schema.validate(value, (err, value) => value);
returnValue = Joi.validate(value, schema);
returnValue = Joi.validate(value, obj);
@@ -872,17 +901,22 @@ schema = Joi.compile(schemaMap);
Joi.assert(obj, schema);
Joi.assert(obj, schema, str);
Joi.assert(obj, schema, err);
Joi.assert(obj, schemaLike);
Joi.attempt(obj, schema);
Joi.attempt(obj, schema, str);
Joi.attempt(obj, schema, err);
Joi.attempt(obj, schemaLike);
ref = Joi.ref(str, refOpts);
ref = Joi.ref(str);
Joi.isRef(ref);
schema = Joi.reach(schema, '');
description = Joi.describe(schema);
description = schema.describe();
schema = Joi.reach(objSchema, '');
const Joi2 = Joi.extend({ name: '', base: schema });
@@ -892,9 +926,11 @@ const Joi3 = Joi.extend({
language: {
asd: 'must be exactly asd(f)',
},
pre (value, state, options) {
pre(value, state, options) {
return value;
},
describe (description) {
describe(description) {
return description;
},
rules: [
{
@@ -902,10 +938,10 @@ const Joi3 = Joi.extend({
params: {
allowF: Joi.boolean().default(false),
},
setup (params) {
setup(params) {
const fIsAllowed = params.allowF;
},
validate (params, value, state, options) {
validate(params, value, state, options) {
if (value === 'asd' || params.allowF && value === 'asdf') {
return value;
}
@@ -914,56 +950,3 @@ const Joi3 = Joi.extend({
},
],
});
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
schema = Joi.allow(x, x);
schema = Joi.allow([x, x, x]);
schema = Joi.valid(x);
schema = Joi.valid(x, x);
schema = Joi.valid([x, x, x]);
schema = Joi.only(x);
schema = Joi.only(x, x);
schema = Joi.only([x, x, x]);
schema = Joi.equal(x);
schema = Joi.equal(x, x);
schema = Joi.equal([x, x, x]);
schema = Joi.invalid(x);
schema = Joi.invalid(x, x);
schema = Joi.invalid([x, x, x]);
schema = Joi.disallow(x);
schema = Joi.disallow(x, x);
schema = Joi.disallow([x, x, x]);
schema = Joi.not(x);
schema = Joi.not(x, x);
schema = Joi.not([x, x, x]);
schema = Joi.required();
schema = Joi.optional();
schema = Joi.forbidden();
schema = Joi.strip();
schema = Joi.description(str);
schema = Joi.notes(str);
schema = Joi.notes(strArr);
schema = Joi.tags(str);
schema = Joi.tags(strArr);
schema = Joi.meta(obj);
schema = Joi.example(obj);
schema = Joi.unit(str);
schema = Joi.options(validOpts);
schema = Joi.strict();
schema = Joi.strict(bool);
schema = Joi.concat(x);
schema = Joi.when(str, whenOpts);
schema = Joi.when(ref, whenOpts);
schema = Joi.label(str);
schema = Joi.raw();
schema = Joi.raw(bool);
schema = Joi.empty();
schema = Joi.empty(str);
schema = Joi.empty(anySchema);
+1 -1
View File
@@ -92,7 +92,7 @@ interface JQueryStatic {
/**
* A simple, lightweight jQuery plugin for reading, writing and deleting cookies.
*/
cookie?: JQueryCookieStatic;
cookie: JQueryCookieStatic;
/**
* Deletes a cookie
* @param name Name of cookie to delete
+19 -5
View File
@@ -30,7 +30,6 @@ interface PNotifyLabel {
stick?: string;
}
interface PNotifyconfirmButton {
text?: string;
addClass?: string;
@@ -192,9 +191,10 @@ interface PNotifyOptions {
*/
icon?: any;
/**
* The animation to use when displaying and hiding the notice. "none", "show", "fade", and "slide" are built in to jQuery. Others require jQuery UI. Use an object with effect_in and effect_out to use different effects.
*/
animation?: any;
* The animation to use when displaying and hiding the notice. "none" and "fade" are supported through CSS.
* Others are supported through the Animate module and Animate.css.
*/
animation?: string;
/**
* Speed at which the notice animates in and out. "slow", "def" or "normal", "fast" or number of milliseconds.
*/
@@ -323,8 +323,22 @@ interface PNotify {
interface PNotifyConstructor {
new (options?: PNotifyOptions): PNotify;
/**
* Remove all notices.
*/
removeAll(): void;
/**
* Remove all the notices in a stack.
* @param stack
*/
removeStack(stack: PNotifyStack): void;
/**
* Reposition the notices, optionally animating their movement.
*/
positionAll(animate?: boolean): void
}
declare var PNotify: PNotifyConstructor;
+3 -3
View File
@@ -25,9 +25,9 @@ export class SObject<T> {
find<T>(query?: any, fields?: Object | string[] | string, callback?: (err: Error, ret: T[]) => void): Query<T>;
find<T>(query?: any, fields?: Object | string[] | string, options?: Object, callback?: (err: Error, ret: T[]) => void): Query<T>;
findOne<T>(query?: any, callback?: (err: Error, ret: T) => void): void;
findOne<T>(query?: any, fields?: Object | string[] | string, callback?: (err: Error, ret: T) => void): void;
findOne<T>(query?: any, fields?: Object | string[] | string, options?: Object, callback?: (err: Error, ret: T) => void): void;
findOne<T>(query?: any, callback?: (err: Error, ret: T) => void): Query<T>;
findOne<T>(query?: any, fields?: Object | string[] | string, callback?: (err: Error, ret: T) => void): Query<T>;
findOne<T>(query?: any, fields?: Object | string[] | string, options?: Object, callback?: (err: Error, ret: T) => void): Query<T>;
approvalLayouts(callback?: (layoutInfo: ApprovalLayoutInfo) => void): Promise<ApprovalLayoutInfo>;
bulkload(operation: string, options?: { extIdField?: string }, input?: Array<Record<T>> | stream.Stream[] | string[], callback?: (err: Error, ret: RecordResult) => void): Batch;
+266 -61
View File
@@ -1,10 +1,229 @@
// Type definitions for JW Player 6.0
// Type definitions for JW Player V8.0
// Project: http://developer.longtailvideo.com/trac/
// Definitions by: Martin Duparc <https://github.com/martinduparc>
// Tomer Kruvi <https://github.com/kutomer>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// JW Player is the leading HTML5 & Flash video player, optimized for mobile and the desktop. Easy enough for beginners, advanced enough for pros.
interface Version {
version: string;
major: number;
minor: number
}
interface Browser {
chrome: boolean;
edge: boolean;
facebook: boolean;
firefox: boolean;
ie: boolean;
msie: boolean;
safari: boolean;
version: Version;
}
interface OS {
android: boolean;
androidNative: boolean; // Android native browser
iOS: boolean;
mobile: boolean;
mac: boolean;
iPad: boolean;
iPhone: boolean;
windows: boolean;
version: Version;
}
interface Features {
flash: boolean;
flashVersion: number;
iframe: boolean;
}
interface Environment{
Browser: Browser;
OS: OS;
Features: Features;
}
interface CallbackParam {
}
interface AdProgressParam extends CallbackParam {
client: 'vast' | 'googima';
creativetype: string;
tag: string;
}
interface AdCompanionsParam extends CallbackParam {
companions: any[];
tag: string;
}
interface AdErrorParam extends CallbackParam {
message: string;
tag: string;
}
interface AdRequestParam extends CallbackParam {
adposition: 'pre' | 'mid' | 'post';
client: 'vast' | 'googima';
offset: 'pre' | 'mid' | 'post';
tag: string;
}
interface AdImpressionParam extends CallbackParam {
adposition: 'pre' | 'mid' | 'post';
adsystem: string;
adtitle: string;
clickThroughUrl: string;
client: 'vast' | 'googima';
creativetype: string;
linear: string;
mediafile: any;
tag: string;
vastversion: number;
wrapper: any[];
}
interface AdStartedParam extends CallbackParam {
creativetype: string;
tag: string;
}
interface AdPlayParam extends CallbackParam {
creativetype: string;
newstate: string;
oldstate: string;
tag: string;
}
interface BufferParam extends CallbackParam {
newstate: string;
oldstate: string;
reason: 'loading' | 'complete' | 'stalled' | 'error';
}
interface BufferChangeParam extends CallbackParam {
duration: number;
bufferPercent: number;
position: number;
metadata: any;
}
interface AdTimeParam extends CallbackParam {
client: 'vast' | 'googima';
creativetype: string;
duration: number;
position: number;
sequence: number;
tag: string;
}
interface AudioTracksParam extends CallbackParam {
levels: any[];
}
interface CaptionsChangedParam extends CallbackParam {
currentTrack: number;
}
interface CaptionsListParam extends CallbackParam {
tracks: any[];
}
interface AudioTrackChangedParam extends CallbackParam {
currentTrack: number;
}
interface MetadataParam extends CallbackParam {
metadata: any;
}
interface ControlsParam extends CallbackParam {
controls: boolean;
}
interface ErrorParam extends CallbackParam {
message: string;
}
interface FullscreenParam extends CallbackParam {
fullscreen: boolean;
}
interface IdleParam extends CallbackParam {
oldstate: 'buffering' | 'playing' | 'paused';
}
interface LevelsChangedParam extends CallbackParam {
currentQuality: number;
}
interface MuteParam extends CallbackParam {
mute: boolean;
}
interface VolumeParam extends CallbackParam {
volume: boolean;
}
interface PlayParam extends CallbackParam {
oldstate: 'buffering' | 'playing';
viewable: 0 | 1;
}
interface PlaylistParam extends CallbackParam {
playlist: any[];
}
interface PlaylistItemParam extends CallbackParam {
index: number;
item: any;
}
interface ReadyParam extends CallbackParam {
setupTime: number;
viewable: 0 | 1;
}
interface ResizeParam extends CallbackParam {
width: number;
height: number;
}
interface VisualQualityParam extends CallbackParam {
mode: string;
label: string;
reason: string;
}
interface LevelsParam extends CallbackParam {
width: number;
levels: any[];
}
interface SeekParam extends CallbackParam {
position: number;
offset: number;
}
interface TimeParam extends CallbackParam {
duration: number;
position: number;
viewable: 0 | 1;
}
interface FirstFrameParam extends CallbackParam {
loadTime: number;
viewable: 0 | 1;
}
interface EventCallback<T extends CallbackParam> {
(param: T): void;
}
interface JWPlayer {
addButton(icon: string, label: string, handler: () => void, id: string): void;
getAudioTracks(): any[];
@@ -27,68 +246,54 @@ interface JWPlayer {
getSafeRegion(): any[];
getState(): string;
getVolume(): number;
getEnvironment(): Environment;
getWidth(): number;
load(playlist: any[]): void;
load(playlist: string): void;
onAdClick(callback: (o: { tag: string; }) => void): void;
onAdCompanions(callback: (o: {
tag: string;
companions: any[];
}) => void): void;
onAdComplete(callback: (o: { tag: string; }) => void): void;
onAdError(callback: (o: {
tag: string;
message: string;
}) => void): void;
onAdImpression(callback: (o: { tag: string; }) => void): void;
onAdPause(callback: (o: { tag: string; }) => void): void;
onAdPlay(callback: (o: { tag: string; }) => void): void;
onAdSkipped(callback: (o: { tag: string; }) => void): void;
onAdTime(callback: (o: {
tag: string;
position: number;
duration: number;
sequence: number;
}) => void): void;
onAudioTracks(callback: (o: { levels: any[]; }) => void): void;
onAudioTrackChange(callback: (o: { currentTrack: number; }) => void): void;
onBeforeComplete(callback: () => void): void;
onBeforePlay(callback: () => void): void;
onBuffer(callback: (o: { oldstate: string }) => void): void;
onBufferChange(callback: () => void): void;
onCaptionsChange(callback: (o: { track: number; }) => void): void;
onCaptionsList(callback: (o: { tracks: any[]; }) => void): void;
onComplete(callback: () => void): void;
onControls(callback: (o: { controls: boolean; }) => void): void;
onDisplayClick(callback: () => void): void;
onError(callback: (o: { message: string }) => void): void;
onFullscreen(callback: (o: { fullscreen: boolean; }) => void): void;
onIdle(callback: (o: { oldstate: string }) => void): void;
onLevelsChanged(callback: (o: { currentQuality: number }) => void): void;
onMeta(callback: (o: { metadata: any; }) => void): void;
onMute(callback: (o: { mute: boolean; }) => void): void;
onPause(callback: (o: { oldstate: string }) => void): void;
onPlay(callback: (o: { oldstate: string }) => void): void;
onPlaylist(callback: () => void): void;
onPlaylistItem(callback: () => void): void;
onPlaylistComplete(callback: () => void): void;
onReady(callback: () => void): void;
onResize(callback: () => void): void;
onQualityChange(callback: () => void): void;
onQualityLevels(callback: (o: { levels: any[] }) => void): void;
onSeek(callback: (o: {
position: number;
offset: number;
}) => void): void;
onSetupError(callback: (o: {
fallback: boolean;
message: string;
}) => void): void;
onTime(callback: (o: {
duration: number;
position: number;
}) => void): void;
onVolume(callback: (o: { volume: number; }) => void): void;
on(event: 'adClick', callback: EventCallback<AdProgressParam>): void;
on(event: 'adCompanions', callback: EventCallback<AdCompanionsParam>): void;
on(event: 'adComplete', callback: EventCallback<AdProgressParam>): void;
on(event: 'adSkipped', callback: EventCallback<AdProgressParam>): void;
on(event: 'adError', callback: EventCallback<AdErrorParam>): void;
on(event: 'adBlock', callback: () => void): void;
on(event: 'adRequest', callback: EventCallback<AdRequestParam>): void;
on(event: 'adStarted', callback: EventCallback<AdStartedParam>): void;
on(event: 'adImpression', callback: EventCallback<AdImpressionParam>): void;
on(event: 'adPlay', callback: EventCallback<AdPlayParam>): void;
on(event: 'adPause', callback: EventCallback<AdPlayParam>): void;
on(event: 'adTime', callback: EventCallback<AdTimeParam>): void;
on(event: 'meta', callback: EventCallback<MetadataParam>): void;
on(event: 'audioTracks', callback: EventCallback<AudioTracksParam>): void;
on(event: 'audioTrackChanged', callback: EventCallback<AudioTrackChangedParam>): void;
on(event: 'beforeComplete', callback: () => void): void;
on(event: 'complete', callback: () => void): void;
on(event: 'firstFrame', callback: EventCallback<FirstFrameParam>): void;
on(event: 'beforePlay', callback: () => void): void;
on(event: 'buffer', callback: EventCallback<BufferParam>): void;
on(event: 'bufferChange', callback: EventCallback<BufferChangeParam>): void;
on(event: 'captionsChanged', callback: EventCallback<CaptionsChangedParam>): void;
on(event: 'captionsList', callback: EventCallback<CaptionsListParam>): void;
on(event: 'controls', callback: EventCallback<ControlsParam>): void;
on(event: 'displayClick', callback: () => void): void;
on(event: 'error', callback: EventCallback<ErrorParam>): void;
on(event: 'fullscreen', callback: EventCallback<FullscreenParam>): void;
on(event: 'idle', callback: EventCallback<IdleParam>): void;
on(event: 'levelsChanged', callback: EventCallback<LevelsChangedParam>): void;
on(event: 'mute', callback: EventCallback<MuteParam>): void;
on(event: 'volume', callback: EventCallback<VolumeParam>): void;
on(event: 'pause', callback: EventCallback<PlayParam>): void;
on(event: 'play', callback: EventCallback<PlayParam>): void;
on(event: 'playlist', callback: EventCallback<PlaylistParam>): void;
on(event: 'playlistItem', callback: EventCallback<PlaylistItemParam>): void;
on(event: 'playlistComplete', callback: () => void): void;
on(event: 'ready', callback: EventCallback<ReadyParam>): void;
on(event: 'resize', callback: EventCallback<ResizeParam>): void;
on(event: 'visualQuality', callback: EventCallback<VisualQualityParam>): void;
on(event: 'levels', callback: EventCallback<LevelsParam>): void;
on(event: 'seek', callback: EventCallback<SeekParam>): void;
on(event: 'setupError', callback: EventCallback<ErrorParam>): void;
on(event: 'remove', callback: () => void): void;
on(event: 'time', callback: EventCallback<TimeParam>): void;
pause(state?: boolean): void;
play(state?: boolean): void;
playAd(tag: string): void;
@@ -115,4 +320,4 @@ interface JWPlayerStatic {
version: string;
}
declare var jwplayer:JWPlayerStatic;
declare const jwplayer:JWPlayerStatic;
+1 -1
View File
@@ -7025,7 +7025,7 @@ declare namespace kendo.ui {
name?: string;
autoHide?: boolean;
animation?: boolean|TooltipAnimation;
content?: TooltipContent;
content?: string | TooltipContent | ((e: any) => string);
callout?: boolean;
filter?: string;
iframe?: boolean;
+25
View File
@@ -0,0 +1,25 @@
// Type definitions for lozad 1.0
// Project: https://github.com/ApoorvSaxena/lozad.js
// Definitions by: York Yao <https://github.com/plantain-00>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface Option {
rootMargin?: string;
threshold?: number;
load?(element: HTMLElement | HTMLCanvasElement): void;
}
interface Observer {
observe(): void;
}
declare function lozad(selector?: string, options?: Option): Observer;
declare namespace lozad {
const prototype: {
};
}
export as namespace lozad;
export = lozad;
+13
View File
@@ -0,0 +1,13 @@
import lozad = require('lozad');
const observer = lozad('.lozad', {
rootMargin: '10px 0px', // syntax similar to that of CSS Margin
threshold: 0.1, // ratio of element convergence
load(el) {
console.log('loading element');
// Custom implementation to load an element
// e.g. el.src = el.dataset.src;
}
});
observer.observe();
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"lozad-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+1 -1
View File
@@ -1724,7 +1724,7 @@ declare namespace __MaterialUI {
onCellHoverExit?(row: number, column: number): void;
onRowHover?(row: number): void;
onRowHoverExit?(row: number): void;
onRowSelection?(selectedRows: number[] | string): void;
onRowSelection?(selectedRows: number[] | 'all'): void;
selectable?: boolean;
style?: React.CSSProperties;
wrapperStyle?: React.CSSProperties;
+4
View File
@@ -7,6 +7,8 @@ declare module Match {
var undefined: any;
var Object: any;
function Maybe(pattern: any): boolean;
function Optional(pattern: any): boolean;
function ObjectIncluding(dico: any): boolean;
@@ -29,6 +31,8 @@ declare module "meteor/check" {
var undefined: any;
var Object: any;
function Maybe(pattern: any): boolean;
function Optional(pattern: any): boolean;
function ObjectIncluding(dico: any): boolean;
+1
View File
@@ -16,6 +16,7 @@
/// <reference path="./mongo.d.ts" />
/// <reference path="./random.d.ts" />
/// <reference path="./reactive-var.d.ts" />
/// <reference path="./server-render.d.ts" />
/// <reference path="./session.d.ts" />
/// <reference path="./templating.d.ts" />
/// <reference path="./tiny-test.d.ts" />
+16
View File
@@ -0,0 +1,16 @@
import * as http from "http";
declare module "meteor/server-render" {
interface Sink {
request?: http.IncomingMessage;
arch?: string;
head?: string;
body?: string;
htmlById?: { [key: string]: string };
maybeMadeChanges?: boolean;
appendToHead(html: string): void;
appendToBody(html: string): void;
appendToElementById(id: string, html: string): void;
renderIntoElementById(id: string, html: string): void;
}
function onPageLoad(sink: Sink): Promise<any> | any;
}
+1
View File
@@ -29,6 +29,7 @@
"meteor.d.ts",
"mongo.d.ts",
"reactive-var.d.ts",
"server-render.d.ts",
"session.d.ts",
"tiny-test.d.ts",
"tools.d.ts",
+9
View File
@@ -0,0 +1,9 @@
import { TypeMap } from "./index";
export default class Mime {
constructor(mimes: TypeMap);
getType(path: string): string | null;
getExtension(mime: string): string | null;
define(mimes: TypeMap, force?: boolean): void;
}
+7 -10
View File
@@ -1,20 +1,17 @@
// Type definitions for mime 1.3
// Type definitions for mime 2.0
// Project: https://github.com/broofa/node-mime
// Definitions by: Jeff Goddard <https://github.com/jedigo>
// Daniel Hritzkiv <https://github.com/dhritzkiv>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Imported from: https://github.com/soywiz/typescript-node-definitions/mime.d.ts
// Originally imported from: https://github.com/soywiz/typescript-node-definitions/mime.d.ts
export as namespace mime;
export function lookup(path: string, fallback?: string): string;
export function extension(mime: string): string;
export function load(filepath: string): void;
export function define(mimes: { [key: string]: any }): void;
export interface TypeMap { [key: string]: string[]; }
export interface Charsets {
lookup(mime: string): string;
}
export function getType(path: string): string | null;
export function getExtension(mime: string): string | null;
export function define(mimes: TypeMap, force?: boolean): void;
export const charsets: Charsets;
export const default_type: string;
+18 -7
View File
@@ -1,12 +1,23 @@
import * as mime from "mime";
import Mime from "mime/Mime";
let str: string;
const obj: {} = {};
const fallback = '';
let strOrNul: string | null;
const obj = {
mime: ["ext", "ext2"]
};
const obj2 = {
"text/plain": ["txt"]
};
str = mime.lookup(str, fallback);
str = mime.extension(str);
mime.load(str);
mime.define(obj);
mime.define(obj2, true);
strOrNul = mime.getType("ext");
strOrNul = mime.getType("foo");
strOrNul = mime.getExtension("mime");
strOrNul = mime.getExtension("bar");
str = mime.charsets.lookup(str);
const myMime = new Mime(obj);
strOrNul = myMime.getType("foo");
strOrNul = myMime.getExtension('text/plan');
+3 -2
View File
@@ -6,7 +6,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
@@ -17,6 +17,7 @@
},
"files": [
"index.d.ts",
"Mime.d.ts",
"mime-tests.ts"
]
}
}
+3 -3
View File
@@ -21,9 +21,9 @@ declare function request <T>(options: Mithril.RequestOptions<T> & { url: string
declare function request <T>(url: string, options?: Mithril.RequestOptions<T>): Promise<T>;
/** Makes a JSON-P request and returns a promise. */
declare function jsonp<T>(options: Mithril.JsonpOptions & { url: string }): Promise<T>;
declare function jsonp<T>(options: Mithril.JsonpOptions & { url: string }): Promise<T>; // tslint:disable-line:no-unnecessary-generics
/** Makes a JSON-P request and returns a promise. */
declare function jsonp<T>(url: string, options?: Mithril.JsonpOptions): Promise<T>;
declare function jsonp<T>(url: string, options?: Mithril.JsonpOptions): Promise<T>; // tslint:disable-line:no-unnecessary-generics
/** Creates an event handler which takes the value of the specified DOM element property and calls a function with it as the argument. */
declare function withAttr(name: string, callback: (value: any) => any): (e: { currentTarget: any, [p: string]: any }) => void;
@@ -116,7 +116,7 @@ declare namespace Mithril {
/** Whether to send cookies to 3rd party domains. */
withCredentials?: boolean;
/** Exposes the underlying XMLHttpRequest object for low-level configuration. */
config?(xhr: XMLHttpRequest): XMLHttpRequest | void;
config?(xhr: XMLHttpRequest, options: this): XMLHttpRequest | void;
/** Headers to append to the request before sending it. */
headers?: { [key: string]: string };
/** A constructor to be applied to each object in the response. */
+1 -1
View File
@@ -20,7 +20,7 @@ const FRAME_BUDGET = 100;
{
const vnode = m.fragment({key: 123}, [m("div")]);
console.assert((vnode.children as Array<m.Vnode<any, any>>).length === 1);
console.assert(vnode.children![0].tag === 'div');
console.assert((vnode.children as Array<m.Vnode<any, any>>)[0].tag === 'div');
}
{
+1 -1
View File
@@ -50,7 +50,7 @@ const comp2: Component<Comp2Attrs, {}> = {
m(comp2, {title: '', description: ''});
// Correct use with lifecycle method
m(comp2, {title: '', description: '', oncreate: (v) => v.attrs.title + '\n' + v.attrs.description});
m(comp2, {title: '', description: '', oncreate: (v) => `${v.attrs.title}\n${v.attrs.description}`});
// Properties missing
// $ExpectError
+2 -1
View File
@@ -44,8 +44,9 @@ request<Result>('/id', {
});
request<Result>('/item', {
config: xhr => {
config: (xhr, opts) => {
xhr.setRequestHeader('accept', '*');
console.log(opts.background);
return xhr;
},
headers: {"Content-Type": "application/json"},
-117
View File
@@ -134,17 +134,6 @@ import { Stream } from 'mithril/stream';
console.assert(b()() === undefined);
}
{
let count = 0;
const a = stream(1);
const b = stream.combine(a => stream.HALT, [a])
["fantasy-land/map"](() => {
count++;
return 1;
});
console.assert(b() === undefined);
}
{
const all = stream.merge([
stream(10),
@@ -215,112 +204,6 @@ import { Stream } from 'mithril/stream';
console.assert(doubled() === 4);
}
{
const s = stream<number>();
const doubled = s["fantasy-land/map"]((n: number) => n * 2);
s(3);
console.assert(doubled() === 6);
}
{
const s = stream(3);
const doubled = s["fantasy-land/map"]((n: number) => n * 2);
console.assert(doubled() === 6);
}
{
const s = stream<undefined>();
const mapped = s["fantasy-land/map"](String);
s(undefined);
console.assert(mapped() === "undefined");
}
{
const s = stream(undefined);
const mapped = s["fantasy-land/map"](String);
console.assert(mapped() === "undefined");
}
{
const s = stream(undefined);
const mapped = s["fantasy-land/map"]((_value: undefined) => stream());
console.assert(mapped()() === undefined);
}
{
const s = stream(undefined);
console.assert(s["fantasy-land/map"] === s.map);
}
{
const apply = stream((n: number) => n * 2);
const s = stream(3);
const applied = s["fantasy-land/ap"](apply);
console.assert(applied() === 6);
apply(n => n / 3);
console.assert(applied() === 1);
s(9);
console.assert(applied() === 3);
}
{
const apply = stream<(value: undefined) => string>(String);
const s = stream(undefined);
const applied = s["fantasy-land/ap"](apply);
console.assert(applied() === "undefined");
apply(value => String(value) + "a");
console.assert(applied() === "undefineda");
}
{
const s = stream(3);
const mapped = s["fantasy-land/map"]((v: number) => v);
console.assert(s() === mapped());
}
{
const f = (x: number) => x * 2;
const g = (x: number) => x * x;
const s = stream(3);
const mapped = s["fantasy-land/map"]((value: any) => f(g(value)));
const composed = s["fantasy-land/map"](g)["fantasy-land/map"](f);
console.assert(mapped() === 18);
console.assert(mapped() === composed());
}
{
const a = stream((n: number) => n * 2);
const u = stream((n: number) => n * 3);
const v = stream(5);
const mapped = v["fantasy-land/ap"](u["fantasy-land/ap"](a["fantasy-land/map"]((f: any) => (g: any) => (x: any) => f(g(x)))));
const composed = v["fantasy-land/ap"](u)["fantasy-land/ap"](a);
console.assert(mapped() === 30);
console.assert(mapped() === composed());
}
{
const a = stream()["fantasy-land/of"]((value: number) => value);
const v = stream(5);
console.assert(v["fantasy-land/ap"](a)() === 5);
console.assert(v["fantasy-land/ap"](a)() === v());
}
{
const a = stream(0);
const f = (n: number) => n * 2;
const x = 3;
console.assert(a["fantasy-land/of"](x)["fantasy-land/ap"](a["fantasy-land/of"](f))() === 6);
console.assert(a["fantasy-land/of"](x)["fantasy-land/ap"](a["fantasy-land/of"](f))() === a["fantasy-land/of"](f(x))());
}
{
const u = stream((n: number) => n * 2);
const a = stream();
const y = 3;
console.assert(a["fantasy-land/of"](y)["fantasy-land/ap"](u)() === 6);
console.assert(a["fantasy-land/of"](y)["fantasy-land/ap"](u)() === u["fantasy-land/ap"](a["fantasy-land/of"]((f: any) => f(y)))());
}
// scan
{
+1 -2
View File
@@ -5,9 +5,8 @@
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": []
-1
View File
@@ -3,7 +3,6 @@
"rules": {
// TODOs
"no-duplicate-imports": false,
"object-literal-key-quotes": false,
"no-empty-interface": false
}
}
+6
View File
@@ -15,6 +15,12 @@ declare module 'moment' {
* Use persian digits as decribed by unicode
*/
usePersianDigits?: boolean;
/**
* use dialect option to change usePersian dialect, available options are:
* persian: default dialect(امرداد، آدینه، ...)
* persian-modern: modern dialect(مرداد، جمعه، ...)
*/
dialect?: 'persian' | 'persian-modern';
}
/**
+55 -42
View File
@@ -1,31 +1,30 @@
// Type definitions for morgan 1.7.0
// Type definitions for morgan 1.7
// Project: https://github.com/expressjs/morgan
// Definitions by: James Roland Cabresos <https://github.com/staticfunction>
// Paolo Scanferla <https://github.com/pscanf>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import express = require('express');
declare namespace morgan {
type FormatFn = (tokens: TokenIndexer, req: express.Request, res: express.Response) => string;
export interface FormatFn extends Function {
(tokens: TokenIndexer, req: express.Request, res: express.Response): string;
}
type TokenCallbackFn = (req: express.Request, res: express.Response, arg?: string | number | boolean) => string;
export interface TokenCallbackFn extends Function {
(req: express.Request, res: express.Response, arg?: string | number | boolean): string;
}
export interface TokenIndexer {
interface TokenIndexer {
[tokenName: string]: TokenCallbackFn;
}
/**
* Public interface of morgan logger
* Public interface of morgan logger.
*/
export interface Morgan {
interface Morgan {
/***
* Create a new morgan logger middleware function using the given format and options. The format argument may be a string of a predefined name (see below for the names),
* or a string of a format string containing defined tokens.
* Create a new morgan logger middleware function using the given format
* and options. The format argument may be a string of a predefined name
* (see below for the names), or a string of a format string containing
* defined tokens.
* @param format
* @param options
*/
@@ -45,7 +44,10 @@ declare namespace morgan {
*/
(format: 'common', options?: Options): express.RequestHandler;
/**
* Concise output colored by response status for development use. The :status token will be colored red for server error codes, yellow for client error codes, cyan for redirection codes, and uncolored for all other codes.
* Concise output colored by response status for development use. The
* :status token will be colored red for server error codes, yellow for
* client error codes, cyan for redirection codes, and uncolored for
* all other codes.
* :method :url :status :response-time ms - :res[content-length]
* @param format
* @param options
@@ -69,29 +71,32 @@ declare namespace morgan {
(format: 'tiny', options?: Options): express.RequestHandler;
/***
* Create a new morgan logger middleware function using the given format and options. The format argument may be a
* custom format function which adheres to the signature.
* Create a new morgan logger middleware function using the given format
* and options. The format argument may be a custom format function
* which adheres to the signature.
* @param format
* @param options
*/
(format: FormatFn, options?: Options): express.RequestHandler;
/**
* Define a custom token which can be used in custom morgan logging formats.
* Define a custom token which can be used in custom morgan logging
* formats.
*/
token(name: string, callback: TokenCallbackFn): Morgan;
/**
* Define a named custom format by specifying a format string in token notation
* Define a named custom format by specifying a format string in token
* notation.
*/
format(name: string, fmt: string): Morgan;
/**
* Define a named custom format by specifying a format function
* Define a named custom format by specifying a format function.
*/
format(name: string, fmt: FormatFn): Morgan;
/**
* Compile a format string in token notation into a format function
* Compile a format string in token notation into a format function.
*/
compile(format: string): FormatFn;
}
@@ -99,49 +104,53 @@ declare namespace morgan {
/**
* Define a custom token which can be used in custom morgan logging formats.
*/
export function token(name: string, callback: TokenCallbackFn): Morgan;
function token(name: string, callback: TokenCallbackFn): Morgan;
/**
* Define a named custom format by specifying a format string in token notation
* Define a named custom format by specifying a format string in token
* notation.
*/
export function format(name: string, fmt: string): Morgan;
function format(name: string, fmt: string): Morgan;
/**
* Define a named custom format by specifying a format function
* Define a named custom format by specifying a format function.
*/
export function format(name: string, fmt: FormatFn): Morgan;
function format(name: string, fmt: FormatFn): Morgan;
/**
* Compile a format string in token notation into a format function
* Compile a format string in token notation into a format function.
*/
export function compile(format: string): FormatFn;
function compile(format: string): FormatFn;
export interface StreamOptions {
interface StreamOptions {
/**
* Output stream for writing log lines
* Output stream for writing log lines.
*/
write: (str: string) => void;
write(str: string): void;
}
/***
* Morgan accepts these properties in the options object.
*/
export interface Options {
interface Options {
/***
* Buffer duration before writing logs to the stream, defaults to false. When set to true, defaults to 1000 ms.
* Buffer duration before writing logs to the stream, defaults to false.
* When set to true, defaults to 1000 ms.
*/
buffer?: boolean;
/***
* Write log line on request instead of response. This means that a requests will be logged even if the server crashes, but data from the response cannot be logged (like the response code).
* Write log line on request instead of response. This means that a
* requests will be logged even if the server crashes, but data from the
* response cannot be logged (like the response code).
*/
immediate?: boolean;
/***
* Function to determine if logging is skipped, defaults to false. This function will be called as skip(req, res).
* Function to determine if logging is skipped, defaults to false. This
* function will be called as skip(req, res).
*/
skip?: (req: express.Request, res: express.Response) => boolean;
skip?(req: express.Request, res: express.Response): boolean;
/***
* Output stream for writing log lines, defaults to process.stdout.
@@ -152,8 +161,9 @@ declare namespace morgan {
}
/***
* Create a new morgan logger middleware function using the given format and options. The format argument may be a string of a predefined name (see below for the names),
* or a string of a format string containing defined tokens.
* Create a new morgan logger middleware function using the given format and
* options. The format argument may be a string of a predefined name (see below
* for the names), or a string of a format string containing defined tokens.
* @param format
* @param options
*/
@@ -176,7 +186,9 @@ declare function morgan(format: 'combined', options?: morgan.Options): express.R
declare function morgan(format: 'common', options?: morgan.Options): express.RequestHandler;
/***
* Concise output colored by response status for development use. The :status token will be colored red for server error codes, yellow for client error codes, cyan for redirection codes, and uncolored for all other codes.
* Concise output colored by response status for development use. The :status
* token will be colored red for server error codes, yellow for client error
* codes, cyan for redirection codes, and uncolored for all other codes.
* :method :url :status :response-time ms - :res[content-length]
* @param format
* @param options
@@ -200,11 +212,12 @@ declare function morgan(format: 'short', options?: morgan.Options): express.Requ
declare function morgan(format: 'tiny', options?: morgan.Options): express.RequestHandler;
/***
* Create a new morgan logger middleware function using the given format and options. The format argument may be a
* custom format function which adheres to the signature.
* Create a new morgan logger middleware function using the given format and
* options. The format argument may be a custom format function which adheres to
* the signature.
* @param format
* @param options
*/
declare function morgan(custom: (req: express.Request, res: express.Response) => string): express.RequestHandler
declare function morgan(format: morgan.FormatFn, options?: morgan.Options): express.RequestHandler;
export = morgan;
+42 -28
View File
@@ -6,72 +6,86 @@ import morgan = require('morgan');
import express = require('express');
// a pre-defined name
morgan('combined')
morgan('common')
morgan('short')
morgan('tiny')
morgan('combined');
morgan('common');
morgan('short');
morgan('tiny');
// a format string
morgan(':remote-addr :method :url')
morgan(':remote-addr :method :url');
morgan('combined', {
buffer: true,
immediate: true,
skip: function (req, res) { return res.statusCode < 400 },
stream: {
write: (str: string) => {
console.log(str);
}
buffer: true,
immediate: true,
skip: (req, res) => res.statusCode < 400,
stream: {
write: (str: string) => {
console.log(str);
}
}
});
// a custom format function
morgan((tokens, req, res) => {
return [
tokens.method(req, res),
tokens.url(req, res),
tokens.status(req, res),
tokens.res(req, res, 'content-length'), '-',
tokens['response-time'](req, res), 'ms'
].join(' ');
});
// a custom format function with options
morgan((_tokens, _req, _res) => "", {
buffer: true,
immediate: true,
skip: (req, res) => res.statusCode < 400,
stream: {
write: (str: string) => {
console.log(str);
}
}
});
// test interface definition for morgan
// a named custom format defined as string (example: extend 'tiny' format with user-agent token)
morgan.format('tiny-extended', ':method :url :status :res[content-length] - :response-time ms :user-agent');
// a named custom format defined using the Function signature (example: extend 'dev' format with user-agent token)
// extend morgan.FormatFn interface with memoizer property to avoid unnecessary re-compiling
// of status-code range driven colorized format functions
interface IFormatFnIndexer {
interface FormatFnIndexer {
[memoizerName: string]: morgan.FormatFn;
}
interface IExtendedFormatFn extends morgan.FormatFn {
memoizer?: IFormatFnIndexer;
interface ExtendedFormatFn extends morgan.FormatFn {
memoizer: FormatFnIndexer;
}
var developmentExtendedFormatLine : IExtendedFormatFn = function(tokens, req, res):string {
const developmentExtendedFormatLine = ((tokens, req, res): string => {
// get the status code if response written
var status = res.statusCode
? res.statusCode
: undefined;
const status = res.statusCode;
// get status color
var color = status >= 500 ? 31 // red
const color = status >= 500 ? 31 // red
: status >= 400 ? 33 // yellow
: status >= 300 ? 36 // cyan
: status >= 200 ? 32 // green
: 0; // no color
// get colored format function, if previously memoized, otherwise undefined
var fn: morgan.FormatFn = developmentExtendedFormatLine.memoizer[color];
let fn: morgan.FormatFn | undefined = developmentExtendedFormatLine.memoizer[color];
if (!fn) {
// compile
fn = developmentExtendedFormatLine.memoizer[color] = morgan.compile('\x1b[0m:method :url \x1b['
+ color + 'm:status \x1b[0m:response-time ms - :res[content-length]\x1b[0m :user-agent');
fn = developmentExtendedFormatLine.memoizer[color] = morgan.compile(`\x1b[0m:method :url \x1b[${color}m:status \x1b[0m:response-time ms - :res[content-length]\x1b[0m :user-agent`);
}
return fn(tokens, req, res);
};
}) as ExtendedFormatFn;
developmentExtendedFormatLine.memoizer = {};
morgan.format('dev-extended', developmentExtendedFormatLine);
+2 -2
View File
@@ -6,7 +6,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
@@ -19,4 +19,4 @@
"index.d.ts",
"morgan-tests.ts"
]
}
}
+6
View File
@@ -0,0 +1,6 @@
{
"extends": "dtslint/dt.json",
"rules": {
"unified-signatures": false
}
}
+1 -1
View File
@@ -2,6 +2,6 @@ import { Server, version, mime } from 'node-static';
const server = new Server(__dirname);
const pathname = server.resolve('./tsconfig.json');
const mimetype = mime.lookup(pathname, '');
const mimetype = mime.getType(pathname);
const versionNum = version.join('.');
console.log(`The node-static server constructed an instance of itself, fetched the mimetype of ${pathname} (${mimetype}), and has a version of ${versionNum}! The package is working.`);
+4 -1
View File
@@ -6,12 +6,15 @@
import * as nodemailer from 'nodemailer';
declare namespace mailgunTransport {
interface Options {
auth: AuthOptions;
}
interface AuthOptions {
api_key: string;
domain?: string;
}
}
declare function mailgunTransport(options: mailgunTransport.AuthOptions): nodemailer.Transport;
declare function mailgunTransport(options: mailgunTransport.Options): nodemailer.Transport;
export = mailgunTransport;
@@ -1,13 +1,17 @@
import mailgunTransport = require('nodemailer-mailgun-transport');
import nodemailer = require('nodemailer');
const opts: mailgunTransport.AuthOptions = {
api_key: "harry"
const opts: mailgunTransport.Options = {
auth: {
api_key: "harry"
}
};
const optsWithDomain: mailgunTransport.AuthOptions = {
api_key: "harry",
domain: "http://www.foo.com"
const optsWithDomain: mailgunTransport.Options = {
auth: {
api_key: "harry",
domain: "http://www.foo.com"
}
};
const transport: nodemailer.Transporter = nodemailer.createTransport(mailgunTransport(optsWithDomain));
+9 -7
View File
@@ -1,6 +1,8 @@
// Type definitions for OpenLayers v4.3.0
// Project: http://openlayers.org/
// Definitions by: Olivier Sechet <https://github.com/osechet>, Guilhem Brouat <https://github.com/ganlhi>
// Definitions by: Olivier Sechet <https://github.com/osechet>
// Guilhem Brouat <https://github.com/ganlhi>
// Bin Wang <https://github.com/wb14123>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Definitions partially generated using tsd-jsdoc (https://github.com/englercj/tsd-jsdoc)
@@ -1830,11 +1832,11 @@ declare module ol {
* Get the feature's style. This return for this method depends on what was
* provided to the {@link ol.Feature#setStyle} method.
* @return {ol.style.Style|Array.<ol.style.Style>|
* ol.FeatureStyleFunction} The feature style.
* ol.FeatureStyleFunction|ol.StyleFunction} The feature style.
* @api stable
* @observable
*/
getStyle(): (ol.style.Style | ol.style.Style[] | ol.FeatureStyleFunction);
getStyle(): (ol.style.Style | ol.style.Style[] | ol.FeatureStyleFunction | ol.StyleFunction);
/**
* Get the feature's style function.
@@ -1858,11 +1860,11 @@ declare module ol {
* of styles, or a function that takes a resolution and returns an array of
* styles. If it is `null` the feature has no style (a `null` style).
* @param {ol.style.Style|Array.<ol.style.Style>|
* ol.FeatureStyleFunction} style Style for this feature.
* ol.FeatureStyleFunction|ol.StyleFunction} style Style for this feature.
* @api stable
* @observable
*/
setStyle(style: (ol.style.Style | ol.style.Style[] | ol.FeatureStyleFunction)): void;
setStyle(style: (ol.style.Style | ol.style.Style[] | ol.FeatureStyleFunction | ol.StyleFunction)): void;
/**
* Set the feature id. The feature id is considered stable and may be used when
@@ -7597,7 +7599,7 @@ declare module ol {
* @observable
* @api stable
*/
setPosition(position: (ol.Coordinate)): void;
setPosition(position: (ol.Coordinate | undefined)): void;
/**
* Set the positioning for this overlay.
@@ -10590,7 +10592,7 @@ declare module ol {
* @api
*/
clone(): ol.style.Style;
/**
* Get the geometry to be rendered.
* @return {string|ol.geom.Geometry|ol.StyleGeometryFunction}
+3 -1
View File
@@ -376,7 +376,7 @@ feature = feature.clone();
geometry = feature.getGeometry();
stringValue = feature.getGeometryName();
let featureGetId: string | number = feature.getId();
let featureGetStyle: ol.style.Style | Array<ol.style.Style> | ol.FeatureStyleFunction = feature.getStyle();
let featureGetStyle: ol.style.Style | Array<ol.style.Style> | ol.FeatureStyleFunction | ol.StyleFunction = feature.getStyle();
featureStyleFunction = feature.getStyleFunction();
voidValue = feature.setGeometry(geometry);
voidValue = feature.setGeometryName(stringValue);
@@ -385,6 +385,7 @@ voidValue = feature.setId(numberValue);
voidValue = feature.setStyle(style);
voidValue = feature.setStyle(styleArray);
voidValue = feature.setStyle(featureStyleFunction);
voidValue = feature.setStyle(styleFunction);
voidValue = feature.setProperties(object);
//
@@ -590,6 +591,7 @@ voidValue = popup.setElement(popupElement);
voidValue = popup.setMap(popupMap);
voidValue = popup.setOffset(popupOffset);
voidValue = popup.setPosition(coordinate);
voidValue = popup.setPosition(undefined);
voidValue = popup.setPositioning(popupPositioning);
+5 -2
View File
@@ -115,9 +115,12 @@ export class Client extends events.EventEmitter {
pauseDrain(): void;
resumeDrain(): void;
escapeIdentifier(str: string): string;
escapeLiteral(str: string): string;
on(event: "drain", listener: () => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: "notification" | "notice", listener: (message: Notification) => void): this;
on(event: "error" | "notice", listener: (err: Error) => void): this;
on(event: "notification", listener: (message: Notification) => void): this;
// tslint:disable-next-line unified-signatures
on(event: "end", listener: () => void): this;
}
+18 -10
View File
@@ -9,6 +9,7 @@
// Vítor Castro <https://github.com/teves-castro>
// Jordan Quagliatini <https://github.com/1M0reBug>
// Simon Højberg <https://github.com/hojberg>
// Charles-Philippe Clermont <https://github.com/charlespwd>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
@@ -63,6 +64,11 @@ declare namespace R {
set<T, U>(str: string, obj: T): U;
}
interface Filter<T> {
(list: T[]): T[];
(obj: Dictionary<T>): Dictionary<T>;
}
type Evolver<T> =
| ((x: T) => T)
| { [K in keyof T]?: Evolver<T[K]> };
@@ -189,8 +195,8 @@ declare namespace R {
* A function that returns the first argument if it's falsy otherwise the second argument. Note that this is
* NOT short-circuited, meaning that if expressions are passed they are both evaluated.
*/
and<T extends { and?: ((...a: any[]) => any); } | number | boolean | string>(fn1: T, val2: boolean | any): boolean;
and<T extends { and?: ((...a: any[]) => any); } | number | boolean | string>(fn1: T): (val2: boolean | any) => boolean;
and<T extends { and?: ((...a: any[]) => any); } | number | boolean | string>(fn1: T, val2: any): boolean;
and<T extends { and?: ((...a: any[]) => any); } | number | boolean | string>(fn1: T): (val2: any) => boolean;
/**
* Returns true if at least one of elements of the list match the predicate, false otherwise.
@@ -583,8 +589,9 @@ declare namespace R {
/**
* Returns a new list containing only those items that match a given predicate function. The predicate function is passed one argument: (value).
*/
filter<T>(fn: (value: T) => boolean): (list: T[]) => T[];
filter<T>(fn: (value: T) => boolean): Filter<T>;
filter<T>(fn: (value: T) => boolean, list: T[]): T[];
filter<T>(fn: (value: T) => boolean, obj: Dictionary<T>): Dictionary<T>;
/**
* Returns the first element of the list which matches the predicate, or `undefined` if no
@@ -787,7 +794,7 @@ declare namespace R {
/**
* Returns a new object with the keys of the given object as values, and the values of the given object as keys.
*/
invertObj(obj: any | { [index: number]: string }): { [index: string]: string };
invertObj(obj: { [index: string]: string } | { [index: number]: string }): { [index: string]: string };
/**
* Turns a named method of an object (or object prototype) into a function that can be
@@ -1220,9 +1227,9 @@ declare namespace R {
* If the given, non-null object has a value at the given path, returns the value at that path.
* Otherwise returns the provided default value.
*/
pathOr<T>(d: T, p: Path, obj: any): T | any;
pathOr<T>(d: T, p: Path): (obj: any) => T | any;
pathOr<T>(d: T): CurriedFunction2<Path, any, T | any>;
pathOr<T>(d: T, p: Path, obj: any): any;
pathOr<T>(d: T, p: Path): (obj: any) => any;
pathOr<T>(d: T): CurriedFunction2<Path, any, any>;
/**
* Returns true if the specified object property at given path satisfies the given predicate; false otherwise.
@@ -1526,8 +1533,9 @@ declare namespace R {
* Similar to `filter`, except that it keeps only values for which the given predicate
* function returns falsy.
*/
reject<T>(fn: (value: T) => boolean): Filter<T>;
reject<T>(fn: (value: T) => boolean, list: T[]): T[];
reject<T>(fn: (value: T) => boolean): (list: T[]) => T[];
reject<T>(fn: (value: T) => boolean, obj: Dictionary<T>): Dictionary<T>;
/**
* Removes the sub-list of `list` starting at index `start` and containing `count` elements.
@@ -1737,7 +1745,7 @@ declare namespace R {
* Note that the order of the output array is not guaranteed to be
* consistent across different JS platforms.
*/
toPairs<F, S>(obj: { [k: string]: S } | { [k: number]: S } | any): Array<[F, S]>;
toPairs<F, S>(obj: { [k: string]: S } | { [k: number]: S }): Array<[F, S]>;
/**
* Converts an object into an array of key, value arrays.
@@ -1745,7 +1753,7 @@ declare namespace R {
* Note that the order of the output array is not guaranteed to be
* consistent across different JS platforms.
*/
toPairsIn<F, S>(obj: { [k: string]: S } | { [k: number]: S } | any): Array<[F, S]>;
toPairsIn<F, S>(obj: { [k: string]: S } | { [k: number]: S }): Array<[F, S]>;
/**
* Returns the string representation of the given value. eval'ing the output should

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