Merge pull request #13396 from DefinitelyTyped/merge_16dec

Merge from types-2.0 to master (16 Dec)
This commit is contained in:
Andy
2016-12-16 08:07:50 -08:00
committed by GitHub
22 changed files with 1135 additions and 1136 deletions

View File

@@ -8,16 +8,20 @@
import * as d3Axis from 'd3-axis';
import {
scaleBand,
ScaleBand,
scaleLinear,
ScaleLinear,
scaleOrdinal,
ScaleOrdinal,
scalePoint,
ScalePoint,
scalePow,
ScalePower,
scaleTime,
ScaleTime,
ScaleTime
} from 'd3-scale';
import { Selection } from 'd3-selection';
import { select, Selection } from 'd3-selection';
import { Transition } from 'd3-transition';
import { timeMinute } from 'd3-time';
import { format } from 'd3-format';
@@ -41,15 +45,18 @@ let axisScaleString: d3Axis.AxisScale<string>;
axisScaleNumber = scaleLinear();
axisScaleDate = scaleTime();
axisScaleString = scaleOrdinal<number>();
axisScaleNumber = scaleBand<number>();
axisScaleNumber = scalePoint<number>();
axisScaleString = scaleBand();
axisScaleString = scalePoint();
// --------------------------------------------------------------------------
// Test AxisContainerElement
// --------------------------------------------------------------------------
let containerElement: d3Axis.AxisContainerElement;
let svg: SVGSVGElement,
g: SVGGElement,
canvas: HTMLCanvasElement;
const svg: SVGSVGElement = select<SVGSVGElement, any>('svg').node() !; //mock
const g: SVGGElement = select<SVGGElement, any>('g').node() !; //mock
const canvas: HTMLCanvasElement = select<HTMLCanvasElement, any>('canvas').node() !; //mock
containerElement = svg;
containerElement = g;
@@ -60,7 +67,7 @@ containerElement = g;
// --------------------------------------------------------------------------
let topAxis: d3Axis.Axis<number | { valueOf(): number }> = d3Axis.axisTop(scaleLinear());
let rightAxis: d3Axis.Axis<Date> = d3Axis.axisRight(scaleTime());
let rightAxis: d3Axis.Axis<Date> = d3Axis.axisRight<Date>(scaleTime());
let bottomAxis: d3Axis.Axis<string> = d3Axis.axisBottom(scaleOrdinal<number>());
let leftAxis: d3Axis.Axis<number | { valueOf(): number }> = d3Axis.axisLeft(scaleLinear<number>());
@@ -95,7 +102,7 @@ topAxis = topAxis.tickArguments([20, 's']);
rightAxis = rightAxis.tickArguments([timeMinute.every(5)]);
let tickArguments: Array<any> = leftAxis.tickArguments();
let tickArguments: any[] = leftAxis.tickArguments();
// tickValues(...) ----------------------------------------------------------------
@@ -105,15 +112,17 @@ bottomAxis = bottomAxis.tickValues(['strongly negative', 'strongly positive']);
leftAxis = leftAxis.tickValues(null);
let tickValues: Array<Date> = rightAxis.tickValues();
let tickValues: Date[] | null = rightAxis.tickValues();
// tickFormat(...) ----------------------------------------------------------------
topAxis = topAxis.tickFormat(format(',.0f'));
topAxis = topAxis.tickFormat(null);
let formatFn: (domainValue: string) => string = bottomAxis.tickFormat();
let formatFn: ((domainValue: string, index: number) => string) | null = bottomAxis.tickFormat();
bottomAxis.tickFormat(function (d, i) { return '#' + i; });
bottomAxis.tickFormat(function (d) { return d + '!'; });
// tickSize(...) ----------------------------------------------------------------
rightAxis = rightAxis.tickSize(5);
@@ -138,19 +147,19 @@ num = rightAxis.tickPadding();
// Test Apply Axis
// --------------------------------------------------------------------------
let gSelection: Selection<SVGGElement, any, any, any>;
let gSelection: Selection<SVGGElement, any, any, any> = select<SVGGElement, any>('g');
let gTransition = gSelection.transition();
gSelection.call(topAxis);
gTransition.call(topAxis);
let svgSelection: Selection<SVGSVGElement, any, any, any>;
let svgSelection: Selection<SVGSVGElement, any, any, any> = select<SVGSVGElement, any>('g');
let svgTransition = svgSelection.transition();
svgSelection.call(leftAxis);
svgTransition.call(leftAxis);
let canvasSelection: Selection<HTMLCanvasElement, any, any, any>;
let canvasSelection: Selection<HTMLCanvasElement, any, any, any> = select<HTMLCanvasElement, any>('canvas');
let canvasTransition = canvasSelection.transition();
// canvasSelection.call(rightAxis); // fails, incompatible context container element

26
d3-axis/index.d.ts vendored
View File

