From 42fb16dc0f0fd2465d7642e76671ce638b4387ed Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Mon, 9 Jul 2018 10:01:01 -0700 Subject: [PATCH 01/32] Lower atob required version to 2.1 (#27114) This file doesn't use anything that needs 2.8 --- types/atob/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/atob/index.d.ts b/types/atob/index.d.ts index 632880f7a6..1feb3481e8 100644 --- a/types/atob/index.d.ts +++ b/types/atob/index.d.ts @@ -2,6 +2,6 @@ // Project: https://git.coolaj86.com/coolaj86/atob.js.git // Definitions by: John Wright // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 2.1 export default function(str: string): string; From ff3bccf613fe50b431f90b686c17384cdd8e5838 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Mon, 9 Jul 2018 11:13:41 -0700 Subject: [PATCH 02/32] Added a few missing tests for Jest (#27134) --- types/jest/jest-tests.ts | 66 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index c6b00a4479..c54ebc3369 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -425,6 +425,72 @@ expect.extend({ }; } }); +expect.extend({ + async foo(this: jest.MatcherUtils, received: {}, ...actual: Array<{}>) { + return { + message: () => JSON.stringify(received), + pass: false, + }; + } +}); +expect.extend({ + foo(this: jest.MatcherUtils) { + const isNot: boolean = this.isNot; + + const expectedColor = this.utils.EXPECTED_COLOR("blue"); + const receivedColor = this.utils.EXPECTED_COLOR("red"); + + this.utils.ensureActualIsNumber({}); + this.utils.ensureActualIsNumber({}, "matcher"); + + this.utils.ensureExpectedIsNumber({}); + this.utils.ensureExpectedIsNumber({}, "matcher"); + + this.utils.ensureNoExpected({}); + this.utils.ensureNoExpected({}, "matcher"); + + this.utils.ensureNumbers({}, {}); + this.utils.ensureNumbers({}, {}, "matcher"); + + const valueType: string = this.utils.getType({}); + + this.utils.matcherHint("matcher"); + this.utils.matcherHint("matcher", "received"); + this.utils.matcherHint("matcher", "received", "expected"); + this.utils.matcherHint("matcher", "received", "expected", {}); + this.utils.matcherHint("matcher", "received", "expected", { + isDirectExpectCall: true, + }); + this.utils.matcherHint("matcher", "received", "expected", { + secondArgument: "", + }); + this.utils.matcherHint("matcher", "received", "expected", { + isDirectExpectCall: true, + secondArgument: "", + }); + + const plural: string = this.utils.pluralize("word", 3); + + const expectedPrinted: string = this.utils.printExpected({}); + + const receivedPrinted: string = this.utils.printReceived({}); + + const printedWithType: string = this.utils.printWithType( + "name", + {}, + (value: {}) => ""); + + const stringified: string = this.utils.stringify({}); + const stringifiedWithMaxDepth: string = this.utils.stringify({}, 3); + + const equals: boolean = this.equals({}, {}); + + return { + message: () => "", + pass: false, + }; + } +}); /* Basic matchers */ From 50536aeb06a63dacd33bfd38ce8d731724b683b6 Mon Sep 17 00:00:00 2001 From: Sou Niyari Date: Tue, 10 Jul 2018 03:15:35 +0900 Subject: [PATCH 03/32] Fix a typo in a monthsShort type (#27119) --- types/materialize-css/common.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/materialize-css/common.d.ts b/types/materialize-css/common.d.ts index 605e9389be..a37afbbb34 100644 --- a/types/materialize-css/common.d.ts +++ b/types/materialize-css/common.d.ts @@ -43,7 +43,7 @@ declare namespace M { previousMonth: string; nextMonth: string; months: string[]; - monthsShort: string; + monthsShort: string[]; weekdays: string[]; weekdaysShort: string[]; weekdaysAbbrev: string[]; From 3500f2e9ea0cc67c10720b882f649e8933993206 Mon Sep 17 00:00:00 2001 From: styu Date: Mon, 9 Jul 2018 14:15:56 -0400 Subject: [PATCH 04/32] Update virtual-dom typings with constructors and type-guards (#27112) * Update virtual-dom typings with constructors and type-guards * Lint * newline * Fix tests, update version * Fix patch typings * New line --- types/virtual-dom/index.d.ts | 51 ++++++++++++++++++++++++-- types/virtual-dom/virtual-dom-tests.ts | 32 ++++++++++++++-- 2 files changed, 76 insertions(+), 7 deletions(-) diff --git a/types/virtual-dom/index.d.ts b/types/virtual-dom/index.d.ts index 813928efeb..2f0d9c6fdc 100644 --- a/types/virtual-dom/index.d.ts +++ b/types/virtual-dom/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for virtual-dom 2.0.1 +// Type definitions for virtual-dom 2.1.1 // Project: https://github.com/Matt-Esch/virtual-dom // Definitions by: Christopher Brown // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -42,13 +42,20 @@ declare namespace VirtualDOM { type: string; // 'VirtualNode' } + interface VNodeConstructor { + new (tagName: string, properties: VProperties, children: VTree[], key?: string, namespace?: string): VNode; + } + interface VText { text: string; - new(text: any): VText; version: string; type: string; // 'VirtualText' } + interface VTextConstructor { + new (text: string): VText; + } + interface Widget { type: string; // 'Widget' init(): Element; @@ -78,7 +85,6 @@ declare namespace VirtualDOM { interface VPatch { vNode: VNode; patch: any; - new(type: number, vNode: VNode, patch: any): VPatch; version: string; /** type is set to 'VirtualPatch' on the prototype, but overridden in the @@ -87,6 +93,12 @@ declare namespace VirtualDOM { type: number; } + type PatchFn = (rootNode: T, patches: VPatch[], renderOptions: VPatchOptions) => T; + + interface VPatchOptions { + patch?: PatchFn; + } + interface createProperties extends VProperties { key?: string; namespace?: string; @@ -107,7 +119,12 @@ declare namespace VirtualDOM { patch() usually just returns rootNode after doing stuff to it, so we want to preserve that type (though it will usually be just Element). */ - function patch(rootNode: T, patches: VPatch[], renderOptions?: any): T; + function patch(rootNode: T, patches: VPatch[], renderOptions?: VPatchOptions): T; + + function isVNode(vTree: VTree): vTree is VNode; + function isVText(vTree: VTree): vTree is VText; + function isWidget(vTree: VTree): vTree is Widget; + function isThunk(vTree: VTree): vTree is Thunk; } declare module "virtual-dom/h" { @@ -130,3 +147,29 @@ declare module "virtual-dom/patch" { declare module "virtual-dom" { export = VirtualDOM; } +declare module "virtual-dom/vnode/vnode" { + import VNodeConstructor = VirtualDOM.VNodeConstructor; + const VNode: VNodeConstructor; + export = VNode; +} +declare module "virtual-dom/vnode/vtext" { + import VTextConstructor = VirtualDOM.VTextConstructor; + const VText: VTextConstructor; + export = VText; +} +declare module "virtual-dom/vnode/is-vnode" { + import isVNode = VirtualDOM.isVNode; + export = isVNode; +} +declare module "virtual-dom/vnode/is-vtext" { + import isVText = VirtualDOM.isVText; + export = isVText; +} +declare module "virtual-dom/vnode/is-widget" { + import isWidget = VirtualDOM.isWidget; + export = isWidget; +} +declare module "virtual-dom/vnode/is-thunk" { + import isThunk = VirtualDOM.isThunk; + export = isThunk; +} diff --git a/types/virtual-dom/virtual-dom-tests.ts b/types/virtual-dom/virtual-dom-tests.ts index f11c7f343f..37fd28fa8f 100644 --- a/types/virtual-dom/virtual-dom-tests.ts +++ b/types/virtual-dom/virtual-dom-tests.ts @@ -1,9 +1,13 @@ - import virtual_dom = require("virtual-dom"); -import VNode = virtual_dom.VNode; +import VNode = require("virtual-dom/vnode/vnode"); +import VText = require("virtual-dom/vnode/vtext"); import h = virtual_dom.h; +import isVNode = virtual_dom.isVNode; +import isVText = virtual_dom.isVText; +import isWidget = virtual_dom.isWidget; +import isThunk = virtual_dom.isThunk; -function renderAny(object: any): VNode { +function renderAny(object: any): virtual_dom.VNode { if (object === undefined) { return h('i.undefined', 'undefined'); } @@ -31,3 +35,25 @@ function renderAny(object: any): VNode { } return h('span.string', object.toString()); } + +const newNode = new VNode("tag", {}, []); +const newText = new VText("text"); +newText.text = "new-text"; +const tree: any = newNode; + +if (isVNode(tree)) { + tree.children = []; +} else if (isVText(tree)) { + tree.text = "hello"; +} else if (isWidget(tree)) { + tree.init(); +} else if (isThunk(tree)) { + tree.vnode = newNode; +} + +virtual_dom.patch(document.createElement("div"), []); +virtual_dom.patch(document.createElement("div"), [], { + patch: (rootNode: HTMLDivElement, patches: virtual_dom.VPatch[]) => { + return rootNode; + } +}); From 215834ee2f1339c03237934a8aa01d46350d60fc Mon Sep 17 00:00:00 2001 From: Davin Kevin <1970922+davinkevin@users.noreply.github.com> Date: Mon, 9 Jul 2018 20:18:03 +0200 Subject: [PATCH 05/32] fix(extend): improve signature of interface ExpectExtendMap (#27124) Jest custom matcher support both `string` and `() => string` for message property > https://github.com/facebook/jest/blob/d3a6a7400a89b857a63d939fc5664ae8a2dfbbb2/packages/expect/src/index.js#L351 --- types/jest/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index dd36f3b269..e32b9f05f0 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -342,7 +342,7 @@ declare namespace jest { } interface ExpectExtendMap { - [key: string]: (this: MatcherUtils, received: any, ...actual: any[]) => { message(): string, pass: boolean } | Promise<{ message(): string, pass: boolean }>; + [key: string]: (this: MatcherUtils, received: any, ...actual: any[]) => { message(): string | (() => string), pass: boolean } | Promise<{ message(): string, pass: boolean }>; } interface SnapshotSerializerOptions { From 8815592a2a3eacfe02b7796a7ef6e8027042dd6f Mon Sep 17 00:00:00 2001 From: Chris Abrams Date: Mon, 9 Jul 2018 13:21:20 -0500 Subject: [PATCH 06/32] Modify three options missing from webpack-dev-middleware and webpack-hot-middleware (#27116) * Add writeToDisk option * Add reload option * make sure writeToDisk can also be a function * enable index option to be boolean type --- types/webpack-dev-middleware/index.d.ts | 4 +++- types/webpack-dev-middleware/webpack-dev-middleware-tests.ts | 1 + types/webpack-hot-middleware/index.d.ts | 5 ++++- types/webpack-hot-middleware/webpack-hot-middleware-tests.ts | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/types/webpack-dev-middleware/index.d.ts b/types/webpack-dev-middleware/index.d.ts index 6a7d1bc4b3..73175d2eab 100644 --- a/types/webpack-dev-middleware/index.d.ts +++ b/types/webpack-dev-middleware/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/webpack/webpack-dev-middleware // Definitions by: Benjamin Lim // reduckted +// Chris Abrams // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -23,7 +24,7 @@ declare namespace WebpackDevMiddleware { lazy?: boolean; watchOptions?: webpack.Options.WatchOptions; publicPath: string; - index?: string; + index?: string | boolean; headers?: { [name: string]: string; }; @@ -32,6 +33,7 @@ declare namespace WebpackDevMiddleware { serverSideRender?: boolean; logger?: Logger; filename?: string; + writeToDisk?: boolean | ((filename: string) => boolean); } interface ReporterOptions { diff --git a/types/webpack-dev-middleware/webpack-dev-middleware-tests.ts b/types/webpack-dev-middleware/webpack-dev-middleware-tests.ts index beb3c1abe6..9881ab3b9c 100644 --- a/types/webpack-dev-middleware/webpack-dev-middleware-tests.ts +++ b/types/webpack-dev-middleware/webpack-dev-middleware-tests.ts @@ -23,6 +23,7 @@ webpackDevMiddlewareInstance = webpackDevMiddleware(compiler, { }, reporter: null, serverSideRender: false, + writeToDisk: false, }); const app = express(); diff --git a/types/webpack-hot-middleware/index.d.ts b/types/webpack-hot-middleware/index.d.ts index ca0abd7d69..d9cfe9cb60 100644 --- a/types/webpack-hot-middleware/index.d.ts +++ b/types/webpack-hot-middleware/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for webpack-hot-middleware 2.16 // Project: https://github.com/glenjamin/webpack-hot-middleware#readme -// Definitions by: Benjamin Lim , Ron Martinez +// Definitions by: Benjamin Lim +// Ron Martinez +// Chris Abrams // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -19,6 +21,7 @@ declare namespace WebpackHotMiddleware { log?: false | Logger; path?: string; heartbeat?: number; + reload?: boolean; } type Logger = (message?: any, ...optionalParams: any[]) => void; diff --git a/types/webpack-hot-middleware/webpack-hot-middleware-tests.ts b/types/webpack-hot-middleware/webpack-hot-middleware-tests.ts index b87b379379..b28f86362f 100644 --- a/types/webpack-hot-middleware/webpack-hot-middleware-tests.ts +++ b/types/webpack-hot-middleware/webpack-hot-middleware-tests.ts @@ -10,6 +10,7 @@ webpackHotMiddlewareInstance = webpackHotMiddleware(compiler, { log: console.log.bind(console), path: '/__what', heartbeat: 2000, + reload: false, }); const app = express(); From e3ff16475bf7155eb230cae5928f00ecb7a48c26 Mon Sep 17 00:00:00 2001 From: AJ Richardson Date: Mon, 9 Jul 2018 14:22:37 -0400 Subject: [PATCH 07/32] lodash: fix pickBy for dictionary types (#27131) Fixes #24133 (I know it's closed but as per the discussion there, it wasn't fixed properly before). Please fill in this template. - [x] Use a meaningful title for the pull request. Include the name of the package modified. - [x] Test the change in your own code. (Compile and run.) - [x] Add or edit tests to reflect the change. (Run with `npm test`.) - [x] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#make-a-pull-request). - [x] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#common-mistakes). - [x] Run `npm run lint package-name` (or `tsc` if no `tslint.json` is present). If changing an existing definition: - [ ] Provide a URL to documentation or source code which provides context for the suggested changes: N/A - [ ] Increase the version number in the header if appropriate. N/A - [x] If you are making substantial changes, consider adding a `tslint.json` containing `{ "extends": "dtslint/dt.json" }`. --- types/lodash/common/object.d.ts | 96 +++++++++++++++++++++++++++++++++ types/lodash/fp.d.ts | 32 ++++++++--- types/lodash/lodash-tests.ts | 42 +++++++++++---- types/lowdb/_lodash.d.ts | 32 +++++++++++ 4 files changed, 187 insertions(+), 15 deletions(-) diff --git a/types/lodash/common/object.d.ts b/types/lodash/common/object.d.ts index 5e2d539c23..a729140e02 100644 --- a/types/lodash/common/object.d.ts +++ b/types/lodash/common/object.d.ts @@ -2951,6 +2951,22 @@ declare module "../index" { * _.omitBy(object, _.isNumber); * // => { 'b': '2' } */ + omitBy( + object: Dictionary | null | undefined, + predicate?: ValueKeyIteratee + ): Dictionary; + + /** + * @see _.omitBy + */ + omitBy( + object: NumericDictionary | null | undefined, + predicate?: ValueKeyIteratee + ): NumericDictionary; + + /** + * @see _.omitBy + */ omitBy( object: T | null | undefined, predicate: ValueKeyIteratee @@ -2958,6 +2974,22 @@ declare module "../index" { } interface LoDashImplicitWrapper { + /** + * @see _.omitBy + */ + omitBy( + this: LoDashImplicitWrapper | null | undefined>, + predicate?: ValueKeyIteratee + ): LoDashImplicitWrapper>; + + /** + * @see _.omitBy + */ + omitBy( + this: LoDashImplicitWrapper | null | undefined>, + predicate?: ValueKeyIteratee + ): LoDashImplicitWrapper>; + /** * @see _.omitBy */ @@ -2968,6 +3000,22 @@ declare module "../index" { } interface LoDashExplicitWrapper { + /** + * @see _.omitBy + */ + omitBy( + this: LoDashExplicitWrapper | null | undefined>, + predicate?: ValueKeyIteratee + ): LoDashExplicitWrapper>; + + /** + * @see _.omitBy + */ + omitBy( + this: LoDashExplicitWrapper | null | undefined>, + predicate?: ValueKeyIteratee + ): LoDashExplicitWrapper>; + /** * @see _.omitBy */ @@ -3063,6 +3111,22 @@ declare module "../index" { * _.pickBy(object, _.isNumber); * // => { 'a': 1, 'c': 3 } */ + pickBy( + object: Dictionary | null | undefined, + predicate?: ValueKeyIteratee + ): Dictionary; + + /** + * @see _.pickBy + */ + pickBy( + object: NumericDictionary | null | undefined, + predicate?: ValueKeyIteratee + ): NumericDictionary; + + /** + * @see _.pickBy + */ pickBy( object: T | null | undefined, predicate?: ValueKeyIteratee @@ -3070,6 +3134,22 @@ declare module "../index" { } interface LoDashImplicitWrapper { + /** + * @see _.pickBy + */ + pickBy( + this: LoDashImplicitWrapper | null | undefined>, + predicate?: ValueKeyIteratee + ): LoDashImplicitWrapper>; + + /** + * @see _.pickBy + */ + pickBy( + this: LoDashImplicitWrapper | null | undefined>, + predicate?: ValueKeyIteratee + ): LoDashImplicitWrapper>; + /** * @see _.pickBy */ @@ -3080,6 +3160,22 @@ declare module "../index" { } interface LoDashExplicitWrapper { + /** + * @see _.pickBy + */ + pickBy( + this: LoDashExplicitWrapper | null | undefined>, + predicate?: ValueKeyIteratee + ): LoDashExplicitWrapper>; + + /** + * @see _.pickBy + */ + pickBy( + this: LoDashExplicitWrapper | null | undefined>, + predicate?: ValueKeyIteratee + ): LoDashExplicitWrapper>; + /** * @see _.pickBy */ diff --git a/types/lodash/fp.d.ts b/types/lodash/fp.d.ts index c799bd734b..2185fbf4aa 100644 --- a/types/lodash/fp.d.ts +++ b/types/lodash/fp.d.ts @@ -2289,11 +2289,21 @@ declare namespace _ { } interface LodashOmitBy { (predicate: lodash.ValueKeyIteratee): LodashOmitBy1x1; - (predicate: lodash.__, object: T | null | undefined): LodashOmitBy1x2; + (predicate: lodash.__, object: lodash.Dictionary | null | undefined): LodashOmitBy1x2; + (predicate: lodash.ValueKeyIteratee, object: lodash.Dictionary | null | undefined): lodash.Dictionary; + (predicate: lodash.__, object: lodash.NumericDictionary | null | undefined): LodashOmitBy2x2; + (predicate: lodash.ValueKeyIteratee, object: lodash.NumericDictionary | null | undefined): lodash.NumericDictionary; + (predicate: lodash.__, object: T | null | undefined): LodashOmitBy3x2; (predicate: lodash.ValueKeyIteratee, object: T | null | undefined): lodash.PartialObject; } - type LodashOmitBy1x1 = (object: T1 | null | undefined) => lodash.PartialObject; - type LodashOmitBy1x2 = (predicate: lodash.ValueKeyIteratee) => lodash.PartialObject; + interface LodashOmitBy1x1 { + (object: lodash.Dictionary | null | undefined): lodash.Dictionary; + (object: lodash.NumericDictionary | null | undefined): lodash.NumericDictionary; + (object: T1 | null | undefined): lodash.PartialObject; + } + type LodashOmitBy1x2 = (predicate: lodash.ValueKeyIteratee) => lodash.Dictionary; + type LodashOmitBy2x2 = (predicate: lodash.ValueKeyIteratee) => lodash.NumericDictionary; + type LodashOmitBy3x2 = (predicate: lodash.ValueKeyIteratee) => lodash.PartialObject; type LodashOnce = any>(func: T) => T; interface LodashOrderBy { (iteratees: lodash.Many<(value: T) => lodash.NotVoid>): LodashOrderBy1x1; @@ -2873,11 +2883,21 @@ declare namespace _ { type LodashPick2x2 = (props: lodash.PropertyPath) => lodash.PartialDeep; interface LodashPickBy { (predicate: lodash.ValueKeyIteratee): LodashPickBy1x1; - (predicate: lodash.__, object: T | null | undefined): LodashPickBy1x2; + (predicate: lodash.__, object: lodash.Dictionary | null | undefined): LodashPickBy1x2; + (predicate: lodash.ValueKeyIteratee, object: lodash.Dictionary | null | undefined): lodash.Dictionary; + (predicate: lodash.__, object: lodash.NumericDictionary | null | undefined): LodashPickBy2x2; + (predicate: lodash.ValueKeyIteratee, object: lodash.NumericDictionary | null | undefined): lodash.NumericDictionary; + (predicate: lodash.__, object: T | null | undefined): LodashPickBy3x2; (predicate: lodash.ValueKeyIteratee, object: T | null | undefined): lodash.PartialObject; } - type LodashPickBy1x1 = (object: T1 | null | undefined) => lodash.PartialObject; - type LodashPickBy1x2 = (predicate: lodash.ValueKeyIteratee) => lodash.PartialObject; + interface LodashPickBy1x1 { + (object: lodash.Dictionary | null | undefined): lodash.Dictionary; + (object: lodash.NumericDictionary | null | undefined): lodash.NumericDictionary; + (object: T1 | null | undefined): lodash.PartialObject; + } + type LodashPickBy1x2 = (predicate: lodash.ValueKeyIteratee) => lodash.Dictionary; + type LodashPickBy2x2 = (predicate: lodash.ValueKeyIteratee) => lodash.NumericDictionary; + type LodashPickBy3x2 = (predicate: lodash.ValueKeyIteratee) => lodash.PartialObject; interface LodashProp { (path: TKey | [TKey]): LodashProp1x1; (path: lodash.__, object: TObject): LodashProp1x2; diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index 88a5a88bfc..bc6084a005 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -5561,13 +5561,23 @@ fp.now(); // $ExpectType number // _.omitBy { const obj: AbcObject | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; + const numericDictionary: _.NumericDictionary | null | undefined = anything; const predicate = (element: string | number | boolean, key: string) => true; + const predicate2 = (element: boolean, key: string) => true; _.omitBy(obj, predicate); // $ExpectType Partial + _.omitBy(dictionary, predicate2); // $ExpectType Dictionary + _.omitBy(numericDictionary, predicate2); // $ExpectType NumericDictionary _(obj).omitBy(predicate); // $ExpectType LoDashImplicitWrapper> + _(dictionary).omitBy(predicate2); // $ExpectType LoDashImplicitWrapper> + _(numericDictionary).omitBy(predicate2); // $ExpectType LoDashImplicitWrapper> _.chain(obj).omitBy(predicate); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).omitBy(predicate2); // $ExpectType LoDashExplicitWrapper> + _.chain(numericDictionary).omitBy(predicate2); // $ExpectType LoDashExplicitWrapper> fp.omitBy(predicate, obj); // $ExpectType Partial - fp.omitBy(predicate)(obj); // $ExpectType Partial + fp.omitBy(predicate2)(dictionary); // $ExpectType Dictionary + fp.omitBy(predicate2)(numericDictionary); // $ExpectType NumericDictionary } // _.pick @@ -5584,8 +5594,10 @@ fp.now(); // $ExpectType number _.pick(obj1, readonlyArray); // $ExpectType PartialDeep // Broken in TS 2.4 // _.pick(obj2, "a", "b"); // Pick - _.pick(obj2, literalsArray); // $ExpectType Pick - _.pick(obj2, roLiteralsArray); // $ExpectType Pick + // We can't use ExpectType here because typescript keeps changing what order the types appear. + let result1: Pick; + result1 = _.pick(obj2, literalsArray); + result1 = _.pick(obj2, roLiteralsArray); _(obj1).pick("a"); // $ExpectType LoDashImplicitWrapper> _(obj1).pick(0, "a"); // $ExpectType LoDashImplicitWrapper> @@ -5593,8 +5605,9 @@ fp.now(); // $ExpectType number _(obj1).pick(readonlyArray); // $ExpectType LoDashImplicitWrapper> // Broken in TS 2.4 // _(obj2).pick("a", "b"); // LoDashImplicitWrapper> - _(obj2).pick(literalsArray); // $ExpectType LoDashImplicitWrapper> - _(obj2).pick(roLiteralsArray); // $ExpectType LoDashImplicitWrapper> + let result2: _.LoDashImplicitWrapper>; + result2 = _(obj2).pick(literalsArray); + result2 = _(obj2).pick(roLiteralsArray); _.chain(obj1).pick("a"); // $ExpectType LoDashExplicitWrapper> _.chain(obj1).pick(0, "a"); // $ExpectType LoDashExplicitWrapper> @@ -5602,24 +5615,35 @@ fp.now(); // $ExpectType number _.chain(obj1).pick(readonlyArray); // $ExpectType LoDashExplicitWrapper> // Broken in TS 2.4 // _.chain(obj2).pick("a", "b"); // LoDashExplicitWrapper> - _.chain(obj2).pick(literalsArray); // $ExpectType LoDashExplicitWrapper> - _.chain(obj2).pick(roLiteralsArray); // $ExpectType LoDashExplicitWrapper> + let result3: _.LoDashExplicitWrapper>; + result3 = _.chain(obj2).pick(literalsArray); + result3 = _.chain(obj2).pick(roLiteralsArray); fp.pick("a", obj2); // $ExpectType Pick fp.pick("a")(obj2); // $ExpectType Pick - fp.pick(literalsArray)(obj2); // $ExpectType Pick + result1 = fp.pick(literalsArray)(obj2); } // _.pickBy { const obj: AbcObject | null | undefined = anything; + const dictionary: _.Dictionary | null | undefined = anything; + const numericDictionary: _.NumericDictionary | null | undefined = anything; const predicate = (element: string | number | boolean, key: string) => true; + const predicate2 = (element: boolean, key: string) => true; _.pickBy(obj, predicate); // $ExpectType Partial + _.pickBy(dictionary, predicate2); // $ExpectType Dictionary + _.pickBy(numericDictionary, predicate2); // $ExpectType NumericDictionary _(obj).pickBy(predicate); // $ExpectType LoDashImplicitWrapper> + _(dictionary).pickBy(predicate2); // $ExpectType LoDashImplicitWrapper> + _(numericDictionary).pickBy(predicate2); // $ExpectType LoDashImplicitWrapper> _.chain(obj).pickBy(predicate); // $ExpectType LoDashExplicitWrapper> + _.chain(dictionary).pickBy(predicate2); // $ExpectType LoDashExplicitWrapper> + _.chain(numericDictionary).pickBy(predicate2); // $ExpectType LoDashExplicitWrapper> fp.pickBy(predicate, obj); // $ExpectType Partial - fp.pickBy(predicate)(obj); // $ExpectType Partial + fp.pickBy(predicate2)(dictionary); // $ExpectType Dictionary + fp.pickBy(predicate2)(numericDictionary); // $ExpectType NumericDictionary } // _.result diff --git a/types/lowdb/_lodash.d.ts b/types/lowdb/_lodash.d.ts index a7d2c424f0..862e8d39bd 100644 --- a/types/lowdb/_lodash.d.ts +++ b/types/lowdb/_lodash.d.ts @@ -1273,6 +1273,14 @@ declare module "./index" { this: LoDashExplicitSyncWrapper, ...paths: Array<_.Many<_.PropertyName>> ): LoDashExplicitSyncWrapper<_.PartialObject>; + omitBy( + this: LoDashExplicitSyncWrapper<_.Dictionary | null | undefined>, + predicate?: _.ValueKeyIteratee + ): LoDashExplicitSyncWrapper<_.Dictionary>; + omitBy( + this: LoDashExplicitSyncWrapper<_.NumericDictionary | null | undefined>, + predicate?: _.ValueKeyIteratee + ): LoDashExplicitSyncWrapper<_.NumericDictionary>; omitBy( this: LoDashExplicitSyncWrapper, predicate: _.ValueKeyIteratee @@ -1285,6 +1293,14 @@ declare module "./index" { this: LoDashExplicitSyncWrapper, ...props: _.PropertyPath[] ): LoDashExplicitSyncWrapper<_.PartialObject>; + pickBy( + this: LoDashExplicitSyncWrapper<_.Dictionary | null | undefined>, + predicate?: _.ValueKeyIteratee + ): LoDashExplicitSyncWrapper<_.Dictionary>; + pickBy( + this: LoDashExplicitSyncWrapper<_.NumericDictionary | null | undefined>, + predicate?: _.ValueKeyIteratee + ): LoDashExplicitSyncWrapper<_.NumericDictionary>; pickBy( this: LoDashExplicitSyncWrapper, predicate?: _.ValueKeyIteratee @@ -2841,6 +2857,14 @@ declare module "./index" { this: LoDashExplicitAsyncWrapper, ...paths: Array<_.Many<_.PropertyName>> ): LoDashExplicitAsyncWrapper<_.PartialObject>; + omitBy( + this: LoDashExplicitAsyncWrapper<_.Dictionary | null | undefined>, + predicate?: _.ValueKeyIteratee + ): LoDashExplicitAsyncWrapper<_.Dictionary>; + omitBy( + this: LoDashExplicitAsyncWrapper<_.NumericDictionary | null | undefined>, + predicate?: _.ValueKeyIteratee + ): LoDashExplicitAsyncWrapper<_.NumericDictionary>; omitBy( this: LoDashExplicitAsyncWrapper, predicate: _.ValueKeyIteratee @@ -2853,6 +2877,14 @@ declare module "./index" { this: LoDashExplicitAsyncWrapper, ...props: _.PropertyPath[] ): LoDashExplicitAsyncWrapper<_.PartialObject>; + pickBy( + this: LoDashExplicitAsyncWrapper<_.Dictionary | null | undefined>, + predicate?: _.ValueKeyIteratee + ): LoDashExplicitAsyncWrapper<_.Dictionary>; + pickBy( + this: LoDashExplicitAsyncWrapper<_.NumericDictionary | null | undefined>, + predicate?: _.ValueKeyIteratee + ): LoDashExplicitAsyncWrapper<_.NumericDictionary>; pickBy( this: LoDashExplicitAsyncWrapper, predicate?: _.ValueKeyIteratee From d0aa16640501ac973c8ec35bdb9a23ae6e9e03cb Mon Sep 17 00:00:00 2001 From: Alexander T Date: Mon, 9 Jul 2018 21:24:28 +0300 Subject: [PATCH 08/32] Update types based on new react-native 0.56 version (#27136) --- types/react-native/index.d.ts | 39 +++++++++++++++++++++---------- types/react-native/test/index.tsx | 23 +++++++++++++++--- 2 files changed, 47 insertions(+), 15 deletions(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index f3efa9f587..3ad2d62367 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.55 +// Type definitions for react-native 0.56 // Project: https://github.com/facebook/react-native // Definitions by: Eloy Durán // HuHuanming @@ -571,7 +571,7 @@ export interface FlexStyle { flexDirection?: "row" | "column" | "row-reverse" | "column-reverse"; flexGrow?: number; flexShrink?: number; - flexWrap?: "wrap" | "nowrap"; + flexWrap?: "wrap" | "nowrap" | "wrap-reverse"; height?: number | string; justifyContent?: "flex-start" | "flex-end" | "center" | "space-between" | "space-around" | "space-evenly"; left?: number | string; @@ -1359,6 +1359,7 @@ interface TextInputState { currentlyFocusedField(): number; /** + * @deprecated * @param TextInputID id of the text field to focus * Focuses the specified text field * noop if the text field was already focused @@ -1366,6 +1367,7 @@ interface TextInputState { focusTextInput(textFieldID?: number): void; /** + * @deprecated * @param textFieldID id of the text field to focus * Unfocuses the specified text field * noop if it wasn't focused @@ -1830,7 +1832,7 @@ export interface AccessibilityPropsIOS { * Is this element a label? A button? A header? These questions are answered by accessibilityTraits. * @platform ios */ - accessibilityTraits?: AccessibilityTraits | AccessibilityTraits[]; + accessibilityTraits?: AccessibilityTrait | AccessibilityTrait[]; /** * When `accessible` is true, the system will try to invoke this function when the user performs accessibility tap gesture. @@ -1845,7 +1847,7 @@ export interface AccessibilityPropsIOS { onMagicTap?: () => void; } -type AccessibilityTraits = +type AccessibilityTrait = | "none" | "button" | "link" @@ -2101,6 +2103,11 @@ Possible values for mixedContentMode are: 'compatibility' - WebView will attempt to be compatible with the approach of a modern web browser with regard to mixed content. */ mixedContentMode?: "never" | "always" | "compatibility"; + + /** + * Controls whether form autocomplete data should be saved + */ + saveFormDataDisabled?: boolean; } export interface WebViewIOSLoadRequestEvent { @@ -2303,6 +2310,14 @@ export interface WebViewProps extends ViewProps, WebViewPropsAndroid, WebViewPro * sets whether the webpage scales to fit the view and the user can change the scale */ scalesPageToFit?: boolean; + + /** + * List of origin strings to allow being navigated to. + * The strings allow wildcards and get matched against just the origin (not the full URL). + * If the user taps to navigate to a new page but the new page is not in this whitelist, the URL will be handled by the OS. + * The default whitelisted origins are "http://" and "https://". + */ + originWhitelist?: string[]; } export class WebView extends React.Component { @@ -3436,11 +3451,6 @@ export interface ImagePropsIOS { */ capInsets?: Insets; - /** - * A static image to display while downloading the final image off the network. - */ - defaultSource?: ImageURISource | number; - /** * Invoked on download progress with {nativeEvent: {loaded, total}} */ @@ -3625,13 +3635,18 @@ export interface ImagePropsBase extends ImagePropsIOS, ImagePropsAndroid, Access */ testID?: string; + /** + * A static image to display while downloading the final image off the network. + */ + defaultSource?: ImageURISource | number; + /** * Currently broken * @see https://github.com/facebook/react-native/pull/19281 */ - width?: never, - height?: never, - tintColor?: never, + width?: never; + height?: never; + tintColor?: never; } export interface ImageProps extends ImagePropsBase { diff --git a/types/react-native/test/index.tsx b/types/react-native/test/index.tsx index 117c80379f..0199d4f14e 100644 --- a/types/react-native/test/index.tsx +++ b/types/react-native/test/index.tsx @@ -66,6 +66,7 @@ import { TextInputContentSizeChangeEventData, TextInputEndEditingEventData, TextInputSubmitEditingEventData, + WebView, } from "react-native"; declare module "react-native" { @@ -608,6 +609,17 @@ class StatusBarTest extends React.Component { } } +class WebViewTest extends React.Component { + render() { + return ( + + ); + } +} + export class ImageTest extends React.Component { componentDidMount(): void { const image: ImageResolvedAssetSource = Image.resolveAssetSource({ @@ -660,7 +672,7 @@ class StylePropsTest extends React.PureComponent { margin={20} overflow="visible" // ps: must fail if "scroll" source={{ uri }} - style={{ width: 200, height: 200, tintColor: 'green' }} + style={{ width: 200, height: 200, tintColor: 'green', flexWrap: 'wrap-reverse' }} // tintColor="green" // width={200} /> @@ -671,10 +683,15 @@ class StylePropsTest extends React.PureComponent { const listViewDataSourceTest = new ListView.DataSource({rowHasChanged: () => true}) -class AccessibilityViewHidingTest extends React.Component { +class AccessibilityTest extends React.Component { render() { return ( - + + Text ); From 50c50a8eb224f9c7a73c149c1d1d7cb41372f3f9 Mon Sep 17 00:00:00 2001 From: Jack Coulter Date: Tue, 10 Jul 2018 04:25:04 +1000 Subject: [PATCH 09/32] [redux-first-router] Update types for compatibility with redux@^4.0.0 (#26975) * Update redux-first-router types for compatibility with Redux 4 * Fix tests for redux-first-router --- types/redux-first-router/index.d.ts | 5 +++-- types/redux-first-router/package.json | 2 +- types/redux-first-router/redux-first-router-tests.ts | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/types/redux-first-router/index.d.ts b/types/redux-first-router/index.d.ts index f15d27ceb7..928be92c6c 100644 --- a/types/redux-first-router/index.d.ts +++ b/types/redux-first-router/index.d.ts @@ -4,6 +4,7 @@ // viggyfresh // janb87 // corydeppen +// jscinoz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -12,7 +13,7 @@ import { Store, Reducer, Middleware, - GenericStoreEnhancer + StoreEnhancer } from 'redux'; import { History } from 'history'; @@ -233,7 +234,7 @@ export function connectRoutes( reducer: Reducer>; middleware: Middleware; thunk(store: Store): Promise>>; - enhancer: GenericStoreEnhancer; + enhancer: StoreEnhancer; initialDispatch?(): void; }; diff --git a/types/redux-first-router/package.json b/types/redux-first-router/package.json index cc21197405..7f5b19d45b 100644 --- a/types/redux-first-router/package.json +++ b/types/redux-first-router/package.json @@ -1,6 +1,6 @@ { "private": true, "dependencies": { - "redux": "^3.7.0" + "redux": "^4.0.0" } } diff --git a/types/redux-first-router/redux-first-router-tests.ts b/types/redux-first-router/redux-first-router-tests.ts index 7d14b755c3..cf3f772d9e 100644 --- a/types/redux-first-router/redux-first-router-tests.ts +++ b/types/redux-first-router/redux-first-router-tests.ts @@ -10,6 +10,7 @@ import { pathToAction } from 'redux-first-router'; import { + AnyAction, createStore, applyMiddleware, Middleware, @@ -18,7 +19,7 @@ import { Dispatch, compose, Action, - GenericStoreEnhancer, + StoreEnhancer, StoreEnhancerStoreCreator, combineReducers } from 'redux'; @@ -32,7 +33,6 @@ interface Keys { } interface State { location: LocationState; - stale: boolean; } type StoreCreator = StoreEnhancerStoreCreator; @@ -78,7 +78,7 @@ const dumbMiddleware: Middleware = store => next => action => next(action); const composedMiddleware = applyMiddleware(middleware, dumbMiddleware); -const storeEnhancer = compose( +const storeEnhancer = compose( enhancer, composedMiddleware ); @@ -112,7 +112,7 @@ const action: ReduxFirstRouterAction = { }; redirect(action); // $ExpectType Action -// $ExpectType Store +// $ExpectType Store store; store.getState().location.routesMap; // $ExpectType RoutesMap From ebcb52fb25a340a2d5e32c4080083dbcf339ebc3 Mon Sep 17 00:00:00 2001 From: silh Date: Mon, 9 Jul 2018 21:25:33 +0300 Subject: [PATCH 10/32] Added support for className option in ImageOverlayOptions. (#27077) ImageOverlayOptions extends InteractiveLayerOptions as described in Leaflet docs. Added bubblingMouseEvents option to InteractiveLayerOptions. --- types/leaflet/index.d.ts | 4 +++- types/leaflet/leaflet-tests.ts | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/types/leaflet/index.d.ts b/types/leaflet/index.d.ts index 89f9625114..47b2ebc515 100644 --- a/types/leaflet/index.d.ts +++ b/types/leaflet/index.d.ts @@ -390,6 +390,7 @@ export interface LayerOptions { export interface InteractiveLayerOptions extends LayerOptions { interactive?: boolean; + bubblingMouseEvents?: boolean; } export class Layer extends Evented { @@ -542,12 +543,13 @@ export namespace tileLayer { function wms(baseUrl: string, options?: WMSOptions): TileLayer.WMS; } -export interface ImageOverlayOptions extends LayerOptions { +export interface ImageOverlayOptions extends InteractiveLayerOptions { opacity?: number; alt?: string; interactive?: boolean; attribution?: string; crossOrigin?: boolean; + className?: string; } export class ImageOverlay extends Layer { diff --git a/types/leaflet/leaflet-tests.ts b/types/leaflet/leaflet-tests.ts index a22ab91248..1f6671cc8c 100644 --- a/types/leaflet/leaflet-tests.ts +++ b/types/leaflet/leaflet-tests.ts @@ -251,6 +251,29 @@ tileLayer = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png'); tileLayer = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', tileLayerOptions); tileLayer = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png?{foo}&{bar}&{abc}', {foo: 'bar', bar: (data: any) => 'foo', abc: () => ''}); +// imageOverlay +let imageOverlayOptions: L.ImageOverlayOptions; +imageOverlayOptions = { + opacity: 100, + alt: 'alt', + interactive: true, + attribution: 'attribution', + crossOrigin: true, + className: 'className', + bubblingMouseEvents: false, + pane: 'pane' +}; + +const imageOverlayBounds = latLngBounds; +let imageOverlay: L.ImageOverlay; +imageOverlay = L.imageOverlay('https://www.google.ru/images/branding/googlelogo/2x/googlelogo_color_120x44dp.png', imageOverlayBounds); +imageOverlay = L.imageOverlay('https://www.google.ru/images/branding/googlelogo/2x/googlelogo_color_120x44dp.png', imageOverlayBounds, imageOverlayOptions); +imageOverlay = L.imageOverlay('https://www.google.ru/images/branding/googlelogo/2x/googlelogo_color_120x44dp.png', imageOverlayBounds, { + opacity: 100, + alt: 'alt', + className: 'className', +}); + const eventHandler = () => {}; const domEvent: Event = {} as Event; L.DomEvent From 8c23206f59af66c64e779a1f69b4f848ddba90de Mon Sep 17 00:00:00 2001 From: Ben LeFevre Date: Mon, 9 Jul 2018 18:26:39 +0000 Subject: [PATCH 11/32] @types/documentdb: Use specified return type in queryDocuments (#27021) `queryDocuments` already has a type variable but it is not being used in the return type. This PR simply merges the RetrievedDocument type with the input type. --- types/documentdb/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/documentdb/index.d.ts b/types/documentdb/index.d.ts index e7962ba568..118881a378 100644 --- a/types/documentdb/index.d.ts +++ b/types/documentdb/index.d.ts @@ -802,7 +802,7 @@ export class DocumentClient { * @param [options] - Represents the feed options. * @returns - An instance of queryIterator to handle reading feed. */ - queryDocuments(collectionLink: string, query: DocumentQuery, options?: FeedOptions): QueryIterator; + queryDocuments(collectionLink: string, query: DocumentQuery, options?: FeedOptions): QueryIterator; /** * Query the triggers for the collection. From 16b94cdf1a69eae66a1e0a3adba1f0621840750a Mon Sep 17 00:00:00 2001 From: Banst Date: Mon, 9 Jul 2018 20:26:57 +0200 Subject: [PATCH 12/32] [ioredis] add missing attributes to Pipeline interface (#27150) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🐛 add missing attribute to Pipeline interfacce * Revert "🐛 add missing attribute to Pipeline interfacce" This reverts commit d45b38583de61af98cd4f749ff8b27b6d8801c37. * 🐛 add missing attributes to Pipeline interface (without auto format) --- types/ioredis/index.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/types/ioredis/index.d.ts b/types/ioredis/index.d.ts index 8256fea80b..7172f1e97d 100644 --- a/types/ioredis/index.d.ts +++ b/types/ioredis/index.d.ts @@ -458,6 +458,13 @@ declare namespace IORedis { } interface Pipeline { + redis: Redis; + isCluster: boolean; + options: RedisOptions; + _queue: Command[]; + _result: any[]; + _transactions: number; + _shaToScript: {}; bitcount(key: string, callback?: (err: Error, res: number) => void): Pipeline; bitcount(key: string, start: number, end: number, callback?: (err: Error, res: number) => void): Pipeline; From 34adabadd6dc74a14a1527b7cac1846855a8cf42 Mon Sep 17 00:00:00 2001 From: Jack Wearden Date: Mon, 9 Jul 2018 11:33:29 -0700 Subject: [PATCH 13/32] [highland] - 2.12.0 toNodeStream method (#27133) * [highland] add support for 2.12.0 toNodeStream() * [highland] bump version in header --- types/highland/highland-tests.ts | 6 ++++++ types/highland/index.d.ts | 22 +++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/types/highland/highland-tests.ts b/types/highland/highland-tests.ts index a1c48c944b..fc63a23925 100644 --- a/types/highland/highland-tests.ts +++ b/types/highland/highland-tests.ts @@ -333,6 +333,12 @@ fooStream.toArray((arr: Foo[]) => {}); fooStream.toCallback((err: Error, x: Foo) => {}); fooStream.toCallback((err: Error) => {}); +fooStream.toNodeStream(); +fooStream.toNodeStream({objectMode: false}); +fooStream.toNodeStream({objectMode: true}); + +fooStream.toPromise(Promise); + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // UTILS // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/types/highland/index.d.ts b/types/highland/index.d.ts index 473e93880a..7203e959ab 100644 --- a/types/highland/index.d.ts +++ b/types/highland/index.d.ts @@ -1,9 +1,10 @@ -// Type definitions for Highland 2.10.5 +// Type definitions for Highland 2.12.0 // Project: http://highlandjs.org/ // Definitions by: Bart van der Schoor // Hugo Wood // William Yu // Alvis HT Tang +// Jack Wearden // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -1319,6 +1320,25 @@ declare namespace Highland { */ toCallback(cb: (err?: Error, x?: R) => void): void; + /** + * Converts the stream to a node Readable Stream for use in methods + * or pipes that depend on the native stream type. + * + * The options parameter can be an object passed into the [`Readable` + * constructor](http://nodejs.org/api/stream.html#stream_class_stream_readable). + * + * @id toNodeStream + * @section Consumption + * @name Stream.toNodeStream(options) + * @param {Object} options - (optional) [`Readable` constructor](http://nodejs.org/api/stream.html#stream_class_stream_readable) options + * @api public + * + * _(fs.createReadStream('./abc')).toNodeStream() + * _(fs.createReadStream('./abc')).toNodeStream({objectMode: false}) + * _([{a: 1}]).toNodeStream({objectMode: true}) + */ + toNodeStream(options?: object): NodeJS.ReadableStream; + /** * Converts the result of a stream to Promise. * From 8355056eb306275f1f5c449963f57e7cc5a1b810 Mon Sep 17 00:00:00 2001 From: Michele Bombardi Date: Mon, 9 Jul 2018 21:49:05 +0200 Subject: [PATCH 14/32] New package: react-native-toast-native (#27148) --- types/react-native-toast-native/index.d.ts | 49 +++++++++++++++++++ .../react-native-toast-native-tests.tsx | 28 +++++++++++ types/react-native-toast-native/tsconfig.json | 25 ++++++++++ types/react-native-toast-native/tslint.json | 1 + 4 files changed, 103 insertions(+) create mode 100644 types/react-native-toast-native/index.d.ts create mode 100644 types/react-native-toast-native/react-native-toast-native-tests.tsx create mode 100644 types/react-native-toast-native/tsconfig.json create mode 100644 types/react-native-toast-native/tslint.json diff --git a/types/react-native-toast-native/index.d.ts b/types/react-native-toast-native/index.d.ts new file mode 100644 index 0000000000..130614290b --- /dev/null +++ b/types/react-native-toast-native/index.d.ts @@ -0,0 +1,49 @@ +// Type definitions for react-native-toast-native 0.1 +// Project: https://github.com/onemolegames/react-native-toast-native/blob/master/README.md +// Definitions by: Michele Bombardi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import { Platform } from 'react-native'; + +export interface Style { + width?: number; + height?: number; + backgroundColor?: string; + color?: string; + borderWidth?: number; + borderRadius?: number; + + // iOS-only + borderColor?: string; + + // Android-only + paddingLeft?: number; + paddingRight?: number; + paddingBottom?: number; + paddingTop?: number; + fontSize?: number; + lines?: number; + lineHeight?: number; + xOffset?: number; + yOffset?: number; + letterSpacing?: number; + fontWeight?: string; +} + +interface ToastNative { + // Toast duration constants + SHORT: any; + LONG: any; + + // Toast gravity constants + TOP: any; + BOTTOM: any; + CENTER: any; + + show(message?: string): void; + show(message: string, duration: any, position: any, styles: Style): void; +} + +declare const ToastNative: ToastNative; +export default ToastNative; diff --git a/types/react-native-toast-native/react-native-toast-native-tests.tsx b/types/react-native-toast-native/react-native-toast-native-tests.tsx new file mode 100644 index 0000000000..af9ed9db7b --- /dev/null +++ b/types/react-native-toast-native/react-native-toast-native-tests.tsx @@ -0,0 +1,28 @@ +import * as React from 'react'; +import { View, Button } from 'react-native'; +import Toast, { Style } from 'react-native-toast-native'; + +class Test extends React.Component { + showToast() { + const style: Style = { + color: 'white', + backgroundColor: '#5CB85C', + fontSize: 16, + height: 140, + borderRadius: 15, + fontWeight: 'bold', + yOffset: 40 + }; + + Toast.show("I'm a toast!", Toast.SHORT, Toast.BOTTOM, style); + } + + render() { + return ( + +