diff --git a/types/angular-loading-bar/index.d.ts b/types/angular-loading-bar/index.d.ts index 191fc043ed..464974631d 100644 --- a/types/angular-loading-bar/index.d.ts +++ b/types/angular-loading-bar/index.d.ts @@ -30,6 +30,10 @@ declare module 'angular' { * Latency Threshold */ latencyThreshold?: number; + /** + * HTML element selector of parent + */ + parentSelector?: string; } } diff --git a/types/angular-material/index.d.ts b/types/angular-material/index.d.ts index 10648c0012..93b92290e4 100644 --- a/types/angular-material/index.d.ts +++ b/types/angular-material/index.d.ts @@ -214,6 +214,7 @@ declare module 'angular' { contrastDefaultColor?: string; contrastDarkColors?: string | string[]; contrastLightColors?: string | string[]; + contrastStrongLightColors?: string|string[]; } interface IThemeHues { diff --git a/types/backbone.marionette/backbone.marionette-tests.ts b/types/backbone.marionette/backbone.marionette-tests.ts index 46f504e18e..a7da55495b 100644 --- a/types/backbone.marionette/backbone.marionette-tests.ts +++ b/types/backbone.marionette/backbone.marionette-tests.ts @@ -292,6 +292,14 @@ function RegionTests() { } +function ViewTests() { + const v = new MyView(new MyModel()); + const isDestroyed: boolean = v.isDestroyed(); + const isRendered: boolean = v.isRendered(); + const isAttached: boolean = v.isAttached(); + const vv: Marionette.View = v.delegateEntityEvents(); +} + function CollectionViewTests() { var cv = new MyCollectionView(); cv.collection.add(new MyModel()); diff --git a/types/backbone.marionette/index.d.ts b/types/backbone.marionette/index.d.ts index d24f9d64f9..93b82355db 100644 --- a/types/backbone.marionette/index.d.ts +++ b/types/backbone.marionette/index.d.ts @@ -856,7 +856,10 @@ declare namespace Marionette { /** * Internal properties extended in Marionette.View. */ - isDestroyed: boolean; + isDestroyed(): boolean; + isRendered(): boolean; + isAttached(): boolean; + delegateEntityEvents(): View; supportsRenderLifecycle: boolean; supportsDestroyLifecycle: boolean; diff --git a/types/codemirror/index.d.ts b/types/codemirror/index.d.ts index 561d311540..9a74dc1e53 100644 --- a/types/codemirror/index.d.ts +++ b/types/codemirror/index.d.ts @@ -178,7 +178,7 @@ declare namespace CodeMirror { /** Remove a CSS class from a line.line can be a line handle or number. where should be one of "text", "background", or "wrap"(see addLineClass). class can be left off to remove all classes for the specified node, or be a string to remove only a specific class. */ - removeLineClass(line: any, where: string, class_: string): CodeMirror.LineHandle; + removeLineClass(line: any, where: string, class_?: string): CodeMirror.LineHandle; /** * Compute the line at the given pixel height. diff --git a/types/d3-drag/d3-drag-tests.ts b/types/d3-drag/d3-drag-tests.ts index 4283cb259f..581b757717 100644 --- a/types/d3-drag/d3-drag-tests.ts +++ b/types/d3-drag/d3-drag-tests.ts @@ -88,6 +88,12 @@ circleDrag = circleDrag containerAccessor = circleDrag.container(); +// clickDistance(...) --------------------------------------------------------- + +circleDrag = circleDrag.clickDistance(5); + +const distance: number = circleDrag.clickDistance(); + // set and get filter --------------------------------------------------------- let filterFn: (this: SVGCircleElement, datum: CircleDatum, index: number, group: SVGCircleElement[] | NodeListOf) => boolean; diff --git a/types/d3-drag/index.d.ts b/types/d3-drag/index.d.ts index d3a65fb377..7105bd4e4d 100644 --- a/types/d3-drag/index.d.ts +++ b/types/d3-drag/index.d.ts @@ -1,9 +1,9 @@ -// Type definitions for D3JS d3-drag module 1.0 +// Type definitions for D3JS d3-drag module 1.1 // Project: https://github.com/d3/d3-drag/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Last module patch version validated against: 1.0.2 +// Last module patch version validated against: 1.1.0 import { ArrayLike, Selection, ValueFn } from 'd3-selection'; @@ -164,6 +164,20 @@ export interface DragBehavior): this; + /** + * Return the current click distance threshold, which defaults to zero. + */ + clickDistance(): number; + /** + * Set the maximum distance that the mouse can move between mousedown and mouseup that will trigger + * a subsequent click event. If at any point between mousedown and mouseup the mouse is greater than or equal to + * distance from its position on mousedown, the click event follwing mouseup will be suppressed. + * + * @param distance The distance threshold between mousedown and mouseup measured in client coordinates (event.clientX and event.clientY). + * The default is zero. + */ + clickDistance(distance: number): this; + /** * Return the first currently-assigned listener matching the specified typenames, if any. * diff --git a/types/d3-random/d3-random-tests.ts b/types/d3-random/d3-random-tests.ts index 8cd72d9f0e..7385d3e984 100644 --- a/types/d3-random/d3-random-tests.ts +++ b/types/d3-random/d3-random-tests.ts @@ -7,7 +7,7 @@ */ import * as d3Random from 'd3-random'; - +import * as seedrandom from 'seedrandom'; // ------------------------------------------------------------ // Preparatory Steps @@ -19,40 +19,70 @@ let randomNumberGenerator: () => number; // randomUniform // ------------------------------------------------------------ -randomNumberGenerator = d3Random.randomUniform(); -randomNumberGenerator = d3Random.randomUniform(0.2); -randomNumberGenerator = d3Random.randomUniform(0.2, 5); +let prngUniform: d3Random.RandomUniform; + +prngUniform = d3Random.randomUniform; +prngUniform = d3Random.randomUniform.source(seedrandom("Schroedinger's flea.")); + +randomNumberGenerator = prngUniform(); +randomNumberGenerator = prngUniform(0.2); +randomNumberGenerator = prngUniform(0.2, 5); // ------------------------------------------------------------ // randomNormal // ------------------------------------------------------------ -randomNumberGenerator = d3Random.randomNormal(); -randomNumberGenerator = d3Random.randomNormal(3); -randomNumberGenerator = d3Random.randomNormal(3, 4); +let prngNormal: d3Random.RandomNormal; + +prngNormal = d3Random.randomNormal; +prngNormal = d3Random.randomNormal.source(seedrandom("Schroedinger's flea.")); + +randomNumberGenerator = prngNormal(); +randomNumberGenerator = prngNormal(3); +randomNumberGenerator = prngNormal(3, 4); // ------------------------------------------------------------ // randomLogNormal // ------------------------------------------------------------ -randomNumberGenerator = d3Random.randomLogNormal(); -randomNumberGenerator = d3Random.randomLogNormal(3); -randomNumberGenerator = d3Random.randomLogNormal(3, 4); +let prngLogNormal: d3Random.RandomLogNormal; + +prngLogNormal = d3Random.randomLogNormal; +prngLogNormal = d3Random.randomLogNormal.source(seedrandom("Schroedinger's flea.")); + +randomNumberGenerator = prngLogNormal(); +randomNumberGenerator = prngLogNormal(3); +randomNumberGenerator = prngLogNormal(3, 4); // ------------------------------------------------------------ // randomBates // ------------------------------------------------------------ -randomNumberGenerator = d3Random.randomBates(3); +let prngBates: d3Random.RandomBates; + +prngBates = d3Random.randomBates; +prngBates = d3Random.randomBates.source(seedrandom("Schroedinger's flea.")); + +randomNumberGenerator = prngBates(3); // ------------------------------------------------------------ // randomIrwinHall // ------------------------------------------------------------ -randomNumberGenerator = d3Random.randomIrwinHall(3); +let prngIrwinHall: d3Random.RandomIrwinHall; + +prngIrwinHall = d3Random.randomIrwinHall; +prngIrwinHall = d3Random.randomIrwinHall.source(seedrandom("Schroedinger's flea.")); + +randomNumberGenerator = prngIrwinHall(3); // ------------------------------------------------------------ // randomExponential // ------------------------------------------------------------ -randomNumberGenerator = d3Random.randomExponential(1 / 40); +let prngExponential: d3Random.RandomExponential; + +prngExponential = d3Random.randomExponential; +prngExponential = d3Random.randomExponential.source(seedrandom("Schroedinger's flea.")); + +randomNumberGenerator = prngExponential(1 / 40); diff --git a/types/d3-random/index.d.ts b/types/d3-random/index.d.ts index 48c9b245ed..41b6034215 100644 --- a/types/d3-random/index.d.ts +++ b/types/d3-random/index.d.ts @@ -1,55 +1,112 @@ -// Type definitions for D3JS d3-random module v1.0.1 +// Type definitions for D3JS d3-random module 1.1 // Project: https://github.com/d3/d3-random/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/** - * Returns a function for generating random numbers with a uniform distribution). - * The minimum allowed value of a returned number is min, and the maximum is max. - * If min is not specified, it defaults to 0; if max is not specified, it defaults to 1. - * - * @param min The minimum allowed value of a returned number, defaults to 0. - * @param max The maximum allowed value of a returned number, defaults to 1. - */ -export function randomUniform(min?: number, max?: number): () => number; +// Last module patch version validated against: 1.1.0 + +export interface RandomNumberGenerationSource { + /** + * Returns the same type of function for generating random numbers but where the given random number + * generator source is used as the source of randomness instead of Math.random. + * This is useful when a seeded random number generator is preferable to Math.random. + * + * @param source Source (pseudo-)random number generator implementing the Math.random interface. + * The given random number generator must implement the same interface as Math.random and + * only return values in the range [0, 1). + */ + source(source: () => number): this; +} /** - * Returns a function for generating random numbers with a normal (Gaussian) distribution. - * The expected value of the generated numbers is mu, with the given standard deviation sigma. - * If mu is not specified, it defaults to 0; if sigma is not specified, it defaults to 1. - * - * @param mu Expected value, defaults to 0. - * @param sigma Standard deviation, defaults to 1. + * A configurable random number generator for the uniform distribution. */ -export function randomNormal(mu?: number, sigma?: number): () => number; +export interface RandomUniform extends RandomNumberGenerationSource { + /** + * Returns a function for generating random numbers with a uniform distribution). + * The minimum allowed value of a returned number is min, and the maximum is max. + * If min is not specified, it defaults to 0; if max is not specified, it defaults to 1. + * + * @param min The minimum allowed value of a returned number, defaults to 0. + * @param max The maximum allowed value of a returned number, defaults to 1. + */ + (min?: number, max?: number): () => number; +} + +export const randomUniform: RandomUniform; /** - * Returns a function for generating random numbers with a log-normal distribution. The expected value of the random variable’s natural logrithm is mu, - * with the given standard deviation sigma. If mu is not specified, it defaults to 0; if sigma is not specified, it defaults to 1. - * - * @param mu Expected value, defaults to 0. - * @param sigma Standard deviation, defaults to 1. + * A configurable random number generator for the normal (Gaussian) distribution. */ -export function randomLogNormal(mu?: number, sigma?: number): () => number; +export interface RandomNormal extends RandomNumberGenerationSource { + /** + * Returns a function for generating random numbers with a normal (Gaussian) distribution. + * The expected value of the generated numbers is mu, with the given standard deviation sigma. + * If mu is not specified, it defaults to 0; if sigma is not specified, it defaults to 1. + * + * @param mu Expected value, defaults to 0. + * @param sigma Standard deviation, defaults to 1. + */ + (mu?: number, sigma?: number): () => number; +} + +export const randomNormal: RandomNormal; /** - * Returns a function for generating random numbers with a Bates distribution with n independent variables. - * - * @param n Number of independent random variables to use. + * A configurable random number generator for the log-normal distribution. */ -export function randomBates(n: number): () => number; +export interface RandomLogNormal extends RandomNumberGenerationSource { + /** + * Returns a function for generating random numbers with a log-normal distribution. The expected value of the random variable’s natural logrithm is mu, + * with the given standard deviation sigma. If mu is not specified, it defaults to 0; if sigma is not specified, it defaults to 1. + * + * @param mu Expected value, defaults to 0. + * @param sigma Standard deviation, defaults to 1. + */ + (mu?: number, sigma?: number): () => number; +} + +export const randomLogNormal: RandomLogNormal; /** - * Returns a function for generating random numbers with an Irwin–Hall distribution with n independent variables. - * - * @param n Number of independent random variables to use. + * A configurable random number generator for the Bates distribution. */ -export function randomIrwinHall(n: number): () => number; +export interface RandomBates extends RandomNumberGenerationSource { + /** + * Returns a function for generating random numbers with a Bates distribution with n independent variables. + * + * @param n Number of independent random variables to use. + */ + (n: number): () => number; +} + +export const randomBates: RandomBates; /** - * Returns a function for generating random numbers with an exponential distribution with the rate lambda; - * equivalent to time between events in a Poisson process with a mean of 1 / lambda. - * - * @param lambda Expected time between events. + * A configurable random number generator for the Irwin–Hall distribution. */ -export function randomExponential(lambda: number): () => number; +export interface RandomIrwinHall extends RandomNumberGenerationSource { + /** + * Returns a function for generating random numbers with an Irwin–Hall distribution with n independent variables. + * + * @param n Number of independent random variables to use. + */ + (n: number): () => number; +} + +export const randomIrwinHall: RandomIrwinHall; + +/** + * A configurable random number generator for the exponential distribution. + */ +export interface RandomExponential extends RandomNumberGenerationSource { + /** + * Returns a function for generating random numbers with an exponential distribution with the rate lambda; + * equivalent to time between events in a Poisson process with a mean of 1 / lambda. + * + * @param lambda Expected time between events. + */ + (lambda: number): () => number; +} + +export const randomExponential: RandomExponential; diff --git a/types/d3-random/tsconfig.json b/types/d3-random/tsconfig.json index 20a20f04f1..f9544a0527 100644 --- a/types/d3-random/tsconfig.json +++ b/types/d3-random/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -19,4 +19,4 @@ "index.d.ts", "d3-random-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/d3-random/tslint.json b/types/d3-random/tslint.json new file mode 100644 index 0000000000..4ae99abce4 --- /dev/null +++ b/types/d3-random/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "max-line-length": [false, 140] + } +} diff --git a/types/d3-zoom/d3-zoom-tests.ts b/types/d3-zoom/d3-zoom-tests.ts index b583bfc8b6..09974bf299 100644 --- a/types/d3-zoom/d3-zoom-tests.ts +++ b/types/d3-zoom/d3-zoom-tests.ts @@ -165,6 +165,12 @@ svgZoom = svgZoom.translateExtent([[-500, -500], [500, 500]]); let translateExtent: [[number, number], [number, number]]; translateExtent = svgZoom.translateExtent(); +// clickDistance() --------------------------------------------------------- + +svgZoom = svgZoom.clickDistance(5); + +const distance: number = svgZoom.clickDistance(); + // duration() -------------------------------------------------------------- // chainable diff --git a/types/d3-zoom/index.d.ts b/types/d3-zoom/index.d.ts index 62c49b977b..88a9a7b95f 100644 --- a/types/d3-zoom/index.d.ts +++ b/types/d3-zoom/index.d.ts @@ -1,9 +1,9 @@ -// Type definitions for d3JS d3-zoom module 1.1 +// Type definitions for d3JS d3-zoom module 1.2 // Project: https://github.com/d3/d3-zoom/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Last module patch version validated against: 1.1.1 +// Last module patch version validated against: 1.2.0 import { ArrayLike, Selection, TransitionLike, ValueFn } from 'd3-selection'; import { ZoomView, ZoomInterpolator } from 'd3-interpolate'; @@ -461,6 +461,20 @@ export interface ZoomBehavior { if (index === array.length - 1 && line === "") { return line; @@ -40,7 +38,7 @@ function printDiff(diff:jsdiff.IDiffResult[]) { }).join("\n"); } - diff.forEach((part)=> { + diff.forEach((part) => { if (part.added) { console.log(addLineHeader("+", part.value)); } else if (part.removed) { diff --git a/types/diff/index.d.ts b/types/diff/index.d.ts index 102305ce70..03228269e0 100644 --- a/types/diff/index.d.ts +++ b/types/diff/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for diff +// Type definitions for diff 3.2 // Project: https://github.com/kpdecker/jsdiff // Definitions by: vvakame // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 export = JsDiff; export as namespace JsDiff; @@ -36,34 +37,37 @@ declare namespace JsDiff { } class Diff { - ignoreWhitespace:boolean; + ignoreWhitespace: boolean; - constructor(ignoreWhitespace?:boolean); + constructor(ignoreWhitespace?: boolean); - diff(oldString:string, newString:string):IDiffResult[]; + diff(oldString: string, newString: string): IDiffResult[]; - pushComponent(components:IDiffResult[], value:string, added:boolean, removed:boolean):void; + pushComponent(components: IDiffResult[], value: string, added: boolean, removed: boolean): void; - extractCommon(basePath:IBestPath, newString:string, oldString:string, diagonalPath:number):number; + extractCommon(basePath: IBestPath, newString: string, oldString: string, diagonalPath: number): number; - equals(left:string, right:string):boolean; + equals(left: string, right: string): boolean; - join(left:string, right:string):string; + join(left: string, right: string): string; - tokenize(value:string):any; // return types are string or string[] + tokenize(value: string): any; // return types are string or string[] } - function diffChars(oldStr:string, newStr:string):IDiffResult[]; + function diffChars(oldStr: string, newStr: string): IDiffResult[]; - function diffWords(oldStr:string, newStr:string):IDiffResult[]; + function diffWords(oldStr: string, newStr: string): IDiffResult[]; - function diffWordsWithSpace(oldStr:string, newStr:string):IDiffResult[]; + function diffWordsWithSpace(oldStr: string, newStr: string): IDiffResult[]; - function diffJson(oldObj: Object, newObj: Object): IDiffResult[]; + function diffJson(oldObj: object, newObj: object): IDiffResult[]; - function diffLines(oldStr:string, newStr:string):IDiffResult[]; + function diffLines(oldStr: string, newStr: string, options?: { + ignoreWhitespace?: boolean, + newlineIsToken?: boolean, + }): IDiffResult[]; - function diffCss(oldStr:string, newStr:string):IDiffResult[]; + function diffCss(oldStr: string, newStr: string): IDiffResult[]; function createPatch(fileName: string, oldStr: string, newStr: string, oldHeader: string, newHeader: string, options?: {context: number}): string; @@ -74,14 +78,14 @@ declare namespace JsDiff { function applyPatch(oldStr: string, uniDiff: string | IUniDiff | IUniDiff[]): string; function applyPatches(uniDiff: IUniDiff[], options: { - loadFile: (index: number, callback: (err: Error, data: string) => void) => void, - patched: (index: number, content: string) => void, - complete: (err?: Error) => void + loadFile(index: number, callback: (err: Error, data: string) => void): void, + patched(index: number, content: string): void, + complete(err?: Error): void }): void; function parsePatch(diffStr: string, options?: {strict: boolean}): IUniDiff[]; - function convertChangesToXML(changes:IDiffResult[]):string; + function convertChangesToXML(changes: IDiffResult[]): string; - function convertChangesToDMP(changes:IDiffResult[]):{0: number; 1:string;}[]; + function convertChangesToDMP(changes: IDiffResult[]): Array<{0: number; 1: string; }>; } diff --git a/types/diff/tslint.json b/types/diff/tslint.json new file mode 100644 index 0000000000..1b7b2672e6 --- /dev/null +++ b/types/diff/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "interface-name": false, + "export-just-namespace": false + } +} diff --git a/types/dockerode/dockerode-tests.ts b/types/dockerode/dockerode-tests.ts index 4b4e406839..8dd9a380de 100644 --- a/types/dockerode/dockerode-tests.ts +++ b/types/dockerode/dockerode-tests.ts @@ -24,6 +24,25 @@ const docker6 = new Docker({ key: 'key' }); +const docker7 = new Docker({ + Promise +}); + +async function foo() { + const containers = await docker7.listContainers(); + for (const container of containers) { + const foo = await docker7.getContainer(container.Id); + const inspect = await foo.inspect(); + } + + const images = await docker5.listImages(); + for (const image of images) { + const foo = await docker5.getImage(image.Id); + const inspect = await foo.inspect(); + await foo.remove(); + } +} + const container = docker.getContainer('container-id'); container.inspect((err, data) => { // NOOP @@ -47,6 +66,10 @@ docker.listContainers((err, containers) => { }); }); +docker.listContainers().then(containers => { + return containers.map(container => docker.getContainer(container.Id)); +}); + docker.buildImage('archive.tar', { t: 'imageName' }, (err, response) => { // NOOP }); diff --git a/types/dockerode/index.d.ts b/types/dockerode/index.d.ts index 2e834f0b3b..a4a1144872 100644 --- a/types/dockerode/index.d.ts +++ b/types/dockerode/index.d.ts @@ -12,69 +12,93 @@ declare namespace Dockerode { interface Container { inspect(options: {}, callback: Callback): void; inspect(callback: Callback): void; - inspect(options?: {}): { id: string }; + inspect(options?: {}): Promise; rename(options: {}, callback: Callback): void; + rename(options: {}): Promise; update(options: {}, callback: Callback): void; + update(options: {}): Promise; top(options: {}, callback: Callback): void; top(callback: Callback): void; + top(options?: {}): Promise; changes(callback: Callback): void; + changes(): Promise; export(callback: Callback): void; + export(): Promise; start(options: {}, callback: Callback): void; start(callback: Callback): void; + start(options?: {}): Promise; pause(options: {}, callback: Callback): void; pause(callback: Callback): void; + pause(options?: {}): Promise; unpause(options: {}, callback: Callback): void; unpause(callback: Callback): void; + unpause(options?: {}): Promise; exec(options: {}, callback: Callback): void; + exec(options: {}): Promise; commit(options: {}, callback: Callback): void; commit(callback: Callback): void; + commit(options?: {}): Promise; stop(options: {}, callback: Callback): void; stop(callback: Callback): void; + stop(options?: {}): Promise; restart(options: {}, callback: Callback): void; restart(callback: Callback): void; + restart(options?: {}): Promise; kill(options: {}, callback: Callback): void; kill(callback: Callback): void; + kill(options?: {}): Promise; resize(options: {}, callback: Callback): void; resize(callback: Callback): void; + resize(options?: {}): Promise; wait(callback: Callback): void; + wait(): Promise; remove(options: {}, callback: Callback): void; remove(callback: Callback): void; + remove(options?: {}): Promise; /** Deprecated since RAPI v1.20 */ copy(options: {}, callback: Callback): void; /** Deprecated since RAPI v1.20 */ copy(callback: Callback): void; + /** Deprecated since RAPI v1.20 */ + copy(options?: {}): Promise; getArchive(options: {}, callback: Callback): void; + getArchive(options: {}): Promise; infoArchive(options: {}, callback: Callback): void; + infoArchive(options: {}): Promise; /** @param file Filename (will read synchronously), Buffer or stream */ putArchive(file: string | Buffer | NodeJS.ReadableStream, options: {}, callback: Callback): void; + putArchive(file: string | Buffer | NodeJS.ReadableStream, options: {}): Promise; - logs(options: { stdout?: boolean, stderr?: boolean, follow?: boolean, since?: number, details?: boolean, tail?: number, timestamps?: boolean }, callback: Callback): void; + logs(options: ContainerLogsOptions, callback: Callback): void; logs(callback: Callback): void; + logs(options?: ContainerLogsOptions): Promise; stats(options: {}, callback: Callback): void; stats(callback: Callback): void; + stats(options?: {}): Promise; attach(options: {}, callback: Callback): void; + attach(options: {}): Promise; modem: any; id?: string; @@ -82,19 +106,25 @@ declare namespace Dockerode { interface Image { inspect(callback: Callback): void; + inspect(): Promise; history(callback: Callback): void; + history(): Promise; get(callback: Callback): void; + get(): Promise; push(options: {}, callback: Callback): void; push(callback: Callback): void; + push(options?: {}): Promise; tag(options: {}, callback: Callback): void; tag(callback: Callback): void; + tag(options?: {}): Promise; remove(options: {}, callback: Callback): void; remove(callback: Callback): void; + remove(options?: {}): Promise; modem: any; id?: string; @@ -102,9 +132,11 @@ declare namespace Dockerode { interface Volume { inspect(callback: Callback): void; + inspect(): Promise; remove(options: {}, callback: Callback): void; remove(callback: Callback): void; + remove(options?: {}): Promise; modem: any; name?: string; @@ -112,11 +144,14 @@ declare namespace Dockerode { interface Service { inspect(callback: Callback): void; + inspect(): Promise; remove(options: {}, callback: Callback): void; remove(callback: Callback): void; + remove(options?: {}): Promise; update(options: {}, callback: Callback): void; + update(options: {}): Promise; modem: any; id?: string; @@ -124,6 +159,7 @@ declare namespace Dockerode { interface Task { inspect(callback: Callback): void; + inspect(): Promise; modem: any; id?: string; @@ -131,6 +167,7 @@ declare namespace Dockerode { interface Node { inspect(callback: Callback): void; + inspect(): Promise; modem: any; id?: string; @@ -142,38 +179,50 @@ declare namespace Dockerode { remote: any; inspect(callback: Callback): void; + inspect(): Promise; remove(options: {}, callback: Callback): void; remove(callback: Callback): void; + remove(options?: {}): Promise; privileges(callback: Callback): void; + privileges(): Promise; pull(options: {}, callback: Callback): void; + pull(options: {}): Promise; enable(options: {}, callback: Callback): void; enable(callback: Callback): void; + enable(options?: {}): Promise; disable(options: {}, callback: Callback): void; disable(callback: Callback): void; + disable(options?: {}): Promise; push(options: {}, callback: Callback): void; push(callback: Callback): void; + push(options?: {}): Promise; configure(options: {}, callback: Callback): void; configure(callback: Callback): void; + configure(options?: {}): Promise; upgrade(auth: any, options: {}, callback: Callback): void; upgrade(auth: any, callback: Callback): void; + upgrade(auth: any, options?: {}): Promise; } interface Secret { inspect(callback: Callback): void; + inspect(): Promise; update(options: {}, callback: Callback): void; update(callback: Callback): void; + update(options?: {}): Promise; remove(options: {}, callback: Callback): void; remove(callback: Callback): void; + remove(options?: {}): Promise; modem: any; id?: string; @@ -181,15 +230,19 @@ declare namespace Dockerode { interface Network { inspect(callback: Callback): void; + inspect(): Promise; remove(options: {}, callback: Callback): void; remove(callback: Callback): void; + remove(options?: {}): Promise; connect(options: {}, callback: Callback): void; connect(callback: Callback): void; + connect(options?: {}): Promise; disconnect(options: {}, callback: Callback): void; disconnect(callback: Callback): void; + disconnect(options?: {}): Promise; modem: any; id?: string; @@ -197,10 +250,13 @@ declare namespace Dockerode { interface Exec { inspect(callback: Callback): void; + inspect(): Promise; start(options: {}, callback: Callback): void; + start(options: {}): Promise; resize(options: {}, callback: Callback): void; + resize(options: {}): Promise; modem: any; id?: string; @@ -587,6 +643,7 @@ declare namespace Dockerode { key?: string; protocol?: "https" | "http"; timeout?: number; + Promise?: typeof Promise; } interface SecretVersion { @@ -719,6 +776,16 @@ declare namespace Dockerode { interface PruneNetworksInfo { NetworksDeleted: string[]; } + + interface ContainerLogsOptions { + stdout?: boolean; + stderr?: boolean; + follow?: boolean; + since?: number; + details?: boolean; + tail?: number; + timestamps?: boolean; + } } type Callback = (error?: any, result?: T) => void; @@ -727,20 +794,27 @@ declare class Dockerode { constructor(options?: Dockerode.DockerOptions); createContainer(options: Dockerode.ContainerCreateOptions, callback: Callback): void; + createContainer(options: Dockerode.ContainerCreateOptions): Promise; createImage(options: {}, callback: Callback): void; createImage(auth: any, options: {}, callback: Callback): void; + createImage(options: {}): Promise; + createImage(auth: any, options: {}): Promise; loadImage(file: string, options: {}, callback: Callback): void; loadImage(file: string, callback: Callback): void; + loadImage(file: string, options?: {}): Promise; importImage(file: string, options: {}, callback: Callback): void; importImage(file: string, callback: Callback): void; + importImage(file: string, options?: {}): Promise; checkAuth(options: any, callback: Callback): void; + checkAuth(options: any): Promise; buildImage(file: string | NodeJS.ReadableStream, options: {}, callback: Callback): void; buildImage(file: string | NodeJS.ReadableStream, callback: Callback): void; + buildImage(file: string | NodeJS.ReadableStream, options?: {}): Promise; getContainer(id: string): Dockerode.Container; @@ -764,80 +838,110 @@ declare class Dockerode { listContainers(options: {}, callback: Callback): void; listContainers(callback: Callback): void; + listContainers(options?: {}): Promise; listImages(options: {}, callback: Callback): void; listImages(callback: Callback): void; + listImages(options?: {}): Promise; listServices(options: {}, callback: Callback): void; listServices(callback: Callback): void; + listServices(options?: {}): Promise; listNodes(options: {}, callback: Callback): void; listNodes(callback: Callback): void; + listNodes(options?: {}): Promise; listTasks(options: {}, callback: Callback): void; listTasks(callback: Callback): void; + listTasks(options?: {}): Promise; listSecrets(options: {}, callback: Callback): void; listSecrets(callback: Callback): void; + listSecrets(options?: {}): Promise; listPlugins(options: {}, callback: Callback): void; listPlugins(callback: Callback): void; + listPlugins(options?: {}): Promise; listVolumes(options: {}, callback: Callback): void; listVolumes(callback: Callback): void; + listVolumes(options?: {}): Promise; listNetworks(options: {}, callback: Callback): void; listNetworks(callback: Callback): void; + listNetworks(options?: {}): Promise; createSecret(options: {}, callback: Callback): void; + createSecret(options: {}): Promise; createPlugin(options: {}, callback: Callback): void; + createPlugin(options: {}): Promise; createVolume(options: {}, callback: Callback): void; + createVolume(options: {}): Promise; createService(options: {}, callback: Callback): void; + createService(options: {}): Promise; createNetwork(options: {}, callback: Callback): void; + createNetwork(options: {}): Promise; searchImages(options: {}, callback: Callback): void; + searchImages(options: {}): Promise; pruneImages(options: {}, callback: Callback): void; pruneImages(callback: Callback): void; + pruneImages(options?: {}): Promise; pruneContainers(options: {}, callback: Callback): void; pruneContainers(callback: Callback): void; + pruneContainers(options?: {}): Promise; pruneVolumes(options: {}, callback: Callback): void; pruneVolumes(callback: Callback): void; + pruneVolumes(options?: {}): Promise; pruneNetworks(options: {}, callback: Callback): void; pruneNetworks(callback: Callback): void; + pruneNetworks(options?: {}): Promise; info(callback: Callback): void; + info(): Promise; version(callback: Callback): void; + version(): Promise; ping(callback: Callback): void; + ping(): Promise; getEvents(options: {}, callback: Callback): void; getEvents(callback: Callback): void; + getEvents(options?: {}): Promise; pull(repoTag: string, options: {}, callback: Callback, auth?: {}): Dockerode.Image; + pull(repoTag: string, options: {}, auth?: {}): Promise; run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, createOptions: {}, startOptions: {}, callback: Callback): events.EventEmitter; run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, startOptions: {}, callback: Callback): events.EventEmitter; run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, callback: Callback): events.EventEmitter; run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, createOptions: {}, callback: Callback): events.EventEmitter; + run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, createOptions?: {}, startOptions?: {}): Promise; swarmInit(options: {}, callback: Callback): void; + swarmInit(options: {}): Promise; swarmJoin(options: {}, callback: Callback): void; + swarmJoin(options: {}): Promise; swarmLeave(options: {}, callback: Callback): void; + swarmLeave(options: {}): Promise; swarmUpdate(options: {}, callback: Callback): void; + swarmUpdate(options: {}): Promise; swarmInspect(callback: Callback): void; + swarmInspect(): Promise; modem: any; } diff --git a/types/dockerode/tsconfig.json b/types/dockerode/tsconfig.json index 2a83a71968..8f360ab29a 100644 --- a/types/dockerode/tsconfig.json +++ b/types/dockerode/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "target": "es6", "module": "commonjs", "lib": [ "es6" diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index 37818e787e..201f14f156 100644 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for Ember.js 2.7 // Project: http://emberjs.com/ // Definitions by: Jed Mao +// bttf // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -1571,6 +1572,34 @@ declare namespace Ember { @return {Promise} */ finally(callback: (a: T) => V, label?: string): Promise; + + static all(promises: GlobalArray<(Q | Thenable)>): Promise; + static race(promises: GlobalArray>): Promise; + + /** + @method resolve + @param {Any} value value that the returned promise will be resolved with + @param {String} label optional string for identifying the returned promise. + Useful for tooling. + @return {Promise} a promise that will become fulfilled with the given + `value` + */ + static resolve(object?: Q | Thenable): Promise; + + /** + @method cast (Deprecated in favor of resolve + @param {Any} value value that the returned promise will be resolved with + @param {String} label optional string for identifying the returned promise. + Useful for tooling. + @return {Promise} a promise that will become fulfilled with the given + `value` + */ + static cast(object: Q | Thenable, label?: string): Promise; + + /** + `RSVP.Promise.reject` returns a promise rejected with the passed `reason`. + */ + static reject(reason?: any): Promise; } function all(promises: GlobalArray>): Promise; diff --git a/types/emscripten/emscripten-tests.ts b/types/emscripten/emscripten-tests.ts index 0c7f99b710..153ea6b5de 100644 --- a/types/emscripten/emscripten-tests.ts +++ b/types/emscripten/emscripten-tests.ts @@ -1,8 +1,20 @@ - - - /// Module function ModuleTest(): void { + Module.environment = "WEB"; + Module.environment = "NODE"; + Module.noInitialRun = false; + Module.logReadFiles = false; + Module.filePackagePrefixURL = "http://www.example.org/"; + Module.preinitializedWebGLContext = new WebGLRenderingContext(); + + let package: ArrayBuffer = Module.getPreloadedPackage("package-name", 100); + let exports: WebAssembly.Exports = Module.instantiateWasm( + [{name: "func-name", kind: "function"}], + (module: WebAssembly.Module) => {} + ); + let memFile: string = Module.locateFile("http://www.example.org/file.mem"); + Module.onCustomMessage(new MessageEvent("TestType")); + Module.print = function(text) { alert('stdout: ' + text) }; var int_sqrt = Module.cwrap('int_sqrt', 'number', ['number']) @@ -16,6 +28,7 @@ function ModuleTest(): void { Module.HEAPU8.set(myTypedArray, buf); Module.ccall('my_function', 'number', ['number'], [buf]); Module._free(buf); + Module.destroy({}); } /// FS diff --git a/types/emscripten/index.d.ts b/types/emscripten/index.d.ts index 38e659a0f3..14260dd9d4 100644 --- a/types/emscripten/index.d.ts +++ b/types/emscripten/index.d.ts @@ -1,7 +1,11 @@ // Type definitions for Emscripten // Project: http://kripken.github.io/emscripten-site/index.html // Definitions by: Kensuke Matsuzaki +// Periklis Tsirakidis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/// declare namespace Emscripten { interface FileSystemType { @@ -9,13 +13,30 @@ declare namespace Emscripten { } declare namespace Module { + type EnvironmentType = "WEB" | "NODE" | "SHELL" | "WORKER"; + function print(str: string): void; function printErr(str: string): void; var arguments: string[]; + var environment: EnvironmentType; var preInit: { (): void }[]; var preRun: { (): void }[]; var postRun: { (): void }[]; + var preinitializedWebGLContext: WebGLRenderingContext; + var noInitialRun: boolean; var noExitRuntime: boolean; + var logReadFiles: boolean; + var filePackagePrefixURL: string; + var wasmBinary: ArrayBuffer; + + function destroy(object: object): void; + function getPreloadedPackage(remotePackageName: string, remotePackageSize: number): ArrayBuffer; + function instantiateWasm( + imports: WebAssembly.Imports, + successCallback: (module: WebAssembly.Module) => void + ): WebAssembly.Exports; + function locateFile(url: string): string; + function onCustomMessage(event: MessageEvent): void; var Runtime: any; @@ -65,7 +86,7 @@ declare namespace Module { function addOnExit(cb: () => any): void; function addOnPostRun(cb: () => any): void; - // Tools + // Tools function intArrayFromString(stringy: string, dontAddNull?: boolean, length?: number): number[]; function intArrayToString(array: number[]): string; function writeStringToMemory(str: string, buffer: number, dontAddNull: boolean): void; diff --git a/types/graphql/type/schema.d.ts b/types/graphql/type/schema.d.ts index 5a2cdd0af4..0f02cd78af 100644 --- a/types/graphql/type/schema.d.ts +++ b/types/graphql/type/schema.d.ts @@ -51,7 +51,7 @@ export class GraphQLSchema { getQueryType(): GraphQLObjectType; getMutationType(): GraphQLObjectType; getSubscriptionType(): GraphQLObjectType; - getTypeMap(): GraphQLNamedType; + getTypeMap(): { [typeName: string]: GraphQLNamedType }; getType(name: string): GraphQLType; getPossibleTypes(abstractType: GraphQLAbstractType): Array; diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index 22b2d6b9e1..b8ae248190 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -18522,7 +18522,7 @@ declare namespace _ { * @param defaultValue The default value. * @returns Returns the resolved value. */ - defaultTo(value: T, defaultValue: T): T; + defaultTo(value: T | null | undefined, defaultValue: T): T; } interface LoDashImplicitWrapperBase { @@ -19591,20 +19591,20 @@ declare namespace _ { type ListIterator = (value: T, index: number, collection: List) => TResult; - type DictionaryIterator = (value: T, key?: string, collection?: Dictionary) => TResult; + type DictionaryIterator = (value: T, key: string, collection: Dictionary) => TResult; - type NumericDictionaryIterator = (value: T, key?: number, collection?: Dictionary) => TResult; + type NumericDictionaryIterator = (value: T, key: number, collection: Dictionary) => TResult; - type ObjectIterator = (element: T, key?: string, collection?: any) => TResult; + type ObjectIterator = (element: T, key: string, collection: any) => TResult; - type StringIterator = (char: string, index?: number, string?: string) => TResult; + type StringIterator = (char: string, index: number, string: string) => TResult; - type MemoVoidIterator = (prev: TResult, curr: T, indexOrKey?: any, list?: T[]) => void; + type MemoVoidIterator = (prev: TResult, curr: T, indexOrKey: any, list: T[]) => void; - type MemoIterator = (prev: TResult, curr: T, indexOrKey?: any, list?: T[]) => TResult; + type MemoIterator = (prev: TResult, curr: T, indexOrKey: any, list: T[]) => TResult; - type MemoVoidArrayIterator = (acc: TResult, curr: T, index?: number, arr?: T[]) => void; - type MemoVoidDictionaryIterator = (acc: TResult, curr: T, key?: string, dict?: Dictionary) => void; + type MemoVoidArrayIterator = (acc: TResult, curr: T, index: number, arr: T[]) => void; + type MemoVoidDictionaryIterator = (acc: TResult, curr: T, key: string, dict: Dictionary) => void; // Common interface between Arrays and jQuery objects interface List { diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index af30a416d6..4f479eab83 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -96,7 +96,12 @@ interface TResult { } // _.MapCache -let testMapCache: _.MapCache; +let testMapCache: _.MapCache = { + delete(key: string) { return true; }, + get(key: string): any { return 1; }, + has(key: string) { return true; }, + set(key: string, value: any): _.Dictionary { return {}; }, +}; result = <(key: string) => boolean>testMapCache.delete; result = <(key: string) => any>testMapCache.get; result = <(key: string) => boolean>testMapCache.has; @@ -153,8 +158,8 @@ result = <_.LoDashExplicitArrayWrapper>_.chain([1, 2, 3, 4]).unshift(5, // _.chunk namespace TestChunk { - let array: TResult[]; - let list: _.List; + let array: TResult[] = []; + let list: _.List = []; { let result: TResult[][]; @@ -189,8 +194,8 @@ namespace TestChunk { // _.compact namespace TestCompact { - let array: TResult[]; - let list: _.List; + let array: TResult[] = []; + let list: _.List = []; { let result: TResult[]; @@ -217,8 +222,8 @@ namespace TestCompact { // _.difference namespace TestDifference { - let array: TResult[]; - let list: _.List; + let array: TResult[] = []; + let list: _.List = []; { let result: TResult[]; @@ -265,9 +270,9 @@ namespace TestDifference { // _.differenceBy namespace TestDifferenceBy { - let array: TResult[]; - let list: _.List; - let iteratee: (value: TResult) => any; + let array: TResult[] = []; + let list: _.List = []; + let iteratee: (value: TResult) => any = (value: TResult) => 1; { let result: TResult[]; @@ -452,8 +457,8 @@ namespace TestDifferenceBy { // _.drop { - let array: TResult[]; - let list: _.List; + let array: TResult[] = []; + let list: _.List = []; { let result: TResult[]; @@ -487,8 +492,8 @@ namespace TestDifferenceBy { // _.dropRight namespace TestDropRight { - let array: TResult[]; - let list: _.List; + let array: TResult[] = []; + let list: _.List = []; { let result: TResult[]; @@ -523,9 +528,9 @@ namespace TestDropRight { // _.dropRightWhile namespace TestDropRightWhile { - let array: TResult[]; - let list: _.List; - let predicateFn: (value: TResult, index: number, collection: _.List) => boolean; + let array: TResult[] = []; + let list: _.List = []; + let predicateFn = (value: TResult, index: number, collection: _.List) => true; { let result: TResult[]; @@ -572,9 +577,9 @@ namespace TestDropRightWhile { // _.dropWhile namespace TestDropWhile { - let array: TResult[]; - let list: _.List; - let predicateFn: (value: TResult, index: number, collection: _.List) => boolean; + let array: TResult[] = []; + let list: _.List = []; + let predicateFn = (value: TResult, index: number, collection: _.List) => true; { let result: TResult[]; @@ -621,8 +626,8 @@ namespace TestDropWhile { // _.fill namespace TestFill { - let array: number[]; - let list: _.List; + let array: number[] = []; + let list: _.List = []; { let result: number[]; @@ -675,10 +680,10 @@ namespace TestFill { // _.findIndex namespace TestFindIndex { - let array: TResult[]; - let list: _.List; - let predicateFn: (value: TResult, index?: number, collection?: _.List) => boolean; - let fromIndex: number; + let array: TResult[] = []; + let list: _.List = []; + let predicateFn = (value: TResult, index: number, collection: _.List) => true; + let fromIndex: number = 0; { let result: number; @@ -727,11 +732,11 @@ namespace TestFindIndex { // _.findLastIndex namespace TestFindLastIndex { - let array: TResult[]; - let list: _.List; + let array: TResult[] = []; + let list: _.List = []; - let predicateFn: (value: TResult, index?: number, collection?: _.List) => boolean; - let fromIndex: number; + let predicateFn = (value: TResult, index: number, collection: _.List) => true; + let fromIndex: number = 0; { let result: number; @@ -780,8 +785,8 @@ namespace TestFindLastIndex { // _.first namespace TestFirst { - let array: TResult[]; - let list: _.List; + let array: TResult[] = []; + let list: _.List = []; { let result: string; @@ -992,8 +997,8 @@ namespace TestFlattenDeep { // _.fromPairs namespace TestFromPairs { - let twoDimensionalArray: string[][]; - let numberTupleArray: [string, number][]; + let twoDimensionalArray: string[][] = []; + let numberTupleArray: [string, number][] = []; let stringDict: _.Dictionary; let numberDict: _.Dictionary; @@ -1017,8 +1022,8 @@ namespace TestFromPairs { // _.head namespace TestHead { - let array: TResult[]; - let list: _.List; + let array: TResult[] = []; + let list: _.List = []; { let result: string; @@ -1053,9 +1058,9 @@ namespace TestHead { // _.indexOf namespace TestIndexOf { - let array: TResult[]; - let list: _.List; - let value: TResult; + let array: TResult[] = []; + let list: _.List = []; + let value: TResult = { a: 1, b: "", c: true }; { let result: number; @@ -1092,9 +1097,9 @@ namespace TestIndexOf { // _.sortedIndexOf namespace TestIndexOf { - let array: TResult[]; - let list: _.List; - let value: TResult; + let array: TResult[] = []; + let list: _.List = []; + let value: TResult = { a: 1, b: "", c: true }; { let result: number; @@ -1115,8 +1120,8 @@ namespace TestIndexOf { //_.initial namespace TestInitial { - let array: TResult[]; - let list: _.List; + let array: TResult[] = []; + let list: _.List = []; { let result: TResult[]; @@ -1142,8 +1147,8 @@ namespace TestInitial { // _.intersection namespace TestIntersection { - let array: TResult[]; - let list: _.List; + let array: TResult[] = []; + let list: _.List = []; { let result: TResult[]; @@ -1210,8 +1215,8 @@ namespace TestJoin { // _.last namespace TestLast { - let array: TResult[]; - let list: _.List; + let array: TResult[] = []; + let list: _.List = []; { let result: string; @@ -1251,9 +1256,9 @@ namespace TestLast { // _.lastIndexOf namespace TestLastIndexOf { - let array: TResult[]; - let list: _.List; - let value: TResult; + let array: TResult[] = []; + let list: _.List = []; + let value: TResult = { a: 1, b: "", c: true }; { let result: number; @@ -1290,9 +1295,9 @@ namespace TestLastIndexOf { // _.nth namespace TestNth { - let array: TResult[]; - let list: _.List; - let value: number; + let array: TResult[] = []; + let list: _.List = []; + let value: number = 0; { let result: TResult; @@ -1321,9 +1326,9 @@ namespace TestNth { // _.pull namespace TestPull { - let array: TResult[]; - let list: _.List; - let value: TResult; + let array: TResult[] = []; + let list: _.List = []; + let value: TResult = { a: 1, b: "", c: true }; { let result: TResult[]; @@ -1382,8 +1387,8 @@ namespace TestPull { // _.pullAt namespace TestPullAt { - let array: TResult[]; - let list: _.List; + let array: TResult[] = []; + let list: _.List = []; { let result: TResult[]; @@ -1430,9 +1435,9 @@ namespace TestPullAt { // _.remove namespace TestRemove { - let array: TResult[]; - let list: _.List; - let predicateFn: (value: TResult, index?: number, collection?: _.List) => boolean; + let array: TResult[] = []; + let list: _.List = []; + let predicateFn = (value: TResult, index: number, collection: _.List) => true; { let result: TResult[]; @@ -1479,8 +1484,8 @@ namespace TestRemove { // _.tail namespace TestTail { - let array: TResult[]; - let list: _.List; + let array: TResult[] = []; + let list: _.List = []; { let result: TResult[]; @@ -1506,7 +1511,7 @@ namespace TestTail { // _.slice namespace TestSlice { - let array: TResult[]; + let array: TResult[] = []; { let result: TResult[]; @@ -1537,10 +1542,10 @@ namespace TestSlice { namespace TestSortedIndex { type SampleType = {a: number; b: string; c: boolean;}; - let array: SampleType[]; - let list: _.List; + let array: SampleType[] = []; + let list: _.List = []; - let value: SampleType; + let value: SampleType = { a: 1, b: "", c: true }; let stringIterator: (x: string) => number; let arrayIterator: (x: SampleType) => number; @@ -1577,14 +1582,14 @@ namespace TestSortedIndex { namespace TestSortedIndexBy { type SampleType = {a: number; b: string; c: boolean;}; - let array: SampleType[]; - let list: _.List; + let array: SampleType[] = []; + let list: _.List = []; - let value: SampleType; + let value: SampleType = { a: 1, b: "", c: true }; - let stringIterator: (x: string) => number; - let arrayIterator: (x: SampleType) => number; - let listIterator: (x: SampleType) => number; + let stringIterator = (x: string) => 0; + let arrayIterator = (x: SampleType) => 0; + let listIterator = (x: SampleType) => 0; { let result: number; @@ -1638,10 +1643,10 @@ namespace TestSortedIndexBy { namespace TestSortedLastIndex { type SampleType = {a: number; b: string; c: boolean;}; - let array: SampleType[]; - let list: _.List; + let array: SampleType[] = []; + let list: _.List = []; - let value: SampleType; + let value: SampleType = { a: 1, b: "", c: true }; let stringIterator: (x: string) => number; let arrayIterator: (x: SampleType) => number; @@ -1678,14 +1683,14 @@ namespace TestSortedLastIndex { namespace TestSortedLastIndexBy { type SampleType = {a: number; b: string; c: boolean;}; - let array: SampleType[]; - let list: _.List; + let array: SampleType[] = []; + let list: _.List = []; - let value: SampleType; + let value: SampleType = { a: 1, b: "", c: true }; - let stringIterator: (x: string) => number; - let arrayIterator: (x: SampleType) => number; - let listIterator: (x: SampleType) => number; + let stringIterator = (x: string) => 0; + let arrayIterator = (x: SampleType) => 0; + let listIterator = (x: SampleType) => 0; { let result: number; @@ -1737,8 +1742,8 @@ namespace TestSortedLastIndexBy { // _.tail namespace TestTail { - let array: TResult[]; - let list: _.List; + let array: TResult[] = []; + let list: _.List = []; { let result: TResult[]; @@ -1764,8 +1769,8 @@ namespace TestTail { // _.take namespace TestTake { - let array: TResult[]; - let list: _.List; + let array: TResult[] = []; + let list: _.List = []; { let result: TResult[]; @@ -1800,8 +1805,8 @@ namespace TestTake { // _.takeRight namespace TestTakeRight { - let array: TResult[]; - let list: _.List; + let array: TResult[] = []; + let list: _.List = []; { let result: TResult[]; @@ -1836,9 +1841,9 @@ namespace TestTakeRight { // _.takeRightWhile namespace TestTakeRightWhile { - let array: TResult[]; - let list: _.List; - let predicateFn: (value: TResult, index: number, collection: _.List) => boolean; + let array: TResult[] = []; + let list: _.List = []; + let predicateFn = (value: TResult, index: number, collection: _.List) => true; { let result: TResult[]; @@ -1885,9 +1890,9 @@ namespace TestTakeRightWhile { // _.takeWhile namespace TestTakeWhile { - let array: TResult[]; - let list: _.List; - let predicateFn: (value: TResult, index: number, collection: _.List) => boolean; + let array: TResult[] = []; + let list: _.List = []; + let predicateFn = (value: TResult, index: number, collection: _.List) => true; { let result: TResult[]; @@ -1934,8 +1939,8 @@ namespace TestTakeWhile { // _.union namespace TestUnion { - let array: TResult[]; - let list: _.List; + let array: TResult[] = []; + let list: _.List = []; { let result: TResult[]; @@ -1986,9 +1991,9 @@ namespace TestUnion { // _.unionBy namespace TestUnionBy { - let array: TResult[]; - let list: _.List; - let iteratee: (value: TResult) => any; + let array: TResult[] = []; + let list: _.List = []; + let iteratee: (value: TResult) => any = (value: TResult) => 1; { let result: TResult[]; @@ -2151,11 +2156,8 @@ namespace TestUnionBy { namespace TestUniq { type SampleObject = {a: number; b: string; c: boolean}; - let array: SampleObject[]; - let list: _.List; - - let stringIterator: (value: string, index: number, collection: string) => string; - let listIterator: (value: SampleObject, index: number, collection: _.List) => number; + let array: SampleObject[] = []; + let list: _.List = []; { let result: string[]; @@ -2199,11 +2201,11 @@ namespace TestUniq { namespace TestUniqBy { type SampleObject = {a: number; b: string; c: boolean}; - let array: SampleObject[]; - let list: _.List; + let array: SampleObject[] = []; + let list: _.List = []; - let stringIterator: (value: string, index: number, collection: string) => string; - let listIterator: (value: SampleObject, index: number, collection: _.List) => number; + let stringIterator = (value: string, index: number, collection: string) => ""; + let listIterator = (value: SampleObject, index: number, collection: _.List) => 0; { let result: string[]; @@ -2273,11 +2275,8 @@ namespace TestUniqBy { namespace TestSortedUniq { type SampleObject = {a: number; b: string; c: boolean}; - let array: SampleObject[]; - let list: _.List; - - let stringIterator: (value: string, index: number, collection: string) => string; - let listIterator: (value: SampleObject, index: number, collection: _.List) => number; + let array: SampleObject[] = []; + let list: _.List = []; { let result: string[]; @@ -2317,11 +2316,11 @@ namespace TestSortedUniq { namespace TestSortedUniqBy { type SampleObject = {a: number; b: string; c: boolean}; - let array: SampleObject[]; - let list: _.List; + let array: SampleObject[] = []; + let list: _.List = []; - let stringIterator: (value: string, index: number, collection: string) => string; - let listIterator: (value: SampleObject, index: number, collection: _.List) => number; + let stringIterator = (value: string, index: number, collection: string) => ""; + let listIterator = (value: SampleObject, index: number, collection: _.List) => 0; { let result: string[]; @@ -2422,9 +2421,9 @@ namespace TestUnzip { // _.unzipWith { - let testUnzipWithArray: (number[]|_.List)[]; - let testUnzipWithList: _.List>; - let testUnzipWithIterator: {(prev: TResult, curr: number, index?: number, list?: number[]): TResult}; + let testUnzipWithArray: (number[]|_.List)[] = []; + let testUnzipWithList: _.List> = []; + let testUnzipWithIterator: {(prev: TResult, curr: number, index?: number, list?: number[]): TResult} = (prev: TResult, curr: number, index?: number, list?: number[]) => ({ a: 1, b: "", c: true }); let result: TResult[]; result = _.unzipWith(testUnzipWithArray); result = _.unzipWith(testUnzipWithArray, testUnzipWithIterator); @@ -2436,8 +2435,8 @@ namespace TestUnzip { // _.without namespace TestWithout { - let array: number[]; - let list: _.List; + let array: number[] = []; + let list: _.List = []; { let result: number[]; @@ -2483,8 +2482,8 @@ namespace TestWithout { // _.xor namespace TestXor { - let array: TResult[]; - let list: _.List; + let array: TResult[] = []; + let list: _.List = []; { let result: TResult[]; @@ -2527,8 +2526,8 @@ namespace TestXor { // _.zip namespace TestZip { - let array: TResult[]; - let list: _.List; + let array: TResult[] = []; + let list: _.List = []; { let result: TResult[][]; @@ -2565,13 +2564,13 @@ namespace TestZip { // _.zipObject namespace TestZipObject { - let arrayOfKeys: string[]; - let arrayOfValues: number[]; - let arrayOfKeyValuePairs: (string|number)[][] + let arrayOfKeys: string[] = []; + let arrayOfValues: number[] = []; + let arrayOfKeyValuePairs: (string|number)[][] = []; - let listOfKeys: _.List; - let listOfValues: _.List; - let listOfKeyValuePairs: _.List<_.List>; + let listOfKeys: _.List = []; + let listOfValues: _.List = []; + let listOfKeyValuePairs: _.List<_.List> = []; { let result: _.Dictionary; @@ -2717,7 +2716,7 @@ namespace TestZipObject { interface TestZipWithFn { (a1: number, a2: number): number; } -let testZipWithFn: TestZipWithFn; +let testZipWithFn: TestZipWithFn = (a1, a2) => 1; result = _.zipWith([1, 2]); result = _.zipWith([1, 2], testZipWithFn); result = _.zipWith([1, 2], [1, 2], testZipWithFn); @@ -2775,28 +2774,28 @@ namespace TestChain { // _.tap namespace TestTap { { - let interceptor: (value: string) => void; + let interceptor = (value: string) => {}; let result: string; _.tap('', interceptor); } { - let interceptor: (value: string[]) => void; + let interceptor = (value: string[]) => {}; let result: _.LoDashImplicitArrayWrapper; _.tap([''], interceptor); } { - let interceptor: (value: {a: string}) => void; + let interceptor = (value: {a: string}) => {}; let result: _.LoDashImplicitObjectWrapper<{a: string}>; _.tap({a: ''}, interceptor); } { - let interceptor: (value: string) => void; + let interceptor = (value: string) => {}; let result: _.LoDashImplicitWrapper; _.chain('').tap(interceptor); @@ -2805,7 +2804,7 @@ namespace TestTap { } { - let interceptor: (value: string[]) => void; + let interceptor = (value: string[]) => {}; let result: _.LoDashImplicitArrayWrapper; _.chain(['']).tap(interceptor); @@ -2814,7 +2813,7 @@ namespace TestTap { } { - let interceptor: (value: {a: string}) => void; + let interceptor = (value: {a: string}) => {}; let result: _.LoDashImplicitObjectWrapper<{a: string}>; _.chain({a: ''}).tap(interceptor); @@ -2823,7 +2822,7 @@ namespace TestTap { } { - let interceptor: (value: string) => void; + let interceptor = (value: string) => {}; let result: _.LoDashExplicitWrapper; _.chain('').tap(interceptor); @@ -2832,7 +2831,7 @@ namespace TestTap { } { - let interceptor: (value: string[]) => void; + let interceptor = (value: string[]) => {}; let result: _.LoDashExplicitArrayWrapper; _.chain(['']).tap(interceptor); @@ -2841,7 +2840,7 @@ namespace TestTap { } { - let interceptor: (value: {a: string}) => void; + let interceptor = (value: {a: string}) => {}; let result: _.LoDashExplicitObjectWrapper<{a: string}>; _.chain({a: ''}).tap(interceptor); @@ -2857,77 +2856,77 @@ namespace TestThru { } { - let interceptor: Interceptor; + let interceptor: Interceptor = (x) => x; let result: number; result = _.thru(1, interceptor); } { - let interceptor: Interceptor; + let interceptor: Interceptor = (x) => x; let result: _.LoDashImplicitWrapper; result = _(1).thru(interceptor); } { - let interceptor: Interceptor; + let interceptor: Interceptor = (x) => x; let result: _.LoDashImplicitWrapper; result = _('').thru(interceptor); } { - let interceptor: Interceptor; + let interceptor: Interceptor = (x) => x; let result: _.LoDashImplicitWrapper; result = _(true).thru(interceptor); } { - let interceptor: Interceptor<{a: string}>; + let interceptor: Interceptor<{a: string}> = (x) => x; let result: _.LoDashImplicitObjectWrapper<{a: string}>; result = _({a: ''}).thru<{a: string}>(interceptor); } { - let interceptor: Interceptor; + let interceptor: Interceptor = (x) => x; let result: _.LoDashImplicitArrayWrapper; result = _([1, 2, 3]).thru(interceptor); } { - let interceptor: Interceptor; + let interceptor: Interceptor = (x) => x; let result: _.LoDashExplicitWrapper; result = _(1).chain().thru(interceptor); } { - let interceptor: Interceptor; + let interceptor: Interceptor = (x) => x; let result: _.LoDashExplicitWrapper; result = _('').chain().thru(interceptor); } { - let interceptor: Interceptor; + let interceptor: Interceptor = (x) => x; let result: _.LoDashExplicitWrapper; result = _(true).chain().thru(interceptor); } { - let interceptor: Interceptor<{a: string}>; + let interceptor: Interceptor<{a: string}> = (x) => x; let result: _.LoDashExplicitObjectWrapper<{a: string}>; result = _({a: ''}).chain().thru<{a: string}>(interceptor); } { - let interceptor: Interceptor; + let interceptor: Interceptor = (x) => x; let result: _.LoDashExplicitArrayWrapper; result = _([1, 2, 3]).chain().thru(interceptor); @@ -3255,9 +3254,9 @@ namespace TestValueOf { // _.at namespace TestAt { - let array: TResult[]; - let list: _.List; - let dictionary: _.Dictionary; + let array: TResult[] = []; + let list: _.List = []; + let dictionary: _.Dictionary = {}; { let result: TResult[]; @@ -3286,15 +3285,15 @@ namespace TestAt { // _.countBy namespace TestCountBy { - let array: TResult[]; - let list: _.List; - let dictionary: _.Dictionary; - let numericDictionary: _.NumericDictionary; + let array: TResult[] = []; + let list: _.List = []; + let dictionary: _.Dictionary = {}; + let numericDictionary: _.NumericDictionary = {}; - let stringIterator: (value: string, index: number, collection: string) => any; - let listIterator: (value: TResult, index: number, collection: _.List) => any; - let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any; - let numericDictionaryIterator: (value: TResult, key: number, collection: _.NumericDictionary) => any; + let stringIterator: (value: string, index: number, collection: string) => any = (value: string, index: number, collection: string) => 1; + let listIterator: (value: TResult, index: number, collection: _.List) => any = (value: TResult, index: number, collection: _.List) => 1; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any = (value: TResult, key: string, collection: _.Dictionary) => 1; + let numericDictionaryIterator: (value: TResult, key: number, collection: _.NumericDictionary) => any = (value: TResult, key: number, collection: _.NumericDictionary) => 1; { let result: _.Dictionary; @@ -3392,13 +3391,13 @@ namespace TestCountBy { // _.each namespace TestEach { - let array: TResult[]; - let list: _.List; - let dictionary: _.Dictionary; + let array: TResult[] = []; + let list: _.List = []; + let dictionary: _.Dictionary = {}; - let stringIterator: (char: string, index: number, string: string) => any; - let listIterator: (value: TResult, index: number, collection: _.List) => any; - let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any; + let stringIterator: (char: string, index: number, string: string) => any = (char: string, index: number, string: string) => 1; + let listIterator: (value: TResult, index: number, collection: _.List) => any = (value: TResult, index: number, collection: _.List) => 1; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any = (value: TResult, key: string, collection: _.Dictionary) => 1; { let result: string; @@ -3475,13 +3474,13 @@ namespace TestEach { // _.eachRight namespace TestEachRight { - let array: TResult[]; - let list: _.List; - let dictionary: _.Dictionary; + let array: TResult[] = []; + let list: _.List = []; + let dictionary: _.Dictionary = {}; - let stringIterator: (char: string, index: number, string: string) => any; - let listIterator: (value: TResult, index: number, collection: _.List) => any; - let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any; + let stringIterator: (char: string, index: number, string: string) => any = (char: string, index: number, string: string) => 1; + let listIterator: (value: TResult, index: number, collection: _.List) => any = (value: TResult, index: number, collection: _.List) => 1; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any = (value: TResult, key: string, collection: _.Dictionary) => 1; { let result: string; @@ -3560,14 +3559,14 @@ namespace TestEachRight { namespace TestEvery { type SampleObject = {a: number; b: string; c: boolean;}; - let array: SampleObject[]; - let list: _.List; - let dictionary: _.Dictionary; - let numericDictionary: _.NumericDictionary; + let array: SampleObject[] = []; + let list: _.List = []; + let dictionary: _.Dictionary = {}; + let numericDictionary: _.NumericDictionary = {}; - let listIterator: (value: SampleObject, index: number, collection: _.List) => boolean; - let dictionaryIterator: (value: SampleObject, key: string, collection: _.Dictionary) => boolean; - let numericDictionaryIterator: (value: SampleObject, key: number, collection: _.NumericDictionary) => boolean; + let listIterator = (value: SampleObject, index: number, collection: _.List) => true; + let dictionaryIterator = (value: SampleObject, key: string, collection: _.Dictionary) => true; + let numericDictionaryIterator = (value: SampleObject, key: number, collection: _.NumericDictionary) => true; { let result: boolean; @@ -3652,13 +3651,13 @@ namespace TestEvery { // _.filter namespace TestFilter { - let array: TResult[]; - let list: _.List; - let dictionary: _.Dictionary; + let array: TResult[] = []; + let list: _.List = []; + let dictionary: _.Dictionary = {}; - let stringIterator: (char: string, index: number, string: string) => any; - let listIterator: (value: TResult, index: number, collection: _.List) => any; - let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any; + let stringIterator: (char: string, index: number, string: string) => any = (char: string, index: number, string: string) => 1; + let listIterator: (value: TResult, index: number, collection: _.List) => any = (value: TResult, index: number, collection: _.List) => 1; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any = (value: TResult, key: string, collection: _.Dictionary) => 1; { let result: string[]; @@ -3738,14 +3737,14 @@ namespace TestFilter { // _.find namespace TestFind { - let array: TResult[]; - let list: _.List; - let dictionary: _.Dictionary; + let array: TResult[] = []; + let list: _.List = []; + let dictionary: _.Dictionary = {}; - let listIterator: (value: TResult, index: number, collection: _.List) => boolean; - let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => boolean; + let listIterator = (value: TResult, index: number, collection: _.List) => true; + let dictionaryIterator = (value: TResult, key: string, collection: _.Dictionary) => true; - let result: TResult; + let result: TResult | undefined; result = _.find(array); result = _.find(array, listIterator); @@ -3822,13 +3821,13 @@ namespace TestFlatMap { let numNumericDictionary: _.NumericDictionary = {0: 1, 1: [2, 3]}; let objNumericDictionary: _.NumericDictionary<{a: number}|{a: number}[]> = {0: {a: 1}, 1: [{a: 2}, {a: 3}]}; - let stringIterator: (value: string, index: number, collection: _.List) => string|string[]; + let stringIterator: (value: string, index: number, collection: _.List) => string|string[] = (a, b, c) => ""; - let listIterator: (value: number, index: number, collection: _.List) => number|number[]; + let listIterator: (value: number, index: number, collection: _.List) => number|number[] = (a, b, c) => 1; - let dictionaryIterator: (value: number, key: number, collection: _.Dictionary) => number|number[]; + let dictionaryIterator: (value: number, key: number, collection: _.Dictionary) => number|number[] = (a, b, c) => 1; - let numericDictionaryIterator: (value: number, key: number, collection: _.NumericDictionary) => number|number[]; + let numericDictionaryIterator: (value: number, key: number, collection: _.NumericDictionary) => number|number[] = (a, b, c) => 1; { let result: string[]; @@ -4001,13 +4000,13 @@ namespace TestFlatMap { // _.forEach namespace TestForEach { - let array: TResult[]; - let list: _.List; - let dictionary: _.Dictionary; + let array: TResult[] = []; + let list: _.List = []; + let dictionary: _.Dictionary = {}; - let stringIterator: (char: string, index: number, string: string) => any; - let listIterator: (value: TResult, index: number, collection: _.List) => any; - let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any; + let stringIterator: (char: string, index: number, string: string) => any = (char: string, index: number, string: string) => 1; + let listIterator: (value: TResult, index: number, collection: _.List) => any = (value: TResult, index: number, collection: _.List) => 1; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any = (value: TResult, key: string, collection: _.Dictionary) => 1; { let result: string; @@ -4084,13 +4083,13 @@ namespace TestForEach { // _.forEachRight namespace TestForEachRight { - let array: TResult[]; - let list: _.List; - let dictionary: _.Dictionary; + let array: TResult[] = []; + let list: _.List = []; + let dictionary: _.Dictionary = {}; - let stringIterator: (char: string, index: number, string: string) => any; - let listIterator: (value: TResult, index: number, collection: _.List) => any; - let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any; + let stringIterator: (char: string, index: number, string: string) => any = (char: string, index: number, string: string) => 1; + let listIterator: (value: TResult, index: number, collection: _.List) => any = (value: TResult, index: number, collection: _.List) => 1; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any = (value: TResult, key: string, collection: _.Dictionary) => 1; { let result: string; @@ -4169,13 +4168,13 @@ namespace TestForEachRight { namespace TestGroupBy { type SampleType = {a: number; b: string; c: boolean;}; - let array: SampleType[]; - let list: _.List; - let dictionary: _.Dictionary; + let array: SampleType[] = []; + let list: _.List = []; + let dictionary: _.Dictionary = {}; - let stringIterator: (char: string, index: number, string: string) => number; - let listIterator: (value: SampleType, index: number, collection: _.List) => number; - let dictionaryIterator: (value: SampleType, key: string, collection: _.Dictionary) => number; + let stringIterator = (char: string, index: number, string: string) => 0; + let listIterator = (value: SampleType, index: number, collection: _.List) => 0; + let dictionaryIterator = (value: SampleType, key: string, collection: _.Dictionary) => 0; { let result: _.Dictionary; @@ -4291,11 +4290,11 @@ namespace TestGroupBy { namespace TestIncludes { type SampleType = {a: string; b: number; c: boolean;}; - let array: SampleType[]; - let list: _.List; - let dictionary: _.Dictionary; + let array: SampleType[] = []; + let list: _.List = []; + let dictionary: _.Dictionary = {}; - let target: SampleType; + let target: SampleType = { a: "", b: 1, c: true }; { let result: boolean; @@ -4337,15 +4336,15 @@ namespace TestIncludes { namespace TestKeyBy { type SampleObject = {a: number; b: string; c: boolean;}; - let array: SampleObject[]; - let list: _.List; - let dictionary: _.Dictionary; - let numericDictionary: _.NumericDictionary; + let array: SampleObject[] = []; + let list: _.List = []; + let dictionary: _.Dictionary = {}; + let numericDictionary: _.NumericDictionary = {}; - let stringIterator: (value: string, index: number, collection: string) => any; - let listIterator: (value: SampleObject, index: number, collection: _.List) => any; - let dictionaryIterator: (value: SampleObject, key: string, collection: _.Dictionary) => any; - let numericDictionaryIterator: (value: SampleObject, key: number, collection: _.NumericDictionary) => any; + let stringIterator: (value: string, index: number, collection: string) => any = (value: string, index: number, collection: string) => 1; + let listIterator: (value: SampleObject, index: number, collection: _.List) => any = (value: SampleObject, index: number, collection: _.List) => 1; + let dictionaryIterator: (value: SampleObject, key: string, collection: _.Dictionary) => any = (value: SampleObject, key: string, collection: _.Dictionary) => 1; + let numericDictionaryIterator: (value: SampleObject, key: number, collection: _.NumericDictionary) => any = (value: SampleObject, key: number, collection: _.NumericDictionary) => 1; { let result: _.Dictionary; @@ -4583,12 +4582,12 @@ namespace TestInvokeMap { // _.map namespace TestMap { - let array: number[]; - let list: _.List; - let dictionary: _.Dictionary; + let array: number[] = []; + let list: _.List = []; + let dictionary: _.Dictionary = {}; - let listIterator: (value: number, index: number, collection: _.List) => TResult; - let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => TResult; + let listIterator: (value: number, index: number, collection: _.List) => TResult = (value: number, index: number, collection: _.List) => ({ a: 1, b: "", c: true }); + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => TResult = (value: number, key: string, collection: _.Dictionary) => ({ a: 1, b: "", c: true }); { _.map(array); // $ExpectType number[] @@ -4698,9 +4697,9 @@ result = <{a: number}[][]>_({0: {a: 1}, 1: {a: 2}}).partition<{a: number}>('a', // d: {b: TResult}[]; // } // -// let array: SampleObject[]; -// let list: _.List; -// let dictionary: _.Dictionary; +// let array: SampleObject[] = []; +// let list: _.List = []; +// let dictionary: _.Dictionary = {}; // // { // let result: any[]; @@ -4776,19 +4775,19 @@ namespace TestReduce { result = _({ 'a': 1, 'b': 2, 'c': 3 }).reduce((r: ABC, num: number, key: string) => { r[key] = num * 3; return r; - }, {}); + }, { a: 1, b: 2, c: 3 }); result = _.reduceRight([[0, 1], [2, 3], [4, 5]], (a: number[], b: number[]) => a.concat(b), []); } // _.reject namespace TestReject { - let array: TResult[]; - let list: _.List; - let dictionary: _.Dictionary; + let array: TResult[] = []; + let list: _.List = []; + let dictionary: _.Dictionary = {}; - let stringIterator: (char: string, index: number, string: string) => any; - let listIterator: (value: TResult, index: number, collection: _.List) => any; - let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any; + let stringIterator: (char: string, index: number, string: string) => any = (char: string, index: number, string: string) => 1; + let listIterator: (value: TResult, index: number, collection: _.List) => any = (value: TResult, index: number, collection: _.List) => 1; + let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => any = (value: TResult, key: string, collection: _.Dictionary) => 1; { let result: string[]; @@ -4859,10 +4858,10 @@ namespace TestReject { // _.sample namespace TestSample { - let array: string[]; - let list: _.List; - let dictionary: _.Dictionary; - let numericDictionary: _.NumericDictionary; + let array: string[] = []; + let list: _.List = []; + let dictionary: _.Dictionary = {}; + let numericDictionary: _.NumericDictionary = {}; { let result: string; @@ -4897,10 +4896,10 @@ namespace TestSample { // _.sampleSize namespace TestSampleSize { - let array: string[]; - let list: _.List; - let dictionary: _.Dictionary; - let numericDictionary: _.NumericDictionary; + let array: string[] = []; + let list: _.List = []; + let dictionary: _.Dictionary = {}; + let numericDictionary: _.NumericDictionary = {}; { let result: string[]; @@ -4958,9 +4957,9 @@ namespace TestSampleSize { // _.shuffle namespace TestShuffle { - let array: TResult[]; - let list: _.List; - let dictionary: _.Dictionary; + let array: TResult[] = []; + let list: _.List = []; + let dictionary: _.Dictionary = {}; { let result: string[]; @@ -5009,9 +5008,9 @@ namespace TestShuffle { namespace TestSize { type SampleType = {a: string; b: number; c: boolean;}; - let array: SampleType[]; - let list: _.List; - let dictionary: _.Dictionary; + let array: SampleType[] = []; + let list: _.List = []; + let dictionary: _.Dictionary = {}; { let result: number; @@ -5041,16 +5040,16 @@ namespace TestSize { namespace TestSome { type SampleObject = {a: number; b: string; c: boolean;}; - let array: SampleObject[]; - let list: _.List; - let dictionary: _.Dictionary; - let numericDictionary: _.NumericDictionary; - let sampleObject: SampleObject; + let array: SampleObject[] = []; + let list: _.List = []; + let dictionary: _.Dictionary = {}; + let numericDictionary: _.NumericDictionary = {}; + let sampleObject: SampleObject = { a: 1, b: "", c: true }; - let listIterator: (value: SampleObject, index: number, collection: _.List) => boolean; - let dictionaryIterator: (value: SampleObject, key: string, collection: _.Dictionary) => boolean; - let numericDictionaryIterator: (value: SampleObject, key: number, collection: _.NumericDictionary) => boolean; - let objectIterator: (value: any, key: string, collection: any) => boolean; + let listIterator = (value: SampleObject, index: number, collection: _.List) => true; + let dictionaryIterator = (value: SampleObject, key: string, collection: _.Dictionary) => true; + let numericDictionaryIterator = (value: SampleObject, key: number, collection: _.NumericDictionary) => true; + let objectIterator = (value: any, key: string, collection: any) => true; { let result: boolean; @@ -5068,7 +5067,13 @@ namespace TestSome { result = _.some(list, {a: 42}); result = _.some(dictionary); - result = _.some(dictionary, dictionaryIterator); + result = _.some(numericDictionary, dictionaryIterator); + result = _.some(dictionary, (value, key, collection) => { + value.a--; + key.substr(0); + value = collection[key]; + return true; + }); result = _.some(dictionary, 'a'); result = _.some(dictionary, ['a', 42]); result = _.some(dictionary, {a: 42}); @@ -5153,12 +5158,12 @@ namespace TestSome { // _.sortBy namespace TestSortBy { - let array: TResult[]; - let list: _.List; - let dictionary: _.Dictionary; + let array: TResult[] = []; + let list: _.List = []; + let dictionary: _.Dictionary = {}; - let listIterator: (value: TResult, index: number, collection: _.List) => number; - let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => number; + let listIterator = (value: TResult, index: number, collection: _.List) => 0; + let dictionaryIterator = (value: TResult, key: string, collection: _.Dictionary) => 0; { let result: TResult[]; @@ -5228,14 +5233,14 @@ result = _(foodsOrganic).sortBy('organic', (food) => food.name, namespace TestorderBy { type SampleObject = {a: number; b: string; c: boolean}; - let array: SampleObject[]; - let list: _.List; - let numericDictionary: _.NumericDictionary; - let dictionary: _.Dictionary; - let orders: boolean|string|(boolean|string)[]; + let array: SampleObject[] = []; + let list: _.List = []; + let numericDictionary: _.NumericDictionary = {}; + let dictionary: _.Dictionary = {}; + let orders: boolean|string|(boolean|string)[] = true as any; { - let iteratees: (value: string) => any|((value: string) => any)[]; + let iteratees: (value: string) => any|((value: string) => any)[] = (value) => 1; let result: string[]; result = _.orderBy('acbd', iteratees); @@ -5243,7 +5248,7 @@ namespace TestorderBy { } { - let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; + let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[] = (value) => 1; let result: SampleObject[]; result = _.orderBy<{a: number}, SampleObject>(array, iteratees); @@ -5268,7 +5273,7 @@ namespace TestorderBy { } { - let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; + let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[] = (value) => ""; let result: _.LoDashImplicitArrayWrapper; result = _(array).orderBy<{a: number}>(iteratees); @@ -5291,7 +5296,7 @@ namespace TestorderBy { } { - let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[]; + let iteratees: (value: SampleObject) => any|string|{a: number}|((value: SampleObject) => any|string|{a: number})[] = (value) => ""; let result: _.LoDashExplicitArrayWrapper; result = _(array).chain().orderBy<{a: number}>(iteratees); @@ -5346,7 +5351,7 @@ namespace TestAfter { (a: string, b: number): boolean; } - let func: Func; + let func: Func = (a, b) => true; { let result: Func; @@ -5371,7 +5376,7 @@ namespace TestAfter { namespace TestAry { type SampleFunc = (a: number, b: string) => boolean; - let func: SampleFunc; + let func: SampleFunc = (a, b) => true; { let result: SampleFunc; @@ -5403,7 +5408,7 @@ namespace TestBefore { (a: string, b: number): boolean; } - let func: Func; + let func: Func = (a, b) => true; { let result: Func; @@ -5428,7 +5433,7 @@ namespace TestBefore { namespace TestBind { type SampleFunc = (a: number, b: string) => boolean; - let func: SampleFunc + let func: SampleFunc = (a, b) => true; { type SampleResult = (a: number, b: string) => boolean; @@ -5514,7 +5519,7 @@ namespace TestBindAll { c: Function; } - let object: SampleObject; + let object: SampleObject = { a: () => {}, b: () => {}, c: () => {} }; { let result: SampleObject; @@ -5546,9 +5551,9 @@ namespace TestBindAll { // _.bindKey namespace TestBindKey { - let object: { - foo(a: number, b: string): boolean; - } + let object = { + foo: (a: number, b: string) => true, + }; { type SampleResult = (a: number, b: string) => boolean; @@ -5699,8 +5704,8 @@ namespace TestDebounce { cancel(): void; } - let func: SampleFunc; - let options: Options; + let func: SampleFunc = (a, b) => true; + let options: Options = {}; { let result: ResultFunc; @@ -5731,7 +5736,7 @@ namespace TestDebounce { namespace TestDefer { type SampleFunc = (a: number, b: string) => boolean; - let func: SampleFunc; + let func: SampleFunc = (a, b) => true; { let result: number; @@ -5765,7 +5770,7 @@ namespace TestDefer { namespace TestDelay { type SampleFunc = (a: number, b: string) => boolean; - let func: SampleFunc; + let func: SampleFunc = (a, b) => true; { let result: number; @@ -5798,7 +5803,7 @@ namespace TestFlip { (a: number, b: string): boolean; } - let func: Func; + let func: Func = (a, b) => true; { let result: Func; @@ -5821,10 +5826,10 @@ namespace TestFlip { // _.flow namespace TestFlow { - let Fn1: (n: number) => number; - let Fn2: (m: number, n: number) => number; - let Fn3: (a: number) => string; - let Fn4: (a: string) => number; + let Fn1 = (n: number) => 0; + let Fn2 = (m: number, n: number) => 0; + let Fn3 = (a: number) => ""; + let Fn4 = (a: string) => 0; { // type infer test @@ -5866,8 +5871,8 @@ namespace TestFlow { // _.flowRight namespace TestFlowRight { - let Fn1: (n: number) => number; - let Fn2: (m: number, n: number) => number; + let Fn1 = (n: number) => 0; + let Fn2 = (m: number, n: number) => 0; { let result: (m: number, n: number) => number; @@ -5897,7 +5902,8 @@ namespace TestFlowRight { // _.memoize namespace TestMemoize { { - let memoizedFunction: _.MemoizedFunction; + let fn: any = () => {}; + let memoizedFunction: _.MemoizedFunction = fn; let cache: _.MapCache = memoizedFunction.cache; } @@ -5905,8 +5911,8 @@ namespace TestMemoize { (a1: string, a2: number): boolean; } - let memoizeFn: (a1: string, a2: number) => boolean; - let memoizeResolverFn: (a1: string, a2: number) => string; + let memoizeFn = (a1: string, a2: number) => true; + let memoizeResolverFn = (a1: string, a2: number) => ""; { let result: MemoizedResultFn; @@ -5938,12 +5944,14 @@ namespace TestMemoize { has(key: K): boolean; set(key: K, value: V): this; } - interface MemoizeCacheConstructor { - new (): MemoizeCache; + class MemoizeCacheClass implements MemoizeCache { + delete: (key: any) => true; + get: (key: any) => 1; + has: (key: any) => true; + set: (key: any, value: any) => this; } - let MemoizeCache: MemoizeCacheConstructor - _.memoize.Cache = MemoizeCache; + _.memoize.Cache = MemoizeCacheClass; } // _.overArgs @@ -5951,11 +5959,11 @@ namespace TestOverArgs { type Func1 = (a: boolean) => boolean; type Func2 = (a: boolean, b: boolean) => boolean; - let func1: Func1; - let func2: Func2; + let func1: Func1 = (a) => true; + let func2: Func2 = (a, b) => true; - let transform1: (a: string) => boolean; - let transform2: (b: number) => boolean; + let transform1 = (a: string) => true; + let transform2 = (b: number) => true; { let result: (a: string) => boolean; @@ -6040,7 +6048,7 @@ namespace TestOnce { (a: number, b: string): boolean; } - let func: Func; + let func: Func = (a, b) => true; { let result: Func; @@ -6089,7 +6097,7 @@ namespace TestRest { type Func = (a: string, b: number[]) => boolean; type ResultFunc = (a: string, ...b: number[]) => boolean; - let func: Func; + let func: Func = (a, b) => true; { let result: ResultFunc; @@ -6121,7 +6129,7 @@ namespace TestSpread { type SampleFunc = (args: (number|string)[]) => boolean; type SampleResult = (a: number, b: string) => boolean; - let func: SampleFunc; + let func: SampleFunc = (a) => true; { let result: SampleResult; @@ -6159,8 +6167,8 @@ namespace TestThrottle { cancel(): void; } - let func: SampleFunc; - let options: Options; + let func: SampleFunc = (a, b) => true; + let options: Options = {}; { let result: ResultFunc; @@ -6193,7 +6201,7 @@ namespace TestUnary { (a: number, b: string): boolean; } - let func: Func; + let func: Func = (a, b) => true; { let result: Func; @@ -6222,8 +6230,8 @@ namespace TestWrap { { type SampleWrapper = (arg1: SampleValue, arg2: number, arg3: string) => boolean; - let value: SampleValue; - let wrapper: SampleWrapper; + let value: SampleValue = { a: 1, b: "", c: true }; + let wrapper: SampleWrapper = (a, b, c) => true; let result: SampleResult; result = _.wrap(value, wrapper); @@ -6234,8 +6242,8 @@ namespace TestWrap { { type SampleWrapper = (arg1: number, arg2: number, arg3: string) => boolean; - let value: number; - let wrapper: SampleWrapper; + let value: number = 0; + let wrapper: SampleWrapper = (a, b, c) => true; let result: _.LoDashImplicitObjectWrapper; result = _(value).wrap(wrapper); @@ -6245,8 +6253,8 @@ namespace TestWrap { { type SampleWrapper = (arg1: number[], arg2: number, arg3: string) => boolean; - let value: number[]; - let wrapper: SampleWrapper; + let value: number[] = []; + let wrapper: SampleWrapper = (a, b, c) => true; let result: _.LoDashImplicitObjectWrapper; result = _(value).wrap(wrapper); @@ -6256,8 +6264,8 @@ namespace TestWrap { { type SampleWrapper = (arg1: SampleValue, arg2: number, arg3: string) => boolean; - let value: SampleValue; - let wrapper: SampleWrapper; + let value: SampleValue = { a: 1, b: "", c: true }; + let wrapper: SampleWrapper = (a, b, c) => true; let result: _.LoDashImplicitObjectWrapper; result = _(value).wrap(wrapper); @@ -6267,8 +6275,8 @@ namespace TestWrap { { type SampleWrapper = (arg1: number, arg2: number, arg3: string) => boolean; - let value: number; - let wrapper: SampleWrapper; + let value: number = 0; + let wrapper: SampleWrapper = (a, b, c) => true; let result: _.LoDashExplicitObjectWrapper; result = _(value).chain().wrap(wrapper); @@ -6278,8 +6286,8 @@ namespace TestWrap { { type SampleWrapper = (arg1: number[], arg2: number, arg3: string) => boolean; - let value: number[]; - let wrapper: SampleWrapper; + let value: number[] = []; + let wrapper: SampleWrapper = (a, b, c) => true; let result: _.LoDashExplicitObjectWrapper; result = _(value).chain().wrap(wrapper); @@ -6289,8 +6297,8 @@ namespace TestWrap { { type SampleWrapper = (arg1: SampleValue, arg2: number, arg3: string) => boolean; - let value: SampleValue; - let wrapper: SampleWrapper; + let value: SampleValue = { a: 1, b: "", c: true }; + let wrapper: SampleWrapper = (a, b, c) => true; let result: _.LoDashExplicitObjectWrapper; result = _(value).chain().wrap(wrapper); @@ -6428,7 +6436,7 @@ namespace TestCloneDeepWith { } { - let customizer: CloneDeepWithCustomizer; + let customizer: CloneDeepWithCustomizer = (x) => ""; let reslut: string; result = _.cloneDeepWith(42, customizer); @@ -6437,14 +6445,14 @@ namespace TestCloneDeepWith { } { - let customizer: CloneDeepWithCustomizer; + let customizer: CloneDeepWithCustomizer = (x) => ""; let result: _.LoDashExplicitWrapper; result = _(42).chain().cloneDeepWith(customizer); } { - let customizer: CloneDeepWithCustomizer; + let customizer: CloneDeepWithCustomizer = (x) => []; let reslut: string[]; result = _.cloneDeepWith([42], customizer); @@ -6453,14 +6461,14 @@ namespace TestCloneDeepWith { } { - let customizer: CloneDeepWithCustomizer; + let customizer: CloneDeepWithCustomizer = (x) => []; let result: _.LoDashExplicitArrayWrapper; result = _([42]).chain().cloneDeepWith(customizer); } { - let customizer: CloneDeepWithCustomizer<{a: {b: number;};}, {a: {b: string;};}>; + let customizer: CloneDeepWithCustomizer<{a: {b: number;};}, {a: {b: string;};}> = (x) => ({ a: { b: "" } }); let reslut: {a: {b: string;};}; result = _.cloneDeepWith<{a: {b: string;};}>({a: {b: 42}}, customizer); @@ -6469,7 +6477,7 @@ namespace TestCloneDeepWith { } { - let customizer: CloneDeepWithCustomizer<{a: {b: number;};}, {a: {b: string;};}>; + let customizer: CloneDeepWithCustomizer<{a: {b: number;};}, {a: {b: string;};}> = (x) => ({ a: { b: "" } }); let result: _.LoDashExplicitObjectWrapper<{a: {b: string;};}>; result = _({a: {b: 42}}).chain().cloneDeepWith<{a: {b: string;};}>(customizer); @@ -6483,7 +6491,7 @@ namespace TestCloneWith { } { - let customizer: CloneWithCustomizer; + let customizer: CloneWithCustomizer = (x) => ""; let reslut: string; result = _.cloneWith(42, customizer); @@ -6492,14 +6500,14 @@ namespace TestCloneWith { } { - let customizer: CloneWithCustomizer; + let customizer: CloneWithCustomizer = (x) => ""; let result: _.LoDashExplicitWrapper; result = _(42).chain().cloneWith(customizer); } { - let customizer: CloneWithCustomizer; + let customizer: CloneWithCustomizer = (x) => []; let reslut: string[]; result = _.cloneWith([42], customizer); @@ -6508,14 +6516,14 @@ namespace TestCloneWith { } { - let customizer: CloneWithCustomizer; + let customizer: CloneWithCustomizer = (x) => []; let result: _.LoDashExplicitArrayWrapper; result = _([42]).chain().cloneWith(customizer); } { - let customizer: CloneWithCustomizer<{a: {b: number;};}, {a: {b: string;};}>; + let customizer: CloneWithCustomizer<{a: {b: number;};}, {a: {b: string;};}> = (x) => ({ a: { b: "" } }); let reslut: {a: {b: string;};}; result = _.cloneWith<{a: {b: string;};}>({a: {b: 42}}, customizer); @@ -6524,7 +6532,7 @@ namespace TestCloneWith { } { - let customizer: CloneWithCustomizer<{a: {b: number;};}, {a: {b: string;};}>; + let customizer: CloneWithCustomizer<{a: {b: number;};}, {a: {b: string;};}> = (x) => ({ a: { b: "" } }); let result: _.LoDashExplicitObjectWrapper<{a: {b: string;};}>; result = _({a: {b: 42}}).chain().cloneWith<{a: {b: string;};}>(customizer); @@ -6605,7 +6613,7 @@ namespace TestGte { // _.isArguments namespace TestisArguments { { - let value: number|IArguments; + let value: number|IArguments = 0; if (_.isArguments(value)) { let result: IArguments = value; @@ -6636,7 +6644,7 @@ namespace TestisArguments { // _.isArray namespace TestIsArray { { - let value: number|string[]|boolean[]; + let value: number|string[]|boolean[] = []; if (_.isArray(value)) { let result: string[] = value; @@ -6672,7 +6680,7 @@ namespace TestIsArray { // _.isArrayBuffer namespace TestIsArrayBuffer { { - let value: ArrayBuffer|number; + let value: ArrayBuffer|number = 0; if (_.isArrayBuffer(value)) { let result: ArrayBuffer = value; @@ -6703,7 +6711,7 @@ namespace TestIsArrayBuffer { // _.isArrayLike namespace TestIsArrayLike { { - let value: number|string[]|boolean[]; + let value: number|string[]|boolean[] = []; if (_.isArrayLike(value)) { let result: string[] = value; @@ -6739,7 +6747,7 @@ namespace TestIsArrayLike { // _.isArrayLikeObject namespace TestIsArrayLikeObject { { - let value: number|string[]|boolean[]; + let value: number|string[]|boolean[] = []; if (_.isArrayLikeObject(value)) { let result: string[] = value; @@ -6775,7 +6783,7 @@ namespace TestIsArrayLikeObject { // _.isBoolean namespace TestIsBoolean { { - let value: number|boolean; + let value: number|boolean = 0; if (_.isBoolean(value)) { let result: boolean = value; @@ -6826,7 +6834,7 @@ namespace TestIsBuffer { // _.isDate namespace TestIsBoolean { { - let value: number|Date; + let value: number|Date = 0; if (_.isDate(value)) { let result: Date = value; @@ -6918,7 +6926,7 @@ namespace TestIsEqual { // _.isEqualWith namespace TestIsEqualWith { - let customizer: (value: any, other: any, indexOrKey?: number|string) => boolean; + let customizer = (value: any, other: any, indexOrKey?: number|string) => true; { let result: boolean; @@ -6937,8 +6945,9 @@ namespace TestIsEqualWith { // _.isError namespace TestIsError { + let x: any = 1; { - let value: number|Error; + let value: number|Error = x; if (_.isError(value)) { let result: Error = value; @@ -6953,7 +6962,7 @@ namespace TestIsError { custom: string } - let value: number|CustomError; + let value: number|CustomError = x; if (_.isError(value)) { let result: CustomError = value; @@ -7004,7 +7013,7 @@ namespace TestIsFinite { // _.isFunction namespace TestIsFunction { { - let value: number|Function; + let value: number|Function = () => {}; if (_.isFunction(value)) { let result: Function = value; @@ -7077,7 +7086,7 @@ namespace TestIsLength { // _.isMap namespace TestIsMap { { - let value: number|Map; + let value: number|Map = 0; if (_.isMap(value)) { let result: Map = value; @@ -7117,7 +7126,7 @@ namespace TestIsMatch { // _.isMatchWith namespace TestIsMatchWith { - let testIsMatchCustiomizerFn: (value: any, other: any, indexOrKey: number|string) => boolean; + let testIsMatchCustiomizerFn = (value: any, other: any, indexOrKey: number|string) => true; let result: boolean; @@ -7149,7 +7158,7 @@ namespace TestIsNaN { // _.isNative namespace TestIsNative { { - let value: number|Function; + let value: number|Function = () => {}; if (_.isNative(value)) { let result: Function = value; @@ -7223,7 +7232,7 @@ namespace TestIsNull { // _.isNumber namespace TestIsNumber { { - let value: string|number; + let value: string|number = 0; if (_.isNumber(value)) { let result: number = value; @@ -7315,7 +7324,7 @@ namespace TestIsPlainObject { // _.isRegExp namespace TestIsRegExp { { - let value: number|RegExp; + let value: number|RegExp = /./; if (_.isRegExp(value)) { let result: RegExp = value; @@ -7367,7 +7376,7 @@ namespace TestIsSafeInteger { // _.isSet namespace TestIsSet { { - let value: number|Set; + let value: number|Set = 0; if (_.isSet(value)) { let result: Set = value; @@ -7398,7 +7407,7 @@ namespace TestIsSet { // _.isString namespace TestIsString { { - let value: number|string; + let value: number|string = ''; if (_.isString(value)) { let result: string = value; @@ -7489,7 +7498,7 @@ namespace TestIsWeakMap { { interface Obj { a: string }; - let value: number|WeakMap; + let value: number|WeakMap = 0; if (_.isWeakMap(value)) { let result: WeakMap = value; @@ -7520,7 +7529,7 @@ namespace TestIsWeakMap { // _.isWeakSet namespace TestIsWeakSet { { - let value: number|WeakSet; + let value: number|WeakSet = 0; if (_.isWeakSet(value)) { let result: WeakSet = value; @@ -7590,10 +7599,10 @@ namespace TestLte { // _.toArray namespace TestToArray { - let array: TResult[]; - let list: _.List; - let dictionary: _.Dictionary; - let numericDictionary: _.NumericDictionary; + let array: TResult[] = []; + let list: _.List = []; + let dictionary: _.Dictionary = {}; + let numericDictionary: _.NumericDictionary = {}; { let result: string[]; @@ -7824,8 +7833,8 @@ namespace TestFloor { // _.max namespace TestMax { - let array: number[]; - let list: _.List; + let array: number[] = []; + let list: _.List = []; let result: number; @@ -7838,12 +7847,12 @@ namespace TestMax { // _.maxBy namespace TestMaxBy { - let array: number[]; - let list: _.List; - let dictionary: _.Dictionary; + let array: number[] = []; + let list: _.List = []; + let dictionary: _.Dictionary = {}; - let listIterator: (value: number, index: number, collection: _.List) => number; - let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => number; + let listIterator = (value: number, index: number, collection: _.List) => 0; + let dictionaryIterator = (value: number, key: string, collection: _.Dictionary) => 0; let result: number; @@ -7880,7 +7889,7 @@ namespace TestMaxBy { // _.mean namespace TestMean { - let array: number[]; + let array: number[] = []; let result: number; @@ -7891,8 +7900,8 @@ namespace TestMean { // _.min namespace TestMin { - let array: number[]; - let list: _.List; + let array: number[] = []; + let list: _.List = []; let result: number; @@ -7905,12 +7914,12 @@ namespace TestMin { // _.minBy namespace TestMinBy { - let array: number[]; - let list: _.List; - let dictionary: _.Dictionary; + let array: number[] = []; + let list: _.List = []; + let dictionary: _.Dictionary = {}; - let listIterator: (value: number, index: number, collection: _.List) => number; - let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => number; + let listIterator = (value: number, index: number, collection: _.List) => 0; + let dictionaryIterator = (value: number, key: string, collection: _.Dictionary) => 0; let result: number; @@ -7967,12 +7976,12 @@ namespace TestRound { // _.sum namespace TestSum { - let array: number[]; - let list: _.List; - let dictionary: _.Dictionary; + let array: number[] = []; + let list: _.List = []; + let dictionary: _.Dictionary = {}; - let listIterator: (value: number, index: number, collection: _.List) => number; - let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => number; + let listIterator = (value: number, index: number, collection: _.List) => 0; + let dictionaryIterator = (value: number, key: string, collection: _.Dictionary) => 0; { let result: number; @@ -8003,13 +8012,13 @@ namespace TestSum { // _.sumBy namespace TestSumBy { - let array: number[]; - let objectArray: { 'age': number }[]; + let array: number[] = []; + let objectArray: { 'age': number }[] = []; - let list: _.List; - let objectList: _.List<{ 'age': number }>; + let list: _.List = []; + let objectList: _.List<{ 'age': number }> = []; - let listIterator: (value: number, index: number, collection: _.List) => number; + let listIterator = (value: number, index: number, collection: _.List) => 0; { let result: number; @@ -8143,14 +8152,12 @@ namespace TestAssign { interface S4 { d: number }; interface S5 { e: number }; - let obj: Obj; - let s1: S1; - let s2: S2; - let s3: S3; - let s4: S4; - let s5: S5; - - let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any; + let obj: Obj = { a: "" }; + let s1: S1 = { a: 1 }; + let s2: S2 = { b: 1 }; + let s3: S3 = { c: 1 }; + let s4: S4 = { d: 1 }; + let s5: S5 = { e: 1 }; { let result: Obj; @@ -8270,14 +8277,14 @@ namespace TestAssignWith { interface S4 { d: number }; interface S5 { e: number }; - let obj: Obj; - let s1: S1; - let s2: S2; - let s3: S3; - let s4: S4; - let s5: S5; + let obj: Obj = { a: "" }; + let s1: S1 = { a: 1 }; + let s2: S2 = { b: 1 }; + let s3: S3 = { c: 1 }; + let s4: S4 = { d: 1 }; + let s5: S5 = { e: 1 }; - let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any; + let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any = (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => 1; { let result: Obj; @@ -8382,14 +8389,14 @@ namespace TestAssignIn { interface S4 { d: number }; interface S5 { e: number }; - let obj: Obj; - let s1: S1; - let s2: S2; - let s3: S3; - let s4: S4; - let s5: S5; + let obj: Obj = { a: "" }; + let s1: S1 = { a: 1 }; + let s2: S2 = { b: 1 }; + let s3: S3 = { c: 1 }; + let s4: S4 = { d: 1 }; + let s5: S5 = { e: 1 }; - let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any; + let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any = (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => 1; { let result: Obj; @@ -8509,14 +8516,14 @@ namespace TestAssignInWith { interface S4 { d: number }; interface S5 { e: number }; - let obj: Obj; - let s1: S1; - let s2: S2; - let s3: S3; - let s4: S4; - let s5: S5; + let obj: Obj = { a: "" }; + let s1: S1 = { a: 1 }; + let s2: S2 = { b: 1 }; + let s3: S3 = { c: 1 }; + let s4: S4 = { d: 1 }; + let s5: S5 = { e: 1 }; - let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any; + let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any = (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => 1; { let result: Obj; @@ -8617,8 +8624,8 @@ namespace TestCreate { type SampleProto = {a: number}; type SampleProps = {b: string}; - let prototype: SampleProto; - let properties: SampleProps; + let prototype: SampleProto = { a: 1 }; + let properties: SampleProps = { b: "" }; { let result: {a: number; b: string}; @@ -8651,12 +8658,12 @@ namespace TestDefaults { interface S4 { d: number }; interface S5 { e: number }; - let obj: Obj; - let s1: S1; - let s2: S2; - let s3: S3; - let s4: S4; - let s5: S5; + let obj: Obj = { a: "" }; + let s1: S1 = { a: 1 }; + let s2: S2 = { b: 1 }; + let s3: S3 = { c: 1 }; + let s4: S4 = { d: 1 }; + let s5: S5 = { e: 1 }; { let result: Obj; @@ -8788,14 +8795,14 @@ namespace TestExtend { type S4 = { d: number }; type S5 = { e: number }; - let obj: Obj; - let s1: S1; - let s2: S2; - let s3: S3; - let s4: S4; - let s5: S5; + let obj: Obj = { a: "" }; + let s1: S1 = { a: 1 }; + let s2: S2 = { b: 1 }; + let s3: S3 = { c: 1 }; + let s4: S4 = { d: 1 }; + let s5: S5 = { e: 1 }; - let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any; + let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any = (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => 1; { let result: Obj; @@ -8915,14 +8922,14 @@ namespace TestExtendWith { type S4 = { d: number }; type S5 = { e: number }; - let obj: Obj; - let s1: S1; - let s2: S2; - let s3: S3; - let s4: S4; - let s5: S5; + let obj: Obj = { a: "" }; + let s1: S1 = { a: 1 }; + let s2: S2 = { b: 1 }; + let s3: S3 = { c: 1 }; + let s4: S4 = { d: 1 }; + let s5: S5 = { e: 1 }; - let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any; + let customizer: (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any = (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => 1; { let result: Obj; @@ -9036,7 +9043,7 @@ namespace TestExtendWith { // _.findKey namespace TestFindKey { { - let predicateFn: (value: any, key?: string, object?: {}) => boolean; + let predicateFn = (value: any, key: string, object: {}) => true; let result: string; result = _.findKey<{a: string;}>({a: ''}); @@ -9057,7 +9064,7 @@ namespace TestFindKey { } { - let predicateFn: (value: string, key?: string, collection?: _.Dictionary) => boolean; + let predicateFn = (value: string, key: string, collection: _.Dictionary) => true; let result: string; result = _.findKey({a: ''}, predicateFn); @@ -9066,7 +9073,7 @@ namespace TestFindKey { } { - let predicateFn: (value: any, key?: string, object?: {}) => boolean; + let predicateFn = (value: any, key: string, object: {}) => true; let result: _.LoDashExplicitWrapper; result = _<{a: string;}>({a: ''}).chain().findKey(); @@ -9079,7 +9086,7 @@ namespace TestFindKey { } { - let predicateFn: (value: string, key?: string, collection?: _.Dictionary) => boolean; + let predicateFn = (value: string, key: string, collection: _.Dictionary) => true; let result: _.LoDashExplicitWrapper; result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn); @@ -9089,7 +9096,7 @@ namespace TestFindKey { // _.findLastKey namespace TestFindLastKey { { - let predicateFn: (value: any, key?: string, object?: {}) => boolean; + let predicateFn = (value: any, key: string, object: {}) => true; let result: string; result = _.findLastKey<{a: string;}>({a: ''}); @@ -9110,7 +9117,7 @@ namespace TestFindLastKey { } { - let predicateFn: (value: string, key?: string, collection?: _.Dictionary) => boolean; + let predicateFn = (value: string, key: string, collection: _.Dictionary) => true; let result: string; result = _.findLastKey({a: ''}, predicateFn); @@ -9119,7 +9126,7 @@ namespace TestFindLastKey { } { - let predicateFn: (value: any, key?: string, object?: {}) => boolean; + let predicateFn = (value: any, key: string, object: {}) => true; let result: _.LoDashExplicitWrapper; result = _<{a: string;}>({a: ''}).chain().findLastKey(); @@ -9132,7 +9139,7 @@ namespace TestFindLastKey { } { - let predicateFn: (value: string, key?: string, collection?: _.Dictionary) => boolean; + let predicateFn = (value: string, key: string, collection: _.Dictionary) => true; let result: _.LoDashExplicitWrapper; result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn); @@ -9143,11 +9150,11 @@ namespace TestFindLastKey { namespace TestForIn { type SampleObject = {a: number; b: string; c: boolean;}; - let dictionary: _.Dictionary; - let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any; + let dictionary: _.Dictionary = {}; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any = (value: number, key: string, collection: _.Dictionary) => 1; - let object: SampleObject; - let objectIterator: (element: any, key?: string, collection?: any) => any; + let object: SampleObject = { a: 1, b: "", c: true }; + let objectIterator: (element: any, key?: string, collection?: any) => any = (element: any, key?: string, collection?: any) => 1; { let result: _.Dictionary; @@ -9182,11 +9189,11 @@ namespace TestForIn { namespace TestForInRight { type SampleObject = {a: number; b: string; c: boolean;}; - let dictionary: _.Dictionary; - let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any; + let dictionary: _.Dictionary = {}; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any = (value: number, key: string, collection: _.Dictionary) => 1; - let object: SampleObject; - let objectIterator: (element: any, key?: string, collection?: any) => any; + let object: SampleObject = { a: 1, b: "", c: true }; + let objectIterator: (element: any, key?: string, collection?: any) => any = (element: any, key?: string, collection?: any) => 1; { let result: _.Dictionary; @@ -9221,11 +9228,11 @@ namespace TestForInRight { namespace TestForOwn { type SampleObject = {a: number; b: string; c: boolean;}; - let dictionary: _.Dictionary; - let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any; + let dictionary: _.Dictionary = {}; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any = (value: number, key: string, collection: _.Dictionary) => 1; - let object: SampleObject; - let objectIterator: (element: any, key?: string, collection?: any) => any; + let object: SampleObject = { a: 1, b: "", c: true }; + let objectIterator: (element: any, key?: string, collection?: any) => any = (element: any, key?: string, collection?: any) => 1; { let result: _.Dictionary; @@ -9260,11 +9267,11 @@ namespace TestForOwn { namespace TestForOwnRight { type SampleObject = {a: number; b: string; c: boolean;}; - let dictionary: _.Dictionary; - let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any; + let dictionary: _.Dictionary = {}; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any = (value: number, key: string, collection: _.Dictionary) => 1; - let object: SampleObject; - let objectIterator: (element: any, key?: string, collection?: any) => any; + let object: SampleObject = { a: 1, b: "", c: true }; + let objectIterator: (element: any, key?: string, collection?: any) => any = (element: any, key?: string, collection?: any) => 1; { let result: _.Dictionary; @@ -9299,7 +9306,7 @@ namespace TestForOwnRight { namespace TestFunctions { type SampleObject = {a: number; b: string; c: boolean;}; - let object: SampleObject; + let object: SampleObject = { a: 1, b: "", c: true }; { let result: string[]; @@ -9324,7 +9331,7 @@ namespace TestFunctions { namespace TestFunctionsIn { type SampleObject = {a: number; b: string; c: boolean;}; - let object: SampleObject; + let object: SampleObject = { a: 1, b: "", c: true }; { let result: string[]; @@ -9436,7 +9443,7 @@ namespace TestGet { namespace TestHas { type SampleObject = {a: number; b: string; c: boolean;}; - let object: SampleObject; + let object: SampleObject = { a: 1, b: "", c: true }; { let result: boolean; @@ -9466,7 +9473,7 @@ namespace TestHas { namespace TestHasIn { type SampleObject = {a: number; b: string; c: boolean;}; - let object: SampleObject; + let object: SampleObject = { a: 1, b: "", c: true }; { let result: boolean; @@ -9521,16 +9528,16 @@ namespace TestInvert { // _.invertBy namespace TestInvertBy { - let array: ({a: number;})[]; - let list: _.List<{a: number;}>; - let dictionary: _.Dictionary<{a: number;}>; - let numericDictionary: _.NumericDictionary<{a: number;}>; + let array: ({a: number;})[] = []; + let list: _.List<{a: number;}> = []; + let dictionary: _.Dictionary<{a: number;}> = {}; + let numericDictionary: _.NumericDictionary<{a: number;}> = {}; - let stringIterator: (value: string) => any; - let arrayIterator: (value: {a: number;}) => any; - let listIterator: (value: {a: number;}) => any; - let dictionaryIterator: (value: {a: number;}) => any; - let numericDictionaryIterator: (value: {a: number;}) => any; + let stringIterator: (value: string) => any = (value: string) => 1; + let arrayIterator: (value: {a: number;}) => any = (value: {a: number;}) => 1; + let listIterator: (value: {a: number;}) => any = (value: {a: number;}) => 1; + let dictionaryIterator: (value: {a: number;}) => any = (value: {a: number;}) => 1; + let numericDictionaryIterator: (value: {a: number;}) => any = (value: {a: number;}) => 1; { let result: _.Dictionary; @@ -9616,7 +9623,7 @@ namespace TestInvertBy { // _.keys namespace TestKeys { - let object: _.Dictionary; + let object: _.Dictionary = {}; { let result: string[]; @@ -9639,7 +9646,7 @@ namespace TestKeys { // _.keysIn namespace TestKeysIn { - let object: _.Dictionary; + let object: _.Dictionary = {}; { let result: string[]; @@ -9662,12 +9669,12 @@ namespace TestKeysIn { // _.mapKeys namespace TestMapKeys { - let array: TResult[]; - let list: _.List; - let dictionary: _.Dictionary; + let array: TResult[] = []; + let list: _.List = []; + let dictionary: _.Dictionary = {}; - let listIterator: (value: TResult, index: number, collection: _.List) => string; - let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => string; + let listIterator = (value: TResult, index: number, collection: _.List) => ""; + let dictionaryIterator = (value: TResult, key: string, collection: _.Dictionary) => ""; { let result: _.Dictionary; @@ -9828,7 +9835,7 @@ namespace TestMergeWith { type ExpectedResult = { a: number, b: string }; let result: ExpectedResult; - let customizer: (value: any, srcValue: any, key?: string, object?: InitialValue, source?: MergingValue) => any; + let customizer: (value: any, srcValue: any, key?: string, object?: InitialValue, source?: MergingValue) => any = (value: any, srcValue: any, key?: string, object?: InitialValue, source?: MergingValue) => 1; // Test for basic merging result = _.mergeWith(initialValue, mergingValue, customizer); @@ -9883,7 +9890,7 @@ namespace TestOmit { // _.omitBy namespace TestOmitBy { - let predicate: (element: any, key: string, collection: any) => boolean; + let predicate = (element: any, key: string, collection: any) => true; { let result: TResult; @@ -9938,7 +9945,7 @@ namespace TestPick { // _.pickBy namespace TestPickBy { - let predicate: (element: any, key: string, collection: any) => boolean; + let predicate = (element: any, key: string, collection: any) => true; { let result: TResult; @@ -10075,8 +10082,8 @@ namespace TestSet { type SampleObject = {a: {}}; type SampleResult = {a: {b: number[]}}; - let object: SampleObject; - let value: number; + let object: SampleObject = { a: {} }; + let value: number = 0; { let result: SampleResult; @@ -10117,9 +10124,9 @@ namespace TestSetWith { type SampleObject = {a: {}}; type SampleResult = {a: {b: number[]}}; - let object: SampleObject; - let value: number; - let customizer: (value: any, key: string, object: SampleObject) => number; + let object: SampleObject = { a: {} }; + let value: number = 0; + let customizer = (value: any, key: string, object: SampleObject) => 0; { let result: SampleResult; @@ -10171,7 +10178,7 @@ namespace TestSetWith { // _.toPairs namespace TestToPairs { - let object: _.Dictionary; + let object: _.Dictionary = {}; { let result: [string, any][]; @@ -10212,7 +10219,7 @@ namespace TestToPairs { // _.toPairsIn namespace TestToPairsIn { - let object: _.Dictionary; + let object: _.Dictionary = {}; { let result: [string, any][]; @@ -10253,12 +10260,12 @@ namespace TestToPairsIn { // _.transform namespace TestTransform { - let array: number[]; - let dictionary: _.Dictionary; + let array: number[] = []; + let dictionary: _.Dictionary = {}; { - let iterator: (acc: TResult[], curr: number, index?: number, arr?: number[]) => void; - let accumulator: TResult[]; + let iterator = (acc: TResult[], curr: number, index?: number, arr?: number[]) => {}; + let accumulator: TResult[] = []; let result: TResult[]; result = _.transform(array); @@ -10271,8 +10278,8 @@ namespace TestTransform { } { - let iterator: (acc: _.Dictionary, curr: number, index?: number, arr?: number[]) => void; - let accumulator: _.Dictionary; + let iterator = (acc: _.Dictionary, curr: number, index?: number, arr?: number[]) => {}; + let accumulator: _.Dictionary = {}; let result: _.Dictionary; result = _.transform(array, iterator); @@ -10283,8 +10290,8 @@ namespace TestTransform { } { - let iterator: (acc: _.Dictionary, curr: number, key?: string, dict?: _.Dictionary) => void; - let accumulator: _.Dictionary; + let iterator = (acc: _.Dictionary, curr: number, key?: string, dict?: _.Dictionary) => {}; + let accumulator: _.Dictionary = {}; let result: _.Dictionary; result = _.transform(dictionary); @@ -10297,8 +10304,8 @@ namespace TestTransform { } { - let iterator: (acc: TResult[], curr: number, key?: string, dict?: _.Dictionary) => void; - let accumulator: TResult[]; + let iterator = (acc: TResult[], curr: number, key?: string, dict?: _.Dictionary) => {}; + let accumulator: TResult[] = []; let result: TResult[]; result = _.transform(dictionary, iterator); @@ -10313,7 +10320,7 @@ namespace TestTransform { namespace TestUnset { type SampleObject = {a: {b: string; c: boolean}}; - let object: SampleObject; + let object: SampleObject = { a: { b: "", c: true } }; { let result: boolean; @@ -10342,8 +10349,8 @@ namespace TestUpdate { type SampleObject = {a: {}}; type SampleResult = {a: {b: number[]}}; - let object: SampleObject; - let updater: (value: any) => number; + let object: SampleObject = { a: {} }; + let updater = (value: any) => 0; { let result: SampleResult; @@ -10415,10 +10422,10 @@ namespace TestValues { } { - let dict: _.Dictionary; - let numDict: _.NumericDictionary; - let list: _.List; - let object: {a: SampleObject}; + let dict: _.Dictionary = {}; + let numDict: _.NumericDictionary = {}; + let list: _.List = []; + let object: {a: SampleObject} = { a: { a: {} } }; let result: SampleObject[]; result = _.values(dict); @@ -10457,10 +10464,10 @@ namespace TestValues { } { - let dict: _.Dictionary; - let numDict: _.NumericDictionary; - let list: _.List; - let object: {a: SampleObject}; + let dict: _.Dictionary = {}; + let numDict: _.NumericDictionary = {}; + let list: _.List = []; + let object: {a: SampleObject} = { a: { a: {} } }; let result: _.LoDashImplicitArrayWrapper; result = _(dict).values(); @@ -10499,10 +10506,10 @@ namespace TestValues { } { - let dict: _.Dictionary; - let numDict: _.NumericDictionary; - let list: _.List; - let object: {a: SampleObject}; + let dict: _.Dictionary = {}; + let numDict: _.NumericDictionary = {}; + let list: _.List = []; + let object: {a: SampleObject} = { a: { a: {} } }; let result: _.LoDashExplicitArrayWrapper; result = _(dict).chain().values(); @@ -10514,7 +10521,7 @@ namespace TestValues { // _.valuesIn namespace TestValuesIn { - let object: _.Dictionary; + let object: _.Dictionary = {}; { let result: TResult[]; @@ -10956,7 +10963,7 @@ namespace TestTemplate { interpolate?: RegExp; sourceURL?: string; variable?: string; - }; + } = {}; { let result: TemplateExecutor; @@ -11171,7 +11178,7 @@ namespace TestWords { // _.attempt namespace TestAttempt { - let func: (...args: any[]) => {a: string}; + let func: (...args: any[]) => {a: string} = (...args) => ({ a: "" }); { let result: {a: string}|Error; @@ -11487,7 +11494,7 @@ namespace TestIteratee { // _.matches namespace TestMatches { - let source: TResult; + let source: TResult = { a: 1, b: "", c: true }; { let result: (value: any) => boolean; @@ -11512,8 +11519,8 @@ namespace TestMatches { // _.matchesProperty namespace TestMatches { - let path: {toString(): string;}|{toString(): string;}[]; - let source: TResult; + let path: {toString(): string;}|{toString(): string;}[] = []; + let source: TResult = { a: 1, b: "", c: true }; { let result: (value: any) => boolean; @@ -11642,7 +11649,7 @@ namespace TestMethodOf { type SampleObject = { a: { b(): TResult }[] }; type ResultFn = (path: _.StringRepresentable|_.StringRepresentable[]) => TResult; - let object: SampleObject; + let object: SampleObject = { a: [] }; { let result: ResultFn; @@ -11679,8 +11686,8 @@ namespace TestMethodOf { // _.mixin namespace TestMixin { - let source: _.Dictionary; - let options: {chain?: boolean}; + let source: _.Dictionary = {}; + let options: {chain?: boolean} = {}; { let result: TResult; @@ -11909,7 +11916,7 @@ namespace TestPropertyOf { } } - let object: SampleObject; + let object: SampleObject = { a: { b: [] } }; { let result: (path: string|string[]) => any; @@ -12095,7 +12102,7 @@ namespace TestRangeRight { // _.times namespace TestTimes { - let iteratee: (num: number) => TResult; + let iteratee: (num: number) => TResult = (num: number) => ({ a: 1, b: "", c: true }); { let result: number[]; diff --git a/types/lodash/tsconfig.json b/types/lodash/tsconfig.json index c0730d6661..88cd24b85a 100644 --- a/types/lodash/tsconfig.json +++ b/types/lodash/tsconfig.json @@ -299,7 +299,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/types/material-ui/index.d.ts b/types/material-ui/index.d.ts index ce98d40903..47c124595e 100644 --- a/types/material-ui/index.d.ts +++ b/types/material-ui/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for material-ui v0.17.5 +// Type definitions for material-ui v0.17.51 // Project: https://github.com/callemall/material-ui // Definitions by: Nathan Brown , Igor Belagorudsky , Ali Taheri Moghaddar , Oliver Herrmann , Daniel Roth , Aurelién Allienne // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -1019,7 +1019,7 @@ declare namespace __MaterialUI { overlayStyle?: React.CSSProperties; style?: React.CSSProperties; swipeAreaWidth?: number; - width?: number; + width?: number | string; zDepth?: number; } export class Drawer extends React.Component { diff --git a/types/material-ui/material-ui-tests.tsx b/types/material-ui/material-ui-tests.tsx index 87908cd6ec..a0d8d32d92 100644 --- a/types/material-ui/material-ui-tests.tsx +++ b/types/material-ui/material-ui-tests.tsx @@ -1662,7 +1662,7 @@ class DrawerOpenRightExample extends React.Component<{}, {open?: boolean}> { label="Toggle Drawer" onTouchTap={this.handleToggle} /> - + diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index cb20b294d2..5a2a0abfe1 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -1065,7 +1065,7 @@ declare module "mongoose" { * @param pathsToValidate only validate the given paths * @returns MongooseError if there are errors during validation, or undefined if there is no error. */ - validateSync(pathsToValidate: string | string[]): Error; + validateSync(pathsToValidate?: string | string[]): Error; /** Hash containing current validation errors. */ errors: Object; diff --git a/types/mysql/index.d.ts b/types/mysql/index.d.ts index 7660feb374..9212d59ef6 100644 --- a/types/mysql/index.d.ts +++ b/types/mysql/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for node-mysql // Project: https://github.com/felixge/node-mysql // Definitions by: William Johnston +// Kacper Polak // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -497,6 +498,11 @@ interface IError extends Error { * Boolean, indicating if this error is terminal to the connection object. */ fatal: boolean; + + /** + * SQL of failed query + */ + sql?: string; } declare const enum FieldType { diff --git a/types/node/v4/index.d.ts b/types/node/v4/index.d.ts index 8d32f09744..c74f8dcb0b 100644 --- a/types/node/v4/index.d.ts +++ b/types/node/v4/index.d.ts @@ -1265,22 +1265,94 @@ declare module "dns" { family: number; } - export function lookup(domain: string, family: number, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; - export function lookup(domain: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; - export function lookup(domain: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException, addresses: LookupAddress[]) => void): void; - export function lookup(domain: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException, address: string | LookupAddress[], family: number) => void): void; - export function lookup(domain: string, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; + export function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; + export function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; + export function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException, addresses: LookupAddress[]) => void): void; + export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException, address: string | LookupAddress[], family: number) => void): void; + export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; - export function resolve(domain: string, rrtype: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function resolve(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function resolve4(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function resolve6(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function resolveMx(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function resolveTxt(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function resolveSrv(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function resolveNs(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function resolveCname(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[]; - export function reverse(ip: string, callback: (err: Error, domains: string[]) =>void ): string[]; + export interface MxRecord { + priority: number; + exchange: string; + } + + export interface NaptrRecord { + flags: string; + service: string; + regexp: string; + replacement: string; + order: number; + preference: number; + } + + export interface SoaRecord { + nsname: string; + hostmaster: string; + serial: number; + refresh: number; + retry: number; + expire: number; + minttl: number; + } + + export interface SrvRecord { + priority: number; + weight: number; + port: number; + name: string; + } + + export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void; + export function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void; + export function resolve(hostname: string, rrtype: "NS", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "PTR", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException, addresses: SoaRecord) => void): void; + export function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException, addresses: SrvRecord[]) => void): void; + export function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException, addresses: string[][]) => void): void; + export function resolve(hostname: string, rrtype: string, callback: (err: NodeJS.ErrnoException, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][]) => void): void; + + export function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void; + export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void; + export function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException, address: SoaRecord) => void): void; + export function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: SrvRecord[]) => void): void; + export function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[][]) => void): void; + + export function reverse(ip: string, callback: (err: NodeJS.ErrnoException, hostnames: string[]) => void): void; + export function setServers(servers: string[]): void; + + //Error codes + export var NODATA: string; + export var FORMERR: string; + export var SERVFAIL: string; + export var NOTFOUND: string; + export var NOTIMP: string; + export var REFUSED: string; + export var BADQUERY: string; + export var BADNAME: string; + export var BADFAMILY: string; + export var BADRESP: string; + export var CONNREFUSED: string; + export var TIMEOUT: string; + export var EOF: string; + export var FILE: string; + export var NOMEM: string; + export var DESTRUCTION: string; + export var BADSTR: string; + export var BADFLAGS: string; + export var NONAME: string; + export var BADHINTS: string; + export var NOTINITIALIZED: string; + export var LOADIPHLPAPI: string; + export var ADDRGETNETWORKPARAMS: string; + export var CANCELLED: string; } declare module "net" { diff --git a/types/node/v4/node-tests.ts b/types/node/v4/node-tests.ts index 43ce0f9f42..5274116452 100644 --- a/types/node/v4/node-tests.ts +++ b/types/node/v4/node-tests.ts @@ -1021,4 +1021,25 @@ namespace dns_tests { const _addresses: string | dns.LookupAddress[] = addresses; const _family: number | undefined = family; }); + + dns.resolve("nodejs.org", (err, addresses) => { + const _addresses: string[] = addresses; + }); + dns.resolve("nodejs.org", "A", (err, addresses) => { + const _addresses: string[] = addresses; + }); + dns.resolve("nodejs.org", "AAAA", (err, addresses) => { + const _addresses: string[] = addresses; + }); + dns.resolve("nodejs.org", "MX", (err, addresses) => { + const _addresses: dns.MxRecord[] = addresses; + }); + + dns.resolve4("nodejs.org", (err, addresses) => { + const _addresses: string[] = addresses; + }); + + dns.resolve6("nodejs.org", (err, addresses) => { + const _addresses: string[] = addresses; + }); } diff --git a/types/node/v6/index.d.ts b/types/node/v6/index.d.ts index 664a037dd9..ebc2b516d6 100644 --- a/types/node/v6/index.d.ts +++ b/types/node/v6/index.d.ts @@ -1807,11 +1807,6 @@ declare module "url" { } declare module "dns" { - export interface MxRecord { - exchange: string, - priority: number - } - // Supported getaddrinfo flags. export const ADDRCONFIG: number; export const V4MAPPED: number; @@ -1835,22 +1830,68 @@ declare module "dns" { family: number; } - export function lookup(domain: string, family: number, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; - export function lookup(domain: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; - export function lookup(domain: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException, addresses: LookupAddress[]) => void): void; - export function lookup(domain: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException, address: string | LookupAddress[], family: number) => void): void; - export function lookup(domain: string, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; + export function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; + export function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; + export function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException, addresses: LookupAddress[]) => void): void; + export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException, address: string | LookupAddress[], family: number) => void): void; + export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; - export function resolve(domain: string, rrtype: string, callback: (err: Error, addresses: string[]) => void): string[]; - export function resolve(domain: string, callback: (err: Error, addresses: string[]) => void): string[]; - export function resolve4(domain: string, callback: (err: Error, addresses: string[]) => void): string[]; - export function resolve6(domain: string, callback: (err: Error, addresses: string[]) => void): string[]; - export function resolveMx(domain: string, callback: (err: Error, addresses: MxRecord[]) => void): string[]; - export function resolveTxt(domain: string, callback: (err: Error, addresses: string[]) => void): string[]; - export function resolveSrv(domain: string, callback: (err: Error, addresses: string[]) => void): string[]; - export function resolveNs(domain: string, callback: (err: Error, addresses: string[]) => void): string[]; - export function resolveCname(domain: string, callback: (err: Error, addresses: string[]) => void): string[]; - export function reverse(ip: string, callback: (err: Error, domains: string[]) => void): string[]; + export interface MxRecord { + priority: number; + exchange: string; + } + + export interface NaptrRecord { + flags: string; + service: string; + regexp: string; + replacement: string; + order: number; + preference: number; + } + + export interface SoaRecord { + nsname: string; + hostmaster: string; + serial: number; + refresh: number; + retry: number; + expire: number; + minttl: number; + } + + export interface SrvRecord { + priority: number; + weight: number; + port: number; + name: string; + } + + export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void; + export function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void; + export function resolve(hostname: string, rrtype: "NS", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "PTR", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException, addresses: SoaRecord) => void): void; + export function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException, addresses: SrvRecord[]) => void): void; + export function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException, addresses: string[][]) => void): void; + export function resolve(hostname: string, rrtype: string, callback: (err: NodeJS.ErrnoException, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][]) => void): void; + + export function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void; + export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void; + export function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; + export function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException, address: SoaRecord) => void): void; + export function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: SrvRecord[]) => void): void; + export function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[][]) => void): void; + + export function reverse(ip: string, callback: (err: NodeJS.ErrnoException, hostnames: string[]) => void): void; export function setServers(servers: string[]): void; //Error codes diff --git a/types/node/v6/node-tests.ts b/types/node/v6/node-tests.ts index 4792c5edf1..b2ca08898c 100644 --- a/types/node/v6/node-tests.ts +++ b/types/node/v6/node-tests.ts @@ -2091,6 +2091,27 @@ namespace dns_tests { const _addresses: string | dns.LookupAddress[] = addresses; const _family: number | undefined = family; }); + + dns.resolve("nodejs.org", (err, addresses) => { + const _addresses: string[] = addresses; + }); + dns.resolve("nodejs.org", "A", (err, addresses) => { + const _addresses: string[] = addresses; + }); + dns.resolve("nodejs.org", "AAAA", (err, addresses) => { + const _addresses: string[] = addresses; + }); + dns.resolve("nodejs.org", "MX", (err, addresses) => { + const _addresses: dns.MxRecord[] = addresses; + }); + + dns.resolve4("nodejs.org", (err, addresses) => { + const _addresses: string[] = addresses; + }); + + dns.resolve6("nodejs.org", (err, addresses) => { + const _addresses: string[] = addresses; + }); } /***************************************************************************** diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index e6f947b677..520928823e 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -2412,7 +2412,6 @@ declare module OfficeExtension { constructor(context: ClientRequestContext, parentObject: ClientObject, name: string, eventInfo: EventInfo); add(handler: (args: T) => IPromise): EventHandlerResult; remove(handler: (args: T) => IPromise): void; - removeAll(): void; } export class EventHandlerResult { diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 20ad9529a9..7fde62feee 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1808,3 +1808,4 @@ declare namespace R { } export = R; +export as namespace R; diff --git a/types/react-monaco-editor/index.d.ts b/types/react-monaco-editor/index.d.ts new file mode 100644 index 0000000000..7f4a4a543e --- /dev/null +++ b/types/react-monaco-editor/index.d.ts @@ -0,0 +1,78 @@ +// Type definitions for react-monaco-editor 0.8 +// Project: https://github.com/superRaytin/react-monaco-editor +// Definitions by: Joshua Netterfield +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/// + +import * as React from "react"; + +export interface ReactMonacoEditorProps { + /** + * Width of editor. Defaults to 100%. + */ + width?: string | number; + + /** + * Height of editor. Defaults to 500. + */ + height?: string | number; + + /** + * Value of the auto created model in the editor. + * If you specify value property, the component behaves in controlled mode. Otherwise, it behaves in uncontrolled mode. + */ + value?: string; + + /** + * The initial value of the auto created model in the editor. + */ + defaultValue?: string; + + /** + * The initial language of the auto created model in the editor. + */ + language?: string; + + /** + * Theme to be used for rendering. + * The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black'. + * You can create custom themes via `monaco.editor.defineTheme`. + */ + theme?: string; + + /** + * Refer to Monaco interface IEditorOptions. + */ + options?: monaco.editor.IEditorOptions; + + /** + * An event emitted when the editor has been mounted (similar to componentDidMount of React). + */ + editorDidMount?(editor: monaco.editor.ICodeEditor, monacoModule: typeof monaco): void; + + /** + * An event emitted before the editor mounted (similar to componentWillMount of React). + */ + editorWillMount?(monacoModule: typeof monaco): void; + + /** + * An event emitted when the content of the current model has changed. + */ + onChange?(val: string, ev: monaco.editor.IModelContentChangedEvent2): void; + + /** + * Optional, allow to config loader url and relative path of module, refer to require.config. + */ + requireConfig?: object; + + /** + * Optional, allow to pass a different context then the global window onto which the monaco instance will be loaded. Useful if you want to load the editor in an iframe. + */ + context?: object; +} + +export default class ReactMonacoEditor extends React.Component { + editor: monaco.editor.ICodeEditor; +} diff --git a/types/react-monaco-editor/package.json b/types/react-monaco-editor/package.json new file mode 100644 index 0000000000..03bb1bd23d --- /dev/null +++ b/types/react-monaco-editor/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "monaco-editor": "0.8.3" + } +} diff --git a/types/react-monaco-editor/react-monaco-editor-tests.tsx b/types/react-monaco-editor/react-monaco-editor-tests.tsx new file mode 100644 index 0000000000..d8e8642bf9 --- /dev/null +++ b/types/react-monaco-editor/react-monaco-editor-tests.tsx @@ -0,0 +1,149 @@ +// Adapted from https://github.com/superRaytin/react-monaco-editor/blob/master/examples/index.js + +import * as React from 'react'; +import { render } from 'react-dom'; +import MonacoEditor from 'react-monaco-editor'; + +interface CodeEditorState { + code?: string; +} + +// Using with webpack +class CodeEditor extends React.Component { + constructor(props: object) { + super(props); + this.state = { + code: '// type your code... \n', + }; + } + editor: monaco.editor.ICodeEditor; + editorDidMount = (editor: monaco.editor.ICodeEditor) => { + console.log('editorDidMount', editor, editor.getValue(), editor.getModel()); + this.editor = editor; + } + onChange = (newValue: string, e: monaco.editor.IModelContentChangedEvent2) => { + console.log('onChange', newValue, e); + this.setState({ + code: newValue, + }); + } + changeEditorValue = () => { + if (this.editor) { + this.editor.setValue('// code changed! \n'); + } + } + changeBySetState = () => { + this.setState({code: '// code changed by setState! \n'}); + } + render() { + const code = this.state.code; + const options = { + selectOnLineNumbers: true, + roundedSelection: false, + readOnly: false, + theme: 'vs', + cursorStyle: 'line', + automaticLayout: false, + }; + return ( +
+
+ + +
+
+ +
+ ); + } +} + +// Using with require.config +class AnotherEditor extends React.Component { + constructor(props: object) { + super(props); + const jsonCode = [ + '{', + ' "$schema": "http://myserver/foo-schema.json"', + "}" + ].join('\n'); + this.state = { + code: jsonCode, + }; + } + editorWillMount = (monacoModule: typeof monaco) => { + monacoModule.languages.json.jsonDefaults.setDiagnosticsOptions({ + schemas: [{ + uri: "http://myserver/foo-schema.json", + schema: { + type: "object", + properties: { + p1: { + enum: [ "v1", "v2"] + }, + p2: { + $ref: "http://myserver/bar-schema.json" + } + } + } + }, { + uri: "http://myserver/bar-schema.json", + schema: { + type: "object", + properties: { + q1: { + enum: [ "x1", "x2"] + } + } + } + }] + }); + } + render() { + const code = this.state.code; + const requireConfig = { + url: 'https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.1/require.min.js', + paths: { + vs: 'https://as.alipayobjects.com/g/cicada/monaco-editor-mirror/0.6.1/min/vs' + } + }; + return ( +
+ +
+ ); + } +} + +class App extends React.Component { + render() { + return ( +
+

Monaco Editor Sample (controlled mode)

+ +
+

Another editor (uncontrolled mode)

+ +
+ ); + } +} + +render( + , + document.getElementById('root') +); diff --git a/types/react-monaco-editor/tsconfig.json b/types/react-monaco-editor/tsconfig.json new file mode 100644 index 0000000000..0b3178ab81 --- /dev/null +++ b/types/react-monaco-editor/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-monaco-editor-tests.tsx" + ] +} diff --git a/types/react-monaco-editor/tslint.json b/types/react-monaco-editor/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-monaco-editor/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/react-native-goby/index.d.ts b/types/react-native-goby/index.d.ts new file mode 100644 index 0000000000..c89cc7b065 --- /dev/null +++ b/types/react-native-goby/index.d.ts @@ -0,0 +1,410 @@ +// Type definitions for react-native-goby 0.04 +// Project: https://gitlab.com/MessageDream/react-native-goby +// Definitions by: jaydenzhao +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +export type DownloadProgressCallback = (progress: DownloadProgress) => void; +export type SyncStatusChangedCallback = (status: Goby.SyncStatus) => void; + +export interface GobyOptions extends SyncOptions { + /** + * Specifies when you would like to synchronize updates with the Goby server. + * Defaults to goby.CheckFrequency.ON_APP_START. + */ + checkFrequency: Goby.CheckFrequency; +} + +export interface DownloadProgress { + /** + * The total number of bytes expected to be received for this update. + */ + totalBytes: number; + + /** + * The number of bytes downloaded thus far. + */ + receivedBytes: number; +} + +export interface LocalPackage extends Package { + /** + * Installs the update by saving it to the location on disk where the runtime expects to find the latest version of the app. + * + * @param installMode Indicates when you would like the update changes to take affect for the end-user. + * @param minimumBackgroundDuration For resume-based installs, this specifies the number of seconds the app needs to be in the background before forcing a restart. Defaults to 0 if unspecified. + */ + install(installMode: Goby.InstallMode, minimumBackgroundDuration?: number): Promise; +} + +export interface Package { + /** + * The app binary version that this update is dependent on. This is the value that was + * specified via the appStoreVersion parameter when calling the CLI's release command. + */ + appVersion: string; + + /** + * The deployment key that was used to originally download this update. + */ + deploymentKey: string; + + /** + * The description of the update. This is the same value that you specified in the CLI when you released the update. + */ + description: string; + + /** + * Indicates whether this update has been previously installed but was rolled back. + */ + failedInstall: boolean; + + /** + * Indicates whether this is the first time the update has been run after being installed. + */ + isFirstRun: boolean; + + /** + * Indicates whether the update is considered mandatory. This is the value that was specified in the CLI when the update was released. + */ + isMandatory: boolean; + + /** + * Indicates whether this update is in a "pending" state. When true, that means the update has been downloaded and installed, but the app restart + * needed to apply it hasn't occurred yet, and therefore, its changes aren't currently visible to the end-user. + */ + isPending: boolean; + + /** + * The internal label automatically given to the update by the Goby server. This value uniquely identifies the update within its deployment. + */ + label: string; + + /** + * The SHA hash value of the update. + */ + packageHash: string; + + /** + * The size of the code contained within the update, in bytes. + */ + packageSize: number; +} + +export interface RemotePackage extends Package { + /** + * Downloads the available update from the Goby service. + * + * @param downloadProgressCallback An optional callback that allows tracking the progress of the update while it is being downloaded. + */ + download(downloadProgressCallback?: DownloadProgressCallback): Promise; + + /** + * The URL at which the package is available for download. + */ + downloadUrl: string; +} + +export interface SyncOptions { + /** + * Specifies the deployment key you want to query for an update against. By default, this value is derived from the Info.plist + * file (iOS) and MainActivity.java file (Android), but this option allows you to override it from the script-side if you need to + * dynamically use a different deployment for a specific call to sync. + */ + deploymentKey?: string; + + /** + * Specifies when you would like to install optional updates (i.e. those that aren't marked as mandatory). + * Defaults to goby.InstallMode.ON_NEXT_RESTART. + */ + installMode?: Goby.InstallMode; + + /** + * Specifies when you would like to install updates which are marked as mandatory. + * Defaults to goby.InstallMode.IMMEDIATE. + */ + mandatoryInstallMode?: Goby.InstallMode; + + /** + * Specifies the minimum number of seconds that the app needs to have been in the background before restarting the app. This property + * only applies to updates which are installed using `InstallMode.ON_NEXT_RESUME`, and can be useful for getting your update in front + * of end users sooner, without being too obtrusive. Defaults to `0`, which has the effect of applying the update immediately after a + * resume, regardless how long it was in the background. + */ + minimumBackgroundDuration?: number; + + /** + * An "options" object used to determine whether a confirmation dialog should be displayed to the end user when an update is available, + * and if so, what strings to use. Defaults to null, which has the effect of disabling the dialog completely. Setting this to any truthy + * value will enable the dialog with the default strings, and passing an object to this parameter allows enabling the dialog as well as + * overriding one or more of the default strings. + */ + updateDialog?: UpdateDialog; +} + +export interface UpdateDialog { + /** + * Indicates whether you would like to append the description of an available release to the + * notification message which is displayed to the end user. Defaults to false. + */ + appendReleaseDescription?: boolean; + + /** + * Indicates the string you would like to prefix the release description with, if any, when + * displaying the update notification to the end user. Defaults to " Description: " + */ + descriptionPrefix?: string; + + /** + * The text to use for the button the end user must press in order to install a mandatory update. Defaults to "Continue". + */ + mandatoryContinueButtonLabel?: string; + + /** + * The text used as the body of an update notification, when the update is specified as mandatory. + * Defaults to "An update is available that must be installed.". + */ + mandatoryUpdateMessage?: string; + + /** + * The text to use for the button the end user can press in order to ignore an optional update that is available. Defaults to "Ignore". + */ + optionalIgnoreButtonLabel?: string; + + /** + * The text to use for the button the end user can press in order to install an optional update. Defaults to "Install". + */ + optionalInstallButtonLabel?: string; + + /** + * The text used as the body of an update notification, when the update is optional. Defaults to "An update is available. Would you like to install it?". + */ + optionalUpdateMessage?: string; + + /** + * The text used as the header of an update notification that is displayed to the end user. Defaults to "Update available". + */ + title?: string; +} + +export interface StatusReport { + /** + * Whether the deployment succeeded or failed. + */ + status: Goby.DeploymentStatus; + + /** + * The version of the app that was deployed (for a native app upgrade). + */ + appVersion?: string; + + /** + * Details of the package that was deployed (or attempted to). + */ + package?: Package; + + /** + * Deployment key used when deploying the previous package. + */ + previousDeploymentKey?: string; + + /** + * The label (v#) of the package that was upgraded from. + */ + previousLabelOrAppVersion?: string; +} + +/** + * Decorates a React Component configuring it to sync for updates with the Goby server. + * + * @param options Options used to configure the end-user sync and update experience (e.g. when to check for updates?, show an prompt?, install the update immediately?). + */ +declare function Goby(options?: GobyOptions): Function; + +declare namespace Goby { + /** + * Represents the default settings that will be used by the sync method if + * an update dialog is configured to be displayed. + */ + var DEFAULT_UPDATE_DIALOG: UpdateDialog; + + /** + * Asks the Goby service whether the configured app deployment has an update available. + * + * @param deploymentKey The deployment key to use to query the Goby server for an update. + */ + function checkForUpdate(deploymentKey?: string): Promise; + + /** + * Retrieves the metadata for an installed update (e.g. description, mandatory). + * + * @param updateState The state of the update you want to retrieve the metadata for. Defaults to UpdateState.RUNNING. + */ + function getUpdateMetadata(updateState?: UpdateState): Promise; + + /** + * Notifies the Goby runtime that an installed update is considered successful. + */ + function notifyAppReady(): Promise; + + /** + * Allow Goby to restart the app. + */ + function allowRestart(): void; + + /** + * Forbid Goby to restart the app. + */ + function disallowRestart(): void; + + /** + * Immediately restarts the app. + * + * @param onlyIfUpdateIsPending Indicates whether you want the restart to no-op if there isn't currently a pending update. + */ + function restartApp(onlyIfUpdateIsPending?: boolean): void; + + /** + * Allows checking for an update, downloading it and installing it, all with a single call. + * + * @param options Options used to configure the end-user update experience (e.g. show an prompt?, install the update immediately?). + * @param syncStatusChangedCallback An optional callback that allows tracking the status of the sync operation, as opposed to simply checking the resolved state via the returned Promise. + * @param downloadProgressCallback An optional callback that allows tracking the progress of an update while it is being downloaded. + */ + function sync(options?: SyncOptions, syncStatusChangedCallback?: SyncStatusChangedCallback, downloadProgressCallback?: DownloadProgressCallback): Promise; + + /** + * Indicates when you would like an installed update to actually be applied. + */ + enum InstallMode { + /** + * Indicates that you want to install the update and restart the app immediately. + */ + IMMEDIATE, + + /** + * Indicates that you want to install the update, but not forcibly restart the app. + */ + ON_NEXT_RESTART, + + /** + * Indicates that you want to install the update, but don't want to restart the + * app until the next time the end user resumes it from the background. + */ + ON_NEXT_RESUME + } + + /** + * Indicates the current status of a sync operation. + */ + enum SyncStatus { + /** + * The Goby server is being queried for an update. + */ + CHECKING_FOR_UPDATE, + + /** + * An update is available, and a confirmation dialog was shown + * to the end user. (This is only applicable when the updateDialog is used) + */ + AWAITING_USER_ACTION, + + /** + * An available update is being downloaded from the Goby server. + */ + DOWNLOADING_PACKAGE, + + /** + * An available update was downloaded and is about to be installed. + */ + INSTALLING_UPDATE, + + /** + * The app is up-to-date with the Goby server. + */ + UP_TO_DATE, + + /** + * The app had an optional update which the end user chose to ignore. + * (This is only applicable when the updateDialog is used) + */ + UPDATE_IGNORED, + + /** + * An available update has been installed and will be run either immediately after the + * syncStatusChangedCallback function returns or the next time the app resumes/restarts, + * depending on the InstallMode specified in SyncOptions + */ + UPDATE_INSTALLED, + + /** + * There is an ongoing sync operation running which prevents the current call from being executed. + */ + SYNC_IN_PROGRESS, + + /** + * The sync operation encountered an unknown error. + */ + UNKNOWN_ERROR + } + + /** + * Indicates the state that an update is currently in. + */ + enum UpdateState { + /** + * Indicates that an update represents the + * version of the app that is currently running. + */ + RUNNING, + + /** + * Indicates than an update has been installed, but the + * app hasn't been restarted yet in order to apply it. + */ + PENDING, + + /** + * Indicates than an update represents the latest available + * release, and can be either currently running or pending. + */ + LATEST + } + + /** + * Indicates the status of a deployment (after installing and restarting). + */ + enum DeploymentStatus { + /** + * The deployment failed (and was rolled back). + */ + FAILED, + + /** + * The deployment succeeded. + */ + SUCCEEDED + } + + /** + * Indicates when you would like to check for (and install) updates from the Goby server. + */ + enum CheckFrequency { + /** + * When the app is fully initialized (or more specifically, when the root component is mounted). + */ + ON_APP_START, + + /** + * When the app re-enters the foreground. + */ + ON_APP_RESUME, + + /** + * Don't automatically check for updates, but only do it when goby.sync() is manully called inside app code. + */ + MANUAL + } +} + +export default Goby; diff --git a/types/react-native-goby/react-native-goby-tests.tsx b/types/react-native-goby/react-native-goby-tests.tsx new file mode 100644 index 0000000000..6c8ed6737b --- /dev/null +++ b/types/react-native-goby/react-native-goby-tests.tsx @@ -0,0 +1,23 @@ +import * as React from 'react'; + +import { + View, + AppRegistry +} from 'react-native'; + +import Goby from "react-native-goby"; + +class Home extends React.Component { + render() { + return ( + + ); + } +} + + +AppRegistry.registerComponent('home', () => Goby({ + updateDialog: false, + checkFrequency: Goby.CheckFrequency.ON_APP_RESUME, + installMode: Goby.InstallMode.IMMEDIATE +})(Home)); diff --git a/types/react-native-goby/tsconfig.json b/types/react-native-goby/tsconfig.json new file mode 100644 index 0000000000..fa2d947691 --- /dev/null +++ b/types/react-native-goby/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-native-goby-tests.tsx" + ] +} \ No newline at end of file diff --git a/types/react-native-goby/tslint.json b/types/react-native-goby/tslint.json new file mode 100644 index 0000000000..d774391cd1 --- /dev/null +++ b/types/react-native-goby/tslint.json @@ -0,0 +1,22 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + // Lowercase `object` is available in TypeScript 2.2 only. + "ban-types": false, + // Below are all TODO + "align": false, + "array-type": false, + "comment-format": false, + "interface-over-type-literal": false, + "jsdoc-format": false, + "no-misused-new": false, + "no-consecutive-blank-lines": false, + "no-empty-interface": false, + "no-padding": false, + "no-var": false, + "prefer-declare-function": false, + "prefer-method-signature": false, + "semicolon": false, + "strict-export-declare-modifiers": false + } +} diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 5fd5b40b96..eed16db158 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-native 0.43 +// Type definitions for react-native 0.44 // Project: https://github.com/facebook/react-native // Definitions by: Eloy Durán , Fedor Nezhivoi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -3123,9 +3123,9 @@ export interface ImageStyle extends FlexStyle, TransformsStyle, ShadowStyleIOS { } /* - * @see https://github.com/facebook/react-native/blob/master/Libraries/Image/ImageSourcePropType.js - */ -interface ImageURISource { + * @see https://github.com/facebook/react-native/blob/master/Libraries/Image/ImageSourcePropType.js + */ +export interface ImageURISource { /** * `uri` is a string representing the resource identifier for the image, which * could be an http address, a local file path, or the name of a static image @@ -3435,6 +3435,13 @@ export interface FlatListProperties { */ data: ItemT[] | null; + /** + * A marker property for telling the list to re-render (since it implements PureComponent). + * If any of your `renderItem`, Header, Footer, etc. functions depend on anything outside of the `data` prop, + * stick it here and treat it immutably. + */ + extraData?: any + /** * `getItemLayout` is an optional optimization that lets us skip measurement of dynamic * content if you know the height of items a priori. getItemLayout is the most efficient, @@ -3598,6 +3605,13 @@ export interface SectionListProperties extends ScrollViewProperties { */ SectionSeparatorComponent?: React.ComponentClass | null + /** + * A marker property for telling the list to re-render (since it implements PureComponent). + * If any of your `renderItem`, Header, Footer, etc. functions depend on anything outside of the `data` prop, + * stick it here and treat it immutably. + */ + extraData?: any + /** * Used to extract a unique key for a given item at the specified index. Key is used for caching * and as the react key to track item re-ordering. The default extractor checks `item.key`, then @@ -5083,6 +5097,11 @@ export interface TabBarItemProperties extends ViewProperties { */ badge?: string | number + /** + * Background color for the badge. Available since iOS 10. + */ + badgeColor?: string + /** * A custom icon for the tab. It is ignored when a system icon is defined. */ @@ -5168,6 +5187,11 @@ export interface TabBarIOSProperties extends ViewProperties { * Color of text on unselected tabs */ unselectedTintColor?: string + + /** + * Color of unselected tab icons. Available since iOS 10. + */ + unselectedItemTintColor?: string } export interface TabBarIOSStatic extends React.ComponentClass { @@ -5769,7 +5793,7 @@ export interface ScrollViewPropertiesIOS { * This can be used for paginating through children that have lengths smaller than the scroll view. * Used in combination with snapToAlignment. */ - snapToInterval?: number[] + snapToInterval?: number /** * An array of child indices determining which children get docked to the @@ -6273,7 +6297,7 @@ export interface AdSupportIOSStatic { interface AlertIOSButton { text: string - onPress?: () => void + onPress?: (message?: string) => void style?: "default" | "cancel" | "destructive" } diff --git a/types/react-native/test/index.tsx b/types/react-native/test/index.tsx index 62e925575b..3d7ddeac07 100644 --- a/types/react-native/test/index.tsx +++ b/types/react-native/test/index.tsx @@ -34,6 +34,7 @@ import { ScrollView, ScrollViewProps, RefreshControl, + TabBarIOS, } from 'react-native'; function testDimensions() { @@ -255,3 +256,30 @@ class ScrollerListComponentTest extends React.Component<{}, { dataSource: ListVi ) } } + + +class TabBarTest extends React.Component<{}, {}> { + render() { + return ( + + {}} + renderAsOriginal={ true } + selectedIcon={ undefined } + systemIcon="history" + title="Item 1"> + + + ); + } +} diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 6b263642ff..ddbe9b11e3 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -584,11 +584,11 @@ export interface StackNavigatorScreenOptions { export interface TabNavigatorScreenOptions { title?: string; tabBarVisible?: boolean; - tabBarIcon?: React.ReactElement; - tabBarLaben?: string - |React.ReactElement - | ((options: {focused: boolean, tintColor: string}) => React.ReactElement) - ; + tabBarIcon?: React.ReactElement + | ((options: { focused: boolean, tintColor: string }) => React.ReactElement); + tabBarLabel?: string + | React.ReactElement + | ((options: { focused: boolean, tintColor: string }) => React.ReactElement); } export interface DrawerNavigatorScreenOptions { diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index d01ae62640..a88a5d3a0b 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -3,6 +3,7 @@ import { View } from 'react-native'; import { addNavigationHelpers, StackNavigator, + TabNavigatorScreenOptions } from 'react-navigation'; const Start = ( @@ -28,3 +29,10 @@ const Router = (props: any) => ( } /> ); + +const tabNavigatorScreenOptions: TabNavigatorScreenOptions = { + title: 'title', + tabBarVisible: true, + tabBarIcon: , + tabBarLabel: 'label' +} diff --git a/types/react-router/index.d.ts b/types/react-router/index.d.ts index 81244caa29..d5bc7240c7 100644 --- a/types/react-router/index.d.ts +++ b/types/react-router/index.d.ts @@ -12,6 +12,7 @@ // Tanguy Krotoff // Huy Nguyen // Jérémy Fauvel +// Daniel Roth // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -36,13 +37,13 @@ export interface MemoryRouterProps { keyLength?: number; } -export class MemoryRouter extends React.Component {} +export class MemoryRouter extends React.Component { } export interface PromptProps { message: string | ((location: H.Location) => void); when?: boolean; } -export class Prompt extends React.Component {} +export class Prompt extends React.Component { } export interface RedirectProps { to: H.LocationDescriptor; @@ -52,7 +53,7 @@ export interface RedirectProps { exact?: boolean; strict?: boolean; } -export class Redirect extends React.Component {} +export class Redirect extends React.Component { } export interface RouteComponentProps

