Merge pull request #5 from DefinitelyTyped/master

keep fork up to date
This commit is contained in:
Nikolaj Kappler
2018-11-08 16:10:58 +01:00
committed by GitHub
311 changed files with 11765 additions and 2285 deletions
+389 -171
View File
File diff suppressed because it is too large Load Diff
+12
View File
@@ -540,6 +540,12 @@
"sourceRepoURL": "https://github.com/code-chris/extended-listbox",
"asOfVersion": "4.0.1"
},
{
"libraryName": "fast-diff",
"typingsPackageName": "fast-diff",
"sourceRepoURL": "https://github.com/jhchen/fast-diff",
"asOfVersion": "1.2.0"
},
{
"libraryName": "JSON-Patch",
"typingsPackageName": "fast-json-patch",
@@ -978,6 +984,12 @@
"sourceRepoURL": "https://github.com/mweststrate/mobservable-react",
"asOfVersion": "1.0.0"
},
{
"libraryName": "Mobx Cookie",
"typingsPackageName": "mobx-cookie",
"sourceRepoURL": "https://github.com/will-stone/mobx-cookie",
"asOfVersion": "1.1.0"
},
{
"libraryName": "Moment",
"typingsPackageName": "moment",
@@ -1,5 +1,5 @@
angular.module('promise-tracker-tests', []).run(['$q', 'promiseTracker',
($q: angular.IQService, promiseTracker: angular.promisetracker.PromiseTrackerService) => {
angular.module('promise-tracker-tests', []).run(['$q', '$http', 'promiseTracker',
($q: angular.IQService, $http: angular.IHttpService, promiseTracker: angular.promisetracker.PromiseTrackerService) => {
const trackerWithoutOptions = promiseTracker();
const options = {
@@ -19,4 +19,8 @@ angular.module('promise-tracker-tests', []).run(['$q', 'promiseTracker',
const addedPromise: angular.IDeferred<void> = trackerWithOptions.addPromise(promiseToAdd);
const trackerWithSomeOptions = promiseTracker({activationDelay: 500});
$http.post('/foo', {}, { });
$http.post('/foo', {}, { tracker: trackerWithOptions });
$http.post('/foo', {}, { tracker: [trackerWithoutOptions, trackerWithOptions] });
}]);
+4
View File
@@ -28,4 +28,8 @@ declare module 'angular' {
(options?: PromiseTrackerOptions): PromiseTracker;
}
}
interface IRequestShortcutConfig {
tracker?: angular.promisetracker.PromiseTracker | angular.promisetracker.PromiseTracker[];
}
}
+4 -1
View File
@@ -16,6 +16,10 @@ angular
closeButton: false,
closeHtml: '<button>&times;</button>',
extendedTimeOut: 1000,
extraData: {
txt: "sample text",
action: () => {/* Do action */},
},
iconClasses: {
error: 'toast-error',
info: 'toast-info',
@@ -29,7 +33,6 @@ angular
progressBar: false,
tapToDismiss: true,
templates: {
toast: 'directives/toast/toast.html',
progressbar: 'directives/progressbar/progressbar.html'
},
+1
View File
@@ -24,6 +24,7 @@ declare module 'angular' {
closeButton?: boolean;
closeHtml?: string;
extendedTimeOut?: number;
extraData?: any,
messageClass?: string;
onHidden?: (wasClicked: boolean, toast: angular.toastr.IToast) => void;
onShown?: (toast: angular.toastr.IToast) => void;
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/mgonto/angular-wizard
// Definitions by: Marko Jurisic <https://github.com/mjurisic>, Ronald Wildenberg <https://github.com/rwwilden>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
import * as angular from 'angular';
+9 -1
View File
@@ -20,5 +20,13 @@ Object.keys({
, brightCyan: 96
, brightWhite: 97
}).forEach((color) => {
cursor[color]().bold().write(`Hello, bold ${color.replace(/([a-z])([A-Z])/g, (_: string, l: string, u: string): string => `${l} ${u.toLowerCase()}`)} world!\n`).reset();
const cname = color.replace(/([a-z])([A-Z])/g, (_: string, l: string, u: string): string => `${l} ${u.toLowerCase()}`);
((<(...anything: any[]) => ansi.Cursor> cursor[color])()
.bold()
.bg)[color === 'blue' || color === 'brightBlue' ? 'black' : 'blue']()
.write(
`Hello, bold ${cname} world!\n`
)
.reset();
});
+16 -3
View File
@@ -2,6 +2,7 @@
// Project: https://www.npmjs.com/package/ansi
// Definitions by: Gustavo6046 <https://github.com/Gustavo6046>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
/**
* References:
@@ -14,11 +15,19 @@
/// <reference types="node" />
import { Stream } from "stream";
declare function ansi(stream: Stream, options?: any): ansi.Cursor;
interface CursorOptions {
enabled: boolean;
buffering: boolean;
}
declare function ansi(stream: Stream, options?: CursorOptions): ansi.Cursor;
declare namespace ansi {
class Cursor {
constructor(stream: Stream, options?: any);
bg: Colorer;
fg: Colorer;
constructor(stream: Stream, options?: CursorOptions);
/**
* Helper function that calls `write()` on the underlying Stream.
@@ -161,7 +170,11 @@ declare namespace ansi {
}
interface Cursor {
[key: string]: (...anything: any[]) => Cursor;
[key: string]: ((...anything: any[]) => Cursor) | Colorer;
}
interface Colorer {
[key: string]: (...anything: any[]) => (Cursor | Colorer);
}
}
+75
View File
@@ -1440,6 +1440,81 @@ declare module "@arangodb/foxx/router" {
export = createRouter;
}
declare module "@arangodb/foxx/queues" {
interface QueueItem {
name: string;
mount: string;
backOff?: ((failureCount: number) => number) | number;
maxFailures?: number;
schema?: Foxx.Schema;
preprocess?: (data: any) => any;
}
interface Script {
name: string;
mount: string;
}
type JobCallback = (result: any, jobData: any, job: ArangoDB.Document<Job>) => void;
interface Job {
status: string;
queue: string;
type: Script;
failures: object[];
runs: number;
data: any;
created: number;
modified: number;
delayUntil: number;
maxFailures: number;
repeatDelay: number;
repeatTimes: number;
repeatUntil: number;
success?: string;
failure?: string;
runFailures: number;
abort(): void;
}
interface JobOptions {
success?: JobCallback;
failure?: JobCallback;
delayUntil?: number | Date;
backOff?: ((failureCount: number) => number) | number;
maxFailures?: number;
repeatTimes?: number;
repeatUntil?: number | Date;
repeatDelay?: number;
}
interface Queue {
push(item: QueueItem, data: any, opts?: JobOptions): void;
get(jobId: string): ArangoDB.Document<Job>;
delete(jobId: string): boolean;
pending(script?: Script): string[];
progress(script?: Script): string[];
complete(script?: Script): string[];
failed(script?: Script): string[];
all(script?: Script): string[];
}
function createQueue(name: string, maxWorkers?: number): Queue;
function deleteQueue(name: string): boolean;
function get(name: string): Queue;
export {
createQueue as create,
deleteQueue as delete,
get,
JobOptions,
Job,
Queue,
QueueItem,
Script,
};
}
declare module "@arangodb/foxx/graphql" {
import { formatError, GraphQLSchema } from "graphql";
type GraphQLModule = object;
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/postcss/autoprefixer
// Definitions by: Armando Meziat <https://github.com/odnamrataizem>, murt <https://github.com/murt>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import { Plugin } from "postcss";
+1
View File
@@ -46,6 +46,7 @@ export type PluginName =
'estree' |
'jsx' |
'flow' |
'typescript' |
'classConstructorCall' |
'doExpressions' |
'objectRestSpread' |
+4
View File
@@ -67,6 +67,10 @@ function test_disabled() {
expect($('#foo')).to.be.disabled;
}
function test_enabled() {
expect($('#foo')).to.be.enabled;
}
function test_empty() {
$('.empty').should.be.empty;
expect($('body')).not.to.be.empty;
+1
View File
@@ -25,6 +25,7 @@ declare namespace Chai {
selected(): Assertion;
checked(): Assertion;
disabled(): Assertion;
enabled(): Assertion;
(selector: string): Assertion;
}
+3
View File
@@ -914,6 +914,9 @@ function test_skin() {
CKEDITOR.skin.loadPart('part', () => console.log('load'));
var path2: string = CKEDITOR.skin.path();
CKEDITOR.skin.ua_dialog = 'ie,iequirks,ie8,gecko';
CKEDITOR.skin.ua_editor = 'ie,gecko';
}
function test_style() {
+3
View File
@@ -2,6 +2,7 @@
// Project: https://ckeditor.com/ckeditor-4/
// Definitions by: Thomas Wittwer <https://github.com/wittwert>
// Stuart Long <https://github.com/stuartlong>
// Viktor Pegy <https://github.com/viktorpegy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// WORK-IN-PROGRESS: Any contribution support welcomed.
@@ -2168,6 +2169,8 @@ declare namespace CKEDITOR {
// tslint:disable-next-line:no-duplicate-variable
var name: string;
var ua: { [name: string]: any };
var ua_dialog: string;
var ua_editor: string;
function addIcon(name: string, path: string, offset?: number, bgsize?: string): void;
function chameleon(editor: string, part: string): void;
+47
View File
@@ -0,0 +1,47 @@
// Type definitions for CodeMirror
// Project: https://github.com/marijnh/CodeMirror
// Definitions by: Nikolaj Kappler <https://github.com/nkappler>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// See docs https://codemirror.net/doc/manual.html#addon_comment
// Todo: add 'toggleComment' command, once command type definitions exist in main definitions
import * as CodeMirror from "codemirror";
declare module "codemirror" {
interface Editor {
/** Tries to uncomment the current selection, and if that fails, line-comments it. */
toggleComment(from: Position, to: Position, options?: CommentOptions): void;
/** Set the lines in the given range to be line comments. Will fall back to `blockComment` when no line comment style is defined for the mode. */
lineComment(from: Position, to: Position, options?: CommentOptions): void;
/** Wrap the code in the given range in a block comment. Will fall back to `lineComment` when no block comment style is defined for the mode. */
blockComment(from: Position, to: Position, options?: CommentOptions): void;
/** Try to uncomment the given range. Returns `true` if a comment range was found and removed, `false` otherwise. */
uncomment(from: Position, to: Position, options?: CommentOptions): boolean;
}
interface CommentOptions {
/** Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings. */
blockCommentStart?: string;
/** Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings. */
blockCommentEnd?: string;
/** Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings. */
blockCommentLead?: string;
/** Override the [comment string properties](https://codemirror.net/doc/manual.html#mode_comment) of the mode with custom comment strings. */
lineComment?: string;
/** A string that will be inserted after opening and leading markers, and before closing comment markers. Defaults to a single space. */
padding?: string;
/** Whether, when adding line comments, to also comment lines that contain only whitespace. */
commentBlankLines?: boolean;
/** When adding line comments and this is turned on, it will align the comment block to the current indentation of the first line of the block. */
indent?: boolean;
/** When block commenting, this controls whether the whole lines are indented, or only the precise range that is given. Defaults to `true`. */
fullLines?: boolean;
}
}
declare module "codemirror/addon/comment/comment" {
export = CodeMirror;
}
+20
View File
@@ -4,6 +4,7 @@
// nrbernard <https://github.com/nrbernard>
// Pr1st0n <https://github.com/Pr1st0n>
// rileymiller <https://github.com/rileymiller>
// toddself <https://github.com/toddself>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = CodeMirror;
@@ -706,8 +707,27 @@ declare namespace CodeMirror {
or undefined if the marker is no longer in the document. */
find(): {from: CodeMirror.Position, to: CodeMirror.Position};
/** Called when you've done something that might change the size of the marker and want to cheaply update the display*/
changed(): void;
/** Returns an object representing the options for the marker. If copyWidget is given true, it will clone the value of the replacedWith option, if any. */
getOptions(copyWidget: boolean): CodeMirror.TextMarkerOptions;
/** Fired when the cursor enters the marked range */
on(eventName: 'beforeCursorEnter', handler: () => void) : void;
off(eventName: 'beforeCursorEnter', handler: () => void) : void;
/** Fired when the range is cleared, either through cursor movement in combination with clearOnEnter or through a call to its clear() method */
on(eventName: 'clear', handler: (from: Position, to: Position) => void) : void;
off(eventName: 'clear', handler: () => void) : void;
/** Fired when the last part of the marker is removed from the document by editing operations */
on(eventName: 'hide', handler: () => void) : void;
off(eventname: 'hide', handler: () => void) : void;
/** Fired when, after the marker was removed by editing, a undo operation brough the marker back */
on(eventName: 'unhide', handler: () => void) : void;
off(eventname: 'unhide', handler: () => void) : void;
}
interface LineWidget {
+16
View File
@@ -0,0 +1,16 @@
const editor = CodeMirror(document.body);
const position: CodeMirror.Position = { ch: 0, line: 0 };
const opt: CodeMirror.CommentOptions = {
blockCommentEnd: "*/",
blockCommentStart: "/*",
blockCommentLead: "*",
commentBlankLines: true,
fullLines: true,
indent: true,
lineComment: "//",
padding: " "
};
editor.toggleComment(position, position, opt);
editor.blockComment(position, position, opt);
editor.lineComment(position, position, opt);
const b: boolean = editor.uncomment(position, position, opt);
+3 -1
View File
@@ -23,12 +23,14 @@
"codemirror-panel.d.ts",
"codemirror-runmode.d.ts",
"codemirror-showhint.d.ts",
"codemirror-comment.d.ts",
"searchcursor.d.ts",
"test/index.ts",
"test/matchbrackets.ts",
"test/panel.ts",
"test/runmode.ts",
"test/searchcursor.ts",
"test/showhint.ts"
"test/showhint.ts",
"test/comment.ts"
]
}
@@ -7,4 +7,8 @@ new Critters({
preloadFonts: true,
keyframes: 'critical',
noscriptFallback: true,
inlineThreshold: 0,
mergeStylesheets: true,
pruneSource: true,
minimumExternalSize: 0,
});
+21 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for critters-webpack-plugin 1.3
// Type definitions for critters-webpack-plugin 2.0
// Project: https://github.com/GoogleChromeLabs/critters
// Definitions by: Juan José González Giraldo <https://github.com/JuanJoseGonGi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -18,6 +18,26 @@ declare namespace Critters {
* @default true
*/
external?: boolean;
/**
* Inline external stylesheets smaller than a given size.
* @default 0
*/
inlineThreshold?: number;
/**
* If the non-critical external stylesheet would be below this size, just inline it.
* @default 0
*/
minimumExternalSize?: number;
/**
* Remove inlined rules from the external stylesheet.
* @default true
*/
pruneSource?: boolean;
/**
* Merged inlined stylesheets into a single <style> tag.
* @default true
*/
mergeStylesheets?: boolean;
/**
* The mechanism to use for lazy-loading stylesheets. [JS] indicates that a strategy requires JavaScript (falls back to <noscript>).
* - default: Move stylesheet links to the end of the document and insert preload meta tags in their place.
+7
View File
@@ -144,6 +144,13 @@ contDensCustom = contDensCustom.y((datum) => {
// get
const yAcc: (d: CustomDatum) => number = contDensCustom.y();
// weight(...) -----------------------------------------------------------------
contDensCustom = contDensCustom.weight((datum) => {
return 5;
});
// get
const weightAcc: (d: CustomDatum) => number = contDensCustom.weight();
// size(...) -------------------------------------------------------------------
// set with chainability
+14 -2
View File
@@ -1,10 +1,10 @@
// Type definitions for d3-contour 1.2
// Type definitions for d3-contour 1.3
// Project: https://d3js.org/d3-contour/
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Hugues Stefanski <https://github.com/Ledragon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// Last module patch version validated against: 1.2.0
// Last module patch version validated against: 1.3.2
import { MultiPolygon } from 'geojson';
import { ThresholdNumberArrayGenerator, ThresholdCountGenerator } from 'd3-array';
@@ -169,6 +169,18 @@ export interface ContourDensity<Datum = [number, number]> {
*/
y(y: (d: Datum) => number): this;
/**
* Returns the current point weight accessor.
*/
weight(): (d: Datum) => number;
/**
* Sets the point weight accessor and returns the density contour estimator.
*
* @param weight A point weight accessor function.
*/
weight(weight: (d: Datum) => number): this;
/**
* Returns the current size, which defaults to [960, 500].
*/
+1 -1
View File
@@ -407,7 +407,7 @@ export type Engine = 'circo' | 'dot' | 'fdp' | 'neato' | 'osage' | 'patchwork' |
export type TypeNames = 'initEnd' | 'start' | 'layoutStart' | 'layoutEnd' | 'dataExtractEnd' |
'dataProcessPass1End' | 'dataProcessPass2End' | 'dataProcessEnd' |
'renderStart' | 'renderEnd' | 'transitionStart' | 'transitionEnd' |
'resotreEnd' | 'end' | string; // string included to allow for optional addition of a name, e.g. initEnd.foo
'restoreEnd' | 'end' | string; // string included to allow for optional addition of a name, e.g. initEnd.foo
/**
* Enum defining the valid strings that can be passed as KeyModes
+141 -95
View File
@@ -74,7 +74,8 @@ let body: d3Selection.Selection<HTMLBodyElement, BodyDatum, HTMLElement, any> =
// with Group element of type BaseType and datum of type 'any' The parent element is of type 'null' with datum of type 'undefined'
const baseTypeEl2: d3Selection.Selection<d3Selection.BaseType, any, null, undefined> = d3Selection.select(baseTypeEl.node());
// let body2: d3Selection.Selection<HTMLElement, any, null, undefined> = d3Selection.select(baseTypeEl.node()); // fails as baseTypeEl.node() is of type cannot be assigned to HTMLElement
// $ExpectError
const body2: d3Selection.Selection<HTMLElement, any, null, undefined> = d3Selection.select(baseTypeEl.node()); // fails as baseTypeEl.node() is of type cannot be assigned to HTMLElement
const body3: d3Selection.Selection<HTMLBodyElement, any, null, undefined> = d3Selection.select(body.node()!); // element types match, but datum is of type 'any' as it cannot be inferred from .node()
@@ -86,18 +87,21 @@ const body4: d3Selection.Selection<HTMLBodyElement, BodyDatum, null, undefined>
// Explicitly cast body.node() to HTMLBodyElement to narrow selection definition.
const body5: d3Selection.Selection<HTMLBodyElement, BodyDatum, null, undefined> = d3Selection.select<HTMLBodyElement, BodyDatum>(body.node()!);
// d3Selection.select<HTMLBodyElement, BodyDatum>(baseTypeEl.node()!); // fails as baseTypeEl.node() is not of type HTMLBodyElement
// $ExpectError
d3Selection.select<HTMLBodyElement, BodyDatum>(baseTypeEl.node()!); // fails as baseTypeEl.node() is not of type HTMLBodyElement
// test, when it is not certain, whether an element of the type to be selected exists
let maybeSVG1: d3Selection.Selection<SVGSVGElement | null, any, HTMLElement, undefined>;
maybeSVG1 = d3Selection.select<SVGSVGElement | null, any>('svg');
let maybeSVG2: d3Selection.Selection<SVGSVGElement | null, any, null, undefined>;
// maybeSVG2 = d3Selection.select<SVGSVGElement, any>(maybeSVG1.node()); // fails with strict function types
// $ExpectError
maybeSVG2 = d3Selection.select<SVGSVGElement, any>(maybeSVG1.node()); // fails with strict function types
maybeSVG2 = d3Selection.select<SVGSVGElement | null, any>(maybeSVG1.node());
// fails, as node type mismatches selection type
// let body7: d3Selection.Selection<HTMLBodyElement | null, any, HTMLElement, undefined> = d3Selection.select<HTMLBodyElement | null, any>(maybeSVG1.node());
// $ExpectError
const body7: d3Selection.Selection<HTMLBodyElement | null, any, HTMLElement, undefined> = d3Selection.select<HTMLBodyElement | null, any>(maybeSVG1.node());
// test "special case DOM objects"
@@ -127,7 +131,8 @@ const divElements: d3Selection.Selection<HTMLDivElement, DivDatum, HTMLElement,
const baseTypeElements2: d3Selection.Selection<d3Selection.BaseType, any, null, undefined> = d3Selection.selectAll(baseTypeElements.nodes());
// fails, group elements types not of compatible for baseTypeElements
// let divElements2: d3Selection.Selection<HTMLDivElement, any, null, undefined> = d3Selection.selectAll(baseTypeElements.nodes());
// $ExpectError
const divElements2: d3Selection.Selection<HTMLDivElement, any, null, undefined> = d3Selection.selectAll(baseTypeElements.nodes());
// element types match, but datum is of type 'any' as it cannot be inferred from .nodes()
const divElements3: d3Selection.Selection<HTMLDivElement, any, null, undefined> = d3Selection.selectAll(divElements.nodes());
@@ -137,7 +142,8 @@ const divElements3: d3Selection.Selection<HTMLDivElement, any, null, undefined>
const divElements4: d3Selection.Selection<HTMLDivElement, DivDatum, null, undefined> = d3Selection.selectAll<HTMLDivElement, DivDatum>(divElements.nodes());
// d3Selection.selectAll<HTMLDivElement, DivDatum>(baseTypeElements.nodes()); // fails as baseTypeEl.node() is not of type HTMLBodyElement
// $ExpectError
d3Selection.selectAll<HTMLDivElement, DivDatum>(baseTypeElements.nodes()); // fails as baseTypeEl.node() is not of type HTMLBodyElement
// selectAll(...) accepts NodeListOf<...> argument
@@ -161,8 +167,8 @@ const documentLinks: d3Selection.Selection<HTMLAnchorElement | HTMLAreaElement,
const svgEl: d3Selection.Selection<SVGSVGElement, SVGDatum, HTMLElement, any> = d3Selection.select<SVGSVGElement, SVGDatum>('svg');
let firstG: d3Selection.Selection<SVGGElement, SVGDatum, HTMLElement, any> = svgEl.select<SVGGElement>('g');
// let firstG_2: d3Selection.Selection<SVGGElement, SVGDatum, SVGSVGElement, any> = svgEl.select<SVGGElement>('g'); // fails, parent element of selection does not change with .select(...)
// firstG = svgEl.select('g'); // fails, element type defaults to 'BaseType', but SVGGElement expected on left-hand side
// $ExpectError
const firstG_2: d3Selection.Selection<SVGGElement, SVGDatum, SVGSVGElement, any> = svgEl.select<SVGGElement>('g'); // fails, parent element of selection does not change with .select(...)
// firstG = svgEl.select<SVGSVGElement>('svg'); // fails, element type of SVGSVGElement provided, but SVGGElement expected on left-hand side (silly test to begin with)
// test, when it is not certain, whether an element of the type to be selected exists
@@ -180,14 +186,16 @@ firstG = svgEl.select(svgGroupSelector);
firstG = svgEl.select(function() {
const that: SVGSVGElement = this;
// const that2: HTMLElement = this; // fails, type mismatch
// $ExpectError
const that2: HTMLElement = this; // fails, type mismatch
console.log('Get <svg> Element width using "this": ', this.width.baseVal.value); // 'this' type is SVGSVGElement
return this.querySelector('g')!; // this of type SVGSVGElement by type inference
});
firstG = svgEl.select(function(d, i, g) {
const that: SVGSVGElement = this;
// const that2: HTMLElement = this; // fails, type mismatch
// $ExpectError
const that2: HTMLElement = this; // fails, type mismatch
const datum: SVGDatum = d;
const index: number = i;
const group: SVGSVGElement[] | d3Selection.ArrayLike<SVGSVGElement> = g;
@@ -199,9 +207,10 @@ firstG = svgEl.select(function(d, i, g) {
return this.querySelector('g')!; // this of type SVGSVGElement by type inference
});
// firstG = svgEl.select(function() {
// return this.querySelector('a'); // fails, return type HTMLAnchorElement is not compatible with SVGGElement expected by firstG
// });
// $ExpectError
firstG = svgEl.select(function() {
return this.querySelector('a'); // fails, return type HTMLAnchorElement is not compatible with SVGGElement expected by firstG
});
// selectAll(...) sub-selection --------------------------------------------------------------
@@ -219,7 +228,6 @@ emptySubSelection = svgEl.selectAll(undefined);
let elementsUnknownData: d3Selection.Selection<SVGGElement, any, SVGSVGElement, SVGDatum> = svgEl.selectAll<SVGGElement, any>('g');
// let elementsAndDataUnknown: d3Selection.Selection<d3Selection.BaseType, any, SVGSVGElement, SVGDatum> = svgEl.selectAll('g'); // fails with strictFunctionTypes
let gElementsOldData: d3Selection.Selection<SVGGElement, CircleDatum, SVGSVGElement, SVGDatum> = svgEl.selectAll<SVGGElement, CircleDatum>('g');
// gElementsOldData = svgEl.selectAll('g'); // fails default type parameters of selectAll for group element type and datum type do not match
// Using selectAll(...) sub-selection with a selector function argument.
@@ -232,18 +240,21 @@ gElementsOldData = svgEl.selectAll<SVGGElement, CircleDatum>(svgGroupSelectorAll
function wrongSvgGroupSelectorAll(this: HTMLElement, d: SVGDatum, i: number, groups: HTMLElement[]): NodeListOf<SVGGElement> {
return this.querySelectorAll('g');
}
// gElementsOldData = svgEl.selectAll<SVGGElement, CircleDatum>(wrongSvgGroupSelectorAll); // fails, wrong this context
// $ExpectError
gElementsOldData = svgEl.selectAll<SVGGElement, CircleDatum>(wrongSvgGroupSelectorAll); // fails, wrong this context
gElementsOldData = svgEl.selectAll<SVGGElement, CircleDatum>(function() {
const that: SVGSVGElement = this;
// const that2: HTMLElement = this; // fails, type mismatch
// $ExpectError
const that2: HTMLElement = this; // fails, type mismatch
console.log('Get <svg> Element width using "this": ', this.width.baseVal.value); // 'this' type is SVGSVGElement
return this.querySelectorAll('g'); // this of type SVGSVGElement by type inference
});
gElementsOldData = svgEl.selectAll<SVGGElement, CircleDatum>(function(d, i, g) {
const that: SVGSVGElement = this;
// const that2: HTMLElement = this; // fails, type mismatch
// $ExpectError
const that2: HTMLElement = this; // fails, type mismatch
const datum: SVGDatum = d;
const index: number = i;
const group: SVGSVGElement[] | d3Selection.ArrayLike<SVGSVGElement> = g;
@@ -255,31 +266,32 @@ gElementsOldData = svgEl.selectAll<SVGGElement, CircleDatum>(function(d, i, g) {
return this.querySelectorAll('g');
});
// gElementsOldData = svgEl.selectAll(function() { // fails, because Datum type is not compatible as selectAll defaults to 'any', but gElementsOldData expects CircleDatum
// return this.querySelectorAll('g');
// });
// gElementsOldData = svgEl.selectAll<SVGGElement, CircleDatum>(function() { // fails, return type HTMLAnchorElement is not compatible with SVGGElement expected by selectAll-typing
// return this.querySelectorAll('a');
// });
// $ExpectError
gElementsOldData = svgEl.selectAll<SVGGElement, CircleDatum>(function() { // fails, return type HTMLAnchorElement is not compatible with SVGGElement expected by selectAll-typing
return this.querySelectorAll('a');
});
elementsUnknownData = svgEl.selectAll(svgGroupSelectorAll);
elementsUnknownData = svgEl.selectAll(function() {
const that: SVGSVGElement = this;
// const that2: HTMLElement = this; // fails, type mismatch
// $ExpectError
const that2: HTMLElement = this; // fails, type mismatch
console.log('Get <svg> Element width using "this": ', this.width.baseVal.value); // 'this' type is SVGSVGElement
return this.querySelectorAll('g'); // this of type SVGSVGElement by type inference
});
// gElementsUnknownData = svgEl.selectAll(function() { // fails, return type HTMLAnchorElement is not compatible with SVGGElement
// return this.querySelectorAll('a');
// });
// $ExpectError
gElementsUnknownData = svgEl.selectAll(function() { // fails, return type HTMLAnchorElement is not compatible with SVGGElement
return this.querySelectorAll('a');
});
maybeG.selectAll(function(d, i, g) {
const that: SVGGElement | null = this;
// const that2: SVGGElement = this; // fails with strictNullChecks
// const that3: HTMLElement | null = this; // fails, type mismatch
// $ExpectError
const that2: SVGGElement = this; // fails with strictNullChecks
// $ExpectError
const that3: HTMLElement | null = this; // fails, type mismatch
const datum: SVGDatum = d;
const index: number = i;
const group: Array<SVGGElement | null> | d3Selection.ArrayLike<SVGGElement | null> = g;
@@ -290,11 +302,13 @@ maybeG.selectAll(function(d, i, g) {
// selector(...) and selectorAll(...) ----------------------------------------------------
// d3Selection.select<SVGGElement>(d3Selection.selector<SVGGElement>('g')); // fails, selector as argument to top-level select not supported
// $ExpectError
d3Selection.select<SVGGElement>(d3Selection.selector<SVGGElement>('g')); // fails, selector as argument to top-level select not supported
// supported on sub-selection
firstG = svgEl.select(d3Selection.selector<SVGGElement>('g')); // type parameter of select(...) inferred
// firstG = svgEl.select<SVGGElement>(d3Selection.selector<HTMLDivElement>('div')); // fails, select and selector mismatch
// $ExpectError
firstG = svgEl.select<SVGGElement>(d3Selection.selector<HTMLDivElement>('div')); // fails, select and selector mismatch
gElementsOldData = svgEl.selectAll<SVGGElement, CircleDatum>(d3Selection.selectorAll<SVGGElement>('g'));
@@ -308,7 +322,8 @@ filteredGElements = gElementsOldData.filter('.top-level');
filteredGElements = gElementsOldData.filter(function(d, i, g) {
const that: SVGGElement = this;
// const that2: HTMLElement = this; // fails, type mismatch
// $ExpectError
const that2: HTMLElement = this; // fails, type mismatch
const datum: CircleDatum = d;
const index: number = i;
const group: SVGGElement[] | d3Selection.ArrayLike<SVGGElement> = g;
@@ -325,16 +340,18 @@ filteredGElements = gElementsOldData.filter(function(d, i, g) {
let filteredGElements2: d3Selection.Selection<SVGGElement, any, HTMLElement, any>;
filteredGElements2 = d3Selection.selectAll<SVGElement, any>('.any-svg-type').filter<SVGGElement>('g');
// filteredGElements2 = d3Selection.selectAll('.any-type').filter('g'); // fails without using narrowing generic on filter method
// $ExpectError
filteredGElements2 = d3Selection.selectAll('.any-type').filter('g'); // fails without using narrowing generic on filter method
filteredGElements2 = d3Selection.selectAll<SVGElement, any>('.any-svg-type').filter<SVGGElement>(function() {
const that: SVGElement = this;
return that.tagName === 'g' || that.tagName === 'G';
});
// filteredGElements2 = d3Selection.selectAll<SVGElement, any>('.any-svg-type').filter(function(){
// const that: SVGElement = this;
// return that.tagName === 'g'|| that.tagName === 'G';
// }); // fails without using narrowing generic on filter method
// $ExpectError
filteredGElements2 = d3Selection.selectAll<SVGElement, any>('.any-svg-type').filter(function() {
const that: SVGElement = this;
return that.tagName === 'g' || that.tagName === 'G';
}); // fails without using narrowing generic on filter method
// matcher() -----------------------------------------------------------------------------
@@ -371,7 +388,8 @@ circles = d3Selection.selectAll<SVGCircleElement, CircleDatumAlternative>('circl
circles = circles // re-assignment test chaining return-type
.attr('cx', function(d, i, g) {
const that: SVGGElement = this;
// const that2: HTMLElement = this; // fails, type mismatch
// $ExpectError
const that2: HTMLElement = this; // fails, type mismatch
const datum: CircleDatum = d;
const index: number = i;
const group: SVGGElement[] | d3Selection.ArrayLike<SVGGElement> = g;
@@ -395,7 +413,8 @@ divs = divs
divs = divs
.classed('zero-px-padding', function(d, i, g) {
const that: HTMLDivElement = this;
// const that2: SVGElement = this; // fails, type mismatch
// $ExpectError
const that2: SVGElement = this; // fails, type mismatch
const datum: DivDatum = d;
const index: number = i;
const group: HTMLDivElement[] | d3Selection.ArrayLike<HTMLDivElement> = g;
@@ -411,13 +430,15 @@ divs = divs
divs = divs
.style('background-color', 'blue') // string
.style('hidden', false) // boolean
// .style('color', 'green', 'test') // fails, invalid priority value
// $ExpectError
.style('color', 'green', 'test') // fails, invalid priority value
.style('color', 'green', 'important');
divs = divs
.style('padding', function(d, i, g) {
const that: HTMLDivElement = this;
// const that2: SVGElement = this; // fails, type mismatch
// $ExpectError
const that2: SVGElement = this; // fails, type mismatch
const datum: DivDatum = d;
const index: number = i;
const group: HTMLDivElement[] | d3Selection.ArrayLike<HTMLDivElement> = g;
@@ -428,7 +449,8 @@ divs = divs
return d.padding; // string return value
})
.style('hidden', () => true, null) // boolean return + test: priority = null
// .style('color', function() { return 'green'; }, 'test') // fails, test: invalid priority value
// $ExpectError
.style('color', () => 'green', 'test') // fails, test: invalid priority value
.style('color', () => 'green', 'important'); // boolean return + test: priority = 'important';
// property(...) Tests
@@ -442,7 +464,8 @@ circles = circles
circles = circles
.property('__hitchhikersguide__', function(d, i, g) {
const that: SVGCircleElement = this;
// const that2: HTMLElement = this; // fails, type mismatch
// $ExpectError
const that2: HTMLElement = this; // fails, type mismatch
const datum: CircleDatumAlternative = d;
const index: number = i;
const group: SVGCircleElement[] | d3Selection.ArrayLike<SVGCircleElement> = g;
@@ -466,7 +489,8 @@ body = body
body = body
.text(function(d, i, g) {
const that: HTMLBodyElement = this;
// const that2: SVGElement = this; // fails, type mismatch
// $ExpectError
const that2: SVGElement = this; // fails, type mismatch
const datum: BodyDatum = d;
const index: number = i;
const group: HTMLBodyElement[] | d3Selection.ArrayLike<HTMLBodyElement> = g;
@@ -482,7 +506,8 @@ body = body
body = body
.html(function(d, i, g) {
const that: HTMLBodyElement = this;
// const that2: SVGElement = this; // fails, type mismatch
// $ExpectError
const that2: SVGElement = this; // fails, type mismatch
const datum: BodyDatum = d;
const index: number = i;
const group: HTMLBodyElement[] | d3Selection.ArrayLike<HTMLBodyElement> = g;
@@ -521,13 +546,15 @@ let newBodyDatum: { newFoo: string };
newBodyDatum = body.datum({ newFoo: 'new foo' }).datum(); // inferred type
// body.datum<BodyDatum>({ newFoo: 'new foo' }); // fails, data type incompatible
// $ExpectError
body.datum<BodyDatum>({ newFoo: 'new foo' }); // fails, data type incompatible
// function-based
newBodyDatum = body.datum(function(d, i, g) {
const that: HTMLBodyElement = this;
// const that2: SVGElement = this; // fails, type mismatch
// $ExpectError
const that2: SVGElement = this; // fails, type mismatch
const datum: BodyDatum = d;
const index: number = i;
const group: HTMLBodyElement[] | d3Selection.ArrayLike<HTMLBodyElement> = g;
@@ -536,10 +563,11 @@ newBodyDatum = body.datum(function(d, i, g) {
return { newFoo: 'new foo' };
}).datum(); // inferred type
// newBodyDatum = body.datum<BodyDatum>(function(d) { // fails, data type incompatible with return value type
// console.log('HTML5 Custom Data Attributes of body: ', this.dataset); // this typings HTMLBodyElement
// return { newFoo: 'new foo' };
// }).datum(); // inferred type
// $ExpectError
newBodyDatum = body.datum<BodyDatum>(function(d) { // fails, data type incompatible with return value type
console.log('HTML5 Custom Data Attributes of body: ', this.dataset); // this typings HTMLBodyElement
return { newFoo: 'new foo' };
}).datum(); // inferred type
// SCENARIO 1: Fully type-parameterized
@@ -560,7 +588,8 @@ d3Selection.select('#svg-1') // irrelevant typing to get contextual typing in la
.datum(data2) // new data type inferred
.classed('has-transform-property', function(d, i, g) {
const that: SVGGElement = this;
// const that2: HTMLElement = this; // fails, type mismatch
// $ExpectError
const that2: HTMLElement = this; // fails, type mismatch
const datum: CircleDatumAlternative[] = d;
const index: number = i;
const group: SVGGElement[] | d3Selection.ArrayLike<SVGGElement> = g;
@@ -569,14 +598,14 @@ d3Selection.select('#svg-1') // irrelevant typing to get contextual typing in la
});
// below fails, as 'this' in .classed(...) will default to BaseType, which may be null and does not have 'transform' property
// d3Selection.select('#svg-1') // irrelevant typing to get contextual typing in last step of chain
// .select('g.circles-group') // missing typing of selected DOM element for use in .classed(...)
// .datum(data2) // new data type inferred
// .classed('has-transform-property', function(d) {
// console.log('Color of first data element array', d.length > 0? d[0].color: 'Data array empty'); // CircleDatumAlternative type
// return this.transform !== undefined;
// });
d3Selection.select('#svg-1') // irrelevant typing to get contextual typing in last step of chain
.select('g.circles-group') // missing typing of selected DOM element for use in .classed(...)
.datum(data2) // new data type inferred
.classed('has-transform-property', function(d) {
console.log('Color of first data element array', d.length > 0 ? d[0].color : 'Data array empty'); // CircleDatumAlternative type
// $ExpectError
return this.transform !== undefined;
});
// SCENARIO 3: Only inferred typing (To have datum-type in 'classed' method call, no need for DOM object access)
@@ -585,7 +614,8 @@ d3Selection.select('#svg-1') // irrelevant typing to get contextual typing in la
.datum(data2) // new data type inferred
.classed('has-green-first-data-element', function(d, i, g) {
const that: d3Selection.BaseType = this;
// const that2: Element = this; // fails, type mismatch
// $ExpectError
const that2: Element = this; // fails, type mismatch
const datum: CircleDatumAlternative[] = d;
const index: number = i;
const group: d3Selection.BaseType[] | d3Selection.ArrayLike<d3Selection.BaseType> = g;
@@ -663,7 +693,8 @@ circles2 = d3Selection.select<SVGSVGElement, any>('#svg2')
circles2 = circles2 // returned update selection has the same type parameters as original selection, if data type is unchanged
.data<CircleDatumAlternative>(endCircleData, d => d.nodeId);
// circles2.data<DivDatum>(endCircleData, function(d) { return d.nodeId; }); // fails, forced data type parameter and data argument mismatch
// $ExpectError
circles2.data<DivDatum>(endCircleData, (d) => d.nodeId); // fails, forced data type parameter and data argument mismatch
// ENTER-selection -----------------------------------------------------------------
@@ -690,7 +721,8 @@ const exitCircles = circles2.exit<CircleDatumAlternative>(); // Note: need to re
exitCircles
.style('opacity', function(d, i, g) {
const that: SVGCircleElement = this;
// const that2: HTMLElement = this; // fails, type mismatch
// $ExpectError
const that2: HTMLElement = this; // fails, type mismatch
const datum: CircleDatumAlternative = d;
const index: number = i;
const group: SVGCircleElement[] | d3Selection.ArrayLike<SVGCircleElement> = g;
@@ -702,12 +734,13 @@ exitCircles
// Note: the alternative using only .exit() without typing, will fail, if access to datum properties is attempted.
// If access to d is not required, the short-hand is acceptable e.g. circles2.exit().remove();
// let exitCircles2 = circles2.exit(); // Note: Without explicit re-typing to the old data type, the data type default to '{}'
// exitCircles2
// .style('opacity', function(d) {
// console.log('Circle Radius exit node: ', this.r.baseVal.value);
// return d.color === 'green' ? 1 : 0; // fails, as data type is defaulted to {}. If datum access is required, this should trigger the thought to type .exit<...>
// });
const exitCircles2 = circles2.exit(); // Note: Without explicit re-typing to the old data type, the data type default to '{}'
exitCircles2
.style('opacity', function(d) {
console.log('Circle Radius exit node: ', this.r.baseVal.value);
// $ExpectError
return d.color === 'green' ? 1 : 0; // fails, as data type is defaulted to {}. If datum access is required, this should trigger the thought to type .exit<...>
});
// MERGE ENTER + UPDATE ------------------------------------------------------------------
@@ -733,8 +766,8 @@ tr = d3Selection.select('body')
.append<HTMLTableElement>('table')
.selectAll()
.data(matrix)
// .data([{test: 1}, {test: 2}]) // fails, using this data statement instead, would fail assignment to tr due to the data type of tr Selection
// .data<number[]>([{test: 1}, {test: 2}]) // fails, using this data statement instead, would fail because of its type parameter not being met by input
// $ExpectError
.data<number[]>([{test: 1}, {test: 2}]) // fails, using this data statement instead, would fail because of its type parameter not being met by input
.enter().append<HTMLTableRowElement>('tr');
nMatrix = tr.data(); // i.e. matrix
@@ -745,7 +778,6 @@ td = tr.selectAll()
.enter().append<HTMLTableDataCellElement>('td')
.text(function(d, i, g) {
const that: HTMLTableDataCellElement = this;
// const that2: Element = this; // fails, type mismatch
const datum: number = d;
const index: number = i;
const group: HTMLTableDataCellElement[] | d3Selection.ArrayLike<HTMLTableDataCellElement> = g;
@@ -787,11 +819,13 @@ newDiv2 = body.append<HTMLDivElement>('div');
// using creator
newDiv2 = body.append(d3Selection.creator<HTMLDivElement>('div'));
// newDiv2 = body.append(d3Selection.creator('div')); // fails, as creator returns BaseType element, but HTMLDivElement is expected.
// $ExpectError
newDiv2 = body.append(d3Selection.creator('div')); // fails, as creator returns BaseType element, but HTMLDivElement is expected.
newDiv2 = body.append(function(d, i, g) {
const that: HTMLBodyElement = this;
// const that2: SVGElement = this; // fails, type mismatch
// $ExpectError
const that2: SVGElement = this; // fails, type mismatch
const datum: BodyDatum = d;
const index: number = i;
const group: HTMLBodyElement[] | d3Selection.ArrayLike<HTMLBodyElement> = g;
@@ -799,13 +833,15 @@ newDiv2 = body.append(function(d, i, g) {
return this.ownerDocument!.createElement('div'); // this-type HTMLBodyElement
});
// newDiv2 = body.append<HTMLDivElement>(function(d) {
// return this.ownerDocument.createElement('a'); // fails, HTMLDivElement expected by type parameter, HTMLAnchorElement returned
// });
// $ExpectError
newDiv2 = body.append<HTMLDivElement>(function(d) {
return this.ownerDocument!.createElement('a'); // fails, HTMLDivElement expected by type parameter, HTMLAnchorElement returned
});
// newDiv2 = body.append(function(d) {
// return this.ownerDocument.createElement('a'); // fails, HTMLDivElement expected by inference, HTMLAnchorElement returned
// });
// $ExpectError
newDiv2 = body.append(function(d) {
return this.ownerDocument!.createElement('a'); // fails, HTMLDivElement expected by inference, HTMLAnchorElement returned
});
// create a detached element
@@ -909,7 +945,8 @@ const size: number = gElementsOldData.size();
// returns 'this' selection
circles = circles.each(function(d, i, g) { // check chaining return type by re-assigning
const that: SVGCircleElement = this;
// const that2: HTMLElement = this; // fails, type mismatch
// $ExpectError
const that2: HTMLElement = this; // fails, type mismatch
const datum: CircleDatum = d;
const index: number = i;
const group: SVGCircleElement[] | d3Selection.ArrayLike<SVGCircleElement> = g;
@@ -931,13 +968,15 @@ function enforceMinRadius(selection: d3Selection.Selection<SVGCircleElement, Cir
// returns 'this' selection
circles = circles.call(enforceMinRadius, 40); // check chaining return type by re-assigning
// circles.call(function(selection: d3Selection.Selection<HTMLDivElement, CircleDatum, any, any>):void {
// // fails, group element types of selection not compatible: SVGCircleElement v HTMLDivElement
// });
// $ExpectError
circles.call((selection: d3Selection.Selection<HTMLDivElement, CircleDatum, any, any>) => {
// fails, group element types of selection not compatible: SVGCircleElement v HTMLDivElement
});
// circles.call(function(selection: d3Selection.Selection<SVGCircleElement, DivDatum, any, any>):void {
// // fails, group datum types of selection not compatible: CircleDatumAlternative v DivDatum
// });
// $ExpectError
circles.call((selection: d3Selection.Selection<SVGCircleElement, DivDatum, any, any>) => {
// fails, group datum types of selection not compatible: CircleDatumAlternative v DivDatum
});
// ---------------------------------------------------------------------------------------
// Tests of Event Handling
@@ -949,7 +988,8 @@ let listener: undefined | ((this: HTMLBodyElement, datum: BodyDatum, index: numb
body = body.on('click', function(d, i, g) {
const that: HTMLBodyElement = this;
// const that2: SVGElement = this; // fails, type mismatch
// $ExpectError
const that2: SVGElement = this; // fails, type mismatch
const datum: BodyDatum = d;
const index: number = i;
const group: HTMLBodyElement[] | d3Selection.ArrayLike<HTMLBodyElement> = g;
@@ -981,7 +1021,8 @@ body = body.dispatch('fooEvent', fooEventParam); // re-assign for chaining test;
body = body.dispatch('fooEvent', function(d, i, g) { // re-assign for chaining test;
const that: HTMLBodyElement = this;
// const that2: SVGElement = this; // fails, type mismatch
// $ExpectError
const that2: SVGElement = this; // fails, type mismatch
const datum: BodyDatum = d;
const index: number = i;
const group: HTMLBodyElement[] | d3Selection.ArrayLike<HTMLBodyElement> = g;
@@ -1016,11 +1057,16 @@ function customListener(this: HTMLBodyElement | null, finalOpponent: string): st
const resultText: string = d3Selection.customEvent(successEvent, customListener, body.node(), 'Wales');
// let result = d3Selection.customEvent(successEvent, customListener, circles.nodes()[0], 'Wales'); // fails, incompatible 'this' context in call
// let resultValue: number = d3Selection.customEvent(successEvent, customListener, body.node(), 'Wales'); // fails, incompatible return types
// d3Selection.customEvent<SVGCircleElement, any>(successEvent, customListener, circles.nodes()[0], 'Wales'); // fails, incompatible 'this' context in type parameter and call
// d3Selection.customEvent<HTMLBodyElement, any>(successEvent, customListener, circles.nodes()[0], 'Wales'); // fails, incompatible 'this' context in type parameter and call
// d3Selection.customEvent<HTMLBodyElement, number>(successEvent, customListener, body.node(), 'Wales'); // fails, incompatible return types
// $ExpectError
const result = d3Selection.customEvent(successEvent, customListener, circles.nodes()[0], 'Wales'); // fails, incompatible 'this' context in call
// $ExpectError
const resultValue: number = d3Selection.customEvent(successEvent, customListener, body.node(), 'Wales'); // fails, incompatible return types
// $ExpectError
d3Selection.customEvent<SVGCircleElement, any>(successEvent, customListener, circles.nodes()[0], 'Wales'); // fails, incompatible 'this' context in type parameter and call
// $ExpectError
d3Selection.customEvent<HTMLBodyElement, any>(successEvent, customListener, circles.nodes()[0], 'Wales'); // fails, incompatible 'this' context in type parameter and call
// $ExpectError
d3Selection.customEvent<HTMLBodyElement, number>(successEvent, customListener, body.node(), 'Wales'); // fails, incompatible return types
// mouse() ---------------------------------------------------------------------------------
+4 -1
View File
@@ -1,6 +1,9 @@
// Type definitions for D3JS d3-selection module 1.3
// Project: https://github.com/d3/d3-selection/
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>
// Alex Ford <https://github.com/gustavderdrache>
// Boris Yankov <https://github.com/borisyankov>
// denisname <https://github.com/denisname>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Last module patch version validated against: 1.3.0
+4
View File
@@ -7,6 +7,10 @@
import { Path } from 'd3-path';
declare global {
interface CanvasRenderingContext2D {} // tslint:disable-line no-empty-interface
}
// -----------------------------------------------------------------------------------
// Shared Types and Interfaces
// -----------------------------------------------------------------------------------
+62 -4
View File
@@ -6,6 +6,7 @@
// Ray Fang <https://github.com/lazarusx>
// Marius Meisenzahl <https://github.com/meisenzahl>
// Rob Moran <https://github.com/thegecko>
// Cameron Diver <https://github.com/CameronDiver>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@@ -328,6 +329,20 @@ declare namespace Dockerode {
MacAddress: string;
}
// not complete definition of network inspection
// info which is returned by list / inspect
interface NetworkInspectInfo {
Id: string;
Name: string;
Driver: string;
Created: string;
Scope: string;
EnableIPv6: boolean;
Internal: boolean;
Attachable: boolean;
Ingress: boolean;
}
interface ContainerInspectInfo {
Id: string;
Created: string;
@@ -573,6 +588,49 @@ declare namespace Dockerode {
};
}
interface AuthConfig {
username: string;
password: string;
serveraddress: string;
email?: string;
}
interface PortBinding {
HostIp?: string;
HostPort?: string;
}
interface PortMap {
[key: string]: PortBinding[];
}
interface RestartPolicy {
Name: string;
MaximumRetryCount?: number;
}
type LoggingDriverType =
| "json-file"
| "syslog"
| "journald"
| "gelf"
| "fluentd"
| "awslogs"
| "splunk"
| "etwlogs"
| "none";
interface LogConfig {
Type: LoggingDriverType;
Config?: { [key: string]: string };
}
interface DeviceMapping {
PathOnHost: string;
PathInContainer: string;
CgroupPermissions: string;
}
interface ContainerCreateOptions {
name?: string;
Hostname?: string;
@@ -620,7 +678,7 @@ declare namespace Dockerode {
OomScoreAdj?: number;
PidMode?: string;
PidsLimit?: number;
PortBindings?: { [portAndProtocol: string]: Array<{ [index: string]: string }> };
PortBindings?: PortMap;
PublishAllPorts?: boolean;
Privileged?: boolean;
ReadonlyRootfs?: boolean;
@@ -632,12 +690,12 @@ declare namespace Dockerode {
CapAdd?: string[];
CapDrop?: string[];
GroupAdd?: string[];
RestartPolicy?: { [index: string]: number | string };
RestartPolicy?: RestartPolicy;
NetworkMode?: string;
Devices?: any[];
Devices?: DeviceMapping[];
Sysctls?: { [index: string]: string };
Ulimits?: Array<{}>;
LogConfig?: { [index: string]: string | {} };
LogConfig?: LogConfig;
SecurityOpt?: { [index: string]: any };
CgroupParent?: string;
VolumeDriver?: string;
+2 -2
View File
@@ -50,11 +50,11 @@ export interface DotenvSafeOptions {
*
* @throws MissingEnvVarsError
*/
export function load(options?: DotenvSafeOptions): env.DotenvResult
export function load(options?: DotenvSafeOptions): env.DotenvConfigOutput
/**
* Loads environment variables file into 'process.env'.
*
* @throws MissingEnvVarsError
*/
export function config(options?: DotenvSafeOptions): env.DotenvResult
export function config(options?: DotenvSafeOptions): env.DotenvConfigOutput
+12 -14
View File
@@ -1,20 +1,18 @@
import dotenv = require('dotenv');
import dotenv = require("dotenv");
const env = dotenv.config();
const dbUrl: string | null = env.error || !env.parsed ? null : env.parsed['DATABASE_URL'];
const dbUrl: string | null = env.error || !env.parsed ? null : env.parsed["BASIC"];
dotenv.config({
path: '.env'
dotenv.load({
path: ".env-example",
encoding: "utf8",
debug: true
});
dotenv.config({
encoding: 'utf8'
const parsed = dotenv.parse("NODE_ENV=production\nDB_HOST=a.b.c");
const dbHost: string = parsed["DB_HOST"];
const parsedFromBuffer = dotenv.parse(new Buffer("JUSTICE=league\n"), {
debug: true
});
dotenv.load();
const parsed = dotenv.parse("ENVIRONMENT=production\nDEBUG=no\n");
const debug: string = parsed['DEBUG'];
const parsedFromBuffer = dotenv.parse(new Buffer("JUSTICE=league\n"));
const justice: string = parsedFromBuffer['JUSTICE'];
const justice: string = parsedFromBuffer["JUSTICE"];
+52 -33
View File
@@ -1,46 +1,65 @@
// Type definitions for dotenv 4.0
// Type definitions for dotenv 6.1
// Project: https://github.com/motdotla/dotenv
// Definitions by: Jussi Kinnula <https://github.com/jussikinnula>, Borek Bernard <https://github.com/borekb>, Eric Naeseth <https://github.com/enaeseth>
// Definitions by: Jussi Kinnula <https://github.com/jussikinnula>
// Borek Bernard <https://github.com/borekb>
// Eric Naeseth <https://github.com/enaeseth>
// Max Beatty <https://github.com/maxbeatty>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
export interface DotenvParseOptions {
/**
* You may turn on logging to help debug why certain keys or values are not being set as you expect.
*/
debug?: boolean;
}
export interface DotenvParseOutput {
[name: string]: string;
}
/**
* Parses a string or buffer in the .env file format into an object.
*
* @param src - contents to be parsed
* @param options - additional options
* @returns an object with keys and values based on `src`
*/
export function parse(src: string | Buffer): {[name: string]: string};
export function parse(
src: string | Buffer,
options?: DotenvParseOptions
): DotenvParseOutput;
export interface DotenvConfigOptions {
/**
* You may specify a custom path if your file containing environment variables is located elsewhere.
*/
path?: string;
/**
* You may specify the encoding of your file containing environment variables.
*/
encoding?: string;
/**
* You may turn on logging to help debug why certain keys or values are not being set as you expect.
*/
debug?: boolean;
}
export interface DotenvConfigOutput {
error?: Error;
parsed?: DotenvParseOutput;
}
/**
* Loads `.env` into `process.env`.
*
* @return Object Object with either
* - "parsed" containing the parsed keys and values or
* - "error" containing an Error object
*
* Loads `.env` file contents into {@link https://nodejs.org/api/process.html#process_process_env | `process.env`}.
* Example: 'KEY=value' becomes { parsed: { KEY: 'value' } }
*
* @param options - controls behavior
* @returns an object with a `parsed` key if successful or `error` key if an error occurred
*
*/
export function config(options?: DotenvOptions): DotenvResult;
export function config(options?: DotenvConfigOptions): DotenvConfigOutput;
export const load: typeof config;
export interface DotenvOptions {
/**
* You can specify a custom path if your file containing environment variables is named or located differently.
*
* @default '.env'
*/
path?: string;
/**
* You may specify the encoding of your file containing environment variables using this option.
*
* @default 'utf8'
*/
encoding?: string;
}
export interface DotenvResult {
error?: Error;
parsed?: {
[name: string]: string;
};
}
+1
View File
@@ -7,6 +7,7 @@ download(new Blob(['hello world']), 'dlTextBlob.txt', 'text/plain');
download('/robots.txt');
// tslint:disable-next-line no-unnecessary-type-assertion
download(document.documentElement!.outerHTML, 'dlHTML.html', 'text/html');
download(new Blob(['hello world'.bold()]), 'dlHtmlBlob.html', 'text/html');
download('/diff6.png');
+1 -1
View File
@@ -101,7 +101,7 @@ export interface CommonWrapper<P = {}, S = {}, C = Component<P, S>> {
/**
* Returns whether or not the current node exists.
*/
exists(): boolean;
exists(selector?: EnzymeSelector): boolean;
/**
* Returns a new wrapper with only the nodes of the current wrapper that don't match the provided selector.
@@ -0,0 +1,4 @@
import { Localization } from "expo-localization";
Localization.getLocalizationAsync().then(localization => localization.locale);
Localization.locale;
+73
View File
@@ -0,0 +1,73 @@
// Type definitions for expo-localization 1.0
// Project: https://docs.expo.io/
// Definitions by: Bartosz Dotryw <https://github.com/burtek>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface LocalizationProps {
/**
* Native device language, returned in standard format. ex: `en-US`, `es-US`
*/
locale: string;
/**
* List of all the native languages provided by the user settings. These are returned in the order the user defines in their native settings
*/
locales: string[];
/**
* Country code for your device
*/
country: string | undefined | null;
/**
* A list of all the supported ISO codes
*/
isoCurrencyCodes: string[] | undefined | null;
/**
* The current time zone in display format. ex: `America/Los_Angeles`
*/
timezone: string;
/**
* This will return `true` if the current language is Right-to-Left
*/
isRTL: boolean;
}
export namespace Localization {
/**
* Native device language, returned in standard format. ex: `en-US`, `es-US`
*/
const locale: string;
/**
* List of all the native languages provided by the user settings. These are returned in the order the user defines in their native settings
*/
const locales: string[];
/**
* Country code for your device
*/
const country: string | undefined | null;
/**
* A list of all the supported ISO codes
*/
const isoCurrencyCodes: string[] | undefined | null;
/**
* The current time zone in display format. ex: `America/Los_Angeles`
*/
const timezone: string;
/**
* This will return `true` if the current language is Right-to-Left
*/
const isRTL: boolean;
/**
* Android only, on iOS changing the locale settings will cause all the apps to reset
*/
function getLocalizationAsync(): Promise<LocalizationProps>;
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"expo-localization-tests.ts"
]
}
-16
View File
@@ -1,16 +0,0 @@
import fastDiff = require('fast-diff');
let diffs: fastDiff.Diff[];
diffs = fastDiff("hi there", "hi");
diffs = fastDiff("hi there", "hi", 1);
diffs.forEach((diff: fastDiff.Diff) => {
const operation: number = diff[0];
const text: string = diff[1];
switch (diff[0]) {
case fastDiff.EQUAL: break;
case fastDiff.DELETE: break;
case fastDiff.INSERT: break;
}
});
-16
View File
@@ -1,16 +0,0 @@
// Type definitions for fast-diff 1.1
// Project: https://github.com/jhchen/fast-diff#readme
// Definitions by: John Renner <https://github.com/djrenren>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function diff(text1: string, text2: string, cursorPos?: number): diff.Diff[];
declare namespace diff {
type Diff = [-1 | 0 | 1, string];
const DELETE: -1;
const INSERT: 1;
const EQUAL: 0;
}
export = diff;
+11
View File
@@ -22,6 +22,17 @@ function testWindowSaveAs() {
window.saveAs(data, filename, disableAutoBOM);
}
/**
* @summary Test for "saveAs" function with URL as first argument.
*/
function testUrlSaveAs() {
const url = 'https://example.com/test.txt';
const filename = 'hello world.txt';
const disableAutoBOM = true;
window.saveAs(url, filename, disableAutoBOM);
}
/**
* @summary Test for "saveAs" function with the 3rd parameter omitted
*/
+3 -3
View File
@@ -1,4 +1,4 @@
// Type definitions for FileSaver.js 1.3
// Type definitions for FileSaver.js 2.0
// Project: https://github.com/eligrey/FileSaver.js/
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>
// Daniel Roth <https://github.com/DaIgeb>
@@ -8,11 +8,11 @@
declare namespace FileSaver {
/**
* FileSaver.js implements the saveAs() FileSaver interface in browsers that do not natively support it.
* @param data - The actual file data blob.
* @param data - The actual file data blob or URL.
* @param filename - The optional name of the file to be downloaded. If omitted, the name used in the file data will be used. If none is provided "download" will be used.
* @param disableAutoBOM - Optional & defaults to `false`. Set to `true` if you want FileSaver.js to automatically provide Unicode text encoding hints
*/
function saveAs(data: Blob, filename?: string, disableAutoBOM?: boolean): void;
function saveAs(data: Blob | string, filename?: string, disableAutoBOM?: boolean): void;
}
declare global {
+1 -1
View File
@@ -3,7 +3,7 @@
// Definitions by: Christopher E. Woodland <https://github.com/cwoodland>
// Johnny Li <https://github.com/johnny4753>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
// TypeScript Version: 2.8
/// <reference types='jasmine'/>
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/vlucas/frisby
// Definitions by: Johnny Li <https://github.com/johnny4753>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
///<reference types="jasmine"/>
+17
View File
@@ -0,0 +1,17 @@
// Type definitions for gl-react-dom 3.15
// Project: https://github.com/gre/gl-react
// Definitions by: Jussi Kinnula <https://github.com/jussikinnula>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as React from 'react';
import * as glReact from 'gl-react';
export interface SurfaceProps extends glReact.SurfaceProps {
width: number;
height: number;
}
export class Surface extends glReact.Surface {
props: SurfaceProps;
}
+24
View File
@@ -0,0 +1,24 @@
{
"files": [
"index.d.ts"
],
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "preserve"
}
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+8
View File
@@ -0,0 +1,8 @@
// Type definitions for gl-react-expo 3.16
// Project: https://github.com/gre/gl-react
// Definitions by: Jussi Kinnula <https://github.com/jussikinnula>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import { Surface } from 'gl-react';
export { Surface };
+24
View File
@@ -0,0 +1,24 @@
{
"files": [
"index.d.ts"
],
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "preserve"
}
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+17
View File
@@ -0,0 +1,17 @@
// Type definitions for gl-react-headless 3.15
// Project: https://github.com/gre/gl-react
// Definitions by: Jussi Kinnula <https://github.com/jussikinnula>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as React from 'react';
import * as glReact from 'gl-react';
export interface SurfaceProps extends glReact.SurfaceProps {
width: number;
height: number;
}
export class Surface extends glReact.Surface {
props: SurfaceProps;
}
+24
View File
@@ -0,0 +1,24 @@
{
"files": [
"index.d.ts"
],
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "preserve"
}
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+8
View File
@@ -0,0 +1,8 @@
// Type definitions for gl-react-native 3.15
// Project: https://github.com/gre/gl-react
// Definitions by: Jussi Kinnula <https://github.com/jussikinnula>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import { Surface } from 'gl-react';
export { Surface };
+24
View File
@@ -0,0 +1,24 @@
{
"files": [
"index.d.ts"
],
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "preserve"
}
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+218
View File
@@ -0,0 +1,218 @@
// Type definitions for gl-react 3.15
// Project: https://github.com/gre/gl-react
// Definitions by: Jussi Kinnula <https://github.com/jussikinnula>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as React from 'react';
export type Vec2 = [number, number];
export type Vec4 = [number, number, number, number];
export interface BusProps {
children?: any;
uniform?: string;
index: number;
}
export class Bus extends React.Component<BusProps> {
id: number;
context: { glParent: Surface | Node, glSurface: Surface };
dependents: Array<Node | Surface>;
glNode?: Node;
glBusRootNode: any;
static defaultProps: BusProps;
static contextTypes: { glParent: any, glSurface: any };
static childContextTypes: { glParent: any };
getChildContext(): { glParent: Bus };
getGLRenderableNode(): Node;
getGLRenderableContent(): any;
getGLName(): string;
getGLShortName(): string;
capture(x?: number, y?: number, w?: number, h?: number): any[];
onRef: (ref: any) => void;
redraw: () => void;
}
export type connectSize = (GLComponent: any) => any;
export interface SurfaceProps {
children?: any;
style?: any;
preload?: any[];
visitor?: Visitor;
onLoad?: () => void;
onLoadError?: (e: Error) => void;
onContextLost?: () => void;
onContextRestored?: () => void;
}
export interface SurfaceState {
ready: boolean;
rebootId: number;
debug: boolean;
}
export class Surface extends React.Component<SurfaceProps, SurfaceState> {
props: SurfaceProps;
state: SurfaceState;
id: number;
gl: WebGLRenderingContext;
RenderLessElement: any;
root: Node;
mapRenderableContent(inst: any): any;
getVisitors(): Visitor[];
getGLSize(): [number, number];
getGLName(): string;
getGLShortName(): string;
captureAsDataURL(...args: any[]): string;
captureAsBlob(...args: any[]): Promise<Blob>;
capture(x?: number, y?: number, w?: number, h?: number): any[];
redraw(): void;
flush(): void;
getEmptyTexture(): WebGLTexture;
glIsAvailable(): boolean;
rebootForDebug(): void;
}
export type createSurface = (
GLView: any,
RenderLessElement: any,
mapRenderableContent: any,
requestFrame: (callback: (time: number) => void) => number,
cancelFrame: (id: number) => void
) => Surface;
export type listSurfaces = () => Surface[];
export function GLSL(strings: TemplateStringsArray, ...values: any[]): string;
export interface LinearCopyProps {
children?: any;
}
export class LinearCopy extends React.Component<LinearCopyProps> {
getNodeRef(): Node;
}
export interface NearestCopyProps {
children?: any;
}
export class NearestCopy extends React.Component<NearestCopyProps> {
getNodeRef(): Node;
}
export interface SurfaceContext {
glParent: Node | Surface | Bus;
glSurface: Surface;
glSizable: {
getGLSize: () => [number, number];
};
}
export interface Framebuffer {
handle: WebGLFramebuffer;
color: WebGLTexture;
bind: () => void;
dispose: () => void;
syncSize: (w: number, h: number) => void;
}
export interface NodeProps {
shader: ShaderIdentifier | ShaderDefinition;
uniformsOptions?: any;
uniforms: { [key: string]: any };
ignoreUnusedUniforms?: string[] | boolean;
sync?: boolean;
width?: number;
height?: number;
children?: any;
backbuffering?: boolean;
blendFunc?: {
src: () => void;
dst: () => void;
};
clear?: {
color: Vec4;
};
onDraw?: () => void;
}
export class Node extends React.Component<NodeProps> {
drawProps: NodeProps;
context: SurfaceContext;
framebuffer?: Framebuffer;
backbuffer?: Framebuffer;
capturePixelsArray?: Uint8Array;
id: number;
uniformsBus: {
[key: string]: Array<Bus | undefined>;
};
dependencies: Array<Node | Bus>;
dependents: Array<Node | Surface>;
}
export interface ShaderIdentifier {
type: string;
id: string;
}
export interface ShaderDefinition {
frag: string;
vert?: string;
}
export interface ShaderInfo {
frag: string;
vert: string;
}
export interface ShadersSheet {
[key: string]: ShaderIdentifier;
}
export namespace Shaders {
function create(shaders: { [key: string]: ShaderDefinition }): ShadersSheet;
function getName(shaderIdentifier: ShaderIdentifier): string;
function getShortName(shaderIdentifier: ShaderIdentifier): string;
function get(shaderIdentifier: ShaderIdentifier): ShaderInfo;
}
export namespace Uniform {
const Backbuffer: string;
function backbufferFrom(node: Node | Bus): { type: string, node: Node | Bus };
const Resolution: string;
function textureSize(obj: any): { type: string, obj: any };
function textureSizeRatio(obj: any): { type: string, obj: any, ratio: boolean };
}
export class Visitor {
onSurfaceMount(surface: Surface): void;
onSurfaceUnmount(surface: Surface): void;
onSurfaceGLContextChange(surface: Surface, gl?: WebGLRenderingContext): void;
onSurfaceDrawSkipped(surface: Surface): void;
onSurfaceDrawStart(surface: Surface): void;
onSurfaceDrawError(e: Error): boolean;
onSurfaceDrawEnd(surface: Surface): void;
onNodeDrawSkipped(node: Node): void;
onNodeDrawStart(node: Node): void;
onNodeSyncDeps(node: Node, additions: Array<Node | Bus>, deletions: Array<Node | Bus>): void;
onNodeDraw(node: Node, preparedUniforms: any[]): void;
onNodeDrawEnd(node: Node): void;
}
export class VisitorLogger extends Visitor {
groupNestedLvl: number;
}
export namespace Visitors {
function add(visitor: Visitor): void;
function remove(visitor: Visitor): void;
function get(): Visitor[];
}
+6
View File
@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"csstype": "^2.2.0"
}
}
+24
View File
@@ -0,0 +1,24 @@
{
"files": [
"index.d.ts"
],
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "preserve"
}
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/sindresorhus/gulp-jasmine#readme
// Definitions by: Andrey Lalev <https://github.com/andypyrope>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
/// <reference types="node" />
/// <reference types="jasmine" />
+1 -1
View File
@@ -3280,7 +3280,7 @@ export type DecorateName = string | symbol;
* the facilities provided by the framework. Each server supports a single connection (e.g. listen to port 80).
* [See docs](https://github.com/hapijs/hapi/blob/master/API.md#server)
*/
export class Server extends Podium {
export class Server {
/**
* Creates a new server object
* @param options server configuration object.
@@ -19,7 +19,7 @@ const options: LngDetector.DetectorOptions = {
cookieDomain: "myDomain",
// optional htmlTag with lang attribute, the default is:
htmlTag: document.documentElement!
htmlTag: document.documentElement
};
i18next.use(LngDetector).init({
+53
View File
@@ -9,6 +9,7 @@
// Francis Gulotta <https://github.com/reconbot>
// Dmitry Motovilov <https://github.com/funthing>
// Oleg Repin <https://github.com/iamolegga>
// Ting-Wai To <https://github.com/tingwai-to>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
@@ -482,6 +483,32 @@ declare namespace IORedis {
sscanStream(key: KeyType, options?: ScanStreamOption): NodeJS.EventEmitter;
hscanStream(key: KeyType, options?: ScanStreamOption): NodeJS.EventEmitter;
zscanStream(key: KeyType, options?: ScanStreamOption): NodeJS.EventEmitter;
xack(key: KeyType, group: string, ...ids: string[]): any;
xadd(key: KeyType, id: string, ...args: string[]): any;
xclaim(key: KeyType, group: string, consumer: string, minIdleTime: number, ...args: any[]): any;
xdel(key: KeyType, ...ids: string[]): any;
xgroup(...args: any[]): any;
xinfo(...args: any[]): any;
xlen(key: KeyType): any;
xpending(key: KeyType, group: string, ...args: any[]): any;
xrange(key: KeyType, start: string, end: string, ...args: any[]): any;
xread(...args: any[]): any;
xreadgroup(groupOption: 'GROUP' | 'group', group: string, consumer: string, ...args: any[]): any;
xrevrange(key: KeyType, end: string, start: string, ...args: any[]): any;
xtrim(key: KeyType, maxLenOption: 'MAXLEN' | 'maxlen', ...args: any[]): any;
}
interface Pipeline {
@@ -801,6 +828,32 @@ declare namespace IORedis {
pfadd(key: KeyType, ...elements: string[]): Pipeline;
pfcount(...keys: KeyType[]): Pipeline;
xack(key: KeyType, group: string, ...ids: string[]): Pipeline;
xadd(key: KeyType, id: string, ...args: string[]): Pipeline;
xclaim(key: KeyType, group: string, consumer: string, minIdleTime: number, id: string, ...args: any[]): Pipeline;
xdel(key: KeyType, ...ids: string[]): Pipeline;
xgroup(...args: any[]): Pipeline;
xinfo(...args: any[]): Pipeline;
xlen(key: KeyType): Pipeline;
xpending(key: KeyType, group: string, ...args: any[]): Pipeline;
xrange(key: KeyType, start: string, end: string, ...args: any[]): Pipeline;
xread(...args: any[]): Pipeline;
xreadgroup(command: 'GROUP' | 'group', group: string, consumer: string, ...args: any[]): Pipeline;
xrevrange(key: KeyType, end: string, start: string, ...args: any[]): Pipeline;
xtrim(key: KeyType, strategy: 'MAXLEN' | 'maxlen', ...args: any[]): Pipeline;
}
interface NodeConfiguration {
+19
View File
@@ -173,3 +173,22 @@ new Redis.Cluster([{
host: 'localhost',
port: 6379
}]);
redis.xack('streamName', 'groupName', 'id');
redis.xadd('streamName', '*', 'field', 'name');
redis.xclaim('streamName', 'groupName', 'consumerName', 3600000, 'id');
redis.xdel('streamName', 'id');
redis.xgroup('CREATE', 'streamName', 'groupName', '$');
redis.xgroup('SETUP', 'streamName', 'groupName', '$');
redis.xgroup('DESTROY', 'streamName', 'groupName');
redis.xgroup('DELCONSUMER', 'streamName', 'groupName', 'consumerName');
redis.xinfo('CONSUMERS', 'streamName', 'groupName');
redis.xinfo('GROUPS', 'streamName');
redis.xinfo('STREAM', 'streamName');
redis.xlen('streamName');
redis.xpending('streamName', 'groupName', '-', '+', '10', 'consumerName');
redis.xrange('streamName', '-', '+', 'COUNT', 1);
redis.xread('STREAMS', 'streamName', '0-0');
redis.xreadgroup('GROUP', 'groupName', 'consumerName', 'STREAMS', 'streamName', '>');
redis.xrevrange('streamName', '+', '-', 'COUNT', 1);
redis.xtrim('streamName', 'MAXLEN', '~', 1000);
+36 -10
View File
@@ -1,8 +1,10 @@
// Type definitions for is.js
// Project: http://arasatasaygin.github.io/is.js/
// Definitions by: Rodrigo Cabral <https://github.com/cabralRodrigo>
// Definitions by: Rodrigo Cabral <https://github.com/cabralRodrigo>, Mitchell Grice <https://github.com/gricey432>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
type EnvironmentVersionRange = number | string;
interface IsStatic {
//#region Type checks
@@ -367,29 +369,45 @@ interface IsStatic {
/**
* Checks if current browser is ie
* @parm value Optional version number of browser
* @parm value Optional version range of browser
*/
ie(value?: number): boolean;
ie(range?: EnvironmentVersionRange): boolean;
/**
* Checks if current browser is chrome.
* @parm value Optional version range of browser
*/
chrome(): boolean;
chrome(range?: EnvironmentVersionRange): boolean;
/**
* Checks if current browser is firefox.
* @parm value Optional version range of browser
*/
firefox(): boolean;
firefox(range?: EnvironmentVersionRange): boolean;
/**
* Checks if current browser is edge.
* @parm value Optional version range of browser
*/
edge(range?: EnvironmentVersionRange): boolean;
/**
* Checks if current browser is opera.
* @parm value Optional version range of browser
*/
opera(): boolean;
opera(range?: EnvironmentVersionRange): boolean;
/**
* Checks if current browser is safari.
* @parm value Optional version range of browser
*/
safari(): boolean;
safari(range?: EnvironmentVersionRange): boolean;
/**
* Checks if current browser is phantom.
* @parm value Optional version range of browser
*/
phantom(range?: EnvironmentVersionRange): boolean;
/**
* Checks if current device has ios.
@@ -398,18 +416,21 @@ interface IsStatic {
/**
* Checks if current device is iPhone.
* @parm value Optional version range of device
*/
iphone(): boolean;
iphone(range?: EnvironmentVersionRange): boolean;
/**
* Checks if current device is iPad.
* @parm value Optional version range of device
*/
ipad(): boolean;
ipad(range?: EnvironmentVersionRange): boolean;
/**
* Checks if current device is iPod.
* @parm value Optional version range of device
*/
ipod(): boolean;
ipod(range?: EnvironmentVersionRange): boolean;
/**
* Checks if current device has Android.
@@ -481,6 +502,11 @@ interface IsStatic {
*/
offline(): boolean;
/**
* Checks if current device supports touch.
*/
touchDevice(): boolean;
//#endregion
//#region Time checks
+40 -3
View File
@@ -446,32 +446,67 @@ is.all.sorted([[1, 2], [5, 4]]);
//#region Environment checks
is.ie();
is.ie(6);
is.not.ie();
is.ie(10);
is.ie('>=10');
is.not.ie('<9');
is.chrome();
is.not.chrome();
is.chrome(50);
is.chrome('>=40');
is.not.chrome('<30');
is.firefox();
is.not.firefox();
is.firefox(41);
is.firefox('>=40');
is.not.firefox('<30');
is.edge();
is.not.edge();
is.edge(13);
is.edge('>=12');
is.not.edge('<13');
is.opera();
is.not.opera();
is.opera(36);
is.opera('>=35');
is.not.opera('<20');
is.safari();
is.not.safari();
is.safari(9);
is.safari('>=8');
is.not.safari('<7');
is.phantom();
is.not.phantom();
is.phantom(2);
is.phantom('>=1');
is.not.phantom('<2');
is.ios();
is.not.ios();
is.iphone();
is.not.iphone();
is.iphone(9);
is.iphone('>=7');
is.not.iphone('<8');
is.ipad();
is.not.ipad();
is.ipad(9);
is.ipad('>=7');
is.not.ipad('<8');
is.ipod();
is.not.ipod();
is.ipod(7);
is.ipod('>=5');
is.not.ipod('<5');
is.android();
is.not.android();
@@ -483,7 +518,6 @@ is.androidTablet();
is.not.androidTablet();
is.blackberry();
is.not.blackberry();
is.windowsPhone();
@@ -516,6 +550,9 @@ is.not.online();
is.offline();
is.not.offline();
is.touchDevice();
is.not.touchDevice();
//#endregion
//#region Time checks
@@ -664,4 +701,4 @@ is.url('quack');
var customName = is.setNamespace();
customName.odd(3);
//#endregion
//#endregion
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/jasmine/jasmine-ajax
// Definitions by: Louis Grignon <https://github.com/lgrignon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
interface JasmineAjaxResponse {
status?: number;
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/gburghardt/jasmine-data_driven_tests
// Definitions by: Anthony MacKinnon <https://github.com/AnthonyMacKinnon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
declare var all: JasmineDataDrivenTest;
declare var xall: JasmineDataDrivenTest;
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/bvaughn/jasmine-es6-promise-matchers
// Definitions by: Stephen Lautier <https://github.com/stephenlautier>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
/// <reference types="jasmine" />
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/searls/jasmine-fixture
// Definitions by: Craig Brett <https://github.com/craigbrett17>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
/// <reference types="jasmine" />
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/velesin/jasmine-jquery
// Definitions by: Gregor Stamac <https://github.com/gstamac>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
/// <reference types="jasmine"/>
/// <reference types="jquery"/>
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/uxebu/jasmine-matchers
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
/*
Typings 2013 Bart van der Schoor
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/mhevery/jasmine-node
// Definitions by: Sven Reglitzki <https://github.com/svi3c>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
///<reference types="jasmine"/>
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/bvaughn/jasmine-promise-matchers
// Definitions by: Matthew Hill <https://github.com/matthewjh>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
/// <reference types="jasmine" />
+15 -3
View File
@@ -1,8 +1,14 @@
// Type definitions for Jasmine 2.8.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>, Boris Breuer <https://github.com/Engineer2B>
// 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>
// Boris Breuer <https://github.com/Engineer2B>
// Chris Yungmann <https://github.com/cyungmann>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
// For ddescribe / iit use : https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/karma-jasmine/karma-jasmine.d.ts
/**
@@ -129,7 +135,7 @@ declare function waits(timeout?: number): void;
declare namespace jasmine {
type Expected<T> = T | ObjectContaining<T> | Any | Spy;
type SpyObjMethodNames<T = {}> = string[] | {[methodName: string]: any} | Array<keyof T>;
type SpyObjMethodNames<T = undefined> = T extends undefined ? (ReadonlyArray<string> | {[methodName: string]: any}) : (ReadonlyArray<keyof T> | {[P in keyof T]?: ReturnType<T[P] extends (...args: any[]) => any ? T[P] : any>});
var clock: () => Clock;
@@ -448,6 +454,12 @@ declare namespace jasmine {
toThrowError(message?: string | RegExp): boolean;
toThrowError(expected?: new (...args: any[]) => Error, message?: string | RegExp): boolean;
/**
* Add some context for an expect.
* @param message - Additional context to show when the matcher fails
*/
withContext(message: string): Matchers<T>;
not: Matchers<T>;
Any: Any;
+6
View File
@@ -246,6 +246,12 @@ describe("A spec", () => {
});
});
describe("withContext", () => {
it("can be used after an expectation", () => {
expect(1).withContext('context message').toBe(1);
});
});
xdescribe("A spec", () => {
var foo: number;
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/charleshansen/jasmine_dom_matchers
// Definitions by: Yaroslav Admin <https://github.com/devoto13>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
/// <reference types="jasmine" />
+1 -1
View File
@@ -3,7 +3,7 @@
// Definitions by: Sammy Jelin <https://github.com/sjelin>
// George Kalpakas <https://github.com/gkalpak>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
/// <reference types="jasmine" />
+2
View File
@@ -2334,7 +2334,9 @@ function examples() {
}
function jQuery_contains_0() {
// tslint:disable-next-line no-unnecessary-type-assertion
$.contains(document.documentElement!, document.body); // true
// tslint:disable-next-line no-unnecessary-type-assertion
$.contains(document.body, document.documentElement!); // false
}
+1
View File
@@ -82,6 +82,7 @@ function test_serialize() {
dom.serialize() === '<!DOCTYPE html><html><head></head><body>hello</body></html>';
// Contrast with:
// tslint:disable-next-line no-unnecessary-type-assertion
dom.window.document.documentElement!.outerHTML === '<html><head></head><body>hello</body></html>';
}
+4 -1
View File
@@ -1,6 +1,7 @@
// Type definitions for jsPDF v1.1.135
// Type definitions for jsPDF 1.2
// Project: https://github.com/MrRio/jsPDF
// Definitions by: Amber Schühmacher <https://github.com/amberjs>
// Kevin Gonnord <https://github.com/lleios>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'jspdf' {
@@ -32,7 +33,9 @@ declare module 'jspdf' {
'scaleFactor':number;
'pageSize': {
width:number;
getWidth: () => number;
height:number;
getHeight: () => number;
};
'output'(type:any, options:any):any;
'getNumberOfPages'():number;
-1
View File
@@ -7,7 +7,6 @@
"ban-types": false,
"callable-types": false,
"comment-format": false,
"dt-header": false,
"eofline": false,
"export-just-namespace": false,
"import-spacing": false,
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/karma-runner/karma-jasmine
// Definitions by: Michel Salib <https://github.com/michelsalib>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
/// <reference types="jasmine" />
+15 -2
View File
@@ -1,14 +1,27 @@
// Type definitions for kdbush 1.0
// Project: https://github.com/mourner/kdbush
// Definitions by: DenisCarriere <https://github.com/DenisCarriere>
// Christian Scott <https://github.com/chrfrasco>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
type Points = number[][];
type Get<T> = (point: T) => number;
type ArrayType = typeof Int32Array | typeof Array;
type ArrayType =
typeof Int8Array
| typeof Int16Array
| typeof Int32Array
| typeof Float32Array
| typeof Float64Array
| typeof Array;
declare function kdbush(points: Points): kdbush.KDBush<Points>;
declare function kdbush<T>(points: T[], getX: Get<T>, getY: Get<T>, nodeSize?: number, ArrayType?: ArrayType): kdbush.KDBush<T>;
declare function kdbush<T>(
points: T[],
getX: Get<T>,
getY: Get<T>,
nodeSize?: number,
ArrayType?: ArrayType
): kdbush.KDBush<T>;
declare namespace kdbush {
class KDBush<T> {
ids: number[];
+13 -4
View File
@@ -1,10 +1,19 @@
import * as kdbush from 'kdbush';
import { KDBush } from 'kdbush';
import * as kdbush from "kdbush";
import { KDBush } from "kdbush";
// API
const points = [[110, 60], [130, 40]];
const index = kdbush(points);
// Specify array constructor
const pick = (index: number) => (point: number[]) => point[index];
kdbush(points, pick(0), pick(1), 64, Int8Array);
kdbush(points, pick(0), pick(1), 64, Int16Array);
kdbush(points, pick(0), pick(1), 64, Int32Array);
kdbush(points, pick(0), pick(1), 64, Float32Array);
kdbush(points, pick(0), pick(1), 64, Float64Array);
kdbush(points, pick(0), pick(1), 64, Array);
// properties
index.nodeSize;
index.points;
@@ -20,8 +29,8 @@ index.within(10, 10, 5);
index.within(10, 10, 5).map(id => points[id]);
// custom points (object)
const xy = [{x: 110, y: 60}, {x: 130, y: 40}];
const index2: KDBush<{x: number, y: number}> = kdbush(xy, p => p.x, p => p.y);
const xy = [{ x: 110, y: 60 }, { x: 130, y: 40 }];
const index2: KDBush<{ x: number; y: number }> = kdbush(xy, p => p.x, p => p.y);
index2.points[0].x;
index2.points[0].y;
index2.points.map(p => [p.x, p.y]);
+15
View File
@@ -0,0 +1,15 @@
// Type definitions for koa-qs 2.0
// Project: https://github.com/koajs/qs#readme
// Definitions by: Rémy Jeancolas <https://github.com/RemyJeancolas>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as koa from 'koa';
declare namespace koaQs {
type ParseMode = 'extended'|'strict'|'first';
}
declare function koaQs(app: koa, mode?: koaQs.ParseMode): koa;
export = koaQs;
+6
View File
@@ -0,0 +1,6 @@
import koaQs = require('koa-qs');
import Koa = require('koa');
const app = koaQs(new Koa());
app.listen(80);
@@ -18,6 +18,6 @@
},
"files": [
"index.d.ts",
"fast-diff-tests.ts"
"koa-qs-tests.ts"
]
}
}
+22 -2
View File
@@ -4,6 +4,7 @@
// Pavel Ivanov <https://github.com/schfkt>
// JounQin <https://github.com/JounQin>
// Romain Faust <https://github.com/romain-faust>
// Guillaume Mayer <https://github.com/Guillaume-Mayer>
// Definitions: https://github.com/hellopao/DefinitelyTyped
// TypeScript Version: 2.3
@@ -86,6 +87,10 @@ declare namespace Router {
sensitive?: boolean;
strict?: boolean;
}
export interface IUrlOptionsQuery {
query: object | string;
}
export class ParamName {
asterisk: boolean;
@@ -258,9 +263,24 @@ declare class Router {
/**
* Generate URL for route. Takes either map of named `params` or series of
* arguments (for regular expression routes)
*
* router = new Router();
* router.get('user', "/users/:id", ...
*
* router.url('user', { id: 3 });
* // => "/users/3"
*
* Query can be generated from third argument:
*
* router.url('user', { id: 3 }, { query: { limit: 1 } });
* // => "/users/3?limit=1"
*
* router.url('user', { id: 3 }, { query: "limit=1" });
* // => "/users/3?limit=1"
*
*/
url(name: string, params: Object): string;
url(name: string, params: Object): Error;
url(name: string, params: any, options?: Router.IUrlOptionsQuery): string;
url(name: string, params: any, options?: Router.IUrlOptionsQuery): Error;
/**
* Match given `path` and return corresponding routes.
+13 -3
View File
@@ -14,11 +14,21 @@ router
.get('/', function (ctx, next) {
ctx.body = 'Hello World!';
})
.get('/users/:id', function (ctx, next) {
ctx.body = ctx.router.url('user-accounts', { id: ctx.params.id })
.get('user', '/users/:id', function (ctx, next) {
ctx.body = {
test1: ctx.router.url('user-accounts', { id: ctx.params.id }),
test2: ctx.router.url('user-accounts', ctx.params.id),
test3: ctx.router.url('user-accounts', [ctx.params.id]),
}
})
.get('user-accounts', '/users/:id/accounts', function (ctx, next) {
// ...
ctx.body = {
test1: ctx.router.url('user', { id: 3 }, { query: { limit: 1 } }),
test2: ctx.router.url('user', { id: 3 }, { query: "limit=1" }),
test3: ctx.router.url('user', 3, { query: { limit: 1 } }),
test4: ctx.router.url('user', [3], { query: "limit=1" }),
test5: ctx.router.url('user', ["3"], { query: { limit: "1" } }),
}
})
.post('/users', function (ctx, next) {
// ...
+2 -2
View File
@@ -9,7 +9,7 @@ import * as L from 'leaflet';
declare module 'leaflet' {
namespace TileLayer {
class Provider extends TileLayer {
constructor(provider: string, options?: TileLayerOptions)
constructor(provider: string, options?: TileLayerOptions & { [name: string]: string; })
}
namespace Provider {
@@ -28,6 +28,6 @@ declare module 'leaflet' {
}
namespace tileLayer {
function provider(provider: string, options?: TileLayerOptions): TileLayer.Provider;
function provider(provider: string, options?: TileLayerOptions & { [name: string]: string; }): TileLayer.Provider;
}
}
+7 -3
View File
@@ -494,7 +494,11 @@ export interface TileLayerOptions extends GridLayerOptions {
zoomReverse?: boolean;
detectRetina?: boolean;
crossOrigin?: boolean;
[name: string]: any;
// [name: string]: any;
// You are able add additional properties, but it makes this interface unchackable.
// See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/15313
// Example:
// tileLayer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png?{foo}&{bar}&{abc}', {foo: 'bar', bar: (data: any) => 'foo', abc: () => ''});
}
export class TileLayer extends GridLayer {
@@ -817,7 +821,7 @@ export interface GeoJSONOptions<P = any> extends LayerOptions {
pointToLayer?(geoJsonPoint: geojson.Feature<geojson.Point, P>, latlng: LatLng): Layer; // should import GeoJSON typings
/**
* A Function defining the Path options for styling GeoJSON lines and polygons,
* PathOptions or a Function defining the Path options for styling GeoJSON lines and polygons,
* called internally when data is added.
*
* The default value is to not override any defaults:
@@ -828,7 +832,7 @@ export interface GeoJSONOptions<P = any> extends LayerOptions {
* }
* ```
*/
style?: StyleFunction<P>;
style?: PathOptions | StyleFunction<P>;
/**
* A Function that will be called once for each created Feature, after it
-5
View File
@@ -227,9 +227,6 @@ tileLayerOptions = {
pane: '',
className: '',
keepBuffer: 1,
foo: 'bar',
bar: () => 'foo',
abc: (data: any) => 'foobar'
};
tileLayerOptions.subdomains = 'a';
@@ -245,11 +242,9 @@ tileLayerOptions.bounds = latLngBoundsLiteral;
let tileLayer: L.TileLayer;
tileLayer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png');
tileLayer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', tileLayerOptions);
tileLayer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png?{foo}&{bar}&{abc}', {foo: 'bar', bar: (data: any) => 'foo', abc: () => ''});
tileLayer = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png');
tileLayer = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', tileLayerOptions);
tileLayer = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png?{foo}&{bar}&{abc}', {foo: 'bar', bar: (data: any) => 'foo', abc: () => ''});
// imageOverlay
let imageOverlayOptions: L.ImageOverlayOptions;
+2
View File
@@ -27,6 +27,8 @@ export interface setupI18nProps {
language?: string;
catalogs?: Catalogs;
development?: object;
locales?: string[];
missing?: string | ((language: string, id: string) => string);
}
export class I18n {
+1 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for @lingui/core 2.1
// Type definitions for @lingui/core 2.2
// Project: https://lingui.github.io/js-lingui/
// Definitions by: Jeow Li Huan <https://github.com/huan086>
// Definitions: https://github.com/huan086/lingui-typings
+9
View File
@@ -80,8 +80,17 @@ const catalog: Catalog = {
}
}
};
function missingFn(language: string, id: string) {
return id;
}
const catalogs: Catalogs = { es: catalog };
const setupResult: I18n = setupI18n({ catalogs, language: 'es' });
const setupResultLocales: I18n = setupI18n({ locales: ['en-UK', 'ar-AS'] });
const setupResultMissingText: I18n = setupI18n({ missing: 'missing' });
const setupResultMissingFn: I18n = setupI18n({ missing: missingFn });
const setupResultCombined: I18n = setupI18n({ catalogs, language: 'de', locales: ['en-UK', 'ar-AS'], missing: missingFn });
const formattedDate: string = date('en', { timeZone: 'UTC' })(new Date());
const formattedNumber: string = number('en', { style: 'currency', currency: 'EUR' })(1234.56);
+5 -5
View File
@@ -127,21 +127,21 @@ declare module "../index" {
* @param key The key of the value to remove.
* @return Returns `true` if the entry was removed successfully, else `false`.
*/
delete(key: string): boolean;
delete(key: any): boolean;
/**
* Gets the cached value for `key`.
* @param key The key of the value to get.
* @return Returns the cached value.
*/
get(key: string): any;
get(key: any): any;
/**
* Checks if a cached value for `key` exists.
* @param key The key of the entry to check.
* @return Returns `true` if an entry for `key` exists, else `false`.
*/
has(key: string): boolean;
has(key: any): boolean;
/**
* Sets `value` to `key` of the cache.
@@ -149,12 +149,12 @@ declare module "../index" {
* @param value The value to cache.
* @return Returns the cache object.
*/
set(key: string, value: any): Dictionary<any>;
set(key: any, value: any): this;
/**
* Removes all key-value entries from the map.
*/
clear(): void;
clear?: () => void;
}
interface MapCacheConstructor {
new (): MapCache;
+6 -1
View File
@@ -3467,7 +3467,7 @@ fp.now(); // $ExpectType number
delete(key: string) { return true; },
get(key: string): any { return 1; },
has(key: string) { return true; },
set(key: string, value: any): _.Dictionary<any> { return {}; },
set(key: string, value: any): _.MapCache { return this; },
clear() { },
};
@@ -3484,6 +3484,11 @@ fp.now(); // $ExpectType number
// $ExpectType MapCache
new _.memoize.Cache();
_.memoize.Cache = WeakMap;
_.memoize.Cache = Map;
const memoizedFn = _.memoize(memoizeFn);
memoizedFn.cache = new WeakMap();
memoizedFn.cache = new Map();
}
// _.overArgs

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