@@ -1,8 +1,10 @@
// Type definitions for D3JS d3-axis module v1.0.3
// Type definitions for D3JS d3-axis module 1.0
// Project: https://github.com/d3/d3-axis/
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Last module patch version validated against: 1.0.4
import { Selection, TransitionLike } from 'd3-selection';
// --------------------------------------------------------------------------
@@ -31,13 +33,16 @@ export interface AxisTimeInterval {
* for axis to use the scale without error
*/
export interface AxisScale<Domain> {
(x: Domain): number;
domain(): Array<Domain>;
range(): Array<number>;
copy(): AxisScale<Domain>;
(x: Domain): number | undefined;
domain(): Domain[];
range(): number[];
copy(): this;
bandwidth?(): number;
ticks?(count: number | AxisTimeInterval): Array<number> | Array<Date>;
tickFormat?(count: number | AxisTimeInterval, specifier?: string): ((d: number) => string) | ((d: Date) => string);
// TODO: Reconsider the below, note that the compiler does not differentiate the overloads w.r.t. optionality
// ticks?(count?: number): Domain[];
// ticks?(count?: AxisTimeInterval): Date[];
// tickFormat?(count?: number, specifier?: string): ((d: number) => string);
// tickFormat?(count?: number | AxisTimeInterval, specifier?: string): ((d: Date) => string);
}
/**
@@ -170,15 +175,16 @@ export interface Axis<Domain> {
/**
* Returns the currently set tick format function, which defaults to null.
*/
tickFormat(): ((domainValue: Domain) => string) | null;
tickFormat(): ((domainValue: Domain, index: number) => string) | null;
/**
* Sets the tick format function and returns the axis.
*
* @param format A function mapping a value from the axis Domain to a formatted string
* for display purposes.
* for display purposes. When invoked, the format function is also passed a second argument representing the zero-based index
* of the tick label in the array of generated tick labels.
*/
tickFormat(format: (domainValue: Domain) => string): this;
tickFormat(format: (domainValue: Domain, index: number) => string): this;
/**
* Reset the tick format function. A null format indicates that the scales

View File

@@ -3,7 +3,7 @@
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"

6
d3-axis/tslint.json Normal file
View File

@@ -0,0 +1,6 @@
{
"extends": "../tslint.json",
"rules": {
"unified-signatures": false
}
}

View File

@@ -0,0 +1,13 @@
emojione.sprites = true;
emojione.imagePathPNG = 'foobar';
emojione.imagePathSVG = 'foobar';
emojione.imagePathSVGSprites = 'foobar';
emojione.imageType = 'svg';
emojione.unicodeAlt = false;
emojione.ascii = true;
emojione.unicodeRegexp = '123.*';
emojione.cacheBustParam = 'asdf';
const myShort: string = emojione.toShort('hi');
const myImage1: string = emojione.toImage('hi');
const myImage2: string = emojione.shortnameToImage('hi');
const myImage3: string = emojione.unicodeToImage('hi');

20
emojione/index.d.ts vendored Normal file
View File

@@ -0,0 +1,20 @@
// Type definitions for emojione 2.2
// Project: https://github.com/Ranks/emojione
// Definitions by: Danilo Bargen <https://github.com/dbrgn/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export as namespace emojione;
export var sprites: boolean;
export var imagePathPNG: string;
export var imagePathSVG: string;
export var imagePathSVGSprites: string;
export var imageType: 'png' | 'svg';
export var unicodeAlt: boolean;
export var ascii: boolean;
export var unicodeRegexp: string;
export var cacheBustParam: string;
export function toShort(str: string): string;
export function toImage(str: string): string;
export function shortnameToImage(str: string): string;
export function unicodeToImage(str: string): string;

19
emojione/tsconfig.json Normal file
View File

@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"emojione-tests.ts"
]
}

1
emojione/tslint.json Normal file
View File

@@ -0,0 +1 @@
{ "extends": "../tslint.json" }

6
knex/index.d.ts vendored
View File

@@ -365,7 +365,7 @@ declare namespace Knex {
dateTime(columnName: string): ColumnBuilder;
time(columnName: string): ColumnBuilder;
timestamp(columnName: string): ColumnBuilder;
timestamps(): ColumnBuilder;
timestamps(useTimestampType?: boolean, makeDefaultNow?: boolean): ColumnBuilder;
binary(columnName: string): ColumnBuilder;
enum(columnName: string, values: Value[]): ColumnBuilder;
enu(columnName: string, values: Value[]): ColumnBuilder;
@@ -380,8 +380,8 @@ declare namespace Knex {
foreign(column: string): ForeignConstraintBuilder;
foreign(columns: string[]): MultikeyForeignConstraintBuilder;
dropForeign(columnNames: string[], foreignKeyName?: string): TableBuilder;
dropUnique(columnNames: string[], indexName?: string): TableBuilder;
dropPrimary(constraintName?: string): TableBuilder;
dropUnique(columnNames: string[], indexName?: string): TableBuilder;
dropPrimary(constraintName?: string): TableBuilder;
}
interface CreateTableBuilder extends TableBuilder {

View File

@@ -432,6 +432,7 @@ knex.schema.createTable('users', function (table) {
table.enu('favorite_color', ['red', 'blue', 'green']);
table.timestamps();
table.timestamp('created_at').defaultTo(knex.fn.now());
table.timestamps(true, true);
});
knex.schema.renameTable('users', 'old_users');

496
parsimmon/index.d.ts vendored
View File

@@ -1,10 +1,8 @@
// Type definitions for Parsimmon 1.0.0
// Type definitions for Parsimmon 1.0
// Project: https://github.com/jneen/parsimmon
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>, Mizunashi Mana <https://github.com/mizunashi-mana>, Boris Cherny <https://github.com/bcherny>, Benny van Reeven <https://github.com/bvanreeven>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TODO convert to generics
/**
* **NOTE:** You probably will never need to use this function. Most parsing
* can be accomplished using `Parsimmon.regexp` and combination with
@@ -41,284 +39,300 @@
declare function Parsimmon<T>(fn: (input: string, i: number) => Parsimmon.Result<T>): Parsimmon.Parser<T>;
declare namespace Parsimmon {
export type StreamType = string;
export type StreamType = string;
export interface Index {
/** zero-based character offset */
offset: number;
/** one-based line offset */
line: number;
/** one-based column offset */
column: number;
}
export interface Index {
/** zero-based character offset */
offset: number;
/** one-based line offset */
line: number;
/** one-based column offset */
column: number;
}
export interface Mark<T> {
start: Index;
end: Index;
value: T;
}
export interface Mark<T> {
start: Index;
end: Index;
value: T;
}
export interface Result<T> {
status: boolean;
value?: T;
expected?: string;
index?: Index;
}
export type Result<T> = Success<T> | Failure;
export interface Parser<T> {
/**
* parse the string
*/
parse(input: string): Result<T>;
/**
* Like parser.parse(input) but either returns the parsed value or throws
* an error on failure. The error object contains additional properties
* about the error.
*/
tryParse(input: string): T;
/**
* returns a new parser which tries parser, and if it fails uses otherParser.
*/
or(otherParser: Parser<T>): Parser<T>;
or<U>(otherParser: Parser<U>): Parser<any>;
/**
* returns a new parser which tries parser, and on success calls the given function
* with the result of the parse, which is expected to return another parser, which
* will be tried next
export interface Success<T> {
status: true;
value: T;
}
export interface Failure {
status: false;
expected: string[];
index: Index;
}
export interface Parser<T> {
/**
* parse the string
*/
chain<U>(next: (result: T) => Parser<U>): Parser<U>;
/**
* returns a new parser which tries parser, and on success calls the given function
* with the result of the parse, which is expected to return another parser.
*/
then<U>(call: (result: T) => Parser<U>): Parser<U>;
/**
* expects anotherParser to follow parser, and yields the result of anotherParser.
* NB: the result of parser here is ignored.
*/
then<U>(anotherParser: Parser<U>): Parser<U>;
/**
* transforms the output of parser with the given function.
*/
map<U>(call: (result: T) => U): Parser<U>;
/**
* expects otherParser after parser, but preserves the yield value of parser.
*/
skip<U>(otherParser: Parser<U>): Parser<T>;
/**
* returns a new parser with the same behavior, but which yields aResult.
*/
result<U>(aResult: U): Parser<U>;
/**
* expects parser zero or more times, and yields an array of the results.
*/
many(): Parser<T[]>;
/**
* expects parser exactly n times, and yields an array of the results.
*/
times(n: number): Parser<T[]>;
/**
* expects parser between min and max times, and yields an array of the results.
*/
times(min: number, max: number): Parser<T[]>;
/**
* expects parser at most n times. Yields an array of the results.
*/
atMost(n: number): Parser<T[]>;
/**
* expects parser at least n times. Yields an array of the results.
*/
atLeast(n: number): Parser<T[]>;
/**
* returns a new parser whose failure message is the passed description.
*/
mark(): Parser<Mark<T>>;
/**
* Returns a new parser whose failure message is description.
* For example, string('x').desc('the letter x') will indicate that 'the letter x' was expected.
*/
desc(description: string): Parser<T>;
}
/**
* Alias of `Parsimmon(fn)` for backwards compatibility.
*/
export function Parser<T>(fn: (input: string, i: number) => Parsimmon.Result<T>): Parser<T>;
/**
* To be used inside of Parsimmon(fn). Generates an object describing how
* far the successful parse went (index), and what value it created doing
* so. See documentation for Parsimmon(fn).
*/
export function makeSuccess<T>(index: number, value: T): Result<T>;
/**
* To be used inside of Parsimmon(fn). Generates an object describing how
* far the unsuccessful parse went (index), and what kind of syntax it
* expected to see (expectation). See documentation for Parsimmon(fn).
*/
export function makeFailure<T>(furthest: number, expectation: string): Result<T>;
parse(input: string): Result<T>;
/**
* Returns true if obj is a Parsimmon parser, otherwise false.
* Like parser.parse(input) but either returns the parsed value or throws
* an error on failure. The error object contains additional properties
* about the error.
*/
export function isParser(obj: any): boolean;
tryParse(input: string): T;
/**
* is a parser that expects to find "my-string", and will yield the same.
* returns a new parser which tries parser, and if it fails uses otherParser.
*/
or<U>(otherParser: Parser<U>): Parser<T | U>;
/**
* returns a new parser which tries parser, and on success calls the given function
* with the result of the parse, which is expected to return another parser, which
* will be tried next
*/
chain<U>(next: (result: T) => Parser<U>): Parser<U>;
/**
* returns a new parser which tries parser, and on success calls the given function
* with the result of the parse, which is expected to return another parser.
*/
then<U>(call: (result: T) => Parser<U>): Parser<U>;
/**
* expects anotherParser to follow parser, and yields the result of anotherParser.
* NB: the result of parser here is ignored.
*/
// tslint:disable-next-line:unified-signatures
then<U>(anotherParser: Parser<U>): Parser<U>;
/**
* transforms the output of parser with the given function.
*/
map<U>(call: (result: T) => U): Parser<U>;
/**
* returns a new parser with the same behavior, but which yields aResult.
*/
result<U>(aResult: U): Parser<U>;
/**
* returns a new parser that returns the fallback value if the first parser failed.
*/
fallback<U>(fallbackValue: U): Parser<T | U>;
/**
* expects otherParser after parser, but preserves the yield value of parser.
*/
skip<U>(otherParser: Parser<U>): Parser<T>;
/**
* expects parser zero or more times, and yields an array of the results.
*/
many(): Parser<T[]>;
/**
* expects parser exactly n times, and yields an array of the results.
*/
times(n: number): Parser<T[]>;
/**
* expects parser between min and max times, and yields an array of the results.
*/
// tslint:disable-next-line:unified-signatures
times(min: number, max: number): Parser<T[]>;
/**
* expects parser at most n times. Yields an array of the results.
*/
atMost(n: number): Parser<T[]>;
/**
* expects parser at least n times. Yields an array of the results.
*/
atLeast(n: number): Parser<T[]>;
/**
* returns a new parser whose failure message is the passed description.
*/
mark(): Parser<Mark<T>>;
/**
* Returns a new parser whose failure message is description.
* For example, string('x').desc('the letter x') will indicate that 'the letter x' was expected.
*/
desc(description: string): Parser<T>;
}
/**
* Alias of `Parsimmon(fn)` for backwards compatibility.
*/
export function string(string: string): Parser<string>;
export function Parser<T>(fn: (input: string, i: number) => Parsimmon.Result<T>): Parser<T>;
/**
* Returns a parser that looks for exactly one character from string, and yields that character.
*/
export function oneOf(string: string): Parser<string>;
/**
* Returns a parser that looks for exactly one character NOT from string, and yields that character.
*/
export function noneOf(string: string): Parser<string>;
/**
* Returns a parser that looks for a match to the regexp and yields the given match group
* (defaulting to the entire match). The regexp will always match starting at the current
* parse location. The regexp may only use the following flags: imu. Any other flag will
* result in an error being thrown.
/**
* To be used inside of Parsimmon(fn). Generates an object describing how
* far the successful parse went (index), and what value it created doing
* so. See documentation for Parsimmon(fn).
*/
export function regexp(myregex: RegExp, group?: number): Parser<string>;
export function makeSuccess<T>(index: number, value: T): Success<T>;
/**
* This was the original name for Parsimmon.regexp, but now it is just an alias.
*/
export function regex(myregex: RegExp, group?: number): Parser<string>;
/**
* Returns a parser that doesn't consume any of the string, and yields result.
/**
* To be used inside of Parsimmon(fn). Generates an object describing how
* far the unsuccessful parse went (index), and what kind of syntax it
* expected to see (expectation). See documentation for Parsimmon(fn).
*/
export function succeed<U>(result: U): Parser<U>;
export function makeFailure(furthest: number, expectation: string): Failure;
/**
* This is an alias for Parsimmon.succeed(result).
*/
export function of<U>(result: U): Parser<U>;
/**
* accepts a variable number of parsers that it expects to find in order, yielding an array of the results.
/**
* Returns true if obj is a Parsimmon parser, otherwise false.
*/
export function seq<T>(p1: Parser<T>): Parser<[T]>;
export function seq<T, U>(p1: Parser<T>, p2: Parser<U>): Parser<[T, U]>;
export function seq<T, U, V>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>): Parser<[T, U, V]>;
export function seq<T, U, V, W>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>): Parser<[T, U, V, W]>;
export function seq<T, U, V, W, X>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>): Parser<[T, U, V, W, X]>;
export function seq<T, U, V, W, X, Y>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, p6: Parser<Y>): Parser<[T, U, V, W, X, Y]>;
export function seq<T, U, V, W, X, Y, Z>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, p6: Parser<Y>, p7: Parser<Z>): Parser<[T, U, V, W, X, Y, Z]>;
export function seq<T>(...parsers: Parser<T>[]): Parser<T[]>;
export function seq(...parsers: Parser<any>[]): Parser<any[]>;
export function isParser(obj: any): boolean;
/**
* Takes the string passed to parser.parse(string) and the error returned from
* parser.parse(string) and turns it into a human readable error message string.
* Note that there are certainly better ways to format errors, so feel free to write your own.
*/
export function formatError<T>(string: string, error: Result<T>): string;
/**
* is a parser that expects to find "my-string", and will yield the same.
*/
export function string(string: string): Parser<string>;
/**
* Matches all parsers sequentially, and passes their results as the arguments to a function.
* Similar to calling Parsimmon.seq and then .map, but the values are not put in an array.
*/
export function seqMap<T, U>(p1: Parser<T>, cb: (a1: T) => U): Parser<U>;
export function seqMap<T, U, V>(p1: Parser<T>, p2: Parser<U>, cb: (a1: T, a2: U) => V): Parser<V>;
export function seqMap<T, U, V, W>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, cb: (a1: T, a2: U, a3: V) => W): Parser<W>;
export function seqMap<T, U, V, W, X>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, cb: (a1: T, a2: U, a3: V, a4: W) => X): Parser<X>;
export function seqMap<T, U, V, W, X, Y>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, cb: (a1: T, a2: U, a3: V, a4: W, a5: X) => Y): Parser<Y>;
export function seqMap<T, U, V, W, X, Y, Z>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, p6: Parser<Y>, cb: (a1: T, a2: U, a3: V, a4: W, a5: X, a6: Y) => Z): Parser<Z>;
/**
* Returns a parser that looks for exactly one character from string, and yields that character.
*/
export function oneOf(string: string): Parser<string>;
export type SuccessFunctionType<U> = (index: number, result: U) => Result<U>;
export type FailureFunctionType<U> = (index: number, msg: string) => Result<U>;
export type ParseFunctionType<U> = (stream: StreamType, index: number) => Result<U>;
/**
* Returns a parser that looks for exactly one character NOT from string, and yields that character.
*/
export function noneOf(string: string): Parser<string>;
/**
* Returns a parser that looks for a match to the regexp and yields the given match group
* (defaulting to the entire match). The regexp will always match starting at the current
* parse location. The regexp may only use the following flags: imu. Any other flag will
* result in an error being thrown.
*/
export function regexp(myregex: RegExp, group?: number): Parser<string>;
/**
* This was the original name for Parsimmon.regexp, but now it is just an alias.
*/
export function regex(myregex: RegExp, group?: number): Parser<string>;
/**
* Returns a parser that doesn't consume any of the string, and yields result.
*/
export function succeed<U>(result: U): Parser<U>;
/**
* This is an alias for Parsimmon.succeed(result).
*/
export function of<U>(result: U): Parser<U>;
/**
* accepts a variable number of parsers that it expects to find in order, yielding an array of the results.
*/
export function seq<T>(p1: Parser<T>): Parser<[T]>;
export function seq<T, U>(p1: Parser<T>, p2: Parser<U>): Parser<[T, U]>;
export function seq<T, U, V>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>): Parser<[T, U, V]>;
export function seq<T, U, V, W>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>): Parser<[T, U, V, W]>;
export function seq<T, U, V, W, X>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>): Parser<[T, U, V, W, X]>;
export function seq<T, U, V, W, X, Y>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, p6: Parser<Y>): Parser<[T, U, V, W, X, Y]>;
export function seq<T, U, V, W, X, Y, Z>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, p6: Parser<Y>, p7: Parser<Z>): Parser<[T, U, V, W, X, Y, Z]>;
export function seq<T>(...parsers: Array<Parser<T>>): Parser<T[]>;
export function seq(...parsers: Array<Parser<any>>): Parser<any[]>;
/**
* Takes the string passed to parser.parse(string) and the error returned from
* parser.parse(string) and turns it into a human readable error message string.
* Note that there are certainly better ways to format errors, so feel free to write your own.
*/
export function formatError<T>(string: string, error: Result<T>): string;
/**
* Matches all parsers sequentially, and passes their results as the arguments to a function.
* Similar to calling Parsimmon.seq and then .map, but the values are not put in an array.
*/
export function seqMap<T, U>(p1: Parser<T>, cb: (a1: T) => U): Parser<U>;
export function seqMap<T, U, V>(p1: Parser<T>, p2: Parser<U>, cb: (a1: T, a2: U) => V): Parser<V>;
export function seqMap<T, U, V, W>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, cb: (a1: T, a2: U, a3: V) => W): Parser<W>;
export function seqMap<T, U, V, W, X>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, cb: (a1: T, a2: U, a3: V, a4: W) => X): Parser<X>;
export function seqMap<T, U, V, W, X, Y>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, cb: (a1: T, a2: U, a3: V, a4: W, a5: X) => Y): Parser<Y>;
export function seqMap<T, U, V, W, X, Y, Z>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, p6: Parser<Y>, cb: (a1: T, a2: U, a3: V, a4: W, a5: X, a6: Y) => Z): Parser<Z>;
export function seqMap<T, U, V, W, X, Y, Z, A>(
p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, p6: Parser<Y>, p7: Parser<Z>,
cb: (a1: T, a2: U, a3: V, a4: W, a5: X, a6: Y, a7: Z) => A): Parser<A>;
export function seqMap<T, U, V, W, X, Y, Z, A, B>(
p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, p6: Parser<Y>, p7: Parser<Z>, p8: Parser<A>,
cb: (a1: T, a2: U, a3: V, a4: W, a5: X, a6: Y, a7: Z, a8: A) => B): Parser<B>;
export type SuccessFunctionType<U> = (index: number, result: U) => Result<U>;
export type FailureFunctionType<U> = (index: number, msg: string) => Result<U>;
export type ParseFunctionType<U> = (stream: StreamType, index: number) => Result<U>;
/**
* allows to add custom primitive parsers.
*/
export function custom<U>(parsingFunction: (success: SuccessFunctionType<U>, failure: FailureFunctionType<U>) => ParseFunctionType<U>): Parser<U>;
export function custom<U>(parsingFunction: (success: SuccessFunctionType<U>, failure: FailureFunctionType<U>) => ParseFunctionType<U>): Parser<U>;
/**
* accepts a variable number of parsers, and yields the value of the first one that succeeds,
* backtracking in between.
/**
* accepts a variable number of parsers, and yields the value of the first one that succeeds,
* backtracking in between.
*/
export function alt<U>(...parsers: Parser<U>[]): Parser<U>;
export function alt(...parsers: Parser<any>[]): Parser<any>;
export function alt<U>(...parsers: Array<Parser<U>>): Parser<U>;
export function alt(...parsers: Array<Parser<any>>): Parser<any>;
/**
* Accepts two parsers, and expects zero or more matches for content, separated by separator, yielding an array.
*/
export function sepBy<T, U>(content: Parser<T>, separator: Parser<U>): Parser<T[]>
/**
* Accepts two parsers, and expects zero or more matches for content, separated by separator, yielding an array.
*/
export function sepBy<T, U>(content: Parser<T>, separator: Parser<U>): Parser<T[]>;
/**
* This is the same as Parsimmon.sepBy, but matches the content parser at least once.
*/
export function sepBy1<T, U>(content: Parser<T>, separator: Parser<U>): Parser<T[]>
/**
* This is the same as Parsimmon.sepBy, but matches the content parser at least once.
*/
export function sepBy1<T, U>(content: Parser<T>, separator: Parser<U>): Parser<T[]>;
/**
* accepts a function that returns a parser, which is evaluated the first time the parser is used.
* This is useful for referencing parsers that haven't yet been defined.
/**
* accepts a function that returns a parser, which is evaluated the first time the parser is used.
* This is useful for referencing parsers that haven't yet been defined.
*/
export function lazy<U>(f: () => Parser<U>): Parser<U>;
export function lazy<U>(description: string, f: () => Parser<U>): Parser<U>;
export function lazy<U>(f: () => Parser<U>): Parser<U>;
export function lazy<U>(description: string, f: () => Parser<U>): Parser<U>;
/**
* fail paring with a message
/**
* fail paring with a message
*/
export function fail(message: string): Parser<void>;
export function fail<U>(message: string): Parser<U>;
export function fail(message: string): Parser<never>;
/**
* is equivalent to Parsimmon.regex(/[a-z]/i)
/**
* is equivalent to Parsimmon.regex(/[a-z]/i)
*/
export var letter: Parser<string>;
/**
* is equivalent to Parsimmon.regex(/[a-z]*`/i)
export var letter: Parser<string>;
/**
* is equivalent to Parsimmon.regex(/[a-z]*`/i)
*/
export var letters: Parser<string>;
/**
* is equivalent to Parsimmon.regex(/[0-9]/)
export var letters: Parser<string>;
/**
* is equivalent to Parsimmon.regex(/[0-9]/)
*/
export var digit: Parser<string>;
/**
* is equivalent to Parsimmon.regex(/[0-9]*`/)
export var digit: Parser<string>;
/**
* is equivalent to Parsimmon.regex(/[0-9]*`/)
*/
export var digits: Parser<string>;
/**
* is equivalent to Parsimmon.regex(/\s+/)
export var digits: Parser<string>;
/**
* is equivalent to Parsimmon.regex(/\s+/)
*/
export var whitespace: Parser<string>;
/**
* is equivalent to Parsimmon.regex(/\s*`/)
export var whitespace: Parser<string>;
/**
* is equivalent to Parsimmon.regex(/\s*`/)
*/
export var optWhitespace: Parser<string>;
/**
* consumes and yields the next character of the stream.
export var optWhitespace: Parser<string>;
/**
* consumes and yields the next character of the stream.
*/
export var any: Parser<string>;
/**
* consumes and yields the entire remainder of the stream.
export var any: Parser<string>;
/**
* consumes and yields the entire remainder of the stream.
*/
export var all: Parser<string>;
/**
* expects the end of the stream.
export var all: Parser<string>;
/**
* expects the end of the stream.
*/
export var eof: Parser<void>;
/**
* is a parser that yields the current index of the parse.
export var eof: Parser<undefined>;
/**
* is a parser that yields the current index of the parse.
*/
export var index: Parser<Index>;
/**
* Returns a parser that yield a single character if it passes the predicate
*/
export function test(predicate: (char: string) => boolean): Parser<string>;
/**
* Returns a parser yield a string containing all the next characters that pass the predicate
*/
export function takeWhile(predicate: (char: string) => boolean): Parser<string>;
export var index: Parser<Index>;
/**
* Returns a parser that yield a single character if it passes the predicate
*/
export function test(predicate: (char: string) => boolean): Parser<string>;
/**
* Returns a parser yield a string containing all the next characters that pass the predicate
*/
export function takeWhile(predicate: (char: string) => boolean): Parser<string>;
}
export = Parsimmon;

