From df2f7932e54f9b0f70027e16c4acd7be20a1b74e Mon Sep 17 00:00:00 2001 From: dherman Date: Sat, 30 Mar 2019 00:02:47 -0400 Subject: [PATCH 01/12] Fix two incorrect export definitions (#34118) Both the `getAllCountries` function and the `getAllTimezones` function return an object rather than an array. https://github.com/manuelmhtr/countries-and-timezones/blob/master/src/data.json#L2-L6 https://github.com/manuelmhtr/countries-and-timezones/blob/master/src/data.json#L1905-L1908 --- types/countries-and-timezones/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/countries-and-timezones/index.d.ts b/types/countries-and-timezones/index.d.ts index 1012133d8e..3a84ea3b76 100644 --- a/types/countries-and-timezones/index.d.ts +++ b/types/countries-and-timezones/index.d.ts @@ -16,9 +16,9 @@ export interface Timezone { countries: string[]; } -export function getAllCountries(): Country[]; +export function getAllCountries(): {[key: string]: Country}; -export function getAllTimezones(): Timezone[]; +export function getAllTimezones(): {[key: string]: Timezone}; export function getCountriesForTimezone(timezoneId: string): Country[]; From 21407b9b2771a2f07b34060780ed37f7c17337b6 Mon Sep 17 00:00:00 2001 From: Fred Date: Sat, 30 Mar 2019 05:04:38 +0100 Subject: [PATCH 02/12] [sequelize] Allow to specify a schema for bulkInsert (#34135) * Allow to specify a schema for bulkInsert * Add test for bulkInsert --- types/sequelize/index.d.ts | 2 +- types/sequelize/sequelize-tests.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index 270d0f42f1..12fe90a34c 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -4380,7 +4380,7 @@ declare namespace sequelize { /** * Inserts multiple records at once */ - bulkInsert(tableName: string, records: Object[], options?: QueryOptions, + bulkInsert(tableName: string | { tableName: string, schema: string }, records: Object[], options?: QueryOptions, attributes?: string[] | string): Promise; /** diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index e598111225..01b8bc27fd 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -1217,6 +1217,7 @@ queryInterface.createTable( { tableName : 'y', schema : 'a' }, queryInterface.changeColumn( { tableName : 'a', schema : 'b' }, 'c', { type : Sequelize.FLOAT }, { logging : () => s } ); queryInterface.createTable( 'users', { id : { type : Sequelize.INTEGER, primaryKey : true, autoIncrement : true } } ); +queryInterface.bulkInsert({tableName:'users', schema:'test'}, [{}, {}, {}]); queryInterface.createTable( 'level', { id : { type : Sequelize.INTEGER, primaryKey : true, autoIncrement : true } } ); queryInterface.addColumn( 'users', 'someEnum', Sequelize.ENUM( 'value1', 'value2', 'value3' ) ); queryInterface.addColumn( 'users', 'so', { type : Sequelize.ENUM, values : ['value1', 'value2', 'value3'] } ); From 2e44c5c8555ae5f7f68595913fe44102f0301ea8 Mon Sep 17 00:00:00 2001 From: Marcello Bardus Date: Sat, 30 Mar 2019 05:11:27 +0100 Subject: [PATCH 03/12] Added string as KeyPair.verify() parameter type (#34136) --- types/elliptic/index.d.ts | 98 +++++++++++++++++++++++++++++---------- 1 file changed, 74 insertions(+), 24 deletions(-) diff --git a/types/elliptic/index.d.ts b/types/elliptic/index.d.ts index 7b1e885d6f..a6775225eb 100644 --- a/types/elliptic/index.d.ts +++ b/types/elliptic/index.d.ts @@ -4,7 +4,7 @@ // Gaylor Bosson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import BN = require('bn.js'); +import BN = require("bn.js"); // incomplete typings export const utils: any; @@ -29,10 +29,10 @@ export namespace curve { g: base.BasePoint; redN: BN; - constructor(type: string, conf: base.BaseCurveOptions) + constructor(type: string, conf: base.BaseCurveOptions); validate(point: base.BasePoint): boolean; - decodePoint(bytes: Buffer | string, enc?: 'hex'): base.BasePoint; + decodePoint(bytes: Buffer | string, enc?: "hex"): base.BasePoint; } namespace base { @@ -83,7 +83,12 @@ export namespace curve { constructor(conf: edwards.EdwardsConf); - point(x: BNInput, y: BNInput, z?: BNInput, t?: BNInput): edwards.EdwardsPoint; + point( + x: BNInput, + y: BNInput, + z?: BNInput, + t?: BNInput + ): edwards.EdwardsPoint; pointFromX(x: BNInput, odd?: boolean): edwards.EdwardsPoint; pointFromY(y: BNInput, odd?: boolean): edwards.EdwardsPoint; pointFromJSON(obj: BNInput[]): edwards.EdwardsPoint; @@ -144,7 +149,7 @@ export namespace curves { n: BN | undefined | null; hash: any; // ? - constructor(options: PresetCurve.Options) + constructor(options: PresetCurve.Options); } namespace PresetCurve { @@ -172,17 +177,47 @@ export class ec { g: any; hash: any; - constructor(options: string | curves.PresetCurve) + constructor(options: string | curves.PresetCurve); keyPair(options: ec.KeyPairOptions): ec.KeyPair; - keyFromPrivate(priv: Buffer | string | ec.KeyPair, enc?: string): ec.KeyPair; - keyFromPublic(pub: Buffer | string | {x: string, y: string} | ec.KeyPair, enc?: string): ec.KeyPair; + keyFromPrivate( + priv: Buffer | string | ec.KeyPair, + enc?: string + ): ec.KeyPair; + keyFromPublic( + pub: Buffer | string | { x: string; y: string } | ec.KeyPair, + enc?: string + ): ec.KeyPair; genKeyPair(options?: ec.GenKeyPairOptions): ec.KeyPair; - sign(msg: BNInput, key: Buffer | ec.KeyPair, enc: string, options?: ec.SignOptions): ec.Signature; - sign(msg: BNInput, key: Buffer | ec.KeyPair, options?: ec.SignOptions): ec.Signature; - verify(msg: BNInput, signature: ec.Signature | ec.SignatureOptions, key: Buffer | ec.KeyPair, enc?: string): boolean; - recoverPubKey(msg: BNInput, signature: ec.Signature | ec.SignatureOptions, j: number, enc?: string): any; - getKeyRecoveryParam(e: Error | undefined, signature: ec.Signature | ec.SignatureOptions, Q: BN, enc?: string): number; + sign( + msg: BNInput, + key: Buffer | ec.KeyPair, + enc: string, + options?: ec.SignOptions + ): ec.Signature; + sign( + msg: BNInput, + key: Buffer | ec.KeyPair, + options?: ec.SignOptions + ): ec.Signature; + verify( + msg: BNInput, + signature: ec.Signature | ec.SignatureOptions, + key: Buffer | ec.KeyPair, + enc?: string + ): boolean; + recoverPubKey( + msg: BNInput, + signature: ec.Signature | ec.SignatureOptions, + j: number, + enc?: string + ): any; + getKeyRecoveryParam( + e: Error | undefined, + signature: ec.Signature | ec.SignatureOptions, + Q: BN, + enc?: string + ): number; } export namespace ec { @@ -201,21 +236,32 @@ export namespace ec { } class KeyPair { - static fromPublic(ec: ec, pub: Buffer | string | {x: string, y: string} | KeyPair, enc?: string): KeyPair; - static fromPrivate(ec: ec, priv: Buffer | string | KeyPair, enc?: string): KeyPair; + static fromPublic( + ec: ec, + pub: Buffer | string | { x: string; y: string } | KeyPair, + enc?: string + ): KeyPair; + static fromPrivate( + ec: ec, + priv: Buffer | string | KeyPair, + enc?: string + ): KeyPair; ec: ec; - constructor(ec: ec, options: KeyPairOptions) + constructor(ec: ec, options: KeyPairOptions); - validate(): { readonly result: boolean, readonly reason: string }; + validate(): { readonly result: boolean; readonly reason: string }; getPublic(compact: boolean, enc?: string): any; // ? getPublic(enc?: string): any; // ? - getPrivate(enc?: 'hex'): Buffer | BN | string; + getPrivate(enc?: "hex"): Buffer | BN | string; derive(pub: any): any; // ? sign(msg: BNInput, enc: string, options?: SignOptions): Signature; sign(msg: BNInput, options?: SignOptions): Signature; - verify(msg: BNInput, signature: Signature | SignatureOptions): boolean; + verify( + msg: BNInput, + signature: Signature | SignatureOptions | string + ): boolean; inspect(): string; } @@ -224,7 +270,7 @@ export namespace ec { s: BN; recoveryParam: number | null; - constructor(options: SignatureOptions | Signature, enc?: string) + constructor(options: SignatureOptions | Signature, enc?: string); toDER(enc?: string | null): any; // ? } @@ -246,10 +292,14 @@ export namespace ec { export class eddsa { curve: curve.edwards; - constructor(name: 'ed25519'); + constructor(name: "ed25519"); sign(message: eddsa.Bytes, secret: eddsa.Bytes): eddsa.Signature; - verify(message: eddsa.Bytes, sig: eddsa.Bytes | eddsa.Signature, pub: eddsa.Bytes | eddsa.Point | eddsa.KeyPair): boolean; + verify( + message: eddsa.Bytes, + sig: eddsa.Bytes | eddsa.Signature, + pub: eddsa.Bytes | eddsa.Point | eddsa.KeyPair + ): boolean; hashInt(): BN; keyFromPublic(pub: eddsa.Bytes): eddsa.KeyPair; keyFromSecret(secret: eddsa.Bytes): eddsa.KeyPair; @@ -281,9 +331,9 @@ export namespace eddsa { secret(): Buffer; sign(message: Bytes): Signature; verify(message: Bytes, sig: Signature | Bytes): boolean; - getSecret(enc: 'hex'): string; + getSecret(enc: "hex"): string; getSecret(): Buffer; - getPublic(enc: 'hex'): string; + getPublic(enc: "hex"): string; getPublic(): Buffer; } From d612bb2ee1287ceccbdd4517ff995edf6816b727 Mon Sep 17 00:00:00 2001 From: Nicholas Sunderland <46519157+nsunderland-cognite@users.noreply.github.com> Date: Sat, 30 Mar 2019 05:14:08 +0100 Subject: [PATCH 04/12] [three] Fixed InstancedBufferAttribute definition (#34142) --- types/three/three-core.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index d018d3241d..bbd5c6bc26 100755 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -1477,7 +1477,7 @@ export namespace GeometryUtils { * @see src/core/InstancedBufferAttribute.js */ export class InstancedBufferAttribute extends BufferAttribute { - constructor(data: ArrayLike, itemSize: number, meshPerAttribute?: number); + constructor(array: ArrayLike, itemSize: number, normalized?: boolean, meshPerAttribute?: number); meshPerAttribute: number; } From d677993a635ecc1aebd69c4f74467870f098f7d9 Mon Sep 17 00:00:00 2001 From: Nick Woodward Date: Fri, 29 Mar 2019 23:17:23 -0500 Subject: [PATCH 05/12] fix: added serve to the parcel-bundler types (#34157) - The earliest version that contains this method is `1.11.0`. --- types/parcel-bundler/index.d.ts | 70 +++++++++++++++----- types/parcel-bundler/parcel-bundler-tests.ts | 22 ++++++ 2 files changed, 77 insertions(+), 15 deletions(-) diff --git a/types/parcel-bundler/index.d.ts b/types/parcel-bundler/index.d.ts index 230d928db1..d6db014c9d 100644 --- a/types/parcel-bundler/index.d.ts +++ b/types/parcel-bundler/index.d.ts @@ -1,12 +1,30 @@ -// Type definitions for parcel-bundler 1.10 +// Type definitions for parcel-bundler 1.12 // Project: https://github.com/parcel-bundler/parcel#readme // Definitions by: pinage404 +// Nick Woodward // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 +import * as http from 'http'; +import * as https from 'https'; import * as express from "express-serve-static-core"; declare namespace ParcelBundler { + interface HttpsOptions { + /** + * Path to custom certificate + * + * @default "./ssl/c.crt" + */ + cert?: string; + /** + * Path to custom key + * + * @default "./ssl/k.key" + */ + key?: string; + } + interface ParcelOptions { /** * The out directory to put the build files in @@ -74,20 +92,7 @@ declare namespace ParcelBundler { https?: | true | false - | { - /** - * Path to custom certificate - * - * @default "./ssl/c.crt" - */ - cert?: string; - /** - * Path to custom key - * - * @default "./ssl/k.key" - */ - key?: string; - }; + | HttpsOptions; /** * 3 = log everything, 2 = log warnings & errors, 1 = log errors * @@ -124,6 +129,27 @@ declare namespace ParcelBundler { * @default false */ detailedReport?: boolean; + + /** + * Expose modules as UMD under this name, disabled by default + */ + global?: string; + + /** + * By default, package.json dependencies are not included when using 'node' or 'electron' with the 'target' option. + * + * Set to true to add them to the bundle. + * + * @default false + */ + bundleNodeModules?: true | false; + + /** + * Enable or disable HMR while watching + * + * @default false + */ + hmr?: true | false; } type ParcelAsset = any; @@ -161,6 +187,11 @@ declare namespace ParcelBundler { * A Map of all the locations of the assets inside the bundle, used to generate accurate source maps */ offsets: Map; + + /** + * A Set of all child bundles + */ + childBundles: Set; } } @@ -177,6 +208,15 @@ declare class ParcelBundler { bundle(): Promise; middleware(): (req: express.Request, res: express.Response, next: express.NextFunction) => any; + + serve(port?: number, https?: true | false | ParcelBundler.HttpsOptions, host?: string): Promise; + + on(name: 'buildEnd', cb: () => void): void; + on(name: 'bundled', cb: (bundle: ParcelBundler.ParcelBundle) => void): void; + on(name: 'buildStart', cb: (entryPoints: string[]) => void): void; + on(name: 'buildError', cb: (error: Error) => void): void; + + off(name: 'buildEnd'| 'bundled'| 'buildStart'| 'buildError', cb: (...any: any[]) => void): void; } export = ParcelBundler; diff --git a/types/parcel-bundler/parcel-bundler-tests.ts b/types/parcel-bundler/parcel-bundler-tests.ts index 0623056c89..dbe0ecdfbb 100644 --- a/types/parcel-bundler/parcel-bundler-tests.ts +++ b/types/parcel-bundler/parcel-bundler-tests.ts @@ -6,6 +6,20 @@ const files = ["./index.d.ts"]; const bundler = new ParcelBundler(files, parcelOption); +bundler.on('buildStart', (entryPoints) => { + console.log(entryPoints); +}); + +bundler.on('bundled', (bundle) => { + console.log(bundle); +}); + +bundler.on('buildEnd', () => console.log('Parcel bundler finished!')); + +const cb = () => {}; +bundler.on('buildEnd', cb); +bundler.off('buildEnd', cb); + bundler.addAssetType('md', 'markdown-asset'); bundler.addPackager('md', 'markdown-packager'); @@ -13,3 +27,11 @@ bundler.addPackager('md', 'markdown-packager'); bundler.middleware(); bundler.bundle().then(bundle => bundle.name); + +bundler.serve(1234, false, 'localhost').then((server) => server.close()); + +const otherBundler = new ParcelBundler(['./missing.d.ts'], parcelOption); + +otherBundler.on('buildError', (error) => console.log(error)); + +otherBundler.bundle(); From 0c20777689ac1167a19f23aca3e2055772e900fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerhard=20St=C3=B6bich?= <18708370+Flarna@users.noreply.github.com> Date: Sat, 30 Mar 2019 05:22:36 +0100 Subject: [PATCH 06/12] [node] correct process.send() and callback of cp.send()/cp.worker.send() (#34337) --- types/node/child_process.d.ts | 6 +++--- types/node/cluster.d.ts | 2 +- types/node/globals.d.ts | 2 +- types/node/test/child_process.ts | 30 +++++++++++++++--------------- types/node/test/process.ts | 8 ++++++++ 5 files changed, 28 insertions(+), 20 deletions(-) diff --git a/types/node/child_process.d.ts b/types/node/child_process.d.ts index d1e14df580..53ea5fc9e4 100644 --- a/types/node/child_process.d.ts +++ b/types/node/child_process.d.ts @@ -19,9 +19,9 @@ declare module "child_process" { readonly pid: number; readonly connected: boolean; kill(signal?: string): void; - send(message: any, callback?: (error: Error) => void): boolean; - send(message: any, sendHandle?: net.Socket | net.Server, callback?: (error: Error) => void): boolean; - send(message: any, sendHandle?: net.Socket | net.Server, options?: MessageOptions, callback?: (error: Error) => void): boolean; + send(message: any, callback?: (error: Error | null) => void): boolean; + send(message: any, sendHandle?: net.Socket | net.Server, callback?: (error: Error | null) => void): boolean; + send(message: any, sendHandle?: net.Socket | net.Server, options?: MessageOptions, callback?: (error: Error | null) => void): boolean; disconnect(): void; unref(): void; ref(): void; diff --git a/types/node/cluster.d.ts b/types/node/cluster.d.ts index fae80659d8..43340ff800 100644 --- a/types/node/cluster.d.ts +++ b/types/node/cluster.d.ts @@ -24,7 +24,7 @@ declare module "cluster" { class Worker extends events.EventEmitter { id: number; process: child.ChildProcess; - send(message: any, sendHandle?: any, callback?: (error: Error) => void): boolean; + send(message: any, sendHandle?: any, callback?: (error: Error | null) => void): boolean; kill(signal?: string): void; destroy(signal?: string): void; disconnect(): void; diff --git a/types/node/globals.d.ts b/types/node/globals.d.ts index 5898edc568..15007121a1 100644 --- a/types/node/globals.d.ts +++ b/types/node/globals.d.ts @@ -891,7 +891,7 @@ declare namespace NodeJS { domain: Domain; // Worker - send?(message: any, sendHandle?: any): void; + send?(message: any, sendHandle?: any, options?: { swallowErrors?: boolean}, callback?: (error: Error | null) => void): boolean; disconnect(): void; connected: boolean; diff --git a/types/node/test/child_process.ts b/types/node/test/child_process.ts index cf5b3e4656..ee42d55b92 100644 --- a/types/node/test/child_process.ts +++ b/types/node/test/child_process.ts @@ -69,15 +69,15 @@ async function testPromisify() { }); _boolean = cp.send(1, (error) => { - const _err: Error = error; + const _err: Error | null = error; }); _boolean = cp.send('one', (error) => { - const _err: Error = error; + const _err: Error | null = error; }); _boolean = cp.send({ type: 'test' }, (error) => { - const _err: Error = error; + const _err: Error | null = error; }); _boolean = cp.send(1, _socket); @@ -87,15 +87,15 @@ async function testPromisify() { }, _socket); _boolean = cp.send(1, _socket, (error) => { - const _err: Error = error; + const _err: Error | null = error; }); _boolean = cp.send('one', _socket, (error) => { - const _err: Error = error; + const _err: Error | null = error; }); _boolean = cp.send({ type: 'test' }, _socket, (error) => { - const _err: Error = error; + const _err: Error | null = error; }); _boolean = cp.send(1, _socket, { @@ -113,19 +113,19 @@ async function testPromisify() { _boolean = cp.send(1, _socket, { keepOpen: true }, (error) => { - const _err: Error = error; + const _err: Error | null = error; }); _boolean = cp.send('one', _socket, { keepOpen: true }, (error) => { - const _err: Error = error; + const _err: Error | null = error; }); _boolean = cp.send({ type: 'test' }, _socket, { keepOpen: true }, (error) => { - const _err: Error = error; + const _err: Error | null = error; }); _boolean = cp.send(1, _server); @@ -135,15 +135,15 @@ async function testPromisify() { }, _server); _boolean = cp.send(1, _server, (error) => { - const _err: Error = error; + const _err: Error | null = error; }); _boolean = cp.send('one', _server, (error) => { - const _err: Error = error; + const _err: Error | null = error; }); _boolean = cp.send({ type: 'test' }, _server, (error) => { - const _err: Error = error; + const _err: Error | null = error; }); _boolean = cp.send(1, _server, { @@ -161,19 +161,19 @@ async function testPromisify() { _boolean = cp.send(1, _server, { keepOpen: true }, (error) => { - const _err: Error = error; + const _err: Error | null = error; }); _boolean = cp.send('one', _server, { keepOpen: true }, (error) => { - const _err: Error = error; + const _err: Error | null = error; }); _boolean = cp.send({ type: 'test' }, _server, { keepOpen: true }, (error) => { - const _err: Error = error; + const _err: Error | null = error; }); const stdin: Writable | null = cp.stdio[0]; diff --git a/types/node/test/process.ts b/types/node/test/process.ts index 0c6865a9ad..c011ac0eeb 100644 --- a/types/node/test/process.ts +++ b/types/node/test/process.ts @@ -56,3 +56,11 @@ import { EventEmitter } from "events"; dest = report.writeReport('asdasd'); dest = report.writeReport(new Error()); } +{ + if (process.send) { + let r: boolean = process.send('aMessage'); + r = process.send({ msg: "foo"}, {}); + r = process.send({ msg: "foo"}, {}, { swallowErrors: true }); + r = process.send({ msg: "foo"}, {}, { swallowErrors: true }, (err: Error | null) => {}); + } +} From f4db707b552b033c6e2c03c05f8aa529113ed430 Mon Sep 17 00:00:00 2001 From: Saoud Rizwan Date: Sat, 30 Mar 2019 00:24:09 -0400 Subject: [PATCH 07/12] Update tree-builder.d.ts (#34279) --- types/nodegit/tree-builder.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/nodegit/tree-builder.d.ts b/types/nodegit/tree-builder.d.ts index f5a6715492..5d489beefb 100644 --- a/types/nodegit/tree-builder.d.ts +++ b/types/nodegit/tree-builder.d.ts @@ -11,5 +11,5 @@ export class Treebuilder { get(filename: string): TreeEntry; insert(filename: string, id: Oid, filemode: number): Promise; remove(filename: string): number; - write(): Oid; + write(): Promise; } From 0f4522b7c801fd87c780c3ce702971a33fce7b76 Mon Sep 17 00:00:00 2001 From: "Jimi (Dimitris) Charalampidis" Date: Sat, 30 Mar 2019 06:26:39 +0200 Subject: [PATCH 08/12] [sinon] Correct comparable type (#34268) * Correct comparable type Typescript complains for functions `calledBefore`, `calledAfter`, `calledImmediatelyBefore` and `calledImmediatelyAfter` because it's trying to compare a `SinonInspectable` to a `Sinonspy`. Correct comparison should be done on the same type (i.e. `SinonInspectable`). * Add test cases . --- types/sinon/ts3.1/index.d.ts | 8 ++++---- types/sinon/ts3.1/sinon-tests.ts | 16 ++++++++++++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/types/sinon/ts3.1/index.d.ts b/types/sinon/ts3.1/index.d.ts index 444ed86f22..cab3c80b67 100644 --- a/types/sinon/ts3.1/index.d.ts +++ b/types/sinon/ts3.1/index.d.ts @@ -238,22 +238,22 @@ declare namespace Sinon { * Returns true if the spy was called before @param anotherSpy * @param anotherSpy */ - calledBefore(anotherSpy: SinonSpy): boolean; + calledBefore(anotherSpy: SinonInspectable): boolean; /** * Returns true if the spy was called after @param anotherSpy * @param anotherSpy */ - calledAfter(anotherSpy: SinonSpy): boolean; + calledAfter(anotherSpy: SinonInspectable): boolean; /** * Returns true if spy was called before @param anotherSpy, and no spy calls occurred between spy and @param anotherSpy. * @param anotherSpy */ - calledImmediatelyBefore(anotherSpy: SinonSpy): boolean; + calledImmediatelyBefore(anotherSpy: SinonInspectable): boolean; /** * Returns true if spy was called after @param anotherSpy, and no spy calls occurred between @param anotherSpy and spy. * @param anotherSpy */ - calledImmediatelyAfter(anotherSpy: SinonSpy): boolean; + calledImmediatelyAfter(anotherSpy: SinonInspectable): boolean; /** * Returns true if the spy was always called with @param obj as this. * @param obj diff --git a/types/sinon/ts3.1/sinon-tests.ts b/types/sinon/ts3.1/sinon-tests.ts index 6251692c2d..05b582b9db 100644 --- a/types/sinon/ts3.1/sinon-tests.ts +++ b/types/sinon/ts3.1/sinon-tests.ts @@ -379,6 +379,7 @@ function testSpy() { let fn = (arg: string, arg2: number): boolean => true; const obj = class { foo() { } + foobar(p1?: string) { return p1; } set bar(val: number) { } get bar() { return 0; } }; @@ -387,8 +388,19 @@ function testSpy() { const spy = sinon.spy(); // $ExpectType SinonSpy const spyTwo = sinon.spy().named('spyTwo'); - const methodSpy = sinon.spy(instance, 'foo'); - const methodSpy2 = sinon.spy(instance, 'bar', ['set', 'get']); + const methodSpy = sinon.spy(instance, 'foo'); // $ExpectType SinonSpy<[], void> + const methodSpy2 = sinon.spy(instance, 'bar', ['set', 'get']); // $ExpectType SinonSpy + const methodSpy3 = sinon.spy(instance, 'foobar'); // $ExpectType SinonSpy<[(string | undefined)?], string | undefined> + + methodSpy.calledBefore(methodSpy2); + methodSpy.calledAfter(methodSpy2); + methodSpy.calledImmediatelyBefore(methodSpy2); + methodSpy.calledImmediatelyAfter(methodSpy2); + + methodSpy.calledBefore(methodSpy3); + methodSpy.calledAfter(methodSpy3); + methodSpy.calledImmediatelyBefore(methodSpy3); + methodSpy.calledImmediatelyAfter(methodSpy3); let count = 0; count = spy.callCount; From d37eb74cea13bfae3c6e01f49442afc65b4d3d17 Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Sat, 30 Mar 2019 04:27:46 +0000 Subject: [PATCH 09/12] `react-autocomplete`: fix `renderMenu` param type (#34183) * Add failing test * Fix failing test --- types/react-autocomplete/index.d.ts | 2 +- types/react-autocomplete/react-autocomplete-tests.tsx | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/types/react-autocomplete/index.d.ts b/types/react-autocomplete/index.d.ts index fd0bdc8b8a..a377a71813 100644 --- a/types/react-autocomplete/index.d.ts +++ b/types/react-autocomplete/index.d.ts @@ -76,7 +76,7 @@ declare namespace Autocomplete { * and the width of the dropdown menu. */ renderMenu?: ( - items: any[], + items: ReactNode[], value: string, styles: CSSProperties, ) => ReactNode; diff --git a/types/react-autocomplete/react-autocomplete-tests.tsx b/types/react-autocomplete/react-autocomplete-tests.tsx index 36834b46d1..0132023dd1 100644 --- a/types/react-autocomplete/react-autocomplete-tests.tsx +++ b/types/react-autocomplete/react-autocomplete-tests.tsx @@ -16,3 +16,8 @@ render( />, container, ); + +// $ExpectError +const renderMenu: React.ComponentProps['renderMenu'] = ( + (item: string[]) =>
+); From 54bd1e1090c1aed6ebce5c70b716fa70106f66c2 Mon Sep 17 00:00:00 2001 From: Eliot Ball Date: Sat, 30 Mar 2019 04:28:55 +0000 Subject: [PATCH 10/12] Improve @types/vis (#34293) * Improveme @types/vis Two improvements: * Correct optional types on options.node.shapeProperties * Add types for options.node.margin * Fix lint --- types/vis/index.d.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/types/vis/index.d.ts b/types/vis/index.d.ts index 827c71b260..813a149baf 100644 --- a/types/vis/index.d.ts +++ b/types/vis/index.d.ts @@ -1828,6 +1828,13 @@ export interface NodeOptions { level?: number; + margin?: { + top?: number; + right?: number; + bottom?: number; + left?: number; + }; + mass?: number; physics?: boolean; @@ -1839,11 +1846,11 @@ export interface NodeOptions { shape?: string; shapeProperties?: { - borderDashes: boolean | number[], // only for borders - borderRadius: number, // only for box shape - interpolation: boolean, // only for image and circularImage shapes - useImageSize: boolean, // only for image and circularImage shapes - useBorderWithImage: boolean // only for image shape + borderDashes?: boolean | number[], // only for borders + borderRadius?: number, // only for box shape + interpolation?: boolean, // only for image and circularImage shapes + useImageSize?: boolean, // only for image and circularImage shapes + useBorderWithImage?: boolean // only for image shape }; size?: number; From ab7694050afc784bde16dd31f9592353c634d9a0 Mon Sep 17 00:00:00 2001 From: Dasa Paddock Date: Fri, 29 Mar 2019 21:30:24 -0700 Subject: [PATCH 11/12] Update for ArcGIS API for JavaScript version 3.28 (#34302) --- types/arcgis-js-api/v3/index.d.ts | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/types/arcgis-js-api/v3/index.d.ts b/types/arcgis-js-api/v3/index.d.ts index e38c5c0356..e595cdb9cc 100644 --- a/types/arcgis-js-api/v3/index.d.ts +++ b/types/arcgis-js-api/v3/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ArcGIS API for JavaScript 3.27 +// Type definitions for ArcGIS API for JavaScript 3.28 // Project: https://developers.arcgis.com/javascript/3/ // Definitions by: Esri // Bjorn Svensson @@ -3477,19 +3477,19 @@ declare module "esri/basemaps" { var basemaps: { /** The Light Gray Canvas basemap is designed to be used as a neutral background map for overlaying and emphasizing other map layers. */ gray: any; - /** The World Imagery map is a detailed imagery map layer and labels that is designed to be used as a basemap for various maps and applications. */ + /** The World Imagery with Labels map is a detailed imagery map layer and labels that is designed to be used as a basemap for various maps and applications: https://services.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer */ hybrid: any; /** The Ocean Basemap is designed to be used as a basemap by marine GIS professionals and as a reference map by anyone interested in ocean data. */ oceans: any; /** The OpenStreetMap is a community map layer that is designed to be used as a basemap for various maps and applications. */ osm: any; - /** The World Imagery map is a detailed imagery map layer that is designed to be used as a basemap for various maps and applications. */ + /** The World Imagery map is a detailed imagery map layer that is designed to be used as a basemap for various maps and applications: https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer. */ satellite: any; - /** The Streets basemap presents a multiscale street map for the world. */ + /** The Streets basemap presents a multiscale street map for the world: https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer. */ streets: any; /** The Terrain with Labels basemap is designed to be used to overlay and emphasize other thematic map layers. */ terrain: any; - /** The Topographic map includes boundaries, cities, water features, physiographic features, parks, landmarks, transportation, and buildings. */ + /** The Topographic map includes boundaries, cities, water features, physiographic features, parks, landmarks, transportation, and buildings: https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer */ topo: any; }; export = basemaps; @@ -9228,8 +9228,9 @@ declare module "esri/lang" { * @param data The data object used in the substitution. * @param template The template used for the substitution. * @param first When true, returns only the first property found in the data object. + * @param format The format object used in the substitution. */ - substitute(data: any, template?: string, first?: boolean): string; + substitute(data: any, template?: string, first?: boolean, format?: any): string; /** * Iterates through the argument array and searches for the identifier to which the argument value matches. * @param array The argument array for testing. @@ -10000,6 +10001,8 @@ declare module "esri/layers/FeatureLayer" { displayField: string; /** Indicates the field names for the editor fields. */ editFieldsInfo: any; + /** Applicable to ArcGIS Online hosted feature services. */ + editingInfo: any; /** The array of fields in the layer. */ fields: Field[]; /** The full extent of the layer. */ @@ -10054,6 +10057,8 @@ declare module "esri/layers/FeatureLayer" { supportsAttachmentsByUploadId: boolean; /** When true, the layer supports the Calculate REST operation when updating features. */ supportsCalculate: boolean; + /** If true, the layer supports a user-defined field description. */ + supportsFieldDescription: boolean; /** When true, the layer supports statistical functions in query operations. */ supportsStatistics: boolean; /** When true, the layer is suspended. */ @@ -10468,6 +10473,8 @@ declare module "esri/layers/Field" { class Field { /** The alias name for the field. */ alias: string; + /** A string that describes the default value set for a field. */ + defaultValue: string; /** Domain associated with the field. */ domain: Domain; /** Indicates whether the field is editable. */ From 0341d2d0824c45ff6a7a49b0c83a13f17d966f7c Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Sat, 30 Mar 2019 00:23:00 -0700 Subject: [PATCH 12/12] Add annotations to ramda tests which contain type inference failures which trigger future `unknown` warnings (#34340) --- types/ramda/ramda-tests.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 8887c52c57..12152ecb4b 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -1975,9 +1975,9 @@ class Rectangle { }; () => { - const a: boolean = R.pathSatisfies(x => x > 0, ["x"], {x: 1, y: 2}); // => true - const b: boolean = R.pathSatisfies(x => x > 0, ["x"])({x: 1, y: 2}); // => true - const c: boolean = R.pathSatisfies(x => x > 0)(["x"])({x: 1, y: 2}); // => true + const a: boolean = R.pathSatisfies((x: number) => x > 0, ["x"], {x: 1, y: 2}); // => true + const b: boolean = R.pathSatisfies((x: number) => x > 0, ["x"])({x: 1, y: 2}); // => true + const c: boolean = R.pathSatisfies((x: number) => x > 0)(["x"])({x: 1, y: 2}); // => true }; () => { @@ -2091,9 +2091,9 @@ class Rectangle { }; () => { - const a: boolean = R.propSatisfies(x => x > 0, "x", {x: 1, y: 2}); // => true - const b: boolean = R.propSatisfies(x => x > 0, "x")({x: 1, y: 2}); // => true - const c: boolean = R.propSatisfies(x => x > 0)("x")({x: 1, y: 2}); // => true + const a: boolean = R.propSatisfies((x: number) => x > 0, "x", {x: 1, y: 2}); // => true + const b: boolean = R.propSatisfies((x: number) => x > 0, "x")({x: 1, y: 2}); // => true + const c: boolean = R.propSatisfies((x: number) => x > 0)("x")({x: 1, y: 2}); // => true }; () => {