{ match: match

; @@ -69,12 +70,12 @@ export interface RouteProps { exact?: boolean; strict?: boolean; } -export class Route extends React.Component {} +export class Route extends React.Component { } export interface RouterProps { history: any; } -export class Router extends React.Component {} +export class Router extends React.Component { } export interface StaticRouterProps { basename?: string; @@ -82,12 +83,12 @@ export interface StaticRouterProps { context?: object; } -export class StaticRouter extends React.Component {} +export class StaticRouter extends React.Component { } export interface SwitchProps { - children?: JSX.Element | JSX.Element[]; + children?: React.ReactNode; location?: H.Location; } -export class Switch extends React.Component {} +export class Switch extends React.Component { } export interface match

{ params: P; @@ -97,4 +98,4 @@ export interface match

{ } export function matchPath

(pathname: string, props: RouteProps): match

| null; -export function withRouter(component: React.SFC> | React.ComponentClass>): React.ComponentClass; +export function withRouter

(component: React.SFC & P> | React.ComponentClass & P>): React.ComponentClass

; diff --git a/types/react-router/test/Switch.tsx b/types/react-router/test/Switch.tsx index 6a8b50f247..fe959504ce 100644 --- a/types/react-router/test/Switch.tsx +++ b/types/react-router/test/Switch.tsx @@ -2,12 +2,18 @@ import * as React from 'react'; import { BrowserRouter, Redirect, Route, Switch } from 'react-router-dom'; const Home = () =>

Home

; +const About = () =>

About

; +const User = () =>

User

; const SwitchTest = () => ( + {[ + , + + ]} ); diff --git a/types/react-router/test/WithRouter.tsx b/types/react-router/test/WithRouter.tsx new file mode 100644 index 0000000000..72035ed92f --- /dev/null +++ b/types/react-router/test/WithRouter.tsx @@ -0,0 +1,14 @@ +import * as React from 'react'; +import { withRouter, RouteComponentProps } from 'react-router-dom'; + +interface TOwnProps { + username: string; +} + +const Component = (props: TOwnProps & RouteComponentProps<{}>) =>

Welcome {props.username}

; + +const WithRouterComponent = withRouter(Component); + +const WithRouterTest = () => (); + +export default WithRouterTest; diff --git a/types/react-router/tsconfig.json b/types/react-router/tsconfig.json index 3a2e475777..df074843df 100644 --- a/types/react-router/tsconfig.json +++ b/types/react-router/tsconfig.json @@ -28,6 +28,7 @@ "test/Recursive.tsx", "test/RouteConfig.tsx", "test/Sidebar.tsx", - "test/Switch.tsx" + "test/Switch.tsx", + "test/WithRouter.tsx" ] } diff --git a/types/sequelize/v3/index.d.ts b/types/sequelize/v3/index.d.ts index 3712c4fb56..2f2f973c19 100644 --- a/types/sequelize/v3/index.d.ts +++ b/types/sequelize/v3/index.d.ts @@ -3211,7 +3211,7 @@ declare namespace sequelize { * https://github.com/sequelize/sequelize/blob/master/docs/docs/models-usage.md#user-content-manipulating-the-dataset-with-limit-offset-order-and-group */ group?: string | string[] | Object; - + /** * Apply DISTINCT(col) for FindAndCount(all) */ @@ -3371,6 +3371,13 @@ declare namespace sequelize { * Defaults to false; */ cascade?: boolean; + + /** + * Delete instead of setting deletedAt to current timestamp (only applicable if paranoid is enabled) + * + * Defaults to false; + */ + force?: boolean; } /** @@ -4750,6 +4757,11 @@ declare namespace sequelize { */ fields?: Array; + /** + * Condition for partioal index + */ + where?: WhereOptions; + } /** diff --git a/types/sequelize/v3/sequelize-tests.ts b/types/sequelize/v3/sequelize-tests.ts index 83c4536a71..9f5eac61ad 100644 --- a/types/sequelize/v3/sequelize-tests.ts +++ b/types/sequelize/v3/sequelize-tests.ts @@ -992,6 +992,9 @@ User.bulkCreate( [{ name : 'foo', code : '123' }, { code : '1234' }], { fields : User.bulkCreate( [{ name : 'a', c : 'b' }, { name : 'e', c : 'f' }], { fields : ['e', 'f'], ignoreDuplicates : true } ); User.truncate(); +User.truncate( { cascade : true } ); +User.truncate( { force : true } ); +User.truncate( { cascade: true, force : true } ); User.destroy( { where : { client_id : 13 } } ).then( ( a ) => a.toFixed() ); User.destroy( { force : true } ); @@ -1258,7 +1261,7 @@ s.define( 'UserWithUniqueUsername', { username : { type : Sequelize.STRING, unique : { name : 'user_and_email', msg : 'User and email must be unique' } }, email : { type : Sequelize.STRING, unique : 'user_and_email' } } ); -/* NOTE https://github.com/DefinitelyTyped/DefinitelyTyped/pull/5590 + s.define( 'UserWithUniqueUsername', { user_id : { type : Sequelize.INTEGER }, email : { type : Sequelize.STRING } @@ -1266,13 +1269,15 @@ s.define( 'UserWithUniqueUsername', { indexes : [ { name : 'user_and_email_index', - msg : 'User and email must be unique', unique : true, method : 'BTREE', - fields : ['user_id', { attribute : 'email', collate : 'en_US', order : 'DESC', length : 5 }] + fields : ['user_id', { attribute : 'email', collate : 'en_US', order : 'DESC', length : 5 }], + where : { + user_id : { $not: null } + } }] } ); - */ + s.define( 'TaskBuild', { title : { type : Sequelize.STRING, defaultValue : 'a task!' }, foo : { type : Sequelize.INTEGER, defaultValue : 2 }, diff --git a/types/webassembly-js-api/index.d.ts b/types/webassembly-js-api/index.d.ts index 4e7b0d52bf..0c8c9d19e8 100644 --- a/types/webassembly-js-api/index.d.ts +++ b/types/webassembly-js-api/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for WebAssembly v1 (MVP) // Project: https://github.com/winksaville/test-webassembly-js-ts -// Definitions by: 01alchemist , Wink Saville +// Definitions by: 01alchemist +// Wink Saville +// Periklis Tsirakidis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** @@ -9,21 +11,25 @@ * for more information. */ declare namespace WebAssembly { + type Imports = Array<{ + name: string; + kind: string; + }>; + + type Exports = Array<{ + module: string; + name: string; + kind: string; + }>; + /** * WebAssembly.Module */ class Module { constructor(bufferSource: ArrayBuffer | Uint8Array); static customSections(module: Module, sectionName: string): ArrayBuffer[]; - static exports(module: Module): Array<{ - name: string; - kind: string; - }>; - static imports(module: Module): Array<{ - module: string; - name: string; - kind: string; - }>; + static exports(module: Module): Imports; + static imports(module: Module): Exports; } /** diff --git a/types/xmlbuilder/index.d.ts b/types/xmlbuilder/index.d.ts index 20dabf97ca..d7ffd2193c 100644 --- a/types/xmlbuilder/index.d.ts +++ b/types/xmlbuilder/index.d.ts @@ -85,5 +85,5 @@ declare class XMLElementOrXMLNode { } declare namespace xmlbuilder { - function create(name: string, xmldec?: Object, doctype?: any, options?: Object): XMLElementOrXMLNode; + function create(nameOrObjSpec: string | { [name:string]: Object }, xmldec?: Object, doctype?: any, options?: Object): XMLElementOrXMLNode; } diff --git a/types/xmlbuilder/xmlbuilder-tests.ts b/types/xmlbuilder/xmlbuilder-tests.ts index 69794640ba..8be8f780f9 100644 --- a/types/xmlbuilder/xmlbuilder-tests.ts +++ b/types/xmlbuilder/xmlbuilder-tests.ts @@ -41,3 +41,10 @@ xml('root') .up() .ele('atttest', 'text') .end(); + +xml({ + displayNotification: { + level: 'error', + message: 'an error occurred' + } +}); \ No newline at end of file