View File

@@ -1,9 +1,6 @@
import P = require('parsimmon');
import Parser = P.Parser;
import Mark = P.Mark;
import Result = P.Result;
import Index = P.Index;
import { Parser, Mark, Result, Index } from "parsimmon";
// -- -- -- -- -- -- -- -- -- -- -- -- --
@@ -18,6 +15,7 @@ class Bar {
// -- -- -- -- -- -- -- -- -- -- -- -- --
var str: string;
var strArr: string[];
var bool: boolean;
var num: number;
var index: Index;
@@ -40,6 +38,7 @@ var indexPar: Parser<Index>;
var fooPar: Parser<Foo>;
var barPar: Parser<Bar>;
var fooOrBarPar: Parser<Foo | Bar>;
// -- -- -- -- -- -- -- -- -- -- -- -- --
@@ -53,23 +52,29 @@ var barArrPar: Parser<Bar[]>;
var fooMarkPar: Parser<Mark<Foo>>;
index = fooMarkPar.parse(str).value.start;
index = fooMarkPar.parse(str).value.end;
foo = fooMarkPar.parse(str).value.value;
const result = fooMarkPar.parse(str);
if (result.status) {
index = result.value.start;
index = result.value.end;
foo = result.value.value;
}
// -- -- -- -- -- -- -- -- -- -- -- -- --
var fooResult: Result<Foo>;
bool = fooResult.status;
foo = fooResult.value;
str = fooResult.expected;
index = fooResult.index;
// https://github.com/Microsoft/TypeScript/issues/12882
if (fooResult.status === true) {
foo = fooResult.value;
} else {
strArr = fooResult.expected;
index = fooResult.index;
}
// -- -- -- -- -- -- -- -- -- -- -- -- --
fooResult = P.makeSuccess(0, foo);
fooResult = P.makeFailure<Foo>(0, '');
fooResult = P.makeFailure(0, '');
fooPar = P((input: string, i: number) => P.makeSuccess(0, foo));
fooPar = P.Parser((input: string, i: number) => P.makeSuccess(0, foo));
@@ -80,7 +85,7 @@ fooResult = fooPar.parse(str);
foo = fooPar.tryParse(str);
fooPar = fooPar.or(fooPar);
anyPar = fooPar.or(barPar);
fooOrBarPar = fooPar.or(barPar);
barPar = fooPar.chain((f) => {
foo = f;
@@ -104,6 +109,8 @@ fooPar = fooPar.skip(barPar);
barPar = barPar = fooPar.result(bar);
fooOrBarPar = fooPar.fallback(bar);
// -- -- -- -- -- -- -- -- -- -- -- -- --
fooArrPar = fooPar.many();
@@ -139,7 +146,7 @@ fooPar = P.lazy(() => {
});
voidPar = P.fail(str);
fooPar = P.fail<Foo>(str);
fooPar = P.fail(str);
// -- -- -- -- -- -- -- -- -- -- -- -- --

1
parsimmon/tslint.json Normal file
View File

@@ -0,0 +1 @@
{ "extends": "../tslint.json" }

View File

@@ -451,7 +451,7 @@ export interface TableHeaderColumnProps extends Props<TableHeaderColumn> {
To customize the column. This callback function should return a String or a React Component.
In addition, this function taking two argument: cell and row.
*/
dataFormat?: (cell: any, row: any) => string | ReactElement<any>;
dataFormat?: (cell: any, row: any, formatExtraData?: any) => string | ReactElement<any>;
/**
To to enable search or filter data on formatting. Default is false
*/

9
three/index.d.ts vendored
View File

@@ -261,7 +261,7 @@ declare namespace THREE {
reset(): AnimationAction;
isRunning(): boolean;
startAt(time: number): AnimationAction;
setLoop(mode: boolean, repetitions: number): AnimationAction;
setLoop(mode: AnimationActionLoopStyles, repetitions: number): AnimationAction;
setEffectiveWeight(weight: number): AnimationAction;
getEffectiveWeight(): number;
fadeIn(duration: number): AnimationAction;
@@ -1285,6 +1285,11 @@ declare namespace THREE {
*/
computeVertexNormals(areaWeighted?: boolean): void;
/**
* Compute vertex normals, but duplicating face normals.
*/
computeFlatVertexNormals(): void;
/**
* Computes morph normals.
*/
@@ -5729,7 +5734,7 @@ declare namespace THREE {
encoding?: TextureEncoding
);
image: { data: ImageData; width: number; height: number; };
image: ImageData;
}
export class VideoTexture extends Texture {

2
uikit/.gitignore vendored
View File

@@ -1,2 +0,0 @@
tsconfig.json
.idea/

563
uikit/index.d.ts vendored

File diff suppressed because it is too large Load Diff

19
uikit/tsconfig.json Normal file
View File

@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"uikit-tests.ts"
]
}

3
uikit/tslint.json Normal file
View File

@@ -0,0 +1,3 @@
{
"extends": "../tslint.json"
}

View File

@@ -2,9 +2,20 @@
function testModal() {
UIkit.modal.alert("Attention!");
UIkit.modal.confirm("Are you sure?", function () {
// will be executed on confirm.
});
let options: UIkit.ModalOptions = {
keyboard: true,
bgclose: true,
minScrollHeight: 150,
center: false,
modal: true
};
UIkit.modal.confirm("Are you sure?", () => {});
UIkit.modal.confirm("Are you sure?", () => {}, {});
UIkit.modal.confirm("Are you sure?", () => {}, () => {});
UIkit.modal.confirm("Are you sure?", () => {}, () => {}, {});
UIkit.modal.confirm("Are you sure?", () => {}, {});
UIkit.modal.prompt("Name:", 'value', function (newvalue:string) {
// will be executed on submit.
});

940
webdriverio/index.d.ts vendored

File diff suppressed because it is too large Load Diff

View File

@@ -6,15 +6,13 @@ import {assert} from "chai";
describe("webdriver.io page", function() {
it("should have the right title - the good old callback way", function(done) {
browser
.url("/")
.getTitle(function(err, title) {
assert.equal(err, undefined);
assert.equal(title, "WebdriverIO - Selenium 2.0 javascript bindings for nodejs");
})
.call(done);
it("should have the right title - the good old callback way", function() {
assert.equal(
browser
.url("/")
.getTitle(),
"WebdriverIO - Selenium 2.0 javascript bindings for nodejs"
);
});
@@ -41,27 +39,28 @@ describe("my webdriverio tests", function(){
client.init(done);
});
it("Github test",function(done) {
client
.url("https://github.com/")
.getElementSize(".header-logo-wordmark", function(err: any, result: webdriverio.Size) {
assert.equal(undefined, err);
assert.strictEqual(result.height, 26);
assert.strictEqual(result.width, 89);
})
.getTitle(function(err: any, title: string) {
assert.equal(undefined, err);
assert.strictEqual(title,"GitHub · Where software is built");
})
.getCssProperty("a[href='/plans']", "color", function(err: any, result: webdriverio.CssProperty){
assert.equal(undefined, err);
assert.strictEqual(result.value, "rgba(64,120,192,1)");
})
.call(done);
it("Github test",function() {
client.url("https://github.com/");
var elementSize = client.getElementSize(".header-logo-wordmark");
var foo = client.getElementSize('div');
assert.isNumber(elementSize.height);
assert.isNumber(elementSize.width);
assert.strictEqual(elementSize.height, 26);
assert.strictEqual(elementSize.width, 89);
var title = client.getTitle();
assert.isString(title);
assert.strictEqual(title, "GitHub · Where software is built");
var cssProperty = client.getCssProperty("a[href='/plans']", "color");
assert.strictEqual(cssProperty.value, "rgba(64,120,192,1)");
});
after(function(done) {
client.end(done);
after(function() {
client.end();
